From 242844d12fb1ed5ac5d43c3587e9b7eb48a298bb Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Fri, 16 Jan 2015 20:04:12 -0800 Subject: [PATCH] ensure order --- pl/protect.yap | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/pl/protect.yap b/pl/protect.yap index 95c901d2d..45b83536b 100755 --- a/pl/protect.yap +++ b/pl/protect.yap @@ -19,28 +19,23 @@ % 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), - fail. + '$protect' :- current_atom(Name), - atom_codes(Name,[0'$|_]), -% '$hide_predicates'(Name), - '$hide'(Name). + sub_atom(Name,0,1,_,'$'), + '$hide'(Name), + '$current_predicate'(Name, Mod, P, _Flags0), + '$hide_predicate'(P,Mod), + fail. '$protect' :- - '$hide_predicates'(bootstrap), - '$hide'(bootstrap). + '$hide'(bootstrap), + '$hide_predicate'(bootstrap), + fail. '$protect'. -'$hide_predicates'(Name) :- - '$current_predicate'(Name, Mod, P, _), - '$hide_predicate'(P,Mod), - fail. -'$hide_predicates'(_). +'$notrace_predicate'(Mod:P, Flags0) :- + Flags is Flags0 \/ 0x400000000, + '$flags'(P, Mod, Flags0, Flags ). % hide all atoms who start by '$' '$hide'('$VAR') :- !, fail. /* not $VAR */