PrologJ implements all 9 of the flags specifed in the ISO standard, as well as
21 others that are unique to PrologJ. The current value of any flag can be
obtained by using the built-in predicate current_prolog_flag/2.
As specified in the ISO standard, these flags fall into two broad categories.
set_prolog_flag/2.
The initial value of some of the flags is also affected by the command-line
-f[lags] option.-f[lags] i - Sets initial values of the flags to cause the
implementation to conform strictly to the behavior specified in the
ISO standard. (This is also the default if no value of
-f[lags] is specified.)
-f[lags] r - Sets initial values of the flags to cause the
implementation to behave in a "relaxed" fashion more appropriate when
developing code interpretively. (The ISO standard assumes that
Prolog programs will be compiled before being run.)
-f[lags] t - Sets initial values of the flags to cause the
implementation to behave like a traditional Prolog implementation.
| Name | Meaning | Possible values | Default value |
|---|---|---|---|
char_conversion |
(ISO standard) Controls whether unquoted characters read from input are
converted according to conversions specified by
char_conversion/2. |
off - character conversion is disabledon - character conversion is enabled |
on |
debug |
(ISO standard) Controls whether the debugging facility is enabled | off - debugging is (temporarily) disabledon - debugging is enabled |
off unless the debugging facility is loaded - then
on. (See note 1) |
double_quotes |
(ISO standard) Controls how a string appearing in double quotes
(") in input is interpreted. |
codes - convert to a list of character codes.chars - convert to a list of one-character atoms.atom - convert to an atom (as if quoted by single
quotes - ') |
codes |
unknown |
(ISO standard) Controls how an attempt to call an undefined predicate is handled | error - throw an errorwarning - print a warning, then failfail - simply fail |
error if strict ISO behavior is specified at startup;
warning if relaxed behavior is specified; fail
if traditional behavior is specified. |
abolish_builtins |
Controls whether abolish/1 may be used to abolish a
built-in predicate. |
off - it cannot be so usedon - it can be so used |
off |
break_fresh_variables |
Controls how variable names are handled at a breakpoint resulting
from a b[reak] command issued in the debugger or a
call to break/1 |
off - variable definitions in the current table of
variables are still visible and can be used in newly entered
code, and will be printed in response to the v[ars]
command entered in the debugger.on - a fresh table of variable definitions is used
for the breakpoint, with the old table being restored when the
breakpoint is terminated. (See note 2) |
on |
catch_all |
Controls what is caught by catch/3 |
off - only exceptions thrown as required by the
error cases listed for the various builtins (including various
input-output and relational database issues) or by
throw/1 are caught. A Java RuntimeException
will cause the interpreter or a compiled main program
to exit in error, or will be propagated to the caller of an
API methodon all exceptions can be caught; Java exceptions that
are not PrologExceptions are wrapped to make them
PrologExceptions, and are propagated as PrologExceptions
if they don't unify with the second argument of
catch/3 |
off |
current_predicate |
Controls what predicates are "visible" to
current_predicate/1 |
public - only public user predicates are
visibleuser - all user predicates are visible,
whether written in Prolog or SQL.built_in - only built-in predicates are
visible (user predicates are not visible)all - all predicates (whether user or built-in)
are visibleNote: system predicates used internally by the implementation are never visible to current_predicate/1 |
public |
detect_real_overflow_underflow |
Controls whether overflow or underflow resulting from an arithmetic operation on real numbers produces an error, or silently produces a result that is either an IEEE infinity or zero, as the case may be. | off - real overflow/underflow is ignoredon - real overflow/underflow is detected and
results in an error |
on |
enforce_directives |
The ISO standard requires the use of certain directives to allow certain kinds of access to Prolog predicates (See note 3). This flag controls whether those requirements are enforced. | off - the ISO requirements are not enforced. Any
Prolog predicate can be altered or examined, and can appear
discontiguously in a single source file or in multiple source files
on - the ISO requirements are enforced.
|
on if strict ISO behavior is specified at
startup; off if relaxed ISO behavior or
traditional behavior is specified. |
ensure_loaded |
Controls what kind of file is loaded by any
:- ensure_loaded/1 directives appearing in a Prolog source
file. |
compiled - only compiled files created by the compiler
can be loadedsource - only Prolog source can be loaded; any
definitions appearing in such a file are necessarily executed
interpretively.either - either kind of file can be loaded. If both kinds
of file for a given base name exist, the compiled version is loaded
in preference to a source version that must be interpreted.default - the same as compiled for any
:- ensure_loaded/1 directive appearing in a source
file being processed by the compiler, and the same as either
for any such directive appearing in a source file being loaded
interpretively.
|
default |
leash |
Controls which events are leashed when the built-in predicate
spy/1 is used to turn on leashing for a predicate. |
Any combination of the letters c (for the CALL
event), e (for the EXIT event),
f (for the FAIL event), or
r (for the REDO event), in that order -
e.g. cr is legal, but rc is not.
The empty string ('') is legal and means that no
events are leashed. |
cefr |
operator_single_slash |
Controls how the operator '/' is interpreted | either - the types of the operands determine
the meaning of the operator - it means integer division if
both operands are integers, real division if either operand
is realreal - the operator always means real division,
regardless of the operand types |
real if strict ISO or relaxed behavior is specified
at startupeither if traditional behavior is specified at
startup |
stack_trace |
Controls what information is included in the stack trace generated when a ball is thrown but not caught | none - no stack trace is ever printeddefault - a backtrace of the Prolog predicates called from
the point where the ball was thrown back to top-level is printed
when an uncaught ball is thrown during execution of interpreted
or compiled code.
If the ball resulted from an exception that was
thrown in Java or SQL code called using the Java or Relational
interfaces, the Java stack trace from the point of the exception
to the call from Prolog code is also printedprolog - same as default, except that no
Java stack trace is ever printedjava - same as default, except that the
backtrace from the point where the ball was thrown back to
top-level is printed in terms of Java routines in the Prolog
implementation, instead of in terms of Prolog predicates. This
option is primarily of use when debugging the implementation,
rather than for production use
all - same as default, except that the
backtrace from the point where the ball was thrown back to top
level is printed twice, once as described for default,
and once as described for java. In addition, an error trace back is printed for balls thrown while reading clauses using consult/1 or reconsult/1,
or while reading clauses to be compiled. Again, this
option is primarily of use when debugging the implementation,
rather than for production use
|
default |
system_predicates |
Controls the way that system predicates are handled. A system
predicate is a predicate that is written in Prolog (and compiled
by the PrologJ compiler), but is not a built-in. A system
predicate can only be called from within the PrologJ
implementation, either by Java code or another system
predicate. For example, the predicates comprising the PrologJ compiler are all system predicates. This flag is only meaningful when compiling code, and affects the way that predicate definitions/references in the file being compiled are understood. System predicates are always invisible to the user in interpreted code. |
off - predicate definitions/references are assumed
to be user predicates.on - predicate definitions/references are assumed to
be system predicates.
|
off |
The following flags are managed by the implementation to indicate what predicate
categories are available. Each has the value off if the predicate
category is not available, and on if the category is available.
core_available (See note 4)iso_availabletraditional_availablestream_extensions_available (See note 5)clauseio_availabledebugger_availablegrammar_rules_availablejava_interface_availablerelational_interface_availableset_extensions_availablefuzzy_extensions_availablemiscellaneous_extensions_availableThe following flags are defined by the ISO standard, and always have the values shown.
| Name | Meaning | Value |
|---|---|---|
bounded |
Indicates whether the set of possible integers is infinite or finite. | false (See note 6) |
max_arity |
Indicates the maximum arity of a compound term. | 65534 (See note 6) |
integer_rounding_function |
Indicates how integer division or remainder rounds a true value of 0.5 | toward_zero |
max_integer |
The largest possible value for an integer | unbounded (See note 6) |
min_integer |
The smallest possible value for an integer | unbounded (See note 6) |
debugger_available flag indicates whether or not the
debugger is loaded; the debug flag indicates whether or not
the debugger is active. Setting debug to off
when the debugger is loaded will temporarily disable debugging. (Of course,
setting debug to on when the debugger is
not loaded has no effect.) The debug flag is set
to on if the debugger is loaded at startup or subsequently
via the Library Components menu; it is set to off if the
debugger is not loaded at startup or is subsequently unloaded via the
Library Components menu. If the debugger is loaded, the debug
flag can be changed to off using set_prolog_flag/2
to temporarily disable debugging, and can be set back to on
to re-enable debugging.off, variables appearing in the
goal that were defined prior to the breakpoint will not be printed if the
goal succeeds.asserta/1,
assertz/1, retract/1 or retractall/1.
(A predicate is dynamic if it is created by assertz/1 or
retract/1 or is declared such by a :- dynamic
directive.) Only public predicates can be accessed by clause/2.
(A predicate is public if it is dynamic or is declared such by a
:- public directive.) Only predicates explictly declared
discontiguous by a :- discontiguous directive can have clauses
that appear at more than one location in a source file, and only predicates
that are explicitly declared multifile by a :- multifile
directive can have clauses that appear in more than one source file. If this
flag is off, information about the properties of predicates is
still maintained, but these requirements are not enforced.on, because the core predicates are always
available.on just when both iso_available and
traditional_available are on.BigInteger when necessary to
represent a value that cannot be represented by a 32-bit integer. While
the set of representable integer values is still ultimately finite (because
the memory of any given computer is finite), there is no limit to the
size of representable integers.MAX_ARITY
in interface prologj.coreconcepts.Compound and recompiling the
system. It is ultimately bounded by the maximum size of an array that
the JVM being used will support - three less than this value to allow for
storing the functor of a compound term and to permit augmenting a term
appearing in a grammar rule with two additional arguments.