diff --git a/C/stdpreds.c b/C/stdpreds.c index 825e9f14e..a2746c89f 100755 --- a/C/stdpreds.c +++ b/C/stdpreds.c @@ -863,26 +863,13 @@ static Int cont_current_predicate(USES_REGS1) { pp = firstModulePred(m->PredForME, task); if (!pp) { /* try Prolog Module */ - if (task != TermUser) { - ModEntry *m = Yap_GetModuleEntry(TermProlog); - pp = firstModulePred(m->PredForME, task); - if (!pp) { - cut_fail(); - } - } + cut_fail(); } } npp = firstModulePred(pp, task); if (!npp) { - if (pp->ModuleOfPred != PROLOG_MODULE && task != TermUser) { - ModEntry *m = Yap_GetModuleEntry(TermProlog); - npp = firstModulePred(m->PredForME, task); - if (!npp) - will_cut = true; - } else { - will_cut = true; - } + will_cut = true; } // just try next one else { diff --git a/pl/modules.yap b/pl/modules.yap index b8dff6336..6cb46117c 100644 --- a/pl/modules.yap +++ b/pl/modules.yap @@ -692,6 +692,11 @@ Reports the following properties of _Module_: operator symbols exported or re-exported by this module. */ +module_property(Mod, Prop) :- + var(Mod), + !, + recorded('$module','$module'(_,Mod,_,_Es,_),_), + module_property(Mod, Prop). module_property(Mod, class(L)) :- '$module_class'(Mod, L). module_property(Mod, line_count(L)) :- @@ -699,24 +704,30 @@ module_property(Mod, line_count(L)) :- module_property(Mod, file(F)) :- recorded('$module','$module'(F,Mod,_,_,_),_). module_property(Mod, exports(Es)) :- - recorded('$module','$module'(_,Mod,_,Es,_),_). + ( + recorded('$module','$module'(_,Mod,_,Es,_),_) + -> + true + ; + Mod==user + -> + findall( P, (current_predicate(user:P)), Es) + ; + Mod==prolog + -> + findall( N/A, (predicate_property(Mod:P0, public),functor(P0,N,A)), Es) + ). -'$module_class'(Mod, system) :- '$is_system_module'( Mod ). -'$module_class'(Mod, library) :- '$library_module'( Mod ). -'$module_class'(Mod, user) :- '$user_module'( Mod ). -'$module_class'(_, temporary) :- fail. -'$module_class'(_, test) :- fail. -'$module_class'(_, development) :- fail. +'$module_class'(Mod, system) :- '$is_system_module'( Mod ), !. +'$module_class'(Mod, library) :- '$library_module'( Mod ), !. +'$module_class'(Mod, user) :- !. +'$module_class'( _, temporary) :- fail. +'$module_class'( _, test) :- fail. +'$module_class'( _, development) :- fail. '$library_module'(M1) :- - recorded('$module','$module'(F, M1, _, _MyExports,_Line),_), - user:library_directory(D), - sub_atom(F, 0, _, _, D). - -'$user_module'( Mod ) :- - \+ '$library_module'( Mod), - \+ '$system_module'( Mod). - + recorded('$module','$module'(F, M1, library(_), _MyExports,_Line),_). + ls_imports :- recorded('$import','$import'(M0,M,G0,G,_N,_K),_R), numbervars(G0+G, 0, _),