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.10#6 (2004/8/7, 21:46:39 CEST)

Version of last change: 1.7#213 (2002/5/14, 18:11:29 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:

The Ciao version, as a term ciao(Version,Patch). Version is a floating point number, Patch is an integer. Unchangeable.
Its 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.
It is false, to denote that the range of integers can be considered infinite (but see int/1). Unchangeable. * ISO *
If on, predicates handling files give errors (throw exceptions) when a file is inexistent or an operation is not allowed. If off, fail in that conditions. Initially on.
Controls whether garbage collection is done. May be on (default) or off.
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.
Governs garbage collection trace messages. An element off [on,off,terse,verbose]. Initially off.
It is toward_zero, so that -1 =:= -3//2 succeeds. Unchangeable. * ISO *
It is 255, so that no compound term (or predicate) can have more than this number of arguments. Unchangeable. * ISO *
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:
No messages are reported.
Only error messages are reported.
Only error and warning messages are reported.
All messages are reported, except debug messages. This is the default state.
All messages, including debug messages, are reported. This is only intended for the system implementators.
Controls action on calls to undefined predicates. The possible states of the flag are:
An error is thrown with the error term existence_error(procedure, F/A).
The call simply fails.
A warning is written and the call fails.
The state is initially error. * ISO *

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.

PREDICATE: current_prolog_flag/2:

current_prolog_flag(FlagName, Value)

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

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 1: prolog_flag(?atm, ?term, +term)

Usage 2: 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.

PREDICATE: pop_prolog_flag/1:


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

PREDICATE: prompt/2:

prompt(Old, New)

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

Usage 2: prompt(Old, New)



PREDICATE: nogc/0:


PREDICATE: fileerrors/0:


PREDICATE: nofileerrors/0:


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: define_flag(-atm, Values, -atm)

Usage 2: define_flag(-atm, Values, -int)

Usage 3: define_flag(Flag, Values, Default)

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