2015-09-21 23:05:36 +01:00
|
|
|
xc/*************************************************************************
|
2001-04-09 20:54:03 +01:00
|
|
|
* *
|
|
|
|
* YAP Prolog *
|
|
|
|
* *
|
|
|
|
* Yap Prolog was developed at NCCUP - Universidade do Porto *
|
|
|
|
* *
|
|
|
|
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
|
|
|
|
* *
|
|
|
|
**************************************************************************
|
|
|
|
* *
|
|
|
|
* File: protect.yap *
|
|
|
|
* Last rev: *
|
|
|
|
* mods: *
|
|
|
|
* comments: protecting the system functions *
|
|
|
|
* *
|
|
|
|
*************************************************************************/
|
|
|
|
|
2014-04-09 12:39:29 +01:00
|
|
|
:- system_module( '$_protect', [], ['$protect'/0]).
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
% This protects all code from further changes
|
|
|
|
% and also makes it impossible from some predicates to be seen
|
2015-01-18 01:32:13 +00:00
|
|
|
'$protect' :-
|
2015-07-23 01:31:03 +01:00
|
|
|
'$current_predicate'(_A, M, T0, all),
|
2015-12-15 09:28:43 +00:00
|
|
|
%format(' ~a ~n', [M]) ,
|
|
|
|
'$system_module'(M),
|
|
|
|
'$predicate_flags'(T0, M, Flags, Flags),
|
|
|
|
% not multifile, dynamic, or logical updates.
|
|
|
|
Flags /\ (0x20000000\/0x08000000\/0x00002000) =\= 0,
|
2015-03-04 10:01:33 +00:00
|
|
|
NFlags is Flags \/ 0x00004000,
|
2015-07-23 01:31:03 +01:00
|
|
|
'$predicate_flags'(T0, M, _Flags, NFlags),
|
2015-03-04 10:01:33 +00:00
|
|
|
%format('~w ~16r ~16r~n', [T0,Flags, NFlags]) ,
|
2015-01-18 01:32:13 +00:00
|
|
|
fail.
|
2001-04-09 20:54:03 +01:00
|
|
|
'$protect' :-
|
|
|
|
current_atom(Name),
|
2015-03-04 10:01:33 +00:00
|
|
|
atom_codes(Name,[0'$|_]), %'
|
2015-11-05 17:24:22 +00:00
|
|
|
'$hide_predicates'(Name),
|
|
|
|
'$hide'(Name),
|
2015-03-04 10:01:33 +00:00
|
|
|
fail.
|
2005-10-19 02:47:43 +01:00
|
|
|
'$protect' :-
|
2015-01-18 01:32:13 +00:00
|
|
|
'$hide_predicates'(bootstrap),
|
2015-06-19 01:12:05 +01:00
|
|
|
hide(bootstrap).
|
2001-04-09 20:54:03 +01:00
|
|
|
'$protect'.
|
|
|
|
|
2015-01-18 01:32:13 +00:00
|
|
|
'$hide_predicates'(Name) :-
|
2015-07-23 01:31:03 +01:00
|
|
|
'$current_predicate'(Name, Mod, P, all),
|
2015-01-18 01:32:13 +00:00
|
|
|
'$hide_predicate'(P,Mod),
|
|
|
|
fail.
|
|
|
|
'$hide_predicates'(_).
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
% hide all atoms who start by '$'
|
|
|
|
'$hide'('$VAR') :- !, fail. /* not $VAR */
|
2004-02-13 18:39:29 +00:00
|
|
|
'$hide'('$dbref') :- !, fail. /* not stream position */
|
2001-04-09 20:54:03 +01:00
|
|
|
'$hide'('$stream') :- !, fail. /* not $STREAM */
|
|
|
|
'$hide'('$stream_position') :- !, fail. /* not stream position */
|
2009-03-10 18:07:50 +00:00
|
|
|
'$hide'('$hacks') :- !, fail.
|
2010-03-14 09:31:25 +00:00
|
|
|
'$hide'('$source_location') :- !, fail.
|
2009-03-10 18:07:50 +00:00
|
|
|
'$hide'('$messages') :- !, fail.
|
2011-06-14 09:03:00 +01:00
|
|
|
'$hide'('$push_input_context') :- !, fail.
|
|
|
|
'$hide'('$pop_input_context') :- !, fail.
|
|
|
|
'$hide'('$set_source_module') :- !, fail.
|
|
|
|
'$hide'('$declare_module') :- !, fail.
|
|
|
|
'$hide'('$store_clause') :- !, fail.
|
2012-03-22 23:30:02 +00:00
|
|
|
'$hide'('$skip_list') :- !, fail.
|
2013-11-25 11:16:10 +00:00
|
|
|
'$hide'('$win_insert_menu_item') :- !, fail.
|
|
|
|
'$hide'('$set_predicate_attribute') :- !, fail.
|
|
|
|
'$hide'('$parse_quasi_quotations') :- !, fail.
|
|
|
|
'$hide'('$quasi_quotation') :- !, fail.
|
|
|
|
'$hide'('$qq_open') :- !, fail.
|
2001-04-09 20:54:03 +01:00
|
|
|
'$hide'(Name) :- hide(Name), fail.
|
|
|
|
|