Certain aspects of the state of the program are accessible as values of the global Prolog flags. Some of these flags are read-only and correspond to implementation defined properties and exist to aid portability. Others can be set and impact the behavior of certain built-in predicates.
The flags are accessed by the built-in predicates prolog_flag/[2,3]
,
current_prolog_flag/2
, and set_prolog_flag/2
.
The possible Prolog flag names and values are listed below. Flags
annotated ISO are prescribed by the ISO standard. Flags
annotated volatile are not saved by save_program/[1,2]
.
Flags annotated read-only are read-only:
agc_margin
argv
volatile% sicstus -- hello world 2001
the value will be [hello,world,'2001']
.
Setting the value can be useful when writing test cases for code that
expects to be run with command line parameters.
bounded
ISO,read-only,volatilefalse
, indicating that the domain of
integers is practically unbounded.
char_conversion
ISO,volatileon
, unquoted characters in terms and
programs read in will be converted, as specified by previous
invocations of char_conversion/2
. If the flag is off
no
conversion will take place. The default value is on
.
compiling
compile/1
operate (see ref-lod).
compactcode
debugcode
debugging
volatiledebug/0
, nodebug/0
,
trace/0
, notrace/0
, zip/0
, nozip/0
. The
flag describes the mode the debugger is in, or is required to be
switched to:
trace
debug
zip
off
debug
ISO,volatiledebug
, prescribed by the ISO Prolog standard, is a
simplified form of the debugging
flag:
off
on
profiling
off
on
(The flags profiling
, debugging
and debug
have no effect in
runtime systems.)
double_quotes
ISO,volatilecodes
chars
atom
quoted_charset
quoted(true)
holds when writing terms.
Its value should be one of the atoms:
portable
prolog
Atoms and functors are written using a character set that can be read
back by read/[1,2]
. This is a subset of Unicode that includes all
of ISO-8859-1 (Latin 1) as well as some additional characters.
This character set may grow but not shrink in subsequent releases. This ensures that future releases can always read a term written by an older release.
Note that the character set supported by the stream is not taken into
account. You can use portable
instead of prolog
if the
stream does not support Unicode.
debugger_print_options
write_term/3
(see ref-iou-tou-wrt), to be used in the debugger's messages. The initial
value is
[quoted(true),numbervars(true),portrayed(true),max_depth(10)]
.
dialect
read-onlysicstus
. It is useful for
distinguishing between Prolog implementations.
Also see the Prolog flag version_data
, below.
discontiguous_warnings
on
or off
. Enable or disable warning messages when
clauses are not together in source files. Initially on
.
(This warning is always disabled in runtime systems.)
fileerrors
on
or off
. Enables or disables raising of file error
exceptions. Initially on
(enabled).
gc
on
or off
. Enables or disables garbage collection
of the global stack. Initially on
(enabled).
gc_margin
gc_trace
verbose
terse
off
host_type
read-only,volatile'x86-linux-glibc2.1'
or 'sparc-solaris-5.7'
.
informational
volatileon
or off
. Enables or disables the printing of
informational messages. Initially on
(printing enabled) in
development systems, unless the --noinfo command line option
was used; off
(printing disabled) in runtime systems.
integer_rounding_function
ISO,read-only,volatiletoward_zero
, indicating that the
integer division ((//)/2
) and integer remainder (rem/2
)
arithmetic functions use rounding toward zero; see ref-ari.
legacy_char_classification
volatileon
or off
. When enabled, most legal Unicode codepoints
above 255 are treated as lowercase characters when reading Prolog
terms. This improves compatibility with earlier versions of SICStus
Prolog and makes it possible to use full Unicode, e.g. Chinese characters, in
unquoted atoms as well as variable names, ref-syn-syn-tok.
Initially off
(disabled).
Setting this flag affects the read_term/[2,3]
option
singletons/1
; see mpg-ref-read_term. It also affects the
style warning for singleton variables; see the description of the
single_var_warnings
in The Load Predicates.
max_arity
ISO,read-only,volatilemax_integer
ISO,read-only,volatileprolog_flag/[2,3]
and current_prolog_flag/2
will fail, when
accessing this flag.
max_tagged_integer
read-only,volatilemin_integer
ISO,read-only,volatileprolog_flag/[2,3]
and current_prolog_flag/2
will fail, when
accessing this flag.
min_tagged_integer
read-only,volatileos_data
read-only,volatileos(Family,Name,Extra)
describing the
operating system on which this SICStus process is running, i.e. it is
the runtime version of the platform_data
flag, below.
Family has the same value and meaning as for the
platform_data
flag, below.
On UNIX-like systems the Name is the lower case value
sysname
returned from uname(3)
at runtime, i.e. the same as from
the comamnd uname -s. On all supported versions of Microsoft
Windows this is win32nt
.
Extra
is a list of extra information. Entries may be added to
this list without prior notice.
Currently, at least up to release 4.2.3, the Family and Name
for the platform_data
and os_data
flags happens to be the
same but this may change in the unlikely case that the operating system
starts to return something new. For this reason it is probably better to
use platform_data
than os_data
in most cases.
The
Extra
value for os_data
may differ from its
platform_data
counterpart in order to accurately describe the
running operating system.
platform_data
read-only,volatileplatform(Family,Name,Extra)
describing the
operating system platform for which this version of SICStus was built.
Family describes the family or class of operating
system. Currently documented values are unix
, for UNIX-like systems like
Linux, OS X, Solaris and Androind; and
windows
for all supported versions of Microsoft Windows. You should not assume
that these are the only two possibilities.
Name describes the name of the operating system. On UNIX-like
systems this correspond to the (lower case) output from uname
-s. Currently documented values are linux
, darwin
,
sunos
, android
and win32nt
.
Note that this implies that some operating systems may have unexpected
names. In particular the name for Apple OS X is darwin
, for
Oracle Solaris it is sunos
and for 64-bit versions of SICStus on
Microsoft Windows it is win32nt
.
Extra
is bound to a list of extra information. Entries may be
added to this list without prior notice.
redefine_warnings
The possible values are:
on
off
reject
proceed
suppress
single_var_warnings
on
or off
. Enable or disable warning messages when a
sentence (see ref-syn-syn-sen) containing variables not
beginning with ‘_’ occurring once only is compiled or consulted.
Initially on
.
source_info
volatileemacs
or on
or off
. If not off
while
source code is being loaded, information about line numbers
and file names are stored with the loaded code. If the value is
on
while debugging, this information is used to print the
source code location while prompting for a debugger command. If
the value is on
while printing an uncaught error exception
message, the information is used to print the source code location
of the culprit goal or one of its ancestors, as far as it
can be determined. If the value is emacs
in any of these cases,
the appropriate line of code is instead highlighted, and no extra text
is printed. The value is off
initially, and that is its only
available value in runtime systems.
syntax_errors
read/[1,2]
.
dec10
error
fail
quiet
system_type
read-only,volatiledevelopment
in development
systems and runtime
in runtime systems.
title
toplevel_print_options
write_term/3
(see ref-iou-tou-wrt), to be used when the top-level displays
variable bindings and answer constraints. It is also used when
messages are displayed. The initial value is
[quoted(true),numbervars(true),portrayed(true),max_depth(10)]
.
typein_module
set_module/1
.
unknown
ISOuser:unknown_predicate_handler/3
(see ref-ere) is called. If
undefined or if the call fails, the action is governed by the state of
the this flag, which can be:
trace
error
warning
fail
user_input
volatileuser_input
and
SP_stdin
. It is initially set to a stream connected to UNIX
stdin
.
user_output
volatileuser_output
and SP_stdout
. It is initially set to a stream
connected to UNIX stdout
.
user_error
volatileuser_error
and SP_stderr
. It is initially set to a stream
connected to UNIX stderr
.
version
read-only,volatile'SICStus 4.1.0 (i386-darwin-9.8.0): Wed Oct 14 14:43:58 CEST 2009'
.
Also see the Prolog flag version_data
, below.
version_data
read-only,volatilesicstus(Major,Minor,Revision,Beta,Extra)
with
integer major, minor, revision, and beta version.
Extra
is bound to a list of extra information. Entries may be
added to this list without prior notice.
Also see the Prolog flag dialect
, above.
You can use prolog_flag/2
to enumerate all the FlagNames that
the system currently understands, together with their current values.
Use prolog_flag/2
to make queries, prolog_flag/3
to
make changes.