root/tags/lgt2210/configs/master.config

Revision 1460, 10.0 KB (checked in by pmoura, 4 years ago)

Updated release number to 2.21.0.

  • 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.21.0
5%
6%  configuration file for MasterProLog 4.1
7%
8%  last updated: July 17, 2004
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
35'$lgt_iso_predicate'(atom_codes(_, _)).
36'$lgt_iso_predicate'(current_predicate(_)).
37'$lgt_iso_predicate'(number_codes(_, _)).
38'$lgt_iso_predicate'(once(_)).
39'$lgt_iso_predicate'(open(_,_,_)).
40'$lgt_iso_predicate'(read_term(_, _, _)).
41'$lgt_iso_predicate'(write_canonical(_, _)).
42'$lgt_iso_predicate'(write_term(_, _, _)).
43
44
45atom_codes(Atom, Codes) :-
46    asciilist(Atom, Codes).
47
48
49current_predicate(Functor/Arity) :-
50    current_predicate(Functor, Term),
51    functor(Term, Functor, Arity).
52
53
54number_codes(Number, Codes) :-
55    name(Number, Codes).
56
57
58once(Goal) :-
59    call(Goal),
60    !.
61
62
63open(File, read, Stream) :-
64    fopen(Stream, File, r).
65
66open(File, write, Stream) :-
67    fopen(Stream, File, w).
68
69
70read_term(Stream, Term, [singletons([])]) :-
71    !,
72    read(Stream, Term).
73
74read_term(Stream, Term, _) :-
75    read(Stream, Term).
76
77
78write_canonical(Stream, Term) :-
79    writeq(Stream, Term).
80
81
82write_term(Stream, Term, [quoted(true)]) :-
83    !,
84    writeq(Stream, Term).
85
86write_term(Stream, Term, _) :-
87    write(Stream, Term).
88
89
90
91%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92%
93%  predicate properties
94%
95%  this predicate must return at least static, dynamic, and built_in
96%  properties for an existing predicate
97%
98%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
99
100
101% '$lgt_predicate_property'(+callable, ?predicate_property)
102
103'$lgt_predicate_property'(Term, Property) :-
104    predicate_type(Term, Property2),
105    (Property2 = builtin -> Property = built_in; Property = Property2).
106
107
108
109%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
110%
111%  metapredicates
112%
113%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
114
115
116% forall(+callable, +callble)
117
118forall(Generate, Test) :-
119    \+ call((Generate, \+ call(Test))).
120
121
122% lgt_call/2-8
123%
124% use these definitions only if your compiler does
125% not provide call/1-8 as built-in predicates
126
127'$lgt_call'(F, A) :-
128    call(F, A).
129
130
131'$lgt_call'(F, A1, A2) :-
132    call(F, A1, A2).
133
134
135'$lgt_call'(F, A1, A2, A3) :-
136    call(F, A1, A2, A3).
137
138
139'$lgt_call'(F, A1, A2, A3, A4) :-
140    call(F, A1, A2, A3, A4).
141
142
143'$lgt_call'(F, A1, A2, A3, A4, A5) :-
144    call(F, A1, A2, A3, A4, A5).
145
146
147'$lgt_call'(F, A1, A2, A3, A4, A5, A6) :-
148    call(F, A1, A2, A3, A4, A5, A6).
149
150
151'$lgt_call'(F, A1, A2, A3, A4, A5, A6, A7) :-
152    call(F, A1, A2, A3, A4, A5, A6, A7).
153
154
155% lgt_once/2-8
156%
157% if your compiler provides call/1-8 as built-in
158% predicates rewrite these definitions using call(...), !.
159
160'$lgt_once'(F, A) :-
161    call(F, A),
162    !.
163
164
165'$lgt_once'(F, A1, A2) :-
166    call(F, A1, A2),
167    !.
168
169
170'$lgt_once'(F, A1, A2, A3) :-
171    call(F, A1, A2, A3),
172    !.
173
174
175'$lgt_once'(F, A1, A2, A3, A4) :-
176    call(F, A1, A2, A3, A4),
177    !.
178
179
180'$lgt_once'(F, A1, A2, A3, A4, A5) :-
181    call(F, A1, A2, A3, A4, A5),
182    !.
183
184
185'$lgt_once'(F, A1, A2, A3, A4, A5, A6) :-
186    call(F, A1, A2, A3, A4, A5, A6),
187    !.
188
189
190'$lgt_once'(F, A1, A2, A3, A4, A5, A6, A7) :-
191    call(F, A1, A2, A3, A4, A5, A6, A7),
192    !.
193
194
195
196%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
197%
198%  Prolog built-in metapredicates
199%
200%  (excluding ISO Prolog Standard metapredicates)
201%
202%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
203
204
205% '$lgt_pl_metapredicate'(?callable).
206
207'$lgt_pl_metapredicate'(_) :-
208    fail.
209
210
211
212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
213%
214%  file extension predicates
215%
216%  these extensions are used by Logtalk load/compile predicates
217%
218%  you may want to change the extension for Prolog files to match
219%  the one expected by your Prolog compiler
220%
221%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
222
223
224% '$lgt_file_extension'(?atom, ?atom)
225
226'$lgt_file_extension'(metafile, '.mlgt').
227'$lgt_file_extension'(logtalk, '.lgt').
228'$lgt_file_extension'(prolog, '.pl').
229'$lgt_file_extension'(xml, '.xml').
230
231
232
233%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
234%
235%  default flag values
236%
237%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
238
239
240% '$lgt_default_flag'(?atom, ?atom)
241%
242% default values for all flags
243
244'$lgt_default_flag'(iso_initialization_dir, false).
245
246'$lgt_default_flag'(xml, on).
247'$lgt_default_flag'(xsl, 'lgtxml.xsl').
248'$lgt_default_flag'(xmlspec, dtd).
249'$lgt_default_flag'(doctype, local).
250
251'$lgt_default_flag'(unknown, warning).
252'$lgt_default_flag'(misspelt, warning).
253'$lgt_default_flag'(singletons, warning).
254'$lgt_default_flag'(lgtredef, warning).
255'$lgt_default_flag'(plredef, silent).
256'$lgt_default_flag'(portability, silent).
257
258'$lgt_default_flag'(report, on).
259
260'$lgt_default_flag'(smart_compilation, off).
261
262'$lgt_default_flag'(startup_message, flags).
263
264'$lgt_default_flag'(underscore_vars, singletons).
265
266'$lgt_default_flag'(code_prefix, '').
267
268'$lgt_default_flag'(debug, off).
269'$lgt_default_flag'(supports_break_predicate, false).
270
271
272
273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
274%
275%  list predicates
276%
277%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
278
279
280'$lgt_append'([], List, List).
281'$lgt_append'([Head| Tail], List, [Head| Tail2]) :-
282    '$lgt_append'(Tail, List, Tail2).
283
284
285'$lgt_member'(Head, [Head| _]).
286'$lgt_member'(Head, [_| Tail]) :-
287    '$lgt_member'(Head, Tail).
288
289
290'$lgt_member_var'(V, [H| _]) :-
291    V == H.
292'$lgt_member_var'(V, [_| T]) :-
293    '$lgt_member_var'(V, T).
294
295
296'$lgt_proper_list'([]).
297'$lgt_proper_list'([_| List]) :-
298    '$lgt_proper_list'(List).
299
300
301'$lgt_reverse'(List, Reversed) :-
302    '$lgt_reverse'(List, [], Reversed, Reversed).
303
304'$lgt_reverse'([], Reversed, Reversed, []).
305'$lgt_reverse'([Head| Tail], List, Reversed, [_| Bound]) :-
306    '$lgt_reverse'(Tail, [Head| List], Reversed, Bound).
307
308
309
310%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
311%
312%  file predicates
313%
314%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
315
316
317% '$lgt_file_exists'(+atom)
318%
319% see if a file exist in the current directory
320
321'$lgt_file_exists'(File) :-
322    exists(File).
323
324
325% '$lgt_load_prolog_code'(+atom)
326%
327% compile and load a Prolog file
328
329'$lgt_load_prolog_code'(File) :-
330    reconsult(File).
331
332
333% '$lgt_compare_file_mtimes'(?atom, +atom, +atom)
334%
335% compare file modification times
336
337'$lgt_compare_file_mtimes'(Result, File1, File2) :-
338    file_info(File1, mtime, Time1),
339    file_info(File2, mtime, Time2),
340    compare(Result, Time1, Time2).
341
342
343
344%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
345%
346%  sorting predicates
347%
348%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
349
350
351% '$lgt_keysort'(+list, -list)
352
353'$lgt_keysort'(List, Sorted) :-
354    keysort(List, Sorted).
355
356
357% '$lgt_sort'(+list, -list)
358
359'$lgt_sort'(List, Sorted) :-
360    sort(List, Sorted).
361
362
363
364%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
365%
366%  time and date predicates
367%
368%  if your Prolog compiler does not provide access to the operating system
369%  time and date just write dummy definitions
370%
371%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
372
373
374% '$lgt_current_date'(?Year, ?Month, ?Day)
375
376'$lgt_current_date'(Year, Month, Day) :-
377    time_info([year,month,day],[Year,Month,Day]).
378
379
380% '$lgt_current_time'(?Hours, ?Mins, ?Secs)
381
382'$lgt_current_time'(Hours, Mins, Secs) :-
383    time_info([hour,min,sec],[Hours,Mins,Secs]).
384
385
386
387%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
388%
389%  timing predicate
390%
391%  if your Prolog compiler does not provide access to a timing predicate
392%  just write dummy definition
393%
394%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
395
396
397% '$lgt_cpu_time'(-Seconds)
398
399'$lgt_cpu_time'(Seconds) :-
400    cputime(Seconds).
401
402
403master_init :-
404    please(q, on), please(c, on), please(s, on), please(rf, off),
405    compiler(c, on), compiler(w, off),
406    op(600, xfy, '::'), op(600, fy, '::'), op(600, fx, '^^'),
407    op(200, fy, '+'), op(200, fy, '?'), op(200, fy, '@'), op(200, fy, '-'),
408    error_message(115 /* Possible erroneous use of nil */ , off).
409       
410?- master_init.   
411
412
413
414%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
415%
416%  comparison predicate
417%
418%  the usual compare/3 definition
419%
420%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
421
422
423% compare(?atom, @term, @term) -- built-in
424
425
426
427%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
428%
429%  callable predicate
430%
431%  the usual callable/1 definition
432%
433%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
434
435
436% callable(@term)
437
438callable(Term) :-
439    once((atom(Term); compound(Term))).
440
441
442
443%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
444%
445%  read character predicate
446%
447%  read a single character echoing it and writing a newline after
448%
449%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
450
451
452'$lgt_read_single_char'(Char) :-
453    get(Code), name(Char, [Code]).
454
455
456
457%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
458%
459%  pretty print a term by naming its free variables
460%  (avoid instantiating variables in term by using double negation if necessary)
461%
462%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
463
464
465'$lgt_pretty_print_vars'(Stream, Term) :-
466    write(Stream, Term).
467
468
469'$lgt_pretty_print_vars_quoted'(Stream, Term) :-
470    writeq(Stream, Term).
471
472
473
474%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
475%
476%  end!
477%
478%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.