[ ECLiPSe Predicate Database built-in.|Group Index| Full Index]

get_flag(+PredSpec, ?Flag, ?Value)

Succeeds if the flag Flag of the procedure specified by PredSpec has the value Value.

+PredSpec
Expression of the form Atom/Integer.
?Flag
Atom or variable.
?Value
Atom, integer, compound_term or variable.

Description

Used to get the value Value of the flag Flag of the procedure specified by PredSpec. The values of certain flags may be set using set_flag/3. It can also be used to test if a procedure with a given functor exists or has certain properties.

The possible flags, their values and their meanings are:

    Flags             Values        Description
   ------------------------------------------------------
    call_type         prolog,       predicate source
                      external,     language
                      b_external
    debugged          on, off       compiled in
                                    debugging mode
    declared          on, off       predicate was
                                    declared
    defined           on, off       predicate code
                                    exists
    definition_module an atom       where the procedure
                                    is defined
    leash             stop,         see below
                      print,
                      notrace
    mode              pred(Mode1,   the mode of the
                      ...)          predicate
    parallel          on, off       clauses may be exe-
                                    cuted in parallel
    protected         on, off       procedure cannot be
                                    redefined
    skip              on, off       procedure will be
                                    traced, but its
                                    children will not
    spy               on, off       procedure has a
                                    spypoint
    stability         static,       is the procedure
                      dynamic       dynamic?
    tool              on, off       tool property
    type              built-in,     type of predicate
                      user
    visibility        local,        accessibility
                      global,
                      exported,
                      imported,
                      unknown
    source_file       an atom       the file where
                                    defined
    source_line       an integer    starting line
                                    number in the file
    source_offset     an integer    byte offset at
                                    which the procedure
                                    definition starts
                                    in its source file
    statistics        on, off       procedure profiling
    waking            eager, lazy   waking priority
The possible values of leash and their meanings are:

   -----------------------------------------------------
   | Values   Description                               |
   |--------------------------------------------------  |
   | stop     procedure ports are printed and the       |
   |          debugger stops on them                    |
   | print    procedure ports are printed and the       |
   |          debugger does not stop on them            |
   | notrace  procedure ports will not be shown, but    |
   |          its childrens's ports will                |
   -----------------------------------------------------|

Fail Conditions

Fails if the flag Flag of the procedure specified by PredSpec does not have the value Value, if its value is unknown or if the procedure does not exist.

Resatisfiable

Yes.

Exceptions

(4) Instantiation fault
PredSpec is not instantiated
(5) Type error
PredSpec is not an expression of the form Atom/Integer.
(5) Type error
Flag is instantiated but not to an atom.
(5) Type error
Value is not an atom.

Examples


Success:
    [eclipse]: get_flag(member/2, F, V),
            printf("%-20s%w\n", [F, V]), fail.
    call_type           prolog
    debugged            on
    declared            off
    defined             on
    leash               stop
    protected           off
    skip                on
    spy                 off
    stability           static
    tool                off
    type                user
    visibility          global
    waking              eager
    parallel            off
    definition_module   lists
    mode                member(?, ?)
    source_file         /usr/local/eclipse/lib/lists.pl
    source_line         30
    source_offset       976
    statistics          off

Fail:
    get_flag(true/0, defined, off).
    get_flag(undef/0, F, V).
Error:
    get_flag(X, spy, on).           (Error 4).
    get_flag("a", spy, on).         (Error 5).


See Also

pred / 1, set_flag / 3