don't leave system mode for hooks
This commit is contained in:
parent
f431142ef4
commit
e2acdf72cf
@ -1085,7 +1085,7 @@ bootstrap(F) :-
|
|||||||
% support SWI hook in a separate predicate, to avoid slow down standard consult.
|
% support SWI hook in a separate predicate, to avoid slow down standard consult.
|
||||||
'$enter_command_with_hook'(Stream,Status) :-
|
'$enter_command_with_hook'(Stream,Status) :-
|
||||||
'$read_vars'(Stream,Command,_,Pos,Vars, '|: ', Comments),
|
'$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).
|
'$command'(Command,Vars,Pos,Status).
|
||||||
|
|
||||||
'$abort_loop'(Stream) :-
|
'$abort_loop'(Stream) :-
|
||||||
@ -1231,7 +1231,7 @@ catch_ball(C, C).
|
|||||||
'$nb_getval'('$break', 0, fail),
|
'$nb_getval'('$break', 0, fail),
|
||||||
recorded('$toplevel_hooks',H,_),
|
recorded('$toplevel_hooks',H,_),
|
||||||
H \= fail, !,
|
H \= fail, !,
|
||||||
( '$exit_system_mode'(H) -> true ; true).
|
( call(user:H1) -> true ; true).
|
||||||
'$run_toplevel_hooks'.
|
'$run_toplevel_hooks'.
|
||||||
|
|
||||||
'$enter_system_mode' :-
|
'$enter_system_mode' :-
|
||||||
@ -1273,7 +1273,6 @@ catch_ball(C, C).
|
|||||||
fail
|
fail
|
||||||
).
|
).
|
||||||
'$execute_outside_system_mode'(G, M, CP) :-
|
'$execute_outside_system_mode'(G, M, CP) :-
|
||||||
format('start~n', []),
|
|
||||||
(
|
(
|
||||||
'$$save_by'(CP1),
|
'$$save_by'(CP1),
|
||||||
'$exit_system_mode',
|
'$exit_system_mode',
|
||||||
@ -1293,7 +1292,7 @@ catch_ball(C, C).
|
|||||||
|
|
||||||
'$run_at_thread_start' :-
|
'$run_at_thread_start' :-
|
||||||
recorded('$thread_initialization',M:D,_),
|
recorded('$thread_initialization',M:D,_),
|
||||||
'$exit_system_mode'(D, M),
|
'$execute_outside_sysem_mode'(D, M),
|
||||||
fail.
|
fail.
|
||||||
'$run_at_thread_start'.
|
'$run_at_thread_start'.
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ initialization(G,OPT) :-
|
|||||||
'$do_error'(type_error(OPT),initialization(G,OPT))
|
'$do_error'(type_error(OPT),initialization(G,OPT))
|
||||||
).
|
).
|
||||||
'$initialization'(G,now) :-
|
'$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,after_load) :-
|
||||||
'$initialization'(G).
|
'$initialization'(G).
|
||||||
% ignore for now.
|
% ignore for now.
|
||||||
@ -412,7 +412,7 @@ initialization(G,OPT) :-
|
|||||||
recorded('$system_initialisation',G,R),
|
recorded('$system_initialisation',G,R),
|
||||||
erase(R),
|
erase(R),
|
||||||
G \= '$',
|
G \= '$',
|
||||||
'$exit_system_mode'(G, prolog),
|
once( call(G) ),
|
||||||
fail.
|
fail.
|
||||||
'$exec_initialisation_goals' :-
|
'$exec_initialisation_goals' :-
|
||||||
'$show_consult_level'(Level),
|
'$show_consult_level'(Level),
|
||||||
|
Reference in New Issue
Block a user