Node:State Info, Next:, Previous:Exception, Up:Built Intro



Information about the State of the Program

listing

Lists onto the current output stream all the clauses in the database (in the type-in module; see Module Spec). Clauses listed onto a file can be consulted back.

listing(:Spec)
Lists all interpreted predicates covered by the generalized predicate spec Spec. For example:
| ?- listing([concatenate/3, reverse, m:go/[2,3], bar:_]).

current_atom(?Atom) meta-logical

Atom is an atom known to SICStus Prolog. Can be used to enumerate (through backtracking) all currently known atoms, and return each one as Atom.

current_predicate(?Name,:Head)
current_predicate(?Name,-Head)

Name is the name of a user defined or library predicate, and Head is the most general goal for that predicate, possibly prefixed by a module name. This predicate can be used to enumerate all user defined or library predicates through backtracking.

current_predicate(?Name/?Arity) ISO

Name is the name of a user defined or library predicate, possibly prefixed by a module name and Arity is its arity. This predicate can be used to enumerate all user defined or library predicates through backtracking.

predicate_property(:Head,?Property)
predicate_property(-Head,?Property)

Head is the most general goal for an existing predicate, possibly prefixed by a module name, and Property is a property of that predicate, where the possible properties are

This predicate can be used to enumerate all existing predicates and their properties through backtracking.

current_module(?Module)

Module is a module in the system. It can be used to backtrack through all modules present in the system.

current_module(?Module, ?File)

Module is the module defined in File.

module(+Module)

The type-in module is set to Module.

set_prolog_flag(+FlagName,+NewValue) ISO
prolog_flag(+FlagName,?OldValue,?NewValue)

OldValue is the value of the Prolog flag FlagName, and the new value of FlagName is set to NewValue. The possible Prolog flag names and values are:

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
A read-only flag. 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 -a hello world 2001

then the value will be [hello,world,'2001'].

bounded ISO
A read-only flag, 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
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 and fcompile/1 operate (see Load Intro).
compactcode
Compilation produces byte-coded abstract instructions (the default).
fastcode
Compilation produces native machine instructions. Currently only available for Sparc platforms.
profiledcode
Compilation produces byte-coded abstract instructions instrumented to produce execution profiling data.
debugcode
Compiling is replaced by consulting.

debugging
Corresponds to the predicates debug/0, nodebug/0, tracee/0, notrace/0, zip/0, nozip/0 (see Debug Pred). 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
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).

(The flags debugging and debug have no effect in runtime systems.)

double_quotes ISO only
Governs the interpretation of double quoted strings (see Compound Terms):
codes
Code-list comprising the string.
chars
Char-list comprising the string.
atom
The atom composed of the same characters as the string.

character_escapes
on or off. If this flag is on, a backslash occurring inside integers in 0' notation or inside quoted atoms or strings has special meaning, and indicates the start of an escape sequence (see Escape Sequences). This flag is relevant when reading as well as when writing terms, and is initially on.
debugger_print_options
The value is a list of options for write_term/3 (see Term I/O), to be used in the debugger's messages. The initial value is [quoted(true),numbervars(true),portrayed(true),max_depth(10)].
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. Equivalent to fileerrors/0 and nofileerrors/0, respectively (see Stream Pred). 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
A read-only flag. 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
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
A read-only flag, 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 Arithmetic.
language
iso or sicstus. Selects the execution mode specified. Initially sicstus, unless the --iso command line option was used.
max_arity ISO
A read-only flag, specifying the maximum arity allowed for a compound term. In SICStus Prolog this is 255.
max_integer ISO
A read-only flag, specifying the largest possible integer value. As in SICStus Prolog the range of integers in not bounded, prolog_flag/3 and current_prolog_flag/2 will fail, when accessing this flag.
min_integer ISO
A read-only flag, specifying the smallest possible integer value. As in SICStus Prolog the range of integers in not bounded, prolog_flag/3 and current_prolog_flag/2 will fail, when accessing this flag.
redefine_warnings
on or off. Enable or disable warning messages when :
  • a module or predicate is being redefined from a different file than its previous definition. Such warnings are currently not issued when a .po file is being loaded.
  • a predicate is being imported while it was locally defined already.
  • a predicate is being redefined locally while it was imported already.
  • a predicate is being imported while it was imported from another module already.

Initially on. (This warning is always disabled in runtime systems.)

