1/*************************************************************************
2*									 *
3*	 YAP Prolog 							 *
4*									 *
5*	Yap Prolog was developed at NCCUP - Universidade do Porto	 *
6*									 *
7* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997	 *
8*									 *
9**************************************************************************
10*									 *
11* File:		protect.yap						 *
12* Last rev:								 *
13* mods:									 *
14* comments:	protecting the system functions				 *
15*									 *
16*************************************************************************/
17
18% This protects all code from further changes
19% and also makes it impossible from some predicates to be seen
20'$protect' :-
21	current_atom(Name),
22	atom_codes(Name,[0'$|_]),
23	'$hide_predicates'(Name),
24	'$hide'(Name).
25'$protect' :-
26	'$hide_predicates'(bootstrap),
27	'$hide'(bootstrap).
28'$protect'.
29
30'$hide_predicates'(Name) :-
31	'$current_predicate_for_atom'(Name, prolog, P),
32	'$hide_predicate'(P,prolog),
33	fail.
34'$hide_predicates'(_).
35
36% hide all atoms who start by '$'
37'$hide'('$VAR') :- !, fail.			/* not $VAR */
38'$hide'('$dbref') :- !, fail.			/* not stream position */
39'$hide'('$stream') :- !, fail.			/* not $STREAM */
40'$hide'('$stream_position') :- !, fail.		/* not stream position */
41'$hide'('$hacks') :- !, fail.
42'$hide'('$source_location') :- !, fail.
43'$hide'('$messages') :- !, fail.
44'$hide'(Name) :- hide(Name), fail.
45
46