Mode Handling

The Prolog interpreter activates the goals of the debug clause fork in case some debug mode is set. The Prolog flag sys_cloak allows temporarily disabling any debug mode for a Prolog interpreter. The predicate sys_ignore/1 will run a goal with this flag set.

The debug clause fork is pickled with the instrumentation built-ins sys_in/0, sys_out/0 and sys_at/0. The end-user is not supposed to use them. They need to have public access so that they can be called from any clause fork.

The following modehandling predicates are provided:

sys_ignore(A):
The predicate succeeds whenever A succeeds. The goal A is invoked with the mode cloak temporarily set to on.
sys_in:
This instrumentation hook should succeed. It is called before a goal is called every time a goal is called.
sys_out:
This instrumentation hook should succeed. It is called after a goal exits every time a goal exits.
sys_at:
This instrumentation hook should succeeds. It is called after a head unification succeeds and before the attribute variable unify hooks are called.

The following Prolog flags for mode handling are provided:

sys_cloak:
Legal values are on and off. The flag indicates whether the interpreter currently should ignore the debug mode. Default value is off. The value can be changed.
sys_clause_instrument:
Legal values are on and off. The flag is per knowledge base and is inherited when predicates are created. Default value is on. The value can be changed.
sys_head_wakeup:
Legal values are on and off. The flag is per knowledge base and is inherited when predicates are created. Default value is on. The value can be changed.

The following mode handling predicate properties are provided:

sys_noinstrument:
The property indicates that the clauses of the predicate should not be instrumented for debugging. The value can be changed.
sys_nowakeup:
The property indicates that frozen goals should not be woken up after the head of the clause is unified. The value can be changed.

Comments