Previous Contents Next
7.22 Prolog state

7.22.1 set_prolog_flag/2
[default]set_prolog_flag/2@set_prolog_flag/2|textbf7.22.1htoc
Templates

set_prolog_flag(+flag, +term)
Description

set_prolog_flag(Flag, Value) sets the value of the Prolog flag[default]Prolog flag@Prolog flag|textbf7.22.1htoc Flag to Value.

[default]flag|see Prolog flag7.22.1htoc Prolog flags: a Prolog flag is an atom which is associated with a value that is either implementation defined or defined by the user. Each flag has a permitted range of values; any other value is a domain_error. The following two tables present available flags, the possible values, a description and if they are ISO or an extension. The first table presents unchangeable flags while the second one the changeable flags. For flags whose default values is machine independent, this value is underlined.

Unchangeable flags:

Flag
Values
Description
ISO
bounded[default]bounded@bounded (flag)|textbf7.22.1htoc
true / false
are integers bounded ?
Y
max_integer[default]max_integer@max_integer (flag)|textbf7.22.1htoc
an integer
greatest integer
Y
min_integer[default]min_integer@min_integer (flag)|textbf7.22.1htoc
an integer
smallest integer
Y
integer_rounding_function[default]integer_rounding_function@integer_rounding_function (flag)|textbf7.22.1htoc
toward_zero
down
rnd(X) = integer part of X
rnd(X) = lfloorXrfloor (section 7.6.1)
Y
max_arity[default]max_arity@max_arity (flag)|textbf7.22.1htoc
an integer
maximum arity for compound terms (255)
Y
max_atom[default]max_atom@max_atom (flag)|textbf7.22.1htoc
an integer
maximum number of atoms
N
max_stream[default]max_stream@max_stream (flag)|textbf7.22.1htoc
an integer
maximum number of streams
N
max_unget[default]max_unget@max_unget (flag)|textbf7.22.1htoc
an integer
maximum number of successive ungets
N
prolog_name[default]prolog_name@prolog_name (flag)|textbf7.22.1htoc
an atom
name of the Prolog system
N
prolog_version[default]prolog_version@prolog_version (flag)|textbf7.22.1htoc
an atom
version number of the Prolog system
N
prolog_date[default]prolog_date@prolog_date (flag)|textbf7.22.1htoc
an atom
date of the Prolog system
N
prolog_copyright[default]prolog_copyright@prolog_copyright (flag)|textbf7.22.1htoc
an atom
copyright message of the Prolog system
N

Changeable flags:

Flag
Values
Description
ISO
char_conversion[default]char_conversion@char_conversion (flag)|textbf7.22.1htoc
on / off
is character conversion activated ?
Y
debug[default]debug@debug (flag)|textbf7.22.1htoc
on / off
is the debugger activated ?
Y
singleton_warning[default]singleton_warning@singleton_warning (flag)|textbf7.22.1htoc
on / off
warn about named singleton variables ?
N
strict_iso[default]strict_iso@strict_iso (flag)|textbf7.22.1htoc
on / off
strict ISO behavior ?
N
 
double_quotes[default]double_quotes@double_quotes (flag)|textbf7.22.1htoc
 
atom
chars
codes
atom_no_escape
chars_no_escape
codes_no_escape
a double quoted constant is returned as:
an atom
a list of characters
a list of character codes
as atom but ignore escape sequence[default]escape sequence@escape sequence|textbf7.22.1htocs
as chars but ignore escape sequences
as code but ignore escape sequences
 
Y
 
 
N
 
back_quotes[default]back_quotes@back_quotes (flag)|textbf7.22.1htoc
 
atom
chars
codes
atom_no_escape
chars_no_escape
codes_no_escape
a back quoted constant is returned as:
an atom
a list of characters
a list of character codes
as atom but ignore escape sequences
as chars but ignore escape sequences
as code but ignore escape sequences
 
N
 
unknown[default]unknown@unknown (flag)|textbf7.22.1htoc
 
error
warning
fail
a predicate calls an unknown procedure:
an existence_error is raised
a message is displayed then fails
quietly fails
 
