try to make top level writing more SWI compatible.
This commit is contained in:
parent
6d52fa371e
commit
c468d8431e
@ -16,7 +16,7 @@
|
|||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
:- module('$attributes', [
|
:- module('$attributes', [
|
||||||
project_delayed_goals/2
|
delayed_goals/4
|
||||||
]).
|
]).
|
||||||
|
|
||||||
prolog:get_attr(Var, Mod, Att) :-
|
prolog:get_attr(Var, Mod, Att) :-
|
||||||
@ -242,6 +242,11 @@ prolog:call_residue(Goal,Residue) :-
|
|||||||
call_residue(Goal,Module,Residue) :-
|
call_residue(Goal,Module,Residue) :-
|
||||||
call(Module:Goal).
|
call(Module:Goal).
|
||||||
|
|
||||||
|
|
||||||
|
delayed_goals(G, Vs, NVs, Gs) :-
|
||||||
|
project_delayed_goals(G),
|
||||||
|
copy_term(G.Vs, _.NVs, Gs).
|
||||||
|
|
||||||
project_delayed_goals(G) :-
|
project_delayed_goals(G) :-
|
||||||
'$undefined'(modules_with_attributes(_),attributes), !.
|
'$undefined'(modules_with_attributes(_),attributes), !.
|
||||||
project_delayed_goals(G) :-
|
project_delayed_goals(G) :-
|
||||||
|
33
pl/boot.yap
33
pl/boot.yap
@ -494,7 +494,7 @@ true :- true.
|
|||||||
% * -------- YAPOR -------- *
|
% * -------- YAPOR -------- *
|
||||||
% ***************************
|
% ***************************
|
||||||
|
|
||||||
'$query'(G,V) :-
|
'$query'(G,V) :-
|
||||||
\+ '$undefined'('$yapor_on', prolog),
|
\+ '$undefined'('$yapor_on', prolog),
|
||||||
'$yapor_on',
|
'$yapor_on',
|
||||||
\+ '$undefined'('$start_yapor', prolog),
|
\+ '$undefined'('$start_yapor', prolog),
|
||||||
@ -504,18 +504,18 @@ true :- true.
|
|||||||
|
|
||||||
% end of YAPOR
|
% end of YAPOR
|
||||||
|
|
||||||
'$query'(G,[]) :-
|
'$query'(G,[]) :-
|
||||||
'$prompt_alternatives_on'(groundness), !,
|
'$prompt_alternatives_on'(groundness), !,
|
||||||
'$yes_no'(G,(?-)).
|
'$yes_no'(G,(?-)).
|
||||||
'$query'(G,V) :-
|
'$query'(G,V) :-
|
||||||
(
|
(
|
||||||
'$exit_system_mode',
|
'$exit_system_mode',
|
||||||
yap_hacks:current_choice_point(CP),
|
yap_hacks:current_choice_point(CP),
|
||||||
'$execute'(G),
|
'$execute'(G),
|
||||||
yap_hacks:current_choice_point(NCP),
|
yap_hacks:current_choice_point(NCP),
|
||||||
( '$enter_system_mode' ; '$exit_system_mode', fail),
|
( '$enter_system_mode' ; '$exit_system_mode', fail),
|
||||||
'$output_frozen'(G, V, LGs),
|
'$delayed_goals'(G, V, NV, LGs),
|
||||||
'$write_answer'(V, LGs, Written),
|
'$write_answer'(NV, LGs, Written),
|
||||||
'$write_query_answer_true'(Written),
|
'$write_query_answer_true'(Written),
|
||||||
(
|
(
|
||||||
'$prompt_alternatives_on'(determinism), CP = NCP ->
|
'$prompt_alternatives_on'(determinism), CP = NCP ->
|
||||||
@ -534,8 +534,8 @@ true :- true.
|
|||||||
'$yes_no'(G,C) :-
|
'$yes_no'(G,C) :-
|
||||||
'$current_module'(M),
|
'$current_module'(M),
|
||||||
'$do_yes_no'(G,M),
|
'$do_yes_no'(G,M),
|
||||||
'$output_frozen'(G, [], LGs),
|
'$delayed_goals'(G, [], NV, LGs),
|
||||||
'$write_answer'([], LGs, Written),
|
'$write_answer'(NV, LGs, Written),
|
||||||
( Written = [] ->
|
( Written = [] ->
|
||||||
!,'$present_answer'(C, yes);
|
!,'$present_answer'(C, yes);
|
||||||
'$another', !
|
'$another', !
|
||||||
@ -547,6 +547,11 @@ true :- true.
|
|||||||
|
|
||||||
'$add_env_and_fail' :- fail.
|
'$add_env_and_fail' :- fail.
|
||||||
|
|
||||||
|
'$delayed_goals'(G, V, NV, LGs) :-
|
||||||
|
'$attributes':delayed_goals(G, V, NV, LGs), !.
|
||||||
|
'$delayed_goals'(_, V, NV, []) :-
|
||||||
|
copy_term_nat(V, NV).
|
||||||
|
|
||||||
'$out_neg_answer' :-
|
'$out_neg_answer' :-
|
||||||
( '$undefined'(print_message(_,_),prolog) ->
|
( '$undefined'(print_message(_,_),prolog) ->
|
||||||
'$present_answer'(user_error,"no~n", [])
|
'$present_answer'(user_error,"no~n", [])
|
||||||
@ -565,11 +570,6 @@ true :- true.
|
|||||||
format(user_error,'~ntrue',[]).
|
format(user_error,'~ntrue',[]).
|
||||||
'$write_query_answer_true'(_).
|
'$write_query_answer_true'(_).
|
||||||
|
|
||||||
'$output_frozen'(_,V,LGs) :-
|
|
||||||
\+ '$undefined'(bindings_message(_,_,_), swi),
|
|
||||||
swi:bindings_message(V, LGs, []), !.
|
|
||||||
'$output_frozen'(G,V,LGs) :-
|
|
||||||
'$attributes':project_delayed_goals(G,LGs).
|
|
||||||
|
|
||||||
%
|
%
|
||||||
% present_answer has three components. First it flushes the streams,
|
% present_answer has three components. First it flushes the streams,
|
||||||
@ -735,11 +735,10 @@ true :- true.
|
|||||||
format(user_error,'~w',[G])
|
format(user_error,'~w',[G])
|
||||||
).
|
).
|
||||||
|
|
||||||
'$name_vars_in_goals'(G, VL0, NG) :-
|
'$name_vars_in_goals'(G, VL0, G) :-
|
||||||
copy_term_nat(G+VL0, NG+NVL0),
|
'$name_well_known_vars'(VL0),
|
||||||
'$name_well_known_vars'(NVL0),
|
'$variables_in_term'(G, [], GVL),
|
||||||
'$variables_in_term'(NG, [], NGVL),
|
'$name_vars_in_goals1'(GVL, 0, _).
|
||||||
'$name_vars_in_goals1'(NGVL, 0, _).
|
|
||||||
|
|
||||||
'$name_well_known_vars'([]).
|
'$name_well_known_vars'([]).
|
||||||
'$name_well_known_vars'([[Name|V]|NVL0]) :-
|
'$name_well_known_vars'([[Name|V]|NVL0]) :-
|
||||||
|
Reference in New Issue
Block a user