]> Repositorios git - scryer-prolog.git/commitdiff
FIXED: make occurs_check and answer_write_options flags discoverable
authorMarkus Triska <[email protected]>
Sun, 3 Sep 2023 22:49:40 +0000 (00:49 +0200)
committerMarkus Triska <[email protected]>
Sun, 3 Sep 2023 22:56:09 +0000 (00:56 +0200)
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.

src/lib/builtins.pl

index 4625cfb216d6578dd3d77855a955ea7f21470f82..7a81b7d317056780fe22119c9b19d27d336471aa 100644 (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,