introduce at_halt/1.

fix bug in naming variables in suspended goals.
This commit is contained in:
Vítor Santos Costa 2012-12-02 13:18:29 +00:00
parent 3c0e16030c
commit 2cbf3439ac
4 changed files with 19 additions and 8 deletions

View File

@ -270,7 +270,7 @@ call_residue(Goal,Module,Residue) :-
delayed_goals(G, Vs, NVs, Gs) :-
project_delayed_goals(G),
copy_term(G.Vs, _.NVs, Gs).
copy_term([G|Vs], [_|NVs], Gs).
project_delayed_goals(G) :-
% SICStus compatible step,

View File

@ -92,7 +92,6 @@ true :- true.
'$init_or_threads',
'$run_at_thread_start'.
'$init_globals' :-
'$init_consult',
nb_setval('$chr_toplevel_show_store',false),
@ -218,7 +217,7 @@ true :- true.
get_value('$top_level_goal',GA), GA \= [], !,
set_value('$top_level_goal',[]),
'$run_atom_goal'(GA),
set_value('$live','$false').
halt(0).
'$enter_top_level' :-
'$disable_docreep',
'$run_toplevel_hooks',
@ -229,8 +228,7 @@ true :- true.
nb_setval('$debug_run',off),
nb_setval('$debug_jump',off),
'$command'(Command,Varnames,_Pos,top),
'$sync_mmapped_arrays',
set_value('$live','$false').
halt(0).
'$erase_sets' :-
@ -537,7 +535,7 @@ true :- true.
yap_hacks:current_choice_point(NCP1),
'$attributes':delayed_goals(G, V, NV, LGs),
yap_hacks:current_choice_point(NCP2),
'$clean_ifcp'(CP),
'$clean_ifcp'(CP),
NCP is NCP2-NCP1
;
copy_term_nat(V, NV),
@ -732,9 +730,8 @@ true :- true.
'$name_vars_in_goals1'(GVL, 0, _).
'$name_well_known_vars'([]).
'$name_well_known_vars'([[SName|V]|NVL0]) :-
'$name_well_known_vars'([Name=V|NVL0]) :-
var(V), !,
atom_codes(Name, SName),
V = '$VAR'(Name),
'$name_well_known_vars'(NVL0).
'$name_well_known_vars'([_|NVL0]) :-

View File

@ -289,11 +289,24 @@ version(T) :-
fail.
'$set_toplevel_hook'(_).
at_halt(G) :-
recorda('$halt', G, _),
fail.
at_halt(_).
halt :-
print_message(informational, halt),
fail.
halt :-
'$halt'(0).
halt(_) :-
recorded('$halt', G, _),
call(G),
fail.
halt(X) :-
'$sync_mmapped_arrays',
set_value('$live','$false'),
'$halt'(X).
prolog_current_frame(Env) :-

View File

@ -586,6 +586,7 @@ source_module(Mod) :-
assertz(:),
assertz(:,+),
assertz_static(:),
at_halt(0),
bagof(?,0,-),
bb_get(:,-),
bb_put(:,+),