Go to the first, previous, next, last section, table of contents.


Changing system behaviour and various flags

Author(s): Daniel Cabeza, Mats Carlsson.

Version: 1.5#118 (2000/4/19, 18:13:43 CEST)

Flags define some parameters of the system and control the behavior of system or library predicates. Each flag has a name and an associated predefined value, and except some system flags which are fixed in general their associated value is changeable. Predefined flags in the system are:

fileerrors
If on, predicates handling files give errors when a file is inexistent or an operation is not allowed. If off, fail in that conditions. Initially on.
unknown
Controls action on calls to undefined predicates. The possible states of the flag are:
error
An error is thrown with the error term existence_error(procedure, F/A).
fail
The call simply fails.
warning
A warning is written and the call fails.
The state is initially error. * ISO *
quiet
Controls which messages issued using io_aux are actually written. As the system uses that library to report its messages, this flag controls the verbosity of the system. Possible states of the flag are:
on
No messages are reported.
error
Only error messages are reported.
warning
Only error and warning messages are reported.
off
All messages are reported, except debug messages. This is the default state.
debug
All messages, including debug messages, are reported. This is only intended for the system implementators.
argv
Value is a list of atoms representing the program arguments supplied when the current executable was invoked. This is the value to which is instantiated the argument of the main/1 predicate at executable startup. Unchangeable.
bounded
It is false, to denote that the range of integers can be considered infinite (but see int/1). Unchangeable. * ISO *
integer_rounding_function
It is toward_zero, so that -1 =:= -3//2 succeeds. Unchangeable. * ISO *
max_arity
It is 255, so that no compound term (or predicate) can have more than this number of arguments. Unchangeable. * ISO *
gc
Controls whether garbage collection is done. May be on (default) or off.
gc_margin
An integer Margin. If less than Margin kilobytes are reclaimed in a garbage collection then the size of the garbage collected area should be increased. Also, no garbage collection is attempted unless the garbage collected area has at least Margin kilobytes. Initially 500.
gc_trace
Governs garbage collection trace messages. An element off [on,off,terse,verbose]. Initially off.

Usage and interface (prolog_flags)

Documentation on exports (prolog_flags)

PREDICATE: set_prolog_flag/2:

set_prolog_flag(FlagName,Value)

Set existing flag FlagName to Value.

Usage 2: * ISO *

PREDICATE: current_prolog_flag/2:

current_prolog_flag(FlagName,Value)

FlagName is an existing flag and Value is the value currently associated with it.

Usage 2: * ISO *

PREDICATE: prolog_flag/3:

prolog_flag(FlagName,OldValue,NewValue)

FlagName is an existing flag, unify OldValue with the value associated with it, and set it to new value NewValue.

Usage 2: prolog_flag(?(FlagName),-(OldValue),-(NewValue))

Usage 3:

Usage 4: prolog_flag(FlagName,OldValue,NewValue)

PREDICATE: push_prolog_flag/2:

push_prolog_flag(Flag,NewValue)

Same as set_prolog_flag/2, but storing current value of Flag to restore it with pop_prolog_flag/1.

Usage 2:

PREDICATE: pop_prolog_flag/1:

pop_prolog_flag(Flag)

Restore the value of Flag previous to the last non-canceled push_prolog_flag/2 on it.

Usage 2:

PREDICATE: prompt/2:

prompt(Old,New)

Unify Old with the current prompt for reading, change it to New.

Usage 2: prompt(Old,New)

Usage 3:

Usage 4: prompt(Old,New)

PREDICATE: gc/0:

Usage 1:

Usage 2:

PREDICATE: nogc/0:

Usage 1:

Usage 2:

PREDICATE: fileerrors/0:

Usage 1:

Usage 2:

PREDICATE: nofileerrors/0:

Usage 1:

Usage 2:

Documentation on multifiles (prolog_flags)

PREDICATE: define_flag/3:

define_flag(Flag,Values,Default)

New flags can be defined by writing facts of this predicate. Flag is the name of the new flag, Values defines the posible values for the flag (see below) and Default defines the predefined value associated with the flag (which should be compatible with Values).

The predicate is multifile.

Usage 1:

Usage 2:

Usage 3: define_flag(Flag,Values,Default)


Go to the first, previous, next, last section, table of contents.