[ Predicate Database and Compiler | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]

current_pragma(?Pragma)

Retrieves pragmas that are currently in effect for the context module
Pragma
A variable, atom or compound term

Description

Used to test or enumerate currently set pragmas in the context module. This is typically only meaningful during the compilation process or during some other kind of source processing.

Source processing tools (or code invoked from source-processing tools, e.g. inline-transformations) can exploit the pragma facility to make their behaviour user-configurable. All they need to do is document the pragma names/structures and check for them using current_pragma/1.

Modes and Determinism

Modules

This predicate is sensitive to its module context (tool predicate, see @/1).

Exceptions

(5) type error
Pragma is not a variable, atom or compound term.

Examples

    :- pragma(blah).

    ?- findall(P, current_pragma(P), L), writeln(L).
    [blah]

    :- pragma(myoption(on)).

    ?- findall(P, current_pragma(P), L), writeln(L).
    [blah, myoption(on)]

    :- pragma(myoption(off)).

    ?- findall(P, current_pragma(P), L), writeln(L).
    [blah, myoption(off)]

    :- pragma(noblah).

     ?- findall(P, current_pragma(P), L), writeln(L).
    [myoption(off)]

     ?- current_pragma(myoption(off)).
     Yes.

See Also

compile / 1, inline / 2, pragma / 1, library(source_processor)