4.9.4 Prolog Flags

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
An integer Margin. The atoms will be garbage collected when Margin new atoms have been created since the last atom garbage collection. Initially 10000.
argv read-only,volatile
The value is a list of atoms of the program arguments supplied when the current SICStus Prolog process was started. For example, if SICStus Prolog were invoked with:
          % sicstus -a hello world 2001
     

the value will be [hello,world,'2001'].

bounded ISO,read-only,volatile
One of the flags defining the integer type. For SICStus, its value is false, indicating that the domain of integers is practically unbounded.
char_conversion ISO,volatile
If this flag is on, 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
Governs the mode in which compile/1 operate (see ref-lod).
compactcode
Compilation produces byte-coded abstract instructions (the default).
profiledcode
Compilation produces byte-coded abstract instructions instrumented to produce execution profiling data.
debugcode
Compiling is replaced by consulting.

debugging volatile
Corresponds to the predicates debug/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
Trace mode (the debugger is creeping).
debug
Debug mode (the debugger is leaping).
zip
Zip mode (the debugger is zipping).
off
The debugger is switched off (the default).

debug ISO,volatile
The flag debug, prescribed by the ISO Prolog standard, is a simplified form of the debugging flag:
off
The debugger is switched off (the default).
on
The debugger is switched on (to trace mode, if previously switched off).

(The flags debugging and debug have no effect in runtime systems.)

double_quotes ISO,volatile
Governs the interpretation of double quoted strings (see ref-syn-cpt-sli):
codes
Code-list comprising the string.
chars
Char-list comprising the string.
atom
The atom composed of the same characters as the string.

quoted_charset
This flag is relevant when quoted(true) holds when writing terms. Its value should be one of the atoms:
portable
Atoms and functors are written using character codes less than 128 only, i.e. using the 7-bit subset of the ISO 8859/1 (Latin 1) character set (see ref-syn-syn-tok).
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
The value is a list of options for 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
Margin: At least Margin kilobytes of free global stack space are guaranteed to exist after a garbage collection. Also, no garbage collection is attempted unless the global stack is at least Margin kilobytes. Initially 1000.
gc_trace
Governs global stack garbage collection trace messages.
verbose
Turn on verbose tracing of garbage collection.
terse
Turn on terse tracing of garbage collection.
off
Turn off tracing of garbage collection (the default).

host_type read-only,volatile
The value is an atom identifying the platform on which SICStus was compiled, such as 'x86-linux-glibc2.1' or 'sparc-solaris-5.7'.
informational volatile
on 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,volatile
One of the flags defining the integer type. In SICStus Prolog its value is toward_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,volatile
Specifies the maximum arity allowed for a compound term. In SICStus Prolog this is 255.
max_integer ISO,read-only,volatile
Specifies the largest possible integer value. As in SICStus Prolog the range of integers in not bounded, prolog_flag/3 and current_prolog_flag/2 will fail, when accessing this flag.
min_integer ISO,read-only,volatile
Specifies the smallest possible integer value. As in SICStus Prolog the range of integers in not bounded, prolog_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 volatile
emacs 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
Controls what action is taken upon syntax errors in read/[1,2].
dec10
The syntax error is reported and the read is repeated.
error
An exception is raised. See ref-ere. (the default).
fail
The syntax error is reported and the read fails.
quiet
The read quietly fails.

system_type read-only,volatile
The value is development in development systems and runtime in runtime systems.
title
The window title. The default value is the same as the boot message `SICStus 4.0.2 ... Licensed to SICS'. It is currently only used as the window title on the Windows platform.
toplevel_print_options
The value is a list of options for 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
Permitted values are atoms. Controls the current type-in module (see ref-mod-tyi). Corresponds to the predicate set_module/1.
unknown ISO
Corresponds to the predicate unknown/2 (see Debug Intro).
trace
Causes calls to undefined predicates to be reported and the debugger to be entered at the earliest opportunity. (This setting is not possible in runtime systems.)
fail
Causes calls to such predicates to fail.
warning
Causes calls to such predicates to display a warning message and then fail.
error
Causes calls to such predicates to raise an exception (the default). See ref-ere.

user_input volatile
Permitted values are any stream opened for reading. Controls which stream is referenced by user_input and SP_stdin. It is initially set to a stream connected to UNIX stdin.
user_output volatile
Permitted values are any stream opened for writing. Controls which stream is referenced by user_output and SP_stdout. It is initially set to a stream connected to UNIX stdout.
user_error volatile
Permitted values are any stream opened for writing. Controls which stream is referenced by user_error and SP_stderr. It is initially set to a stream connected to UNIX stderr.
version read-only,volatile
The value is an atom containing the banner text displayed on startup, such as '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.


Send feedback on this subject.