From 362455bc74c0e0ad61dd1d501d73e2f801fcc6df Mon Sep 17 00:00:00 2001 From: vsc Date: Wed, 16 Jan 2002 06:20:56 +0000 Subject: [PATCH] fix predicate_property to handle modules correctly git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@300 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- pl/utils.yap | 48 +++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/pl/utils.yap b/pl/utils.yap index 74e33442c..bdc238218 100644 --- a/pl/utils.yap +++ b/pl/utils.yap @@ -525,36 +525,46 @@ predicate_property(Pred,Prop) :- '$predicate_property2'(Pred,Prop,Mod). '$predicate_property2'(Pred,Prop,M) :- var(Pred), !, - '$current_predicate'(M,_,Pred), - '$pred_exists'(Pred,M), - '$predicate_property'(Pred,M,Prop). -'$predicate_property2'(M:Pred,Prop,_) :- - '$predicate_property'(Pred,Prop,M). + '$generate_all_preds_from_mod'(Pred, SourceMod, M), + '$predicate_property'(Pred,SourceMod,M,Prop). +'$predicate_property2'(M:Pred,Prop,_) :- !, + '$predicate_property2'(Pred,Prop,M). '$predicate_property2'(Pred,Prop,Mod) :- - '$predicate_property'(Pred,Mod,Prop), - '$pred_exists'(Pred,Mod). + '$pred_exists'(Pred,Mod), !, + '$predicate_property'(Pred,Mod,Mod,Prop). +'$predicate_property2'(Pred,Prop,Mod) :- + functor(Pred, N, K), + '$recorded'('$import','$import'(M,Mod,N,K),_), + '$predicate_property'(Pred,M,Mod,Prop). -'$predicate_property'(P,M,built_in) :- +'$generate_all_preds_from_mod'(Pred, M, M) :- + '$current_predicate'(M,Na,Ar), + functor(Pred, Na, Ar). +'$generate_all_preds_from_mod'(Pred, SourceMod, Mod) :- + '$recorded'('$import','$import'(SourceMod,Mod,N,K),_), + functor(Pred, N, K). + + +'$predicate_property'(P,M,_,built_in) :- '$system_predicate'(P,M), !. -'$predicate_property'(P,M,dynamic) :- +'$predicate_property'(P,M,_,dynamic) :- '$is_dynamic'(P,M). -'$predicate_property'(P,M,static) :- +'$predicate_property'(P,M,_,static) :- \+ '$is_dynamic'(P,M). -'$predicate_property'(P,M,meta_predicate(P)) :- +'$predicate_property'(P,M,_,meta_predicate(P)) :- functor(P,Na,Ar), user:'$meta_predicate'(M,Na,Ar,P). -'$predicate_property'(P,M,multifile) :- +'$predicate_property'(P,M,_,multifile) :- '$is_multifile'(P,M). -'$predicate_property'(P,_,imported_from(Mod)) :- - functor(P,N,A), - '$recorded'('$module','$module'(_TFN,Mod,Publics),_), - '$member'(N/A,Publics). /* defined in modules.yap */ -'$predicate_property'(P,M,public) :- +'$predicate_property'(P,Mod,M,imported_from(Mod)) :- + functor(P,N,K), + '$recorded'('$import','$import'(Mod,M,N,K),_). +'$predicate_property'(P,M,_,public) :- '$is_public'(P,M). -'$predicate_property'(P,M,exported) :- +'$predicate_property'(P,M,M,exported) :- functor(P,N,A), '$recorded'('$module','$module'(_TFN,M,Publics),_), - '$member'(N/A,Publics). /* defined in modules.yap */ + '$member'(N/A,Publics), !. /* defined in modules.yap */ %%% Some "dirty" predicates