Y
 
syntax_error[default]syntax_error@syntax_error (flag)|textbf7.22.1htoc
 
error
warning
fail
a predicate causes a syntax error:
a syntax_error is raised
a message is displayed then fails
quietly fails
 
N
 
os_error[default]os_error@os_error (flag)|textbf7.22.1htoc
 
error
warning
fail
a predicate causes an O.S. error:
a system_error is raised
a message is displayed then fails
quietly fails
 
N

The strict_iso flag is introduced to allow a compatibility with other Prolog systems. When turned off the following relaxations apply:

Errors

Flag is a variable    instantiation_error
Value is a variable    instantiation_error
Flag is neither a variable nor an atom    type_error(atom, Flag)
Flag is an atom but not a valid flag    domain_error(prolog_flag, Flag)
Value is inappropriate for Flag    domain_error(flag_value, Flag+Value)
Value is appropriate for Flag but flag Flag is not modifiable    permission_error(modify, flag, Flag)

Portability

ISO predicate. All ISO flags are implemented.

7.22.2 current_prolog_flag/2
[default]current_prolog_flag/2@current_prolog_flag/2|textbf7.22.2htoc
Templates

current_prolog_flag(?flag, ?term)
Description

current_prolog_flag(Flag, Value) succeeds if there exists a Prolog flag[default]Prolog flag@Prolog flag7.22.2htoc that unifies with Flag and whose value unifies with Value. This predicate is re-executable on backtracking.

Errors

Flag is neither a variable nor an atom    type_error(atom, Flag)
Flag is an atom but not a valid flag    domain_error(prolog_flag, Flag)

Portability

ISO predicate.

7.22.3 set_bip_name/2
[default]set_bip_name/2@set_bip_name/2|textbf7.22.3htoc
Templates

set_bip_name(+atom, +arity)
Description

set_bip_name(Functor, Arity) initializes the context of the error (section 5.3.1) with Functor and Arity (if Arity < 0 only Functor is significant).

Errors

Functor is a variable    instantiation_error
Arity is a variable    instantiation_error
Functor is neither a variable nor an atom    type_error(atom, Functor)
Arity is neither a variable nor an integer    type_error(integer, Arity)

Portability

GNU Prolog predicate.

7.22.4 current_bip_name/2
[default]current_bip_name/2@current_bip_name/2|textbf7.22.4htoc
Templates

current_bip_name(?atom, ?arity)
Description

current_bip_name(Functor, Arity) succeeds if Functor and Arity correspond to the context of the error (section 5.3.1) (if Arity < 0 only Functor is significant).

Errors

Functor is neither a variable nor an atom    type_error(atom, Functor)
Arity is neither a variable nor an integer    type_error(integer, Arity)

Portability

GNU Prolog predicate.

7.22.5 write_pl_state_file/1, read_pl_state_file/1
[default]write_pl_state_file/1@write_pl_state_file/1|textbf7.22.5htoc [default]read_pl_state_file/1@read_pl_state_file/1|textbf7.22.5htoc
Templates

write_pl_state_file(+source_sink)
read_pl_state_file(+source_sink)
Description

write_pl_state_file(FileName) writes onto FileName all information that influences the parsing of a term (section 7.14). This allows a sub-process written in Prolog to read this file and then process any Prolog term as done by the parent process. This file can also be passed as argument of the --pl-state[default]--pl-state@--pl-state7.22.5htoc option when invoking gplc[default]gplc@gplc7.22.5htoc (section 3.4.3). More precisely the following elements are saved:

read_pl_state_file(FileName) reads (restores) from FileName all information previously saved by write_pl_state_file/1.

Errors

FileName is a variable    instantiation_error
FileName is neither a variable nor an atom    type_error(atom, FileName)
an operating system error occurs and the value of the os_error Prolog flag is error (section 7.22.1)    system_error(atom explaining the error)

Portability

GNU Prolog predicate.


Copyright (C) 1999-2001 Daniel Diaz

Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.

More about the copyright
Previous Contents Next