Node:WCX Concepts, Next:Prolog Level WCX Features, Previous:WCX Introduction, Up:Handling Wide Characters
First let us introduce some notions concerning wide characters.
SICStus Prolog allows character codes in the range 0..2147483647
(= 2^31-1). Consequently, the built-in predicates for building and
decomposing atoms from/into character codes (e.g.
atom_codes/2
, name/2
, etc.) accept and produce lists
of integers in the above range (excluding the 0 code).
Wide characters can be used in all contexts: in atoms (single quoted,
or unquoted, depending on the character-type mapping), strings,
character code notation (0'char), etc.
SICStus Prolog has three different external stream encoding schemes
built-in, selectable through an environment variable. Furthermore
it provides hooks for users to plug in their own external stream
encoding functions. The built-in predicates put_code/1
,
get_code/1
, etc., accept and return wide character codes,
converting the bytes written or read using the external encoding in
force.
Note that an encoding need not be able to handle the whole range of
character codes allowed by SICStus Prolog.
usage
flag WCX_CHANGES_ASCII
;
see WCX Hooks.
open/3
, command line options, as returned by
prolog_flag(argv,
Flags)
, etc.). The system encoding
is hookable in SICStus Prolog and has two built-in defaults.
As discussed above there are several points where the users can influence the behavior of SICStus Prolog. The user can decide on
Let us call WCX mode a particular setting of these parameters.
Note that the selection of the character code set is conceptual only and need not be communicated to SICStus Prolog, as the decision materializes in the functions for the mapping and encodings.