support search for predicates

This commit is contained in:
Vítor Santos Costa 2014-11-28 02:32:35 +00:00
parent d44beea3aa
commit 097db1b0b6
2 changed files with 9 additions and 12 deletions

View File

@ -37,7 +37,7 @@ The main predicates in the module system are:
YAP pre-defines a number of modules. Most system predicates belong to YAP pre-defines a number of modules. Most system predicates belong to
the module `prolog`. Predicates from the module `prolog` are the module `prolog`. Predicates from the module `prolog` are
automatically visible to every module. The `system` module was automatically visible to every module. The `system` module was
introduced for SWI-Prolog compatibility, and in YAP mostly acts as an introduced for SWI-Prolog compatibility, and in YAP mostly acts as an
alias to `prolog`. alias to `prolog`.
YAP is always associated to a module, the current <em>source YAP is always associated to a module, the current <em>source

View File

@ -1075,9 +1075,7 @@ predicate_property(Pred,Prop) :-
). ).
'$generate_all_preds_from_mod'(Pred, M, M) :- '$generate_all_preds_from_mod'(Pred, M, M) :-
'$current_predicate'(Na,M,S,_), '$current_predicate'(_Na,M,Pred,_).
functor(S,Na,Ar),
'$ifunctor'(Pred,Na,Ar).
'$generate_all_preds_from_mod'(Pred, SourceMod, Mod) :- '$generate_all_preds_from_mod'(Pred, SourceMod, Mod) :-
recorded('$import','$import'(SourceMod, Mod, Orig, Pred,_,_),_), recorded('$import','$import'(SourceMod, Mod, Orig, Pred,_,_),_),
'$pred_exists'(Orig, SourceMod). '$pred_exists'(Orig, SourceMod).
@ -1114,15 +1112,13 @@ predicate_property(Pred,Prop) :-
'$owner_file'(P,Mod,F). '$owner_file'(P,Mod,F).
/** @pred predicate_statistics( _P_, _NCls_, _Sz_, _IndexSz_) /**
@pred predicate_statistics( _P_, _NCls_, _Sz_, _IndexSz_)
Given predicate _P_, _NCls_ is the number of clauses for Given predicate _P_, _NCls_ is the number of clauses for
_P_, _Sz_ is the amount of space taken to store those clauses _P_, _Sz_ is the amount of space taken to store those clauses
(in bytes), and _IndexSz_ is the amount of space required to store (in bytes), and _IndexSz_ is the amount of space required to store
indices to those clauses (in bytes). indices to those clauses (in bytes).
*/ */
predicate_statistics(V,NCls,Sz,ISz) :- var(V), !, predicate_statistics(V,NCls,Sz,ISz) :- var(V), !,
'$do_error'(instantiation_error,predicate_statistics(V,NCls,Sz,ISz)). '$do_error'(instantiation_error,predicate_statistics(V,NCls,Sz,ISz)).
@ -1202,11 +1198,12 @@ system_predicate(P) :-
system_predicate(_, P). system_predicate(_, P).
/** @pred current_predicate( _F_) is iso /**
@pred current_predicate( _F_) is iso
True if _F_ is the predicate indicator for a currently defined user or
_F_ is the predicate indicator for a currently defined user or library predicate.The indicator _F_ is of the form _Mod_:_Na_/_Ar_ or _Na/Ar_,
library predicate. _F_ is of the form _Na/Ar_, where the atom where the atom _Mod_ is the module of the predicate,
_Na_ is the name of the predicate, and _Ar_ its arity. _Na_ is the name of the predicate, and _Ar_ its arity.
*/ */
current_predicate(F0) :- current_predicate(F0) :-