undef should not fail immediately: it needs to test for exports first
This commit is contained in:
parent
e92062886b
commit
c5323b2920
@ -888,10 +888,7 @@ static int interrupt_dexecute(USES_REGS1) {
|
|||||||
|
|
||||||
static void undef_goal(USES_REGS1) {
|
static void undef_goal(USES_REGS1) {
|
||||||
PredEntry *pe = PredFromDefCode(P);
|
PredEntry *pe = PredFromDefCode(P);
|
||||||
if (Yap_UnknownFlag(CurrentModule) == TermFail) {
|
|
||||||
P = FAILCODE;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
BEGD(d0);
|
BEGD(d0);
|
||||||
/* avoid trouble with undefined dynamic procedures */
|
/* avoid trouble with undefined dynamic procedures */
|
||||||
/* I assume they were not locked beforehand */
|
/* I assume they were not locked beforehand */
|
||||||
|
11
pl/boot.yap
11
pl/boot.yap
@ -273,13 +273,18 @@ private(_).
|
|||||||
'$handle_error'(_Action,_G0,_M0) :- fail.
|
'$handle_error'(_Action,_G0,_M0) :- fail.
|
||||||
|
|
||||||
% cases where we cannot afford to ever fail.
|
% cases where we cannot afford to ever fail.
|
||||||
'$undefp'([_|print_message(Context, Msg)], true) :- !,
|
'$undefp'([ImportingMod|G], _) :- !,
|
||||||
|
recorded('$import','$import'(ExportingModI,ImportingMod,G,G0I,_,_),_), !,
|
||||||
|
% writeln('$execute0'(G0I, ExportingModI)),
|
||||||
|
'$execute0'(G0I, ExportingModI).
|
||||||
|
'$undefp'([_|print_message(Context, Msg)], _) :- !,
|
||||||
'$early_print_message'(Context, Msg).
|
'$early_print_message'(Context, Msg).
|
||||||
% undef handler
|
% undef handler
|
||||||
'$undefp'([M0|G0], Action) :-
|
'$undefp'([M0|G0], Action) :-
|
||||||
% make sure we do not loop on undefined predicates
|
% make sure we do not loop on undefined predicates
|
||||||
'$stop_creeping'(Current),
|
'$stop_creeping'(Current),
|
||||||
yap_flag( unknown, Action, fail),
|
yap_flag( unknown, Action, fail),
|
||||||
|
Action\=fail,
|
||||||
% yap_flag( debug, Debug, false),
|
% yap_flag( debug, Debug, false),
|
||||||
(
|
(
|
||||||
'$undefp_search'(M0:G0, NM:NG),
|
'$undefp_search'(M0:G0, NM:NG),
|
||||||
@ -419,7 +424,7 @@ true :- true.
|
|||||||
% simple trick to find out if this is we are booting from Prolog.
|
% simple trick to find out if this is we are booting from Prolog.
|
||||||
% boot from a saved state
|
% boot from a saved state
|
||||||
(
|
(
|
||||||
current_prolog_flag(saved_program, false)
|
current_prolog_flag(saved_program, false)
|
||||||
->
|
->
|
||||||
prolog_flag(verbose, OldV, silent),
|
prolog_flag(verbose, OldV, silent),
|
||||||
prolog_flag(resource_database, RootPath),
|
prolog_flag(resource_database, RootPath),
|
||||||
@ -1387,7 +1392,7 @@ not(G) :- \+ '$execute'(G).
|
|||||||
bootstrap( F ),
|
bootstrap( F ),
|
||||||
yap_flag(verbose, _, Old),
|
yap_flag(verbose, _, Old),
|
||||||
'$live'.
|
'$live'.
|
||||||
|
|
||||||
|
|
||||||
bootstrap(F) :-
|
bootstrap(F) :-
|
||||||
% '$open'(F, '$csult', Stream, 0, 0, F),
|
% '$open'(F, '$csult', Stream, 0, 0, F),
|
||||||
|
@ -82,7 +82,7 @@ followed by the failure of that call.
|
|||||||
:- '$set_no_trace'('$handle_error'(_,_,_), prolog).
|
:- '$set_no_trace'('$handle_error'(_,_,_), prolog).
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Z * @pred '$undefp_expand'(+ M0:G0, -MG)
|
* @pred '$undefp_expand'(+ M0:G0, -MG)
|
||||||
*
|
*
|
||||||
* @param G0 input goal
|
* @param G0 input goal
|
||||||
* @param M0 current module
|
* @param M0 current module
|
||||||
|
Reference in New Issue
Block a user