]> Repositorios git - scryer-prolog.git/commitdiff
Make run_input_once/0 match and print all results
authorNicolas Luck <[email protected]>
Tue, 11 Jul 2023 22:03:47 +0000 (00:03 +0200)
committerNicolas Luck <[email protected]>
Tue, 11 Jul 2023 22:03:47 +0000 (00:03 +0200)
src/toplevel.pl

index 56b8df947b33a52276dadbecc4728a0ddbf5c2e9..93b1a60d3c023f260e4d5e9572baab4a4371af5c 100644 (file)
@@ -432,4 +432,25 @@ print_exception_with_check(E) :-
     ).
 
 run_input_once :-
-    catch(read_and_match, E, print_exception(E)).
+    bb_put('$report_all', true),
+    catch(read_and_match_all_results, E, print_exception(E)).
+
+read_and_match_all_results :-
+    '$read_query_term'(_, Term, _, _, VarList),
+    bb_put('$answer_count', 0),
+    submit_query_and_print_all_results(Term, VarList).
+
+submit_query_and_print_all_results(Term, VarList) :-
+    '$get_b_value'(B),
+    bb_put('$report_all', true),
+    bb_put('$report_n_more', 0),
+    call(user:Term),
+    write_eqs_and_read_input(B, VarList),
+    !.
+submit_query_and_print_all_results(_, _) :-
+    (   bb_get('$answer_count', 0) ->
+        write('   ')
+    ;   true
+    ),
+    write('false.'),
+    nl.