changes to import
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2080 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
9b4c83ddb2
commit
a65a9d67ad
@ -7,7 +7,7 @@
|
|||||||
<title>YAP change log</title>
|
<title>YAP change log</title>
|
||||||
<link rel=stylesheet href="changes.css" type="text/css">
|
<link rel=stylesheet href="changes.css" type="text/css">
|
||||||
</head>
|
</head>
|
||||||
|
xb
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
@ -17,6 +17,9 @@
|
|||||||
|
|
||||||
<h2>Yap-5.1.3:</h2>
|
<h2>Yap-5.1.3:</h2>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li> SPEEDUP: quickly check if we are importing an undefined goal.</li>
|
||||||
|
<li> FIXED: current_predicate/1 should enumerate all predicates
|
||||||
|
visible (obs from Nicos Angelopoulos).</li>
|
||||||
<li> NEW: time/1 (based on the SWI-Prolog time/1 predicate; request from Paulo Moura).</li>
|
<li> NEW: time/1 (based on the SWI-Prolog time/1 predicate; request from Paulo Moura).</li>
|
||||||
<li> FIXED: with 64 bits indexing would separate ints from atoms (obs from A N Saravanaraj).</li>
|
<li> FIXED: with 64 bits indexing would separate ints from atoms (obs from A N Saravanaraj).</li>
|
||||||
<li> FIXED: duplicated clause when starting from trace (obs from A N Saravanaraj).</li>
|
<li> FIXED: duplicated clause when starting from trace (obs from A N Saravanaraj).</li>
|
||||||
|
18
pl/boot.yap
18
pl/boot.yap
@ -810,21 +810,15 @@ not(G) :- \+ '$execute'(G).
|
|||||||
'$undefp'([M|G]) :-
|
'$undefp'([M|G]) :-
|
||||||
% make sure we do not loop on undefined predicates
|
% make sure we do not loop on undefined predicates
|
||||||
% for undefined_predicates.
|
% for undefined_predicates.
|
||||||
|
(
|
||||||
|
recorded('$import','$import'(NM,M,Goal,G,_,_),_)
|
||||||
|
;
|
||||||
'$enter_undefp',
|
'$enter_undefp',
|
||||||
'$find_undefp_handler'(G,M,Goal,NM), !,
|
once('$find_undefp_handler'(G,M,Goal,NM))
|
||||||
|
),
|
||||||
|
!,
|
||||||
'$execute0'(Goal,NM).
|
'$execute0'(Goal,NM).
|
||||||
|
|
||||||
'$find_undefp_handler'(G,M,NG,S) :-
|
|
||||||
recorded('$import','$import'(S,M,NG,G,_,_),_),
|
|
||||||
S \= M, % can't try importing from the module itself.
|
|
||||||
!,
|
|
||||||
'$exit_undefp'.
|
|
||||||
/*
|
|
||||||
'$find_undefp_handler'(G,M,NG,M) :-
|
|
||||||
'$is_expand_goal_or_meta_predicate'(G,M),
|
|
||||||
'$system_catch'(goal_expansion(G, M, NG), user, _, fail), !,
|
|
||||||
'$exit_undefp'.
|
|
||||||
*/
|
|
||||||
'$find_undefp_handler'(G,M,NG,user) :-
|
'$find_undefp_handler'(G,M,NG,user) :-
|
||||||
\+ '$undefined'(unknown_predicate_handler(_,_,_), user),
|
\+ '$undefined'(unknown_predicate_handler(_,_,_), user),
|
||||||
'$system_catch'(unknown_predicate_handler(G,M,NG), user, Error, '$leave_undefp'(Error)), !,
|
'$system_catch'(unknown_predicate_handler(G,M,NG), user, Error, '$leave_undefp'(Error)), !,
|
||||||
|
89
pl/preds.yap
89
pl/preds.yap
@ -884,3 +884,92 @@ predicate_erased_statistics(M:P,NCls,Sz,ISz) :- !,
|
|||||||
predicate_erased_statistics(P,NCls,Sz,ISz) :-
|
predicate_erased_statistics(P,NCls,Sz,ISz) :-
|
||||||
'$current_module'(M),
|
'$current_module'(M),
|
||||||
'$predicate_erased_statistics'(M:P,NCls,Sz,_,ISz).
|
'$predicate_erased_statistics'(M:P,NCls,Sz,_,ISz).
|
||||||
|
|
||||||
|
current_predicate(A,T) :- var(T), !, % only for the predicate
|
||||||
|
'$current_module'(M),
|
||||||
|
'$current_predicate_no_modules'(M,A,T).
|
||||||
|
current_predicate(A,M:T) :- % module specified
|
||||||
|
var(M), !,
|
||||||
|
current_module(M),
|
||||||
|
M \= prolog,
|
||||||
|
'$current_predicate_no_modules'(M,A,T).
|
||||||
|
current_predicate(A,M:T) :- % module specified
|
||||||
|
nonvar(T),
|
||||||
|
!,
|
||||||
|
functor(T,A,_),
|
||||||
|
'$pred_exists'(T,M).
|
||||||
|
current_predicate(A,M:T) :- % module specified
|
||||||
|
!,
|
||||||
|
'$current_predicate_no_modules'(M,A,T).
|
||||||
|
current_predicate(A,T) :- % only for the predicate
|
||||||
|
'$current_module'(M),
|
||||||
|
'$current_predicate_no_modules'(M,A,T).
|
||||||
|
|
||||||
|
current_predicate(F) :- var(F), !, % only for the predicate
|
||||||
|
'$current_module'(M),
|
||||||
|
'$current_predicate3'(M,F).
|
||||||
|
current_predicate(M:F) :- % module specified
|
||||||
|
var(M), !,
|
||||||
|
'$current_module'(M),
|
||||||
|
M \= prolog,
|
||||||
|
'$current_predicate3'(M,F).
|
||||||
|
current_predicate(M:F) :- % module specified
|
||||||
|
!,
|
||||||
|
'$current_predicate3'(M,F).
|
||||||
|
current_predicate(S) :- % only for the predicate
|
||||||
|
'$current_module'(M),
|
||||||
|
'$current_predicate3'(M,S).
|
||||||
|
|
||||||
|
system_predicate(A,P) :-
|
||||||
|
'$current_predicate_no_modules'(prolog,A,P),
|
||||||
|
\+ '$hidden'(A).
|
||||||
|
|
||||||
|
system_predicate(P) :-
|
||||||
|
'$current_module'(M),
|
||||||
|
'$system_predicate'(P,M).
|
||||||
|
|
||||||
|
'$current_predicate_no_modules'(M,A,T) :-
|
||||||
|
'$current_predicate'(M,A,Arity),
|
||||||
|
functor(T,A,Arity),
|
||||||
|
'$pred_exists'(T,M).
|
||||||
|
|
||||||
|
'$current_predicate3'(M,A/Arity) :- nonvar(A), nonvar(Arity), !,
|
||||||
|
(
|
||||||
|
'$current_predicate'(M,A,Arity)
|
||||||
|
->
|
||||||
|
functor(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),_)
|
||||||
|
->
|
||||||
|
'$pred_exists'(G,NM)
|
||||||
|
).
|
||||||
|
'$current_predicate3'(M,A/Arity) :- !,
|
||||||
|
(
|
||||||
|
'$current_predicate'(M,A,Arity),
|
||||||
|
functor(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'(M,BadSpec) :- % only for the predicate
|
||||||
|
'$do_error'(type_error(predicate_indicator,BadSpec),current_predicate(M:BadSpec)).
|
||||||
|
|
||||||
|
current_key(A,K) :-
|
||||||
|
'$current_predicate'(idb,A,Arity),
|
||||||
|
functor(K,A,Arity).
|
||||||
|
current_key(A,K) :-
|
||||||
|
'$current_immediate_key'(A,K).
|
||||||
|
|
||||||
|
|
||||||
|
62
pl/utils.yap
62
pl/utils.yap
@ -381,68 +381,6 @@ current_atom(A) :- % generate
|
|||||||
current_atom(A) :- % generate
|
current_atom(A) :- % generate
|
||||||
'$current_wide_atom'(A).
|
'$current_wide_atom'(A).
|
||||||
|
|
||||||
current_predicate(A,T) :- var(T), !, % only for the predicate
|
|
||||||
'$current_module'(M),
|
|
||||||
'$current_predicate_no_modules'(M,A,T).
|
|
||||||
current_predicate(A,M:T) :- % module specified
|
|
||||||
var(M), !,
|
|
||||||
current_module(M),
|
|
||||||
M \= prolog,
|
|
||||||
'$current_predicate_no_modules'(M,A,T).
|
|
||||||
current_predicate(A,M:T) :- % module specified
|
|
||||||
nonvar(T),
|
|
||||||
!,
|
|
||||||
functor(T,A,_),
|
|
||||||
'$pred_exists'(T,M).
|
|
||||||
current_predicate(A,M:T) :- % module specified
|
|
||||||
!,
|
|
||||||
'$current_predicate_no_modules'(M,A,T).
|
|
||||||
current_predicate(A,T) :- % only for the predicate
|
|
||||||
'$current_module'(M),
|
|
||||||
'$current_predicate_no_modules'(M,A,T).
|
|
||||||
|
|
||||||
current_predicate(F) :- var(F), !, % only for the predicate
|
|
||||||
'$current_module'(M),
|
|
||||||
'$current_predicate3'(M,F).
|
|
||||||
current_predicate(M:F) :- % module specified
|
|
||||||
var(M), !,
|
|
||||||
'$current_module'(M),
|
|
||||||
M \= prolog,
|
|
||||||
'$current_predicate3'(M,F).
|
|
||||||
current_predicate(M:F) :- % module specified
|
|
||||||
!,
|
|
||||||
'$current_predicate3'(M,F).
|
|
||||||
current_predicate(S) :- % only for the predicate
|
|
||||||
'$current_module'(M),
|
|
||||||
'$current_predicate3'(M,S).
|
|
||||||
|
|
||||||
system_predicate(A,P) :-
|
|
||||||
'$current_predicate_no_modules'(prolog,A,P),
|
|
||||||
\+ '$hidden'(A).
|
|
||||||
|
|
||||||
system_predicate(P) :-
|
|
||||||
'$current_module'(M),
|
|
||||||
'$system_predicate'(P,M).
|
|
||||||
|
|
||||||
'$current_predicate_no_modules'(M,A,T) :-
|
|
||||||
'$current_predicate'(M,A,Arity),
|
|
||||||
functor(T,A,Arity),
|
|
||||||
'$pred_exists'(T,M).
|
|
||||||
|
|
||||||
'$current_predicate3'(M,A/Arity) :- !,
|
|
||||||
'$current_predicate'(M,A,Arity),
|
|
||||||
functor(T,A,Arity),
|
|
||||||
'$pred_exists'(T,M).
|
|
||||||
'$current_predicate3'(M,BadSpec) :- % only for the predicate
|
|
||||||
'$do_error'(type_error(predicate_indicator,BadSpec),current_predicate(M:BadSpec)).
|
|
||||||
|
|
||||||
current_key(A,K) :-
|
|
||||||
'$current_predicate'(idb,A,Arity),
|
|
||||||
functor(K,A,Arity).
|
|
||||||
current_key(A,K) :-
|
|
||||||
'$current_immediate_key'(A,K).
|
|
||||||
|
|
||||||
|
|
||||||
%%% The unknown predicate,
|
%%% The unknown predicate,
|
||||||
% informs about what the user wants to be done when
|
% informs about what the user wants to be done when
|
||||||
% there are no clauses for a certain predicate */
|
% there are no clauses for a certain predicate */
|
||||||
|
Reference in New Issue
Block a user