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/[1,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 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 -- 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,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).
debugcode
Compiling is replaced by consulting.

debugging volatile
Corresponds to the predicates debug/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
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).

profiling
This flag describes the mode the execution profiler (see Execution Profiling) is in, or is required to be switched to:
off
The profiler is switched off (the default).
on
The profiler is switched on.

(The flags profiling, 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)].
dialect read-only
The value of this flag is sicstus. 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
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.
legacy_char_classification volatile
on 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,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/[2,3] and current_prolog_flag/2 will fail, when accessing this flag.
max_tagged_integer read-only,volatile
The largest small integer, i.e. integers larger than this are less efficient to manipulate.
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/[2,3] and current_prolog_flag/2 will fail, when accessing this flag.
min_tagged_integer read-only,volatile
The smallest small integer, i.e. integers smaller than this are less efficient to manipulate.
os_data read-only,volatile
The value is a term os(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,volatile
The value is a term platform(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
Enable or disable warning messages when:

The possible values are:

on
The default in development systems. The user is queried about what to do in each case.
off
The default in runtime systems, but note that this flag is not volatile. Redefinitions are performed silently, as if the user had accepted them.
reject
Redefinitions are refused silently, as if the user had rejected them.
proceed
Redefinitions are performed, and warnings are issued.
suppress
Redefinitions are refused, and warnings are issued.

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.2.3 ... 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
The system can optionally catch calls to predicates that have no definition. First, the user defined predicate user: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
Causes calls to undefined predicates to be reported and the debugger to be entered at the earliest opportunity. Not available in runtime systems.
error
Causes calls to such predicates to raise an exception (the default). See ref-ere.
warning
Causes calls to such predicates to display a warning message and then fail.
fail
Causes calls to such predicates to fail.

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 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,volatile
The value is a term sicstus(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.


Send feedback on this subject.