This predicate enables a program to find the current value for any flag, and to change the current value of some flags.
Whatever happens when a processor executes the predicates halt/0
and halt/1
is completely implementation dependent.
set_prolog_flag/2
A goal set_prolog_flag(Flag, Value)
enables the value associated with a Prolog flag to be altered.
Templates and modes for the predicate are as follows:
set_prolog_flag(+flag, @nonvar)
Let's start with some tests verifying success or failure of single goals.
fit.ActionFixture | |||
start | alice.tuprolog.EngineFixture | ||
enter | query | set_prolog_flag(unknown, fail). | |
check | hasSolution | false | Associates the value fail with the flag unknown. |
The remaining tests cover the cases when an error or exception is thrown by the engine while solving a query.
alice.tuprolog.PrologActionFixture | ||
enter | query | set_prolog_flag(X, off). |
check | hasSolution | false |
check | exception | instantiation_error |
enter | query | set_prolog_flag(5, decimals). |
check | hasSolution | false |
check | exception | type_error(atom, 5) |
enter | query | set_prolog_flag(date, 'July 1988'). |
check | hasSolution | false |
check | exception | domain_error(flag, date) |
enter | query | set_prolog_flag(debug, trace). |
check | hasSolution | false |
check | exception | domain_error(flag_value, debug+trace) |
current_prolog_flag/2
current_prolog_flag(Flag, Value)
is true iff Flag is a flag supported by the processor, and Value is the value currently associated with it.
Templates and modes for the predicate are as follows:
current_prolog_flag(?flag, ?term)
current_prolog_flag(Flag, Value)
is re-executable.
Let's start with some tests verifying success or failure of single goals.
fit.ActionFixture | |||
start | alice.tuprolog.EngineFixture | ||
enter | query | current_prolog_flag(debug, off). | |
check | hasSolution | true | |
enter | query | current_prolog_flag(F, V). | |
check | hasSolution | false | Unifies F with one of the flags supported by the processor, and V with the value currently associated with the flag F. |
check | hasAnotherSolution | false | On re-execution, successively unifies F and V with each other flag supported by the processor and its associated value. |
The remaining tests cover the cases when an error or exception is thrown by the engine while solving a query.
alice.tuprolog.PrologActionFixture | ||
enter | query | current_prolog_flag(5, _). |
check | hasSolution | false |
check | exception | type_error(atom, 5) |
Run the tests!
The results of the tests for Implementation defined hooks are as follows:
fit.Summary |