fix catch and throw: make sure we have an environment.
use $notrace consistently: note that it only matters if ran from the debugger, otherwise it is just a meta-call.
This commit is contained in:
parent
6747cb21de
commit
139f591458
20
pl/boot.yap
20
pl/boot.yap
@ -849,7 +849,7 @@ not(G) :- \+ '$execute'(G).
|
||||
'$call'(G, CP, G0, CurMod) :-
|
||||
( '$is_expand_goal_or_meta_predicate'(G,CurMod) ->
|
||||
(
|
||||
'$oncenotrace'(user:goal_expansion(G, CurMod, NG)) ->
|
||||
'$notrace'(user:goal_expansion(G, CurMod, NG)) ->
|
||||
'$call'(NG, CP, G0,CurMod)
|
||||
;
|
||||
% repeat other code.
|
||||
@ -1076,7 +1076,7 @@ access_file(F,Mode) :-
|
||||
|
||||
expand_term(Term,Expanded) :-
|
||||
( \+ '$undefined'(term_expansion(_,_), user),
|
||||
once(user:term_expansion(Term,Expanded))
|
||||
'$notrace'(user:term_expansion(Term,Expanded))
|
||||
;
|
||||
'$expand_term_grammar'(Term,Expanded)
|
||||
),
|
||||
@ -1116,7 +1116,11 @@ expand_term(Term,Expanded) :-
|
||||
% where was the previous catch
|
||||
catch(G, C, A) :-
|
||||
'$catch'(C,A,_),
|
||||
'$execute'(G).
|
||||
'$execute'(G),
|
||||
'$true'.
|
||||
|
||||
% makes sure we have an environment.
|
||||
'$true'.
|
||||
|
||||
|
||||
% system_catch is like catch, but it avoids the overhead of a full
|
||||
@ -1127,7 +1131,8 @@ catch(G, C, A) :-
|
||||
'$system_catch'(G, M, C, A) :-
|
||||
% check current trail
|
||||
'$catch'(C,A,_),
|
||||
'$execute_nonstop'(G, M).
|
||||
'$execute_nonstop'(G, M),
|
||||
'$true'.
|
||||
|
||||
%
|
||||
% throw has to be *exactly* after system catch!
|
||||
@ -1164,8 +1169,11 @@ throw(Ball) :-
|
||||
'$exit_system_mode' :-
|
||||
nb_setval('$system_mode',off),
|
||||
( nb_getval('$trace',on) -> '$creep' ; true).
|
||||
|
||||
'$donotrace'(G) :-
|
||||
|
||||
%
|
||||
% just leave this around to show the debugger.
|
||||
%
|
||||
'$notrace'(G) :-
|
||||
'$execute'(G).
|
||||
|
||||
'$oncenotrace'(G) :-
|
||||
|
@ -778,7 +778,7 @@ absolute_file_name(File,Opts,TrueFileName) :-
|
||||
|
||||
|
||||
'$extend_path_directory'(Name, D, File, Opts, NewFile, Call) :-
|
||||
user:file_search_path(Name, Dir),
|
||||
'$notrace'(user:file_search_path(Name, Dir)),
|
||||
'$extend_pathd'(Dir, D, File, Opts, NewFile, Call).
|
||||
|
||||
'$extend_pathd'(Dir, A, File, Opts, NewFile, Call) :-
|
||||
|
@ -240,16 +240,16 @@ print_message(Severity, Msg) :-
|
||||
print_message(Severity, Term) :-
|
||||
(
|
||||
(
|
||||
'$notrace'(user:generate_message_hook(Term, [], Lines)) ->
|
||||
'$oncenotrace'(user:generate_message_hook(Term, [], Lines)) ->
|
||||
true
|
||||
;
|
||||
'$notrace'(prolog:message(Term, Lines, [])) ->
|
||||
'$oncenotrace'(prolog:message(Term, Lines, [])) ->
|
||||
true
|
||||
;
|
||||
'$message':generate_message(Term, Lines, [])
|
||||
)
|
||||
-> ( nonvar(Term),
|
||||
'$notrace'(user:message_hook(Term, Severity, Lines))
|
||||
'$oncenotrace'(user:message_hook(Term, Severity, Lines))
|
||||
-> !
|
||||
; !, '$print_system_message'(Term, Severity, Lines)
|
||||
)
|
||||
|
20
pl/preds.yap
20
pl/preds.yap
@ -964,26 +964,6 @@ current_key(A,K) :-
|
||||
% do nothing for now.
|
||||
'$noprofile'(_, _).
|
||||
|
||||
'$notrace'(G) :-
|
||||
var(G), !,
|
||||
'$do_error'(instantiation_error,G).
|
||||
'$notrace'(G) :- number(G), !,
|
||||
'$do_error'(type_error(callable,G),G).
|
||||
'$notrace'(G) :- db_reference(G), !,
|
||||
'$do_error'(type_error(callable,G),G).
|
||||
'$notrace'(M:G) :-
|
||||
\+ atom(M),
|
||||
'$do_error'(type_error(atom,Na), Msg).
|
||||
'$notrace'(M:G) :- !,
|
||||
'$notrace'(G, M).
|
||||
'$notrace'(G) :- !,
|
||||
'$notrace'(G, prolog).
|
||||
|
||||
|
||||
'$notrace'(G, Mod) :-
|
||||
\+ '$undefined'(G, Mod),
|
||||
'$donotrace'(Mod:G).
|
||||
|
||||
'$ifunctor'(Pred,Na,Ar) :-
|
||||
(Ar > 0 ->
|
||||
functor(Pred, Na, Ar)
|
||||
|
@ -99,7 +99,7 @@
|
||||
'$execute_nonstop'('$call'(G, CP, G0, M),M0).
|
||||
% donotrace: means do not trace! So,
|
||||
% ignore and then put creep back for the continuation.
|
||||
'$start_creep'([M0|'$donotrace'(G)]) :-
|
||||
'$start_creep'([M0|'$notrace'(G)]) :-
|
||||
!,
|
||||
(
|
||||
CP0 is '$last_choice_pt',
|
||||
|
Reference in New Issue
Block a user