prolog_flag/[2,3]

Synopsis

prolog_flag(*FlagName, *Value)

FlagName is a flag, which currently is set to Value.

prolog_flag(+FlagName, -OldValue, +NewValue)

Unifies the current value of FlagName with OldValue and then sets the value of the flag to NewValue.

Arguments


FlagName atom

Value atomic

OldValue atomic

NewValue atomic

Currently, the supported FlagNames and Values for both prolog_flag/2 and prolog_flag/3 are:


FlagNames
Values
character_escapes
on or off
debugging
trace, debug, zip, or off
fileerrors
on or off
gc
on or off
gc_margin
non-negative integer
in thousands of bytes
gc_trace
on or off
unknown
error or fail
syntax_errors
(see ref-ere-err-syn)
single_var
on or off
discontiguous
on or off
multiple
on or off

Values available only to prolog_flag/2 (query-only) are:



FlagNames
Values

add_ons
an atom containing the list of add-on products that are statically linked into the Prolog system. If no add-ons are part of the system, the empty atom '' is returned.
host_type
the host type, which is generally a hardware-operating system combination. This prolog_flag is used to create the system file_search_path/2 facts (see ref-fdi-fsp-pre and ref-fdi-fsp-sys).
quintus_directory
the absolute name of the Quintus directory. The Quintus directory is the root of the entire Quintus installation hierarchy.
runtime_directory
the absolute name of the directory where all the Prolog executables reside.
version
the version of the Prolog being run.
system_type
development or runtime.

Description

To inspect the value of a flag without changing it, use prolog_flag/2 or the following idiom, where FlagName is bound to one of the valid flags above.

      | ?- prolog_flag(FlagName, Value, Value).
     

Use prolog_flag/2 to query and prolog_flag/3 to set values.

prolog_flag/3 can be used to save flag values so that one can return a flag to its previous state. For example:

     ...
     prolog_flag(debugging,Old,on), % Save in Old and set
     ...
     prolog_flag(debugging,_,Old),  % Restore from Old
     ...
     

The read-only prolog_flag/2 flags add_ons, host_type, quintus_directory, and runtime_directory represent information set by the qsetpath program. For more detail on the qsetpath and qgetpath utilities, see and .

Backtracking

prolog_flag/2 enumerates all valid flagnames of a given current value, or all pairs of flags and their current values. It is not a way to find out non-current values for a flag.

Exceptions


instantiation_error
In prolog_flag/3, FlagName unbound, or

NewValue unbound and not identical to OldValue.

type_error
FlagName is not an atom.
domain_error
In prolog_flag/3, FlagName bound to an atom that does not represent a supported flag, or

NewValue bound to atom that does not represent a valid value for FlagName.

See Also

gc/0, nogc/0, style_check/1, no_style_check/1, unknown/2, fileerrors/0, nofileerrors/0 ref-lps