FIXED: make occurs_check and answer_write_options flags discoverable

Quoting from 7.11 Flags:

   NOTE - A built-in predicate current_prolog_flag(Flag, Value)
   (8.17.2) enables a program to discover all the flags supported
   by a processor and their current values.
This commit is contained in:
Markus Triska
2023-09-04 00:49:40 +02:00
parent 99bd3d3b1a
commit aca0de06cd

View File

@@ -161,12 +161,14 @@ current_prolog_flag(Flag, OccursCheckEnabled) :-
Flag == occurs_check,
!,
'$is_sto_enabled'(OccursCheckEnabled).
current_prolog_flag(occurs_check, OccursCheckEnabled) :-
'$is_sto_enabled'(OccursCheckEnabled).
current_prolog_flag(Flag, Value) :-
Flag == answer_write_options,
!,
( iso_ext:bb_get('$answer_write_options', Value) -> true
; Value = []
).
answer_write_options(Value).
current_prolog_flag(answer_write_options, Value) :-
answer_write_options(Value).
current_prolog_flag(Flag, _) :-
atom(Flag),
throw(error(domain_error(prolog_flag, Flag), current_prolog_flag/2)). % 8.17.2.3 b
@@ -174,6 +176,11 @@ current_prolog_flag(Flag, _) :-
nonvar(Flag),
throw(error(type_error(atom, Flag), current_prolog_flag/2)). % 8.17.2.3 a
answer_write_options(Value) :-
( iso_ext:bb_get('$answer_write_options', Value) -> true
; Value = []
).
%% set_prolog_flag(Flag, Value).
%
% Sets the internal value of the flag. To see the list of flags supported by Scryer Prolog,