Next: Saved States
Up: Overview
Previous: Compilation
The current system defines 3 different mechanisms to query and/or set
properties of the environment: please/3, flag/3 and feature/2 as well as
a number of special purpose predicates of which unknown/2, fileerrors/2
are examples. The ISO standard defines prolog_flag. It is likely that
all these global features will be merged into a single in the future.
- please( +Key, -Old, +New)
The predicate please/3
is a solution to avoid large numbers of environment control
predicates. Later versions will support other environment control as
now provided via the predicates style_check/2, leash/1, unknown/2, the
tracer predicates, etc. These predicates are then moved into a library
for backwards compatibility. The currently available options are:
- optimise (/off)
off
Switch optimise mode for the compiler on
or off
(see also
the command line option -O
). Currently optimised compilation only
implies compilation of arithmetic, making it fast, but invisible to the
tracer. Later versions might imply various other optimisations such as
incorporating a number of basic predicates in the virtual machine
( var/1, fail/0, =/2, etc.) to gain speed at the cost of crippling the
debugger. Also source level optimisations such as integrating small
predicates into their callers, eliminating constant expressions and
other predictable constructs. Source code optimisation is never
applied to predicates that are declared dynamic (see dynamic/1).
- autoload (/off)
on
If on
autoloading of library functions is enabled. If
off
autoloading is disabled. See section .
- verbose_autoload (/off)
off
If on
the normal consult message will be printed if a library is
autoloaded. By default this message is suppressed. Intended to be used
for debugging purposes (e.g. where does this predicate come from?).
- feature( ?Key, -Value)
The predicate feature/2 defines an interface to installation features:
options compiled in, version, home, etc. With both arguments unbound,
it will generate all defined features. With the `Key' instantiated it
unify the value of the feature. Features come in three types: boolean
features, features with an atom value and features with an integer
value. A boolean feature is true iff the feature is present and
the Value is the atom true. Currently defined keys:
- arch ()
Identifier for the hardware and operating system SWI-Prolog is running
on. Used to determine the startup file as well as to select foreign
files for the right architecture. See also load_foreign/5.
- version ()
The version identifier is an atom consisting of 3 numeric values
separated by dots (e.g. 1.9.2).
- home ()
SWI-Prolog's notion of the home-directory. SWI-Prolog uses it's home
directory to find its startup file as <home>/startup/startup.<arch>
and to find its library as <home>/library.
- pipe ()
If true, tell(pipe(command)), etc. are supported.
- load_foreign ()
If true, load_foreign/[2,5] are implemented.
- open_shared_object ()
If true, open_shared_object/2 and friends are implemented, providing
access to shared libraries (.so files). This requires the C-library
functions dlopen() and friends as well as the configuration option
--with-dlopen.
- dynamic_stacks ()
If true, the system provides virtual memory based stack expansion. This
makes stack-expansion safe when called from C and while running
C-defined functions without these functions taking any precautions.
Pure Prolog programs are not affected by this feature as the system
will use stack-shifting to expand the stacks at runtime.
- c_libs ()
Libraries passed to the C-linker when SWI-Prolog was linked. May be used
to determine the libraries needed to create statically linked extensions
for SWI-Prolog.
- c_staticlibs ()
On some machines, the SWI-Prolog executable is dynamically linked, but
requires some libraries to be statically linked.
- c_cc ()
Name of the C-compiler used to compile SWI-Prolog. Normally either gcc
or cc.
- c_ldflags ()
Special linker flags passed to link SWI-Prolog.
- save ()
If true, save/[1,2] is implemented.
- save_program ()
If true, save_program/[1,2] is implemented.
- readline ()
If true, SWI-Prolog is linked with the readline library. This is done
by default if you have this library installed on your system.
- saved_program ()
If true, Prolog is started from a state saved with qsave_program/[1,2].
- runtime ()
If true, SWI-Prolog is compiled with -DO_RUNTIME, disabling various
useful development features (currently the tracer and profiler).
- max_integer ()
Maximum integer value. Most arithmetic operations will automatically
convert to floats if integer values above this are returned.
- min_integer ()
Minimum integer value.
- set_feature( +Key, +Value)
Define a new feature or change its value. Both arguments must be atoms.
Next: Saved States
Up: Overview
Previous: Compilation
Passani Luca
Tue Nov 14 08:58:33 MET 1995