single_var_warnings
on or off. Enable or disable warning messages when a clause containing variables not beginning with _ occurring once only is compiled or consulted. Initially on.
source_info
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 Exception. (the default).
fail
The syntax error is reported and the read fails.
quiet
The read quietly fails.

system_type
A read-only flag. The value is development in development systems and runtime in runtime systems.
toplevel_print_options
The value is a list of options for write_term/3 (see Term I/O), to be used when the top-level displays variable bindings, 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 Module Spec). Corresponds to the predicate module/1.
unknown ISO
Corresponds to the predicate unknown/2 (see Debug Pred).
trace
Causes calls to undefined predicates to be reported and the debugger to be entered at the earliest opportunity. (This setting is not possible in runtime systems.)
fail
Causes calls to such predicates to fail.
warning
Causes calls to such predicates to display a warning message and then fail.
error
Causes calls to such predicates to raise an exception (the default). See Exception.

user_input
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
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
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
A read-only flag. The value is an atom containing the banner text displayed on startup, such as 'SICStus 3 #0: Wed Mar 15 12:29:29 MET 1995'.
wcx
The value of the flag is the default term to be passed to the wide character extension component; see Prolog Level WCX Features.

prolog_flag(?FlagName,?Value)
current_prolog_flag(?FlagName,?Value) ISO

Value is the current value of the Prolog flag FlagName. Can be used to enumerate all Prolog flags and their values by backtracking.

prolog_load_context(?Key,?Value)

This predicate gives access to context variables during compilation and loading of Prolog files. It unifies Value with the value of the variable identified by Key. Possible keys are:

source
The absolute path name of the file being compiled. During loading of a .po or .ql file, the corresponding source file name is returned.
file
Outside included files (see Include Declarations) this is the same as the source key. In included files this is the absolute path name of the file being included.
directory
The absolute path name of the directory of the file being compiled/loaded. In included files this is the directory of the file being included.
module
The source module (see Meta Exp). This is useful for example if you are defining clauses for user:term_expansion/[2,4] and need to access the source module at compile time.
stream
The stream being compiled or loaded from.
term_position
A term representing the stream position of the last clause read.

statistics

Displays on the standard error stream statistics relating to memory usage, run time, garbage collection of the global stack and stack shifts. The printing is handled by print_message/2; see Messages and Queries.

statistics(?Key,?Value)
This allows a program to gather various execution statistics. For each of the possible keys Key, Value is unified with a list of values, as follows:

global_stack
[size used,free]
This refers to the global stack, where compound terms are stored. The values are gathered before the list holding the answers is allocated.
local_stack
[size used,free]
This refers to the local stack, where recursive predicate environments are stored.
trail
[size used,free]
This refers to the trail stack, where conditional variable bindings are recorded.
choice
[size used,free]
This refers to the choicepoint stack, where partial states are stored for backtracking purposes.
core
memory
[size used,0]
These refer to the amount of memory actually allocated by the Prolog engine. The zero is there for compatibility with other Prolog implementations.
heap
program
[size used,size free]
These refer to the amount of memory allocated for the database, symbol tables, and the like.
runtime
[since start of Prolog,since previous statistics] These refer to CPU time used while executing, excluding time spent garbage collecting, stack shifting, or in system calls. The second element is the time since the last call to statistics/2 with this key. It is not affected by calls to statistics/0.
walltime
[since start of Prolog,since previous statistics] These refer to absolute time elapsed. The second element is the time since the last call to statistics/2 with this key. It is not affected by calls to statistics/0.
garbage_collection
[no. of GCs,bytes freed,time spent]
stack_shifts
[no. of global shifts,no. of local/trailtrail shifts,time spent]
atoms
[no. of atoms,bytes used,atoms free] The number of atoms free is the number of atoms allocated (the first element in the list) subtracted from the maximum number of atoms, i.e. 262143 (33554431) on 32-bit (64-bit) architectures. Note that atom garbage collection may be able to reclaim some of the allocated atoms.
atom_garbage_collection
[no. of AGCs,bytes freed,time spent]

Times are in milliseconds, sizes of areas in bytes.

trimcore

Trims the stacks, reclaims any dead clauses and predicates, defragmentizes Prolog's memory, and attempts to return any unused memory to the operating system. It is called automatically at every top-level query, except the stacks are not trimmed then.