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/2
.
Flags annotated read-only are read-only:
agc_margin
argv
read-only,volatile% sicstus -a hello world 2001
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
profiledcode
debugcode
debugging
volatiledebug/0
, nodebug/0
,
tracee/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
(The flags 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 the full ISO 8859/1 (Latin 1) character set.
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)]
.
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.
max_arity
ISO,read-only,volatilemax_integer
ISO,read-only,volatileprolog_flag/3
and current_prolog_flag/2
will fail, when
accessing this flag.
min_integer
ISO,read-only,volatileprolog_flag/3
and current_prolog_flag/2
will fail, when
accessing this flag.
redefine_warnings
on
or off
. Enable or disable warning messages when:
Initially on
. (This warning is always disabled in runtime
systems.)
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.
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
ISOunknown/2
(see Debug Intro).
trace
fail
warning
error
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 3 #0: Wed Mar 15 12:29:29 MET 1995'
.
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.