prolog_flag/[2,3]prolog_flag(?FlagName, ?Value)
FlagName is a flag, which currently is set to Value.
prolog_flag(+FlagName, -OldValue, +NewValue)
Unifies the current value of FlagName with OldValue and then sets the value of the flag to NewValue. The available Prolog flags are listed in ref-lps-flg.
prolog_flag/3
To inspect the value of a
flag without changing it, use prolog_flag/2 or the following
idiom, where FlagName is bound to one of the valid flags above.
| ?- prolog_flag(FlagName, Value, Value).
Use prolog_flag/2 to query and set_prolog_flag/2 or
prolog_flag/3 to set values.
prolog_flag/3 can be used to save flag values so that one can
return a flag to its previous state.
For example:
...
prolog_flag(debugging,Old,on), % Save in Old and set
...
prolog_flag(debugging,_,Old), % Restore from Old
...
prolog_flag/2 enumerates all valid
flagnames of a given current value, or all pairs of flags and their
current values.
instantiation_errorprolog_flag/3, FlagName unbound, or
NewValue unbound and not identical to OldValue.
type_errordomain_errorprolog_flag/3, FlagName bound to an atom that does not
represent a supported flag, or
NewValue bound to a term that does not represent a valid value
for FlagName.
permission_errorprolog_flag/3,
NewValue not identical to OldValue for a read-only flag.
| ?- prolog_flag(X,Y).
X = bounded,
Y = false ? <RET>
yes
| ?- prolog_flag(X,Y,Y).
! Instantiation error in argument 1 of prolog_flag/3
! goal: prolog_flag(_94,_95,_95)
| ?- prolog_flag(source_info,X,X).
X = on ? <RET>
yes
current_prolog_flag/2, set_prolog_flag/2, ref-lps-flg.