root/tags/lgt290/configs/master.config

Revision 2, 7.6 KB (checked in by pmoura, 7 years ago)

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%
3%  Logtalk - Object oriented extension to Prolog
4%  Release 2.9.0
5%
6%  configuration file for MasterProLog 4.1
7%
8%  last updated: August 24, 2000
9%
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12
13:- option('c+').
14
15
16
17%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18%
19%  ISO Prolog Standard predicates that we must define because they are
20%  not built-in
21%
22%  add a clause for lgt_iso_predicate/1 declaring each ISO predicate that
23%  we must define; there must be at least one clause for this predicate
24%  whose call should fail if we don't define any ISO predicates
25%
26%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27
28
29initialization(Goal) :-
30    call(Goal).
31
32
33% lgt_iso_predicate(?callable).
34
35lgt_iso_predicate(atom_codes(_, _)).
36lgt_iso_predicate(current_predicate(_)).
37lgt_iso_predicate(number_codes(_, _)).
38lgt_iso_predicate(once(_)).
39lgt_iso_predicate(open(_,_,_)).
40lgt_iso_predicate(read_term(_, _, _)).
41lgt_iso_predicate(write_term(_, _, _)).
42
43
44atom_codes(Atom, Codes) :-
45    asciilist(Atom, Codes).
46
47
48current_predicate(Functor/Arity) :-
49    current_predicate(Functor, Term),
50    functor(Term, Functor, Arity).
51
52
53number_codes(Number, Codes) :-
54    name(Number, Codes).
55
56
57once(Goal) :-
58    call(Goal),
59    !.
60
61
62open(File, read, Stream) :-
63    fopen(Stream, File, r).
64
65open(File, write, Stream) :-
66    fopen(Stream, File, w).
67
68
69read_term(Stream, Term, [singletons([])]) :-
70    !,
71    read(Stream, Term).
72
73read_term(Stream, Term, _) :-
74    read(Stream, Term).
75
76
77write_term(Stream, Term, [quoted(true)]) :-
78    !,
79    writeq(Stream, Term).
80
81write_term(Stream, Term, _) :-
82    write(Stream, Term).
83
84
85
86%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
87%
88%  predicate properties
89%
90%  this predicate must return at least static, dynamic and built_in
91%  properties for an existing predicate
92%
93%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
94
95
96% lgt_predicate_property(+callable, ?predicate_property)
97
98lgt_predicate_property(Term, Property) :-
99    predicate_type(Term, Property2),
100    (Property2 = builtin -> Property = built_in; Property = Property2).
101
102
103
104%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
105%
106%  metapredicates
107%
108%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
109
110
111% forall(+callable, +callble)
112
113forall(Generate, Test) :-
114    \+ call((Generate, \+ call(Test))).
115
116
117% lgt_call/2-8
118%
119% use these definitions only if your compiler does
120% not provide call/1-8 as built-in predicates
121
122lgt_call(F, A) :-
123    call(F, A).
124
125
126lgt_call(F, A1, A2) :-
127    call(F, A1, A2).
128
129
130lgt_call(F, A1, A2, A3) :-
131    call(F, A1, A2, A3).
132
133
134lgt_call(F, A1, A2, A3, A4) :-
135    call(F, A1, A2, A3, A4).
136
137
138lgt_call(F, A1, A2, A3, A4, A5) :-
139    call(F, A1, A2, A3, A4, A5).
140
141
142lgt_call(F, A1, A2, A3, A4, A5, A6) :-
143    call(F, A1, A2, A3, A4, A5, A6).
144
145
146lgt_call(F, A1, A2, A3, A4, A5, A6, A7) :-
147    call(F, A1, A2, A3, A4, A5, A6, A7).
148
149
150% lgt_once/2-8
151%
152% if your compiler provides call/1-8 as built-in
153% predicates rewrite these definitions using call(...), !.
154
155lgt_once(F, A) :-
156    call(F, A),
157    !.
158
159
160lgt_once(F, A1, A2) :-
161    call(F, A1, A2),
162    !.
163
164
165lgt_once(F, A1, A2, A3) :-
166    call(F, A1, A2, A3),
167    !.
168
169
170lgt_once(F, A1, A2, A3, A4) :-
171    call(F, A1, A2, A3, A4),
172    !.
173
174
175lgt_once(F, A1, A2, A3, A4, A5) :-
176    call(F, A1, A2, A3, A4, A5),
177    !.
178
179
180lgt_once(F, A1, A2, A3, A4, A5, A6) :-
181    call(F, A1, A2, A3, A4, A5, A6),
182    !.
183
184
185lgt_once(F, A1, A2, A3, A4, A5, A6, A7) :-
186    call(F, A1, A2, A3, A4, A5, A6, A7),
187    !.
188
189
190
191%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
192%
193%  file extension predicates
194%
195%  these extensions are used by Logtalk load/compile predicates
196%
197%  you may want to change the extension for Prolog files to match
198%  the one expected by your Prolog compiler
199%
200%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
201
202
203% lgt_file_extension(?atom, ?atom)
204
205lgt_file_extension(logtalk, '.lgt').
206lgt_file_extension(prolog, '.pl').
207lgt_file_extension(xml, '.xml').
208
209
210
211%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
212%
213%  default compiler options
214%
215%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
216
217
218% lgt_default_compiler_option(?atom, ?atom)
219%
220% default values for all compiler options
221
222lgt_default_compiler_option(iso_initialization_dir, false).
223
224lgt_default_compiler_option(xml, on).
225lgt_default_compiler_option(xsl, 'lgtxml.xsl').
226
227lgt_default_compiler_option(unknown, warning).
228lgt_default_compiler_option(misspelt, warning).
229lgt_default_compiler_option(singletons, warning).
230lgt_default_compiler_option(lgtredef, warning).
231lgt_default_compiler_option(plredef, silent).
232
233lgt_default_compiler_option(report, on).
234
235
236
237%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
238%
239%  list predicates
240%
241%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
242
243
244lgt_append([], List, List).
245lgt_append([Head| Tail], List, [Head| Tail2]) :-
246    lgt_append(Tail, List, Tail2).
247
248
249lgt_member(Head, [Head| _]).
250lgt_member(Head, [_| Tail]) :-
251    lgt_member(Head, Tail).
252
253
254lgt_member_var(V, [H| _]) :-
255    V == H.
256lgt_member_var(V, [_| T]) :-
257    lgt_member_var(V, T).
258
259
260lgt_proper_list([]).
261lgt_proper_list([_| List]) :-
262    lgt_proper_list(List).
263
264
265
266%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
267%
268%  file predicates
269%
270%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
271
272
273% lgt_file_exists(+atom)
274%
275% see if a file exist in the current directory
276
277lgt_file_exists(File) :-
278    exists(File).
279
280
281% lgt_load_prolog_code(+atom)
282%
283% compile and load a Prolog file
284
285lgt_load_prolog_code(File) :-
286    reconsult(File).
287
288
289
290%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
291%
292%  sorting predicates
293%
294%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
295
296
297% lgt_keysort(+list, -list)
298
299lgt_keysort(List, Sorted) :-
300    keysort(List, Sorted).
301
302
303% lgt_sort(+list, -list)
304
305lgt_sort(List, Sorted) :-
306    sort(List, Sorted).
307
308
309
310%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
311%
312%  time and date predicates
313%
314%  if your Prolog compiler does not provide access to the operating system
315%  time and date just write dummy definitions
316%
317%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
318
319
320% lgt_current_date(?Year, ?Month, ?Day)
321
322lgt_current_date(Year, Month, Day) :-
323    time_info([year,month,day],[Year,Month,Day]).
324
325
326% lgt_current_time(?Hours, ?Mins, ?Secs)
327
328lgt_current_time(Hours, Mins, Secs) :-
329    time_info([hour,min,sec],[Hours,Mins,Secs]).
330
331
332
333%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
334%
335%  timing predicate
336%
337%  if your Prolog compiler does not provide access to a timing predicate
338%  just write dummy definition
339%
340%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
341
342
343% lgt_cpu_time(-Seconds)
344
345lgt_cpu_time(Seconds) :-
346    cputime(Seconds).
347
348
349master_init :-
350    please(q, on), please(c, on), please(s, on), please(rf, off),
351    compiler(c, on), compiler(w, off),
352    op(600, xfy, '::'), op(600, fy, '::'), op(600, fx, '^^'),
353    op(200, fy, '+'), op(200, fy, '?'), op(200, fy, '@'), op(200, fy, '-'),
354    error_message(115 /* Possible erroneous use of nil */ , off).
355       
356?- master_init.   
357
358
359
360%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
361%
362%  comparison predicate
363%
364%  the usual compare/3 definition
365%
366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
367
368
369% compare(?atom, @term, @term) -- built-in
370
371
372
373%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
374%
375%  end!
376%
377%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.