root/tags/lgt2311/configs/master.config

Revision 3986, 12.1 KB (checked in by pmoura, 13 months ago)

Updated the release number to 2.31.1.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%
3%  Logtalk - Open source object-oriented logic programming language
4%  Release 2.31.1
5%
6%  configuration file for MasterProLog 4.1
7%
8%  last updated: October 24, 2007
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'(open(_, _, _, _)).
41'$lgt_iso_predicate'(read_term(_, _, _)).
42'$lgt_iso_predicate'(write_canonical(_, _)).
43'$lgt_iso_predicate'(write_term(_, _, _)).
44
45
46atom_codes(Atom, Codes) :-
47    asciilist(Atom, Codes).
48
49
50current_predicate(Functor/Arity) :-
51    current_predicate(Functor, Term),
52    functor(Term, Functor, Arity).
53
54
55number_codes(Number, Codes) :-
56    name(Number, Codes).
57
58
59once(Goal) :-
60    call(Goal),
61    !.
62
63
64open(File, read, Stream) :-
65    fopen(Stream, File, r).
66
67open(File, write, Stream) :-
68    fopen(Stream, File, w).
69
70
71open(File, Mode, Stream, []) :-
72    open(File, read, Stream).
73
74
75read_term(Stream, Term, [singletons([])]) :-
76    !,
77    read(Stream, Term).
78
79read_term(Stream, Term, _) :-
80    read(Stream, Term).
81
82
83write_canonical(Stream, Term) :-
84    writeq(Stream, Term).
85
86
87write_term(Stream, Term, [quoted(true)]) :-
88    !,
89    writeq(Stream, Term).
90
91write_term(Stream, Term, _) :-
92    write(Stream, Term).
93
94
95
96%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
97%
98%  predicate properties
99%
100%  this predicate must return at least static, dynamic, and built_in
101%  properties for an existing predicate
102%
103%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
104
105
106% '$lgt_predicate_property'(+callable, ?predicate_property)
107
108'$lgt_predicate_property'(Term, Property) :-
109    predicate_type(Term, Property2),
110    (Property2 = builtin -> Property = built_in; Property = Property2).
111
112
113
114%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
115%
116%  meta-predicates
117%
118%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
119
120
121% call_cleanup(+callable, +callble)
122
123call_cleanup(_, _) :-
124    throw(not_supported(call_cleanup/2)).
125
126
127% forall(+callable, +callble) -- built-in
128
129forall(Generate, Test) :-
130    \+ (call(Generate), \+ call(Test)).
131
132
133% retractall(+callable) -- built-in
134
135
136% call_with_args/2-9
137%
138% use these definitions only if your compiler does
139% not provide call_with_args/2-9 as built-in predicates
140
141call_with_args(F, A) :-
142    call(F, A).
143
144call_with_args(F, A1, A2) :-
145    call(F, A1, A2).
146
147call_with_args(F, A1, A2, A3) :-
148    call(F, A1, A2, A3).
149
150call_with_args(F, A1, A2, A3, A4) :-
151    call(F, A1, A2, A3, A4).
152
153call_with_args(F, A1, A2, A3, A4, A5) :-
154    call(F, A1, A2, A3, A4, A5).
155
156call_with_args(F, A1, A2, A3, A4, A5, A6) :-
157    call(F, A1, A2, A3, A4, A5, A6).
158
159call_with_args(F, A1, A2, A3, A4, A5, A6, A7) :-
160    call(F, A1, A2, A3, A4, A5, A6, A7).
161
162call_with_args(F, A1, A2, A3, A4, A5, A6, A7, A8) :-
163    call(F, A1, A2, A3, A4, A5, A6, A7, A8).
164
165
166
167%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
168%
169%  Prolog built-in meta-predicates
170%
171%  (excluding ISO Prolog Standard meta-predicates)
172%
173%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
174
175
176% '$lgt_pl_meta_predicate'(?callable).
177
178'$lgt_pl_meta_predicate'(_) :-
179    fail.
180
181
182
183%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
184%
185%  file extension predicates
186%
187%  these extensions are used by Logtalk load/compile predicates
188%
189%  you may want to change the extension for Prolog files to match
190%  the one expected by your Prolog compiler
191%
192%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
193
194
195% '$lgt_file_extension'(?atom, ?atom)
196
197'$lgt_file_extension'(logtalk, '.lgt').
198'$lgt_file_extension'(prolog, '.pl').
199'$lgt_file_extension'(xml, '.xml').
200
201
202
203%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
204%
205%  default flag values
206%
207%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
208
209
210% '$lgt_default_flag'(?atom, ?atom)
211%
212% default values for all flags
213
214'$lgt_default_flag'(xmldocs, on).
215'$lgt_default_flag'(xslfile, 'lgtxml.xsl').
216'$lgt_default_flag'(xmlspec, dtd).
217'$lgt_default_flag'(xmlsref, local).
218
219'$lgt_default_flag'(unknown, warning).
220'$lgt_default_flag'(misspelt, warning).
221'$lgt_default_flag'(singletons, warning).
222'$lgt_default_flag'(lgtredef, warning).
223'$lgt_default_flag'(plredef, silent).
224'$lgt_default_flag'(portability, silent).
225
226'$lgt_default_flag'(report, on).
227
228'$lgt_default_flag'(smart_compilation, off).
229'$lgt_default_flag'(reload, always).
230
231'$lgt_default_flag'(startup_message, flags(verbose)).
232
233'$lgt_default_flag'(underscore_variables, singletons).
234
235'$lgt_default_flag'(code_prefix, '').
236
237'$lgt_default_flag'(debug, off).
238'$lgt_default_flag'(break_predicate, false).
239
240'$lgt_default_flag'(events, off).
241
242'$lgt_default_flag'(altdirs, off).
243'$lgt_default_flag'(tmpdir, 'lgt_tmp/').
244'$lgt_default_flag'(xmldir, 'xml_docs/').
245
246'$lgt_default_flag'(encoding_directive, unsupported).
247'$lgt_default_flag'(threads, unsupported).
248
249'$lgt_default_flag'(context_switching_calls, allow).
250
251
252
253%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
254%
255%  list predicates
256%
257%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
258
259
260'$lgt_append'([], List, List).
261'$lgt_append'([Head| Tail], List, [Head| Tail2]) :-
262    '$lgt_append'(Tail, List, Tail2).
263
264
265'$lgt_member'(Head, [Head| _]).
266'$lgt_member'(Head, [_| Tail]) :-
267    '$lgt_member'(Head, Tail).
268
269
270'$lgt_member_var'(V, [H| _]) :-
271    V == H.
272'$lgt_member_var'(V, [_| T]) :-
273    '$lgt_member_var'(V, T).
274
275
276'$lgt_is_list'([]) :-
277    !.
278'$lgt_is_list'([_| Tail]) :-
279    '$lgt_is_list'(Tail).
280
281
282'$lgt_is_proper_list'(List) :-
283    List == [], !.
284'$lgt_is_proper_list'([_| Tail]) :-
285    nonvar(Tail),
286    '$lgt_is_proper_list'(Tail).
287
288
289
290%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
291%
292%  file predicates
293%
294%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
295
296
297% '$lgt_file_exists'(+atom)
298%
299% checks if a file exist in the current directory
300
301'$lgt_file_exists'(File) :-
302    exists(File).
303
304
305% '$lgt_directory_exists'(+atom)
306%
307% checks if a directory exists
308
309'$lgt_directory_exists'(Directory) :-
310    exists(Directory),
311    file_info(Directory, type, dir).
312
313
314% '$lgt_current_directory'(-atom)
315%
316% gets current working directory
317
318'$lgt_current_directory'(Directory) :-
319    getenv('PWD', Directory).
320
321
322% '$lgt_change_directory'(+atom)
323%
324% changes current working directory
325
326'$lgt_change_directory'(Directory) :-
327    putenv('PWD', Directory).
328
329
330% '$lgt_make_directory'(+atom)
331%
332% makes a new directory; succeeds if the directory already exists
333
334'$lgt_make_directory'(_) :-
335    throw(not_supported('$lgt_make_directory'/1)).
336
337
338% '$lgt_load_prolog_code'(+atom, +atom)
339%
340% compile and load a Prolog file
341
342'$lgt_load_prolog_code'(File, _) :-
343    reconsult(File).
344
345
346% '$lgt_compare_file_mtimes'(?atom, +atom, +atom)
347%
348% compare file modification times
349
350'$lgt_compare_file_mtimes'(Result, File1, File2) :-
351    file_info(File1, mtime, Time1),
352    file_info(File2, mtime, Time2),
353    compare(Result, Time1, Time2).
354
355
356
357%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
358%
359%  sorting predicates
360%
361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
362
363
364% '$lgt_keysort'(+list, -list)
365
366'$lgt_keysort'(List, Sorted) :-
367    keysort(List, Sorted).
368
369
370% '$lgt_sort'(+list, -list)
371
372'$lgt_sort'(List, Sorted) :-
373    sort(List, Sorted).
374
375
376
377%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
378%
379%  time and date predicates
380%
381%  if your Prolog compiler does not provide access to the operating system
382%  time and date just write dummy definitions
383%
384%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
385
386
387% '$lgt_current_date'(?Year, ?Month, ?Day)
388
389'$lgt_current_date'(Year, Month, Day) :-
390    time_info([year,month,day],[Year,Month,Day]).
391
392
393% '$lgt_current_time'(?Hours, ?Mins, ?Secs)
394
395'$lgt_current_time'(Hours, Mins, Secs) :-
396    time_info([hour,min,sec],[Hours,Mins,Secs]).
397
398
399
400%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
401%
402%  timing predicate
403%
404%  if your Prolog compiler does not provide access to a timing predicate
405%  just write dummy definition
406%
407%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
408
409
410% '$lgt_cpu_time'(-Seconds)
411
412'$lgt_cpu_time'(Seconds) :-
413    cputime(Seconds).
414
415
416master_init :-
417    please(q, on), please(c, on), please(s, on), please(rf, off),
418    compiler(c, on), compiler(w, off),
419    op(600, xfy, '::'), op(600, fy, '::'), op(600, fx, '^^'),
420    op(200, fy, '+'), op(200, fy, '?'), op(200, fy, '@'), op(200, fy, '-'),
421    error_message(115 /* Possible erroneous use of nil */ , off).
422       
423?- master_init.   
424
425
426
427%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
428%
429%  comparison predicate
430%
431%  the usual compare/3 definition
432%
433%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
434
435
436% compare(?atom, @term, @term) -- built-in
437
438
439
440%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
441%
442%  callable predicate
443%
444%  the usual callable/1 definition
445%
446%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
447
448
449% callable(@term)
450
451callable(Term) :-
452    nonvar(Term),
453    functor(Term, Functor, _),
454    atom(Functor).
455
456
457
458%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
459%
460%  read character predicate
461%
462%  read a single character echoing it and writing a newline after
463%
464%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
465
466
467'$lgt_read_single_char'(Char) :-
468    get(Code), name(Char, [Code]).
469
470
471
472%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
473%
474%  pretty print a term by naming its free variables
475%  (avoid instantiating variables in term by using double negation if necessary)
476%
477%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
478
479
480'$lgt_pretty_print_vars'(Stream, Term) :-
481    write(Stream, Term).
482
483
484'$lgt_pretty_print_vars_quoted'(Stream, Term) :-
485    writeq(Stream, Term).
486
487
488
489%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
490%
491%  getting stream current line number
492%  (needed for improved compiler error messages)
493%
494%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
495
496
497% '$lgt_stream_current_line_number'(@stream, -integer)
498
499'$lgt_stream_current_line_number'(_, _) :-
500    fail.
501
502
503
504%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
505%
506%  handling of Prolog-proprietary directives on Logtalk source files
507%
508%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
509
510
511% '$lgt_ignore_pl_directive'(@callable)
512
513'$lgt_ignore_pl_directive'(_) :-
514    fail.
515
516
517% '$lgt_rewrite_and_copy_pl_directive'(@callable, -callable)
518
519'$lgt_rewrite_and_copy_pl_directive'(_, _) :-
520    fail.
521
522
523% '$lgt_rewrite_and_recompile_pl_directive'(@callable, -callable)
524
525'$lgt_rewrite_and_recompile_pl_directive'(_, _) :-
526    fail.
527
528
529
530%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
531%
532%  Shortcut to the Logtalk built-in predicate logtalk_load/1
533%
534%  defined in the config files in order to be able to comment it out in case
535%  of conflict with some Prolog native feature; it implies conformance with
536%  the ISO Prolog standard regarding the definition of the {}/1 syntax
537%
538%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
539
540{File, Files} :-
541    !,
542    logtalk_load(File),
543    {Files}.
544{File} :-
545    logtalk_load(File).
546
547
548
549%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
550%
551%  end!
552%
553%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.