diff --git a/pl/boot.yap b/pl/boot.yap index 507ef429b..69f5b29a9 100644 --- a/pl/boot.yap +++ b/pl/boot.yap @@ -904,19 +904,13 @@ not(G) :- \+ '$execute'(G). '$undefp'([M|G]) :- % make sure we do not loop on undefined predicates % for undefined_predicates. + '$enter_undefp', ( - recorded('$import','$import'(NM,M,Goal,G,_,_),_) + '$imported_predicate'(NM,M,Goal,G) -> - true + '$exit_undefp' ; - '$enter_undefp', - ( - swi:swi_predicate_table(M,G,NM,Goal) - -> - '$exit_undefp' - ; - once('$find_undefp_handler'(G,M,Goal,NM)) - ) + once('$find_undefp_handler'(G,M,Goal,NM)) ), !, Goal \= fail, diff --git a/pl/modules.yap b/pl/modules.yap index 2ee65cc10..bfebda934 100644 --- a/pl/modules.yap +++ b/pl/modules.yap @@ -368,6 +368,22 @@ module(N) :- '$exit_undefp', fail. +% +% get all imported predicates +% +'$imported_predicate'(FM,Mod,FPred,Pred) :- + recorded('$import','$import'(IM,Mod,IPred,Pred,_,_),_), + '$continue_imported'(FM, IM, FPred, IPred). +'$imported_predicate'(FM,Mod,FPred,Pred) :- + swi:swi_predicate_table(Mod,Pred,IM,IPred), + '$continue_imported'(FM, IM, FPred, IPred). + +'$continue_imported'(FM,Mod,FPred,Pred) :- + recorded('$import','$import'(IM,Mod,IPred,Pred,_,_),_), !, + '$continue_imported'(FM, IM, FPred, IPred). +'$continue_imported'(Mod,Mod,Pred,Pred). + + % module_transparent declaration % diff --git a/pl/preds.yap b/pl/preds.yap index db14cc2d5..d157dfdb3 100644 --- a/pl/preds.yap +++ b/pl/preds.yap @@ -798,7 +798,7 @@ predicate_property(Pred,Prop) :- '$pred_exists'(Pred,Mod), !, '$predicate_property'(Pred,Mod,Mod,Prop). '$predicate_property2'(Pred,Prop,Mod) :- - recorded('$import','$import'(M,Mod,NPred,Pred,_,_),_), + '$imported_predicate'(M,Mod,NPred,Pred), ( Prop = imported_from(M) ;