don't leave system mode for hooks

This commit is contained in:
Vítor Santos Costa 2013-02-14 20:40:11 -06:00
parent f431142ef4
commit e2acdf72cf
2 changed files with 5 additions and 6 deletions

View File

@ -1085,7 +1085,7 @@ bootstrap(F) :-
% support SWI hook in a separate predicate, to avoid slow down standard consult.
'$enter_command_with_hook'(Stream,Status) :-
'$read_vars'(Stream,Command,_,Pos,Vars, '|: ', Comments),
('$exit_system_mode'(comment_hook(Comments,Pos,Command), prolog) -> true ; true ),
( prolog:comment_hook(Comments,Pos,Command), prolog) -> true ; true ),
'$command'(Command,Vars,Pos,Status).
'$abort_loop'(Stream) :-
@ -1231,7 +1231,7 @@ catch_ball(C, C).
'$nb_getval'('$break', 0, fail),
recorded('$toplevel_hooks',H,_),
H \= fail, !,
( '$exit_system_mode'(H) -> true ; true).
( call(user:H1) -> true ; true).
'$run_toplevel_hooks'.
'$enter_system_mode' :-
@ -1273,7 +1273,6 @@ catch_ball(C, C).
fail
).
'$execute_outside_system_mode'(G, M, CP) :-
format('start~n', []),
(
'$$save_by'(CP1),
'$exit_system_mode',
@ -1293,7 +1292,7 @@ catch_ball(C, C).
'$run_at_thread_start' :-
recorded('$thread_initialization',M:D,_),
'$exit_system_mode'(D, M),
'$execute_outside_sysem_mode'(D, M),
fail.
'$run_at_thread_start'.

View File

@ -394,7 +394,7 @@ initialization(G,OPT) :-
'$do_error'(type_error(OPT),initialization(G,OPT))
).
'$initialization'(G,now) :-
( '$exit_system_mode'(G,prolog) -> true ; format(user_error,':- ~w:~w failed.~n',[M,G]) ).
( call(G) -> true ; format(user_error,':- ~w:~w failed.~n',[M,G]) ).
'$initialization'(G,after_load) :-
'$initialization'(G).
% ignore for now.
@ -412,7 +412,7 @@ initialization(G,OPT) :-
recorded('$system_initialisation',G,R),
erase(R),
G \= '$',
'$exit_system_mode'(G, prolog),
once( call(G) ),
fail.
'$exec_initialisation_goals' :-
'$show_consult_level'(Level),