improve notion of standadard predicate
This commit is contained in:
parent
65c97e7072
commit
0f2d1e8429
0
pl/eam.yap
Normal file → Executable file
0
pl/eam.yap
Normal file → Executable file
@ -1166,7 +1166,7 @@ its parent goal.
|
|||||||
@}
|
@}
|
||||||
|
|
||||||
@{
|
@{
|
||||||
\defgroup YAPDynamicYAPModules Dynamic Modules
|
\defgroup YAPDynamicYAPModules Dynamic Modules
|
||||||
\ingroup YAPModules
|
\ingroup YAPModules
|
||||||
|
|
||||||
YAP (in the footsteps of SWI-Prolog) allows to create modules that
|
YAP (in the footsteps of SWI-Prolog) allows to create modules that
|
||||||
@ -1630,9 +1630,20 @@ ls_imports.
|
|||||||
|
|
||||||
'$system_module'('$swi').
|
'$system_module'('$swi').
|
||||||
'$system_module'('$win_menu').
|
'$system_module'('$win_menu').
|
||||||
|
'$system_module'('$arrays').
|
||||||
'$system_module'('prolog').
|
'$system_module'('prolog').
|
||||||
'$system_module'('system').
|
'$system_module'('system').
|
||||||
|
'$system_module'('$hacks').
|
||||||
'$system_module'('$attributes').
|
'$system_module'('$attributes').
|
||||||
|
'$system_module'('$coroutining').
|
||||||
|
'$system_module'('$db_load').
|
||||||
|
'$system_module'('predicate_options').
|
||||||
|
'$system_module'('dialect').
|
||||||
|
'$system_module'('$history').
|
||||||
|
'$system_module'('$messages').
|
||||||
|
'$system_module'('autoloader').
|
||||||
|
'$system_module'('$win_menu').
|
||||||
|
'$system_module'('ypp').
|
||||||
|
|
||||||
unload_module(Mod) :-
|
unload_module(Mod) :-
|
||||||
clause( '$meta_predicate'(_F,Mod,_N,_P), _, R),
|
clause( '$meta_predicate'(_F,Mod,_N,_P), _, R),
|
||||||
|
23
pl/preds.yap
23
pl/preds.yap
@ -1167,12 +1167,17 @@ predicate_erased_statistics(P,NCls,Sz,ISz) :-
|
|||||||
Defines the relation: _P_ is a currently defined predicate whose name is the atom _A_.
|
Defines the relation: _P_ is a currently defined predicate whose name is the atom _A_.
|
||||||
*/
|
*/
|
||||||
current_predicate(A,T) :-
|
current_predicate(A,T) :-
|
||||||
'$system_module'(M),
|
|
||||||
'$ground_module'(T, M, T0),
|
'$ground_module'(T, M, T0),
|
||||||
(
|
format('`0 ~w~n', [M:T0]),
|
||||||
'$current_predicate'(A, M, T0, _)
|
(
|
||||||
;
|
'$current_predicate'(A, M, T0, Flags),
|
||||||
'$imported_predicate'(A, M, A/_Arity, T0, _)
|
TFlags is Flags /\ 0x00004000,
|
||||||
|
% format('1 ~w ~16r~n', [M:T0,Flags, TFlags]),
|
||||||
|
Flags /\ 0x00004000 =:= 0x0
|
||||||
|
;
|
||||||
|
'$imported_predicate'(A, M, A/_Arity, T0, Flags),
|
||||||
|
% format('2 ~w ~16r~n', [M:T0,Flags]),
|
||||||
|
Flags /\ 0x00004000 =:= 0x0
|
||||||
).
|
).
|
||||||
|
|
||||||
/** @pred system_predicate( _A_, _P_)
|
/** @pred system_predicate( _A_, _P_)
|
||||||
@ -1187,8 +1192,7 @@ system_predicate(A,T) :-
|
|||||||
'$current_predicate'(A, M, T0, Flags)
|
'$current_predicate'(A, M, T0, Flags)
|
||||||
;
|
;
|
||||||
'$current_predicate'(A, prolog, T0, Flags)
|
'$current_predicate'(A, prolog, T0, Flags)
|
||||||
),
|
).
|
||||||
\+ '$hidden'(A).
|
|
||||||
|
|
||||||
/** @pred system_predicate( ?_P_ )
|
/** @pred system_predicate( ?_P_ )
|
||||||
|
|
||||||
@ -1213,8 +1217,9 @@ current_predicate(F0) :-
|
|||||||
functor( S, N, Ar),
|
functor( S, N, Ar),
|
||||||
F = N/Ar
|
F = N/Ar
|
||||||
;
|
;
|
||||||
'$imported_predicate'(_Name, M, F, _S, _)
|
'$imported_predicate'(_Name, M, F, S, _)
|
||||||
).
|
),
|
||||||
|
\+ system_predicate(_, S).
|
||||||
|
|
||||||
'$imported_predicate'(A, ImportingMod, A/Arity, G, Flags) :-
|
'$imported_predicate'(A, ImportingMod, A/Arity, G, Flags) :-
|
||||||
'$get_undefined_pred'(G, ImportingMod, G0, ExportingMod),
|
'$get_undefined_pred'(G, ImportingMod, G0, ExportingMod),
|
||||||
|
@ -20,17 +20,20 @@
|
|||||||
% This protects all code from further changes
|
% This protects all code from further changes
|
||||||
% and also makes it impossible from some predicates to be seen
|
% and also makes it impossible from some predicates to be seen
|
||||||
'$protect' :-
|
'$protect' :-
|
||||||
fail,
|
'$current_predicate'(_A, M, T0, Flags),
|
||||||
'$system_mod'( M ),
|
%format(' ~a ~n', [M]) ,
|
||||||
'$current_predicate'(_A, M, T0, Flags),
|
M \= user,
|
||||||
NFlags is Flags \/ 0x00004000,
|
M \= lists,
|
||||||
'$flags'(M:T0, Flags, NFlags),
|
'$flags'(T0, M, _Flags, NFlags),
|
||||||
|
NFlags is Flags \/ 0x00004000,
|
||||||
|
%format('~w ~16r ~16r~n', [T0,Flags, NFlags]) ,
|
||||||
fail.
|
fail.
|
||||||
'$protect' :-
|
'$protect' :-
|
||||||
current_atom(Name),
|
current_atom(Name),
|
||||||
atom_codes(Name,[0'$|_]),
|
atom_codes(Name,[0'$|_]), %'
|
||||||
% '$hide_predicates'(Name),
|
%'$hide_predicates'(Name),
|
||||||
'$hide'(Name).
|
'$hide'(Name),
|
||||||
|
fail.
|
||||||
'$protect' :-
|
'$protect' :-
|
||||||
'$hide_predicates'(bootstrap),
|
'$hide_predicates'(bootstrap),
|
||||||
'$hide'(bootstrap).
|
'$hide'(bootstrap).
|
||||||
|
Reference in New Issue
Block a user