Section "javascript"

The specifics mainly deal with the number blending that is applied in the Dogelog Player for the JavaScript platform. Whereas Prolog atoms are simply mapped to JavaScript strings, the map-ping of Prolog integers is towards JavaScript smallint and JavaScript bigint. Exclusion of NaN and infinites from Prolog floats, is done by mapping values to errors.

The following mapping from Prolog to JavaScript is used:

Prolog Atomic
+--- Prolog Atom
+--- JavaScript string
+--- Prolog Number
+--- Prolog integer
+---- JavaScript smallint in -94906266..94906266
+---- JavaScript bigint otherwise
+--- Prolog float
+---- JavaScript bigint in -94906266..94906266
+---- JavaScript number otherwise
+--- Prolog 0rNone Reference
+--- JavaScript null
+--- Prolog 0rFalse Reference
+--- JavaScript false
+--- Prolog 0rTrue Reference
+--- JavaScript true
The following JavaScript specific calls are provided:
is_bigint(T): (host language)
Check whether the object T is a JavaScript bigint.
norm_smallint(T): (host language)
Return the JavaScript smallint T normalized to a Prolog integer.
norm_bigint(T): (host language)
Return the JavaScript bigint T normalized to a Prolog integer.
norm_float(T): (host language)
Return JavaScript float T normalized to a Prolog number.
widen_bigint(T): (host language)
Return the Prolog integer T widened to a JavaScript bigint.
char_count(C): (host language)
Return the 16-bit char count of a Unicode code point C.

Kommentare