dynamic(Pred) specifies that the procedure whose
predicate indicator is Pred is a dynamic procedure. This directive
makes it possible to alter the definition of Pred by adding or
removing clauses. For more information refer to the section about dynamic
clause management (section 6.7.1).
This directive shall precede the definition of Pred in the source
file.
If there is no clause for Pred in the source file, Pred
exists however as an empty predicate (this means that
current_predicate(Pred) succeeds).
In order to allow multiple definitions, Pred can also be a list of
predicate indicators or a sequence of predicate indicators using
','/2 as separator.
public(Pred) specifies that the procedure whose predicate indicator
is Pred is a public procedure. This directive makes it possible to
inspect the clauses of Pred. For more information refer to the
section about dynamic clause management (section 6.7.1).
This directive shall precede the definition of Pred in the source
file. Since a dynamic procedure is also public. It is useless (but correct)
to define a public directive for a predicate already declared as dynamic.
In order to allow multiple definitions, Pred can also be a list of
predicate indicators or a sequence of predicate indicators using
','/2 as separator.
Portability
GNU Prolog directive. The ISO reference does not define any directive to
declare a predicate public but it does distinguish public predicates. It is
worth noting that in most Prolog systems the public/1 directive is
as a visibility declaration. Indeed, declaring a predicate as public makes
it visible from any predicate defined in any other file (otherwise the
predicate is only visible from predicates defined in the same source file as
itself). When a module system is incorporated in GNU Prolog a more general
visibility declaration shall be provided conforming to the ISO reference.
multifile(Pred) is not supported by GNU Prolog.
When such a directive is encountered it is simply ignored. All clauses for a
given predicate must reside in a single file.
discontiguous(Pred) specifies that the procedure whose predicate
indicator is Pred is a discontiguous procedure. Namely, the clauses
defining Pred are not restricted to be consecutive but can appear
anywhere in the source file.
This directive shall precede the definition of Pred in the source
file.
In order to allow multiple definitions, Pred can also be a list of
predicate indicators or a sequence of predicate indicators using
','/2 as separator.
Portability
ISO directive. The ISO reference document states that if there is no clause
for Pred in the source file, Pred exists however as an
empty predicate (i.e. current_predicate(Pred) will succeed). This
is not the case for GNU Prolog.
ensure_linked(Pred) specifies that the procedure
whose predicate indicator is Pred must be included by the linker.
This directive is useful when compiling to native code to force the linker to
include the code of a given predicate. Indeed, if the gplc is
invoked with an option to reduce the size of the executable
(section 2.4.3), the linker only includes the code of predicates
that are statically referenced. However, the linker cannot detect dynamically
referenced predicates (used as data passed to a meta-call predicate). The use
of this directive prevents it to exclude the code of such predicates.
In order to allow multiple definitions, Pred can also be a list of
predicate indicators or a sequence of predicate indicators using
','/2 as separator.
built_in specifies that the procedures defined from
now have the built_in property (section 6.8.2).
built_in(Pred) is similar to built_in/0 but
only affects the procedure whose predicate indicator is Pred.
This directive shall precede the definition of Pred in the source
file.
In order to allow multiple definitions, Pred can also be a list of
predicate indicators or a sequence of predicate indicators using
','/2 as separator.
built_in_fd (resp.
built_in_fd(Pred)) is similar to
built_in (resp. built_in(Pred)) but sets the
built_in_fd predicate property (section 6.8.2).
Portability
GNU Prolog directives.
5.1.8
include/1
Templates
include(+atom)
Description
include(File) specifies that the content of the Prolog source
File shall be inserted. The resulting Prolog text is identical to
the Prolog text obtained by replacing the directive by the content of the
Prolog source File.
See absolute_file_name/2 for information about the syntax of
File (section 6.26.1).
Portability
ISO directive.
5.1.9
ensure_loaded/1
Templates
ensure_loaded(+atom)
Description
ensure_loaded(File) is not supported by GNU Prolog. When such a
directive is encountered it is simply ignored.
op(Priority, OpSpecifier, Operator) alters the operator table. This
directive is executed as soon as it is encountered by calling the built-in
predicate op/3 (section 6.14.10). A system
directive is also generated to reflect the effect of this directive at
run-time (section 2.4.4).
Portability
ISO directive.
5.1.11
char_conversion/2
Templates
char_conversion(+character, +character)
Description
char_conversion(InChar, OutChar) alters the character-conversion
mapping. This directive is executed as soon as it is encountered by a call
to the built-in predicate char_conversion/2
(section 6.14.12). A system directive is also generated to reflect
the effect of this directive at run-time (section 2.4.4).
Portability
ISO directive.
5.1.12
set_prolog_flag/2
Templates
set_prolog_flag(+flag, +term)
Description
set_prolog_flag(Flag, Value) sets the value of the
Prolog flagFlag to Value. This directive is
executed as soon as it is encountered by a call to the built-in predicate
set_prolog_flag/2 (section 6.22.1). A system directive
is also generated to reflect the effect of this directive at run-time
(section 2.4.4).
Portability
ISO directive.
5.1.13
initialization/1
Templates
initialization(+callable_term)
Description
initialization(Goal) adds Goal to the set of goal which
shall be executed at run-time. A user directive is generated to execute
Goal at run-time. If several initialization directives appear in
the same file they are executed in the order of apparition (section 2.4.4).
foreign(Template, Options) defines an interface predicate whose
prototype is Template according to the options given by
Options. Refer to the foreign code interface for more information
(section 8.1).
foreign(Template) is equivalent to foreign(Template, []).
Portability
GNU Prolog directive.
Copyright (C) 1999,2000 Daniel Diaz
Verbatim copying and distribution of this entire article is permitted in any
medium, provided this notice is preserved.