SWI compatible option: prompt_alternatives_on.

This commit is contained in:
Vitor Santos Costa 2010-02-28 00:05:38 +00:00
parent a00c3e13c1
commit 495529e69e
3 changed files with 39 additions and 9 deletions

View File

@ -7766,6 +7766,11 @@ procedures. If @code{on} compile predicates so that they will output
profiling information. Profiling data can be read through the
@code{profile_data/3} built-in.
@item prompt_alternatives_on(atom, changeable)
@findex prompt_alternatives_on (yap_flag/2 option)
SWI-Compatible opttion, determines prompting for alternatives in the Prolog toplevel. Default is @t{groundness}, YAP prompts for alternatives if and only if the query contains variables. The alternative, default in SWI-Prolog is @t{determinism} which implies the system prompts for alternatives if the goal succeeded while leaving choicepoints.
@item redefine_warnings
@findex discontiguous_warnings (yap_flag/2 option)
@*

View File

@ -475,7 +475,9 @@ true :- true.
X == '$', !,
( recorded('$reconsulting',_,R) -> erase(R) ).
/* Executing a query */
'$prompt_alternatives_on'(groundness).
/* Executing a query */
'$query'(end_of_file,_).
@ -493,18 +495,28 @@ true :- true.
% end of YAPOR
'$query'(G,[]) :- !,
'$query'(G,[]) :-
'$prompt_alternatives_on'(groundness), !,
'$yes_no'(G,(?-)).
'$query'(G,V) :-
(
'$exit_system_mode',
yap_hacks:current_choice_point(CP),
'$execute'(G),
yap_hacks:current_choice_point(NCP),
( '$enter_system_mode' ; '$exit_system_mode', fail),
'$output_frozen'(G, V, LGs),
'$write_answer'(V, LGs, Written),
'$write_query_answer_true'(Written),
(
'$prompt_alternatives_on'(determinism), CP = NCP ->
nl(user_error),
!
;
'$another',
!, fail
!
),
fail
;
'$enter_system_mode',
'$out_neg_answer'

View File

@ -761,6 +761,18 @@ yap_flag(write_strings,off) :- !,
yap_flag(write_strings,X) :-
'$do_error'(domain_error(flag_value,write_strings+X),yap_flag(write_strings,X)).
yap_flag(prompt_alternatives_on,OUT) :-
var(OUT), !,
'$prompt_alternatives_on'(OUT).
yap_flag(prompt_alternatives_on,determinism) :- !,
'$purge_clauses'('$prompt_alternatives_on'(_),prolog),
'$compile'('$prompt_alternatives_on'(determinism),0,'$prompt_alternatives_on'(determinism),prolog).
yap_flag(prompt_alternatives_on,groundness) :- !,
'$purge_clauses'('$prompt_alternatives_on'(_),prolog),
'$compile'('$prompt_alternatives_on'(groundness),0,'$prompt_alternatives_on'(groundness),prolog).
yap_flag(prompt_alternatives_on,X) :-
'$do_error'(domain_error(flag_value,prompt_alternatives_on+X),yap_flag(prompt_alternatives_on,X)).
yap_flag(stack_dump_on_error,OUT) :-
var(OUT), !,
'$access_yap_flags'(17,X),
@ -933,6 +945,7 @@ yap_flag(dialect,yap).
V = n_of_integer_keys_in_db ;
V = open_expands_filename ;
V = profiling ;
V = prompt_alternatives_on ;
V = redefine_warnings ;
V = shared_object_search_path ;
V = single_var_warnings ;