introduce at_halt/1.
fix bug in naming variables in suspended goals.
This commit is contained in:
parent
3c0e16030c
commit
2cbf3439ac
@ -270,7 +270,7 @@ call_residue(Goal,Module,Residue) :-
|
|||||||
|
|
||||||
delayed_goals(G, Vs, NVs, Gs) :-
|
delayed_goals(G, Vs, NVs, Gs) :-
|
||||||
project_delayed_goals(G),
|
project_delayed_goals(G),
|
||||||
copy_term(G.Vs, _.NVs, Gs).
|
copy_term([G|Vs], [_|NVs], Gs).
|
||||||
|
|
||||||
project_delayed_goals(G) :-
|
project_delayed_goals(G) :-
|
||||||
% SICStus compatible step,
|
% SICStus compatible step,
|
||||||
|
11
pl/boot.yap
11
pl/boot.yap
@ -92,7 +92,6 @@ true :- true.
|
|||||||
'$init_or_threads',
|
'$init_or_threads',
|
||||||
'$run_at_thread_start'.
|
'$run_at_thread_start'.
|
||||||
|
|
||||||
|
|
||||||
'$init_globals' :-
|
'$init_globals' :-
|
||||||
'$init_consult',
|
'$init_consult',
|
||||||
nb_setval('$chr_toplevel_show_store',false),
|
nb_setval('$chr_toplevel_show_store',false),
|
||||||
@ -218,7 +217,7 @@ true :- true.
|
|||||||
get_value('$top_level_goal',GA), GA \= [], !,
|
get_value('$top_level_goal',GA), GA \= [], !,
|
||||||
set_value('$top_level_goal',[]),
|
set_value('$top_level_goal',[]),
|
||||||
'$run_atom_goal'(GA),
|
'$run_atom_goal'(GA),
|
||||||
set_value('$live','$false').
|
halt(0).
|
||||||
'$enter_top_level' :-
|
'$enter_top_level' :-
|
||||||
'$disable_docreep',
|
'$disable_docreep',
|
||||||
'$run_toplevel_hooks',
|
'$run_toplevel_hooks',
|
||||||
@ -229,8 +228,7 @@ true :- true.
|
|||||||
nb_setval('$debug_run',off),
|
nb_setval('$debug_run',off),
|
||||||
nb_setval('$debug_jump',off),
|
nb_setval('$debug_jump',off),
|
||||||
'$command'(Command,Varnames,_Pos,top),
|
'$command'(Command,Varnames,_Pos,top),
|
||||||
'$sync_mmapped_arrays',
|
halt(0).
|
||||||
set_value('$live','$false').
|
|
||||||
|
|
||||||
|
|
||||||
'$erase_sets' :-
|
'$erase_sets' :-
|
||||||
@ -537,7 +535,7 @@ true :- true.
|
|||||||
yap_hacks:current_choice_point(NCP1),
|
yap_hacks:current_choice_point(NCP1),
|
||||||
'$attributes':delayed_goals(G, V, NV, LGs),
|
'$attributes':delayed_goals(G, V, NV, LGs),
|
||||||
yap_hacks:current_choice_point(NCP2),
|
yap_hacks:current_choice_point(NCP2),
|
||||||
'$clean_ifcp'(CP),
|
'$clean_ifcp'(CP),
|
||||||
NCP is NCP2-NCP1
|
NCP is NCP2-NCP1
|
||||||
;
|
;
|
||||||
copy_term_nat(V, NV),
|
copy_term_nat(V, NV),
|
||||||
@ -732,9 +730,8 @@ true :- true.
|
|||||||
'$name_vars_in_goals1'(GVL, 0, _).
|
'$name_vars_in_goals1'(GVL, 0, _).
|
||||||
|
|
||||||
'$name_well_known_vars'([]).
|
'$name_well_known_vars'([]).
|
||||||
'$name_well_known_vars'([[SName|V]|NVL0]) :-
|
'$name_well_known_vars'([Name=V|NVL0]) :-
|
||||||
var(V), !,
|
var(V), !,
|
||||||
atom_codes(Name, SName),
|
|
||||||
V = '$VAR'(Name),
|
V = '$VAR'(Name),
|
||||||
'$name_well_known_vars'(NVL0).
|
'$name_well_known_vars'(NVL0).
|
||||||
'$name_well_known_vars'([_|NVL0]) :-
|
'$name_well_known_vars'([_|NVL0]) :-
|
||||||
|
@ -289,11 +289,24 @@ version(T) :-
|
|||||||
fail.
|
fail.
|
||||||
'$set_toplevel_hook'(_).
|
'$set_toplevel_hook'(_).
|
||||||
|
|
||||||
|
at_halt(G) :-
|
||||||
|
recorda('$halt', G, _),
|
||||||
|
fail.
|
||||||
|
at_halt(_).
|
||||||
|
|
||||||
halt :-
|
halt :-
|
||||||
print_message(informational, halt),
|
print_message(informational, halt),
|
||||||
|
fail.
|
||||||
|
halt :-
|
||||||
'$halt'(0).
|
'$halt'(0).
|
||||||
|
|
||||||
|
halt(_) :-
|
||||||
|
recorded('$halt', G, _),
|
||||||
|
call(G),
|
||||||
|
fail.
|
||||||
halt(X) :-
|
halt(X) :-
|
||||||
|
'$sync_mmapped_arrays',
|
||||||
|
set_value('$live','$false'),
|
||||||
'$halt'(X).
|
'$halt'(X).
|
||||||
|
|
||||||
prolog_current_frame(Env) :-
|
prolog_current_frame(Env) :-
|
||||||
|
@ -586,6 +586,7 @@ source_module(Mod) :-
|
|||||||
assertz(:),
|
assertz(:),
|
||||||
assertz(:,+),
|
assertz(:,+),
|
||||||
assertz_static(:),
|
assertz_static(:),
|
||||||
|
at_halt(0),
|
||||||
bagof(?,0,-),
|
bagof(?,0,-),
|
||||||
bb_get(:,-),
|
bb_get(:,-),
|
||||||
bb_put(:,+),
|
bb_put(:,+),
|
||||||
|
Reference in New Issue
Block a user