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
|
||||
|
||||
YAP (in the footsteps of SWI-Prolog) allows to create modules that
|
||||
@ -1630,9 +1630,20 @@ ls_imports.
|
||||
|
||||
'$system_module'('$swi').
|
||||
'$system_module'('$win_menu').
|
||||
'$system_module'('$arrays').
|
||||
'$system_module'('prolog').
|
||||
'$system_module'('system').
|
||||
'$system_module'('$hacks').
|
||||
'$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) :-
|
||||
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_.
|
||||
*/
|
||||
current_predicate(A,T) :-
|
||||
'$system_module'(M),
|
||||
'$ground_module'(T, M, T0),
|
||||
(
|
||||
'$current_predicate'(A, M, T0, _)
|
||||
;
|
||||
'$imported_predicate'(A, M, A/_Arity, T0, _)
|
||||
format('`0 ~w~n', [M:T0]),
|
||||
(
|
||||
'$current_predicate'(A, M, T0, Flags),
|
||||
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_)
|
||||
@ -1187,8 +1192,7 @@ system_predicate(A,T) :-
|
||||
'$current_predicate'(A, M, T0, Flags)
|
||||
;
|
||||
'$current_predicate'(A, prolog, T0, Flags)
|
||||
),
|
||||
\+ '$hidden'(A).
|
||||
).
|
||||
|
||||
/** @pred system_predicate( ?_P_ )
|
||||
|
||||
@ -1213,8 +1217,9 @@ current_predicate(F0) :-
|
||||
functor( S, 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) :-
|
||||
'$get_undefined_pred'(G, ImportingMod, G0, ExportingMod),
|
||||
|
@ -20,17 +20,20 @@
|
||||
% This protects all code from further changes
|
||||
% and also makes it impossible from some predicates to be seen
|
||||
'$protect' :-
|
||||
fail,
|
||||
'$system_mod'( M ),
|
||||
'$current_predicate'(_A, M, T0, Flags),
|
||||
NFlags is Flags \/ 0x00004000,
|
||||
'$flags'(M:T0, Flags, NFlags),
|
||||
'$current_predicate'(_A, M, T0, Flags),
|
||||
%format(' ~a ~n', [M]) ,
|
||||
M \= user,
|
||||
M \= lists,
|
||||
'$flags'(T0, M, _Flags, NFlags),
|
||||
NFlags is Flags \/ 0x00004000,
|
||||
%format('~w ~16r ~16r~n', [T0,Flags, NFlags]) ,
|
||||
fail.
|
||||
'$protect' :-
|
||||
current_atom(Name),
|
||||
atom_codes(Name,[0'$|_]),
|
||||
% '$hide_predicates'(Name),
|
||||
'$hide'(Name).
|
||||
atom_codes(Name,[0'$|_]), %'
|
||||
%'$hide_predicates'(Name),
|
||||
'$hide'(Name),
|
||||
fail.
|
||||
'$protect' :-
|
||||
'$hide_predicates'(bootstrap),
|
||||
'$hide'(bootstrap).
|
||||
|
Reference in New Issue
Block a user