current_predicate and imports
This commit is contained in:
parent
67b23a2ae4
commit
ea99d42897
@ -806,9 +806,9 @@ export_list(Module, List) :-
|
|||||||
G1=..[N1|Args],
|
G1=..[N1|Args],
|
||||||
( '$check_import'(M0,ContextMod,N1,K) ->
|
( '$check_import'(M0,ContextMod,N1,K) ->
|
||||||
( ContextMod = user ->
|
( ContextMod = user ->
|
||||||
( recordzifnot('$import','$import'(M0,user,G0,G1,N1,K),_) -> Cl = (G1:- M0:G0), '$compile'(Cl, 0, Cl, user) ; true )
|
( recordzifnot('$import','$import'(M0,user,G0,G1,N1,K),_) -> true ; true )
|
||||||
;
|
;
|
||||||
( recordaifnot('$import','$import'(M0,ContextMod,G0,G1,N1,K),_) -> Cl = (G1:- M0:G0), '$compile'(Cl, 0, Cl, ContextMod) ; true )
|
( recordaifnot('$import','$import'(M0,ContextMod,G0,G1,N1,K),_) -> true ; true )
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
true
|
true
|
||||||
|
68
pl/preds.yap
68
pl/preds.yap
@ -964,18 +964,6 @@ current_predicate(A,T) :- % only for the predicate
|
|||||||
M \= prolog,
|
M \= prolog,
|
||||||
'$pred_exists'(T,M).
|
'$pred_exists'(T,M).
|
||||||
|
|
||||||
current_predicate(F) :-
|
|
||||||
strip_module(F, M, F0),
|
|
||||||
'$$current_predicate'(F0,M).
|
|
||||||
|
|
||||||
'$$current_predicate'(F0,M) :-
|
|
||||||
( var(M) -> % only for the predicate
|
|
||||||
'$current_module'(M),
|
|
||||||
M \= prolog
|
|
||||||
;
|
|
||||||
true ),
|
|
||||||
'$current_predicate3'(M, F0).
|
|
||||||
|
|
||||||
system_predicate(A,P) :-
|
system_predicate(A,P) :-
|
||||||
'$current_predicate_no_modules'(prolog,A,P),
|
'$current_predicate_no_modules'(prolog,A,P),
|
||||||
\+ '$hidden'(A).
|
\+ '$hidden'(A).
|
||||||
@ -989,22 +977,48 @@ system_predicate(P) :-
|
|||||||
'$ifunctor'(T,A,Arity),
|
'$ifunctor'(T,A,Arity),
|
||||||
'$pred_exists'(T,M).
|
'$pred_exists'(T,M).
|
||||||
|
|
||||||
'$current_predicate3'(M,A/Arity) :-
|
current_predicate(F0) :-
|
||||||
nonvar(M),
|
strip_module(F0, M, F),
|
||||||
nonvar(A),
|
'$$current_predicate'(F, M).
|
||||||
nonvar(Arity), !,
|
|
||||||
'$ifunctor'(Pred,A,Arity),
|
'$$current_predicate'(F, M) :-
|
||||||
'$pred_exists'(Pred,M).
|
( var(M) -> % only for the predicate
|
||||||
'$current_predicate3'(M,A/Arity) :-
|
'$current_module'(M),
|
||||||
|
M \= prolog
|
||||||
|
; true),
|
||||||
|
'$current_predicate3'(F,M).
|
||||||
|
|
||||||
|
'$current_predicate3'(A/Arity,M) :-
|
||||||
nonvar(A), nonvar(Arity), !,
|
nonvar(A), nonvar(Arity), !,
|
||||||
'$current_predicate'(M,A,Arity),
|
( '$ifunctor'(T,A,Arity),
|
||||||
'$ifunctor'(T,A,Arity),
|
'$pred_exists'(T,M)
|
||||||
'$pred_exists'(T,M).
|
->
|
||||||
'$current_predicate3'(M,A/Arity) :- !,
|
true
|
||||||
'$current_predicate'(M,A,Arity),
|
;
|
||||||
'$ifunctor'(T,A,Arity),
|
% '$current_predicate'(prolog,A,Arity)
|
||||||
'$pred_exists'(T,M).
|
% ->
|
||||||
'$current_predicate3'(M,BadSpec) :- % only for the predicate
|
% functor(T,A,Arity),
|
||||||
|
% '$pred_exists'(T,M)
|
||||||
|
% ;
|
||||||
|
recorded('$import','$import'(NM,M,G,T,A,Arity),_)
|
||||||
|
->
|
||||||
|
'$pred_exists'(G,NM)
|
||||||
|
).
|
||||||
|
'$current_predicate3'(A/Arity,M) :- !,
|
||||||
|
(
|
||||||
|
'$current_predicate'(M,A,Arity),
|
||||||
|
'$ifunctor'(T,A,Arity),
|
||||||
|
'$pred_exists'(T,M)
|
||||||
|
;
|
||||||
|
% '$current_predicate'(prolog,A,Arity),
|
||||||
|
% functor(T,A,Arity),
|
||||||
|
% '$pred_exists'(T,M)
|
||||||
|
% ;
|
||||||
|
recorded('$import','$import'(NM,M,G,T,A,Arity),_),
|
||||||
|
functor(T,A,Arity),
|
||||||
|
'$pred_exists'(G,NM)
|
||||||
|
).
|
||||||
|
'$current_predicate3'(BadSpec,M) :- % only for the predicate
|
||||||
'$do_error'(type_error(predicate_indicator,BadSpec),current_predicate(M:BadSpec)).
|
'$do_error'(type_error(predicate_indicator,BadSpec),current_predicate(M:BadSpec)).
|
||||||
|
|
||||||
current_key(A,K) :-
|
current_key(A,K) :-
|
||||||
|
Reference in New Issue
Block a user