[ Predicate Database and Compiler | Reference Manual | Alphabetic Index ]

set_flag(++PredSpec, +Flag, +Value)

Sets the flag Flag of the procedure specified by PredSpec to the value Value.
PredSpec
Expression of the form Atom/Integer or a list of those.
Flag
Atom.
Value
Atom.

Description

Used to set the value Value of the flag Flag of the procedure(s) specified by PredSpec. The value of a flag may be returned using get_flag/3.

The settable flags, their values and their meanings are:

   ---------------------------------------------------------------------
   | Flags          Values     Description                             |
   |-------------------------------------------------------------------|
   | deprecated     on, off    predicate is deprecated, warn on use    |
   |                                                                   |
   | leash                     debugger behaviour for this procedure:  |
   |                stop,        trace procedure's ports and stop      |
   |                print,       trace procedure's ports and continue  |
   |                notrace      hide procedure's ports                |
   |                                                                   |
   | skip           on, off    procedure will be traced,               |
   |                           but its children will not               |
   |                                                                   |
   | spy            on, off    procedure has a spypoint                |
   |                                                                   |
   | start_tracing  on, off    procedure starts the tracer             |
   |                                                                   |
   | priority       1..12      default waking priority                 |
   |                                                                   |
   | run_priority   1..12      execution priority when woken           |
   ---------------------------------------------------------------------

Modes and Determinism

Modules

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

Exceptions

(4) instantiation fault
At least one of PredSpec, Flag or Value are not instantiated
(5) type error
PredSpec is not an expression of the form Atom/Integer.
(5) type error
Flag is not an atom.
(5) type error
Value is not an atom.
(6) out of range
Flag is no flag.
(6) out of range
Value is no value of the flag Flag.
(30) trying to write a read-only flag
Flag is a read only flag.
(60) referring to an undefined procedure
PredSpec is not defined.

Examples

Success:
    [eclipse]: [user].
     pr([]).  % prints the elements of a list
     pr([ S | T ]) :-
            writeln(S),
            pr(T).
     user compiled 484 bytes in 0.00 seconds
    yes.
    [eclipse]: pr([tom, dick]).
    tom
    dick
    yes.
    [eclipse]: set_flag(pr/1, spy, on).
    yes.
    [eclipse]: trace.
    Debugger switched on - creep mode
    yes.
    [eclipse]: pr([tom, dick]).
     +(1) 0  CALL   pr([tom, dick]) (dbg)?- leap
    tom
     +(3) 1  CALL   pr([dick]) (dbg)?- leap
    dick
     +(5) 2  CALL   pr([]) (dbg)?- leap
     +(5) 2  EXIT   pr([]) (dbg)?- leap
     +(3) 1  EXIT   pr([dick]) (dbg)?- leap
     +(1) 0  EXIT   pr([tom, dick]) (dbg)?- leap
    yes.

Error:
    set_flag(X, skip, on).                 (Error 4).
    set_flag("a", spy, on).                (Error 5).
    set_flag(is/2, spy, yes).              (Error 6).
    set_flag(p/2, leash, on).              (Error 60).



See Also

debug / 0, get_flag / 3, deprecated / 2, nospy / 1, pred / 1, skipped / 1, spy / 1, trace / 0, traceable / 1, unskipped / 1, untraceable / 1