fix predicate_property to handle modules correctly
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@300 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
9966ff57c6
commit
362455bc74
48
pl/utils.yap
48
pl/utils.yap
@ -525,36 +525,46 @@ predicate_property(Pred,Prop) :-
|
|||||||
'$predicate_property2'(Pred,Prop,Mod).
|
'$predicate_property2'(Pred,Prop,Mod).
|
||||||
|
|
||||||
'$predicate_property2'(Pred,Prop,M) :- var(Pred), !,
|
'$predicate_property2'(Pred,Prop,M) :- var(Pred), !,
|
||||||
'$current_predicate'(M,_,Pred),
|
'$generate_all_preds_from_mod'(Pred, SourceMod, M),
|
||||||
'$pred_exists'(Pred,M),
|
'$predicate_property'(Pred,SourceMod,M,Prop).
|
||||||
'$predicate_property'(Pred,M,Prop).
|
'$predicate_property2'(M:Pred,Prop,_) :- !,
|
||||||
'$predicate_property2'(M:Pred,Prop,_) :-
|
'$predicate_property2'(Pred,Prop,M).
|
||||||
'$predicate_property'(Pred,Prop,M).
|
|
||||||
'$predicate_property2'(Pred,Prop,Mod) :-
|
'$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), !.
|
'$system_predicate'(P,M), !.
|
||||||
'$predicate_property'(P,M,dynamic) :-
|
'$predicate_property'(P,M,_,dynamic) :-
|
||||||
'$is_dynamic'(P,M).
|
'$is_dynamic'(P,M).
|
||||||
'$predicate_property'(P,M,static) :-
|
'$predicate_property'(P,M,_,static) :-
|
||||||
\+ '$is_dynamic'(P,M).
|
\+ '$is_dynamic'(P,M).
|
||||||
'$predicate_property'(P,M,meta_predicate(P)) :-
|
'$predicate_property'(P,M,_,meta_predicate(P)) :-
|
||||||
functor(P,Na,Ar),
|
functor(P,Na,Ar),
|
||||||
user:'$meta_predicate'(M,Na,Ar,P).
|
user:'$meta_predicate'(M,Na,Ar,P).
|
||||||
'$predicate_property'(P,M,multifile) :-
|
'$predicate_property'(P,M,_,multifile) :-
|
||||||
'$is_multifile'(P,M).
|
'$is_multifile'(P,M).
|
||||||
'$predicate_property'(P,_,imported_from(Mod)) :-
|
'$predicate_property'(P,Mod,M,imported_from(Mod)) :-
|
||||||
functor(P,N,A),
|
functor(P,N,K),
|
||||||
'$recorded'('$module','$module'(_TFN,Mod,Publics),_),
|
'$recorded'('$import','$import'(Mod,M,N,K),_).
|
||||||
'$member'(N/A,Publics). /* defined in modules.yap */
|
'$predicate_property'(P,M,_,public) :-
|
||||||
'$predicate_property'(P,M,public) :-
|
|
||||||
'$is_public'(P,M).
|
'$is_public'(P,M).
|
||||||
'$predicate_property'(P,M,exported) :-
|
'$predicate_property'(P,M,M,exported) :-
|
||||||
functor(P,N,A),
|
functor(P,N,A),
|
||||||
'$recorded'('$module','$module'(_TFN,M,Publics),_),
|
'$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
|
%%% Some "dirty" predicates
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user