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:		init.yap						 *
12* Last rev:								 *
13* mods:									 *
14* comments:	initializing the full prolog system			 *
15*									 *
16*************************************************************************/
17
18% This is yap's init file
19% should be consulted first step after booting
20
21% These are pseudo declarations
22% so that the user will get a redefining system predicate
23fail :- fail.
24
25false :- fail.
26
27otherwise.
28
29!.
30
31(:- G) :- '$execute'(G), !.
32
33(?- G) :- '$execute'(G).
34
35'$$!'(CP) :- '$cut_by'(CP).
36
37[] :- true.
38
39:- set_value('$doindex',true).
40
41% force having indexing code for throw.
42:- '$handle_throw'(_,_,_), !.
43
44:- bootstrap('errors.yap').
45:- bootstrap('consult.yap').
46
47:- [	 'utils.yap',
48	 'control.yap',
49	 'arith.yap',
50	 'directives.yap',
51	 'flags.yap'].
52
53:- compile_expressions.
54
55:- [
56    % lists is often used.
57   	 'lists.yap',
58   	 'yio.yap',
59	 'debug.yap',
60	 'checker.yap',
61	 'depth_bound.yap',
62	 'grammar.yap',
63	 'ground.yap',
64	 'listing.yap',
65	 'preds.yap',
66	 % modules must be after preds, otherwise we will have trouble
67	 % with meta-predicate expansion being invoked
68	 'modules.yap',
69	 % must follow grammar
70	 'eval.yap',
71	 'signals.yap',
72	 'profile.yap',
73	 'callcount.yap',
74	 'load_foreign.yap',
75	 'save.yap',
76	 'sockets.yap',
77	 'sort.yap',
78	 'setof.yap',
79	 'statistics.yap',
80	 'strict_iso.yap',
81	 'tabling.yap',
82	 'threads.yap',
83	 'eam.yap',
84	 'chtypes.yap',
85	 'yapor.yap',
86         'udi.yap'].
87
88:- dynamic prolog:'$user_defined_flag'/4.
89
90:- dynamic prolog:'$parent_module'/2.
91
92:- multifile prolog:debug_action_hook/1.
93
94:- source.
95
96:- no_source.
97
98
99:-	 ['protect.yap'].
100
101version(yap,[6,0]).
102
103system_mode(verbose,on)  :- set_value('$verbose',on).
104system_mode(verbose,off) :- set_value('$verbose',off).
105
106:- op(1150,fx,(mode)).
107
108:- dynamic 'extensions_to_present_answer'/1.
109
110:- 	['arrays.yap'].
111
112:- use_module('messages.yap').
113:- use_module('hacks.yap').
114:- use_module('attributes.yap').
115:- use_module('corout.yap').
116:- use_module('dialect.yap').
117
118'$system_module'('$messages').
119'$system_module'('$hacks').
120'$system_module'('$attributes').
121'$system_module'('$coroutining').
122
123yap_hacks:cut_by(CP) :- '$$cut_by'(CP).
124
125:- '$change_type_of_char'(36,7). % Make $ a symbol character
126
127:- default_sequential(off).
128
129:- multifile user:library_directory/1.
130
131:- dynamic user:library_directory/1.
132
133:- multifile user:commons_directory/1.
134
135:- dynamic user:commons_directory/1.
136
137:- recorda('$dialect',yap,_).
138
139%
140% cleanup ensure loaded and recover some data-base space.
141%
142:- ( recorded('$loaded','$loaded'(_,_,_),R), erase(R), fail ; true ).
143
144:- dynamic autoloader:autoload/0.
145
146:- set_value('$user_module',user), '$protect'.
147
148:- style_check([]).
149
150%
151% moved this to init_gc in gc.c to separate the alpha
152%
153% :- yap_flag(gc,on).
154
155% :- yap_flag(gc_trace,verbose).
156
157:- system_mode(verbose,on).
158
159:- multifile prolog:message/3.
160
161:- dynamic prolog:message/3.
162
163:- module(user).
164
165:- multifile goal_expansion/3.
166
167:- dynamic goal_expansion/3.
168
169:- multifile goal_expansion/2.
170
171:- dynamic goal_expansion/2.
172
173:- multifile term_expansion/2.
174
175:- dynamic term_expansion/2.
176
177:- multifile file_search_path/2.
178
179:- dynamic file_search_path/2.
180
181:- multifile generate_message_hook/3.
182
183:- dynamic generate_message_hook/3.
184
185:- multifile swi:swi_predicate_table/4.
186
187:- multifile user:message_hook/3.
188
189:- dynamic user:message_hook/3.
190
191:- multifile user:portray_message/2.
192
193:- multifile user:exception/3.
194
195:- dynamic user:exception/3.
196
197file_search_path(library, Dir) :-
198	library_directory(Dir).
199file_search_path(commons, Dir) :-
200	commons_directory(Dir0).
201file_search_path(swi, Home) :-
202	current_prolog_flag(home, Home).
203file_search_path(yap, Home) :-
204        current_prolog_flag(home, Home).
205file_search_path(system, Dir) :-
206	prolog_flag(host_type, Dir).
207file_search_path(foreign, yap('lib/Yap')).
208
209:- yap_flag(unknown,fail).
210
211