From 0f2d1e84298238d890b55efafdc66d26b4bfcebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Wed, 4 Mar 2015 10:01:33 +0000 Subject: [PATCH] improve notion of standadard predicate --- pl/eam.yap | 0 pl/modules.yap | 13 ++++++++++++- pl/preds.yap | 23 ++++++++++++++--------- pl/protect.yap | 19 +++++++++++-------- 4 files changed, 37 insertions(+), 18 deletions(-) mode change 100644 => 100755 pl/eam.yap diff --git a/pl/eam.yap b/pl/eam.yap old mode 100644 new mode 100755 diff --git a/pl/modules.yap b/pl/modules.yap index 53d648256..d4a1ce35e 100644 --- a/pl/modules.yap +++ b/pl/modules.yap @@ -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), diff --git a/pl/preds.yap b/pl/preds.yap index d046ac6e2..e8274dab1 100644 --- a/pl/preds.yap +++ b/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), diff --git a/pl/protect.yap b/pl/protect.yap index 95c901d2d..dd0a5cff1 100755 --- a/pl/protect.yap +++ b/pl/protect.yap @@ -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).