root/tags/lgt2307/configs/quintus.config

Revision 3896, 11.9 KB (checked in by pmoura, 15 months ago)

Added a new read-only compiler flag, "context_switching_calls", allowing context switching calls to be disabled (by default, they are enabled).

  • 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.30.7
5%
6%  configuration file for Quintus Prolog 3.3~3.5
7%
8%  last updated: October 24, 2007
9%
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12
13:- [library(files)].
14:- [library(date)].
15
16
17
18%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
19%
20%  ISO Prolog Standard predicates that we must define because they are
21%  not built-in
22%
23%  add a clause for lgt_iso_predicate/1 declaring each ISO predicate that
24%  you must define; there must be at least one clause for this predicate
25%  whose call should fail if you don't define any ISO predicates
26%
27%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
28
29
30:- op(700, xfx, \=).
31
32
33% '$lgt_iso_predicate'(?callable).
34
35'$lgt_iso_predicate'(_ \= _).
36'$lgt_iso_predicate'(atom_codes(_, _)).
37'$lgt_iso_predicate'(atom_concat(_, _, _)).
38'$lgt_iso_predicate'(catch(_, _, _)).
39'$lgt_iso_predicate'(number_codes(_, _)).
40'$lgt_iso_predicate'(once(_)).
41'$lgt_iso_predicate'(throw(_)).
42
43
44Term1 \= Term2 :-
45    \+ (Term1 = Term2).
46
47
48atom_codes(Atom, Codes) :-
49    atom_chars(Atom, Codes).
50
51
52atom_concat(Atom1, Atom2, Atom3) :-
53    nonvar(Atom1), nonvar(Atom2),
54    !,
55    atom_chars(Atom1, Codes1),
56    atom_chars(Atom2, Codes2),
57    '$lgt_append'(Codes1, Codes2, Codes3),
58    atom_chars(Atom3, Codes3).
59
60atom_concat(Atom1, Atom2, Atom3) :-
61    nonvar(Atom3),
62    !,
63    atom_chars(Atom3, Codes3),
64    '$lgt_append'(Codes1, Codes2, Codes3),
65    atom_chars(Atom1, Codes1),
66    atom_chars(Atom2, Codes2).
67
68
69catch(Goal, Catcher, Recovery) :-
70    on_exception(Catcher, Goal, Recovery).
71
72
73number_codes(Number, Codes) :-
74    number_chars(Number, Codes).
75
76
77once(Goal) :-
78    call(Goal),
79    !.
80
81
82throw(Ball) :-
83    raise_exception(Ball).
84
85
86
87%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88%
89%  predicate properties
90%
91%  this predicate must return at least static, dynamic, and built_in
92%  properties for an existing predicate
93%
94%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
95
96
97% '$lgt_predicate_property'(+callable, ?predicate_property)
98
99'$lgt_predicate_property'(Pred, Prop) :-
100    predicate_property(Pred, Prop).
101
102
103
104%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
105%
106%  meta-predicates
107%
108%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
109
110
111% call_cleanup(+callable, +callble)
112
113call_cleanup(_, _) :-
114    throw(not_supported(call_cleanup/2)).
115
116
117% forall(+callable, +callble) -- built-in
118
119forall(Generate, Test) :-
120    \+ (call(Generate), \+ call(Test)).
121
122
123% retractall(+callable) -- built-in
124
125
126% call_with_args/2-9
127%
128% use these definitions only if your compiler does
129% not provide call_with_args/2-9 as built-in predicates
130
131call_with_args(F, A) :-
132    Call =.. [F, A],
133    call(Call).
134
135call_with_args(F, A1, A2) :-
136    Call =.. [F, A1, A2],
137    call(Call).
138
139call_with_args(F, A1, A2, A3) :-
140    Call =.. [F, A1, A2, A3],
141    call(Call).
142
143call_with_args(F, A1, A2, A3, A4) :-
144    Call =.. [F, A1, A2, A3, A4],
145    call(Call).
146
147call_with_args(F, A1, A2, A3, A4, A5) :-
148    Call =.. [F, A1, A2, A3, A4, A5],
149    call(Call).
150
151call_with_args(F, A1, A2, A3, A4, A5, A6) :-
152    Call =.. [F, A1, A2, A3, A4, A5, A6],
153    call(Call).
154
155call_with_args(F, A1, A2, A3, A4, A5, A6, A7) :-
156    Call =.. [F, A1, A2, A3, A4, A5, A6, A7],
157    call(Call).
158
159call_with_args(F, A1, A2, A3, A4, A5, A6, A7, A8) :-
160    Call =.. [F, A1, A2, A3, A4, A5, A6, A7, A8],
161    call(Call).
162
163
164
165%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
166%
167%  Prolog built-in meta-predicates
168%
169%  (excluding ISO Prolog Standard meta-predicates)
170%
171%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
172
173
174% '$lgt_pl_meta_predicate'(?callable).
175
176'$lgt_pl_meta_predicate'(not(::)).
177'$lgt_pl_meta_predicate'(on_exception(*, ::, ::)).
178
179
180
181%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
182%
183%  file extension predicates
184%
185%  these extensions are used by Logtalk load/compile predicates
186%
187%  you may want to change the extension for Prolog files to match
188%  the one expected by your Prolog compiler
189%
190%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
191
192
193% '$lgt_file_extension'(?atom, ?atom)
194
195'$lgt_file_extension'(logtalk, '.lgt').
196'$lgt_file_extension'(prolog, '.pl').
197'$lgt_file_extension'(xml, '.xml').
198
199
200
201%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
202%
203%  default flag values
204%
205%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
206
207
208% '$lgt_default_flag'(?atom, ?atom)
209%
210% default values for all flags
211
212'$lgt_default_flag'(xmldocs, on).
213'$lgt_default_flag'(xslfile, 'lgtxml.xsl').
214'$lgt_default_flag'(xmlspec, dtd).
215'$lgt_default_flag'(xmlsref, local).
216
217'$lgt_default_flag'(unknown, warning).
218'$lgt_default_flag'(misspelt, warning).
219'$lgt_default_flag'(singletons, warning).
220'$lgt_default_flag'(lgtredef, warning).
221'$lgt_default_flag'(plredef, silent).
222'$lgt_default_flag'(portability, silent).
223
224'$lgt_default_flag'(report, on).
225
226'$lgt_default_flag'(smart_compilation, off).
227'$lgt_default_flag'(reload, always).
228
229'$lgt_default_flag'(startup_message, flags(verbose)).
230
231'$lgt_default_flag'(underscore_variables, singletons).
232
233'$lgt_default_flag'(code_prefix, '').
234
235'$lgt_default_flag'(debug, off).
236'$lgt_default_flag'(break_predicate, true).
237
238'$lgt_default_flag'(events, off).
239
240'$lgt_default_flag'(altdirs, off).
241'$lgt_default_flag'(tmpdir, 'lgt_tmp/').
242'$lgt_default_flag'(xmldir, 'xml_docs/').
243
244'$lgt_default_flag'(encoding_directive, unsupported).
245'$lgt_default_flag'(threads, unsupported).
246
247'$lgt_default_flag'(context_switching_calls, allow).
248
249
250
251%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
252%
253%  list predicates
254%
255%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
256
257
258'$lgt_append'([], List, List).
259'$lgt_append'([Head| Tail], List, [Head| Tail2]) :-
260    '$lgt_append'(Tail, List, Tail2).
261
262
263'$lgt_member'(Head, [Head| _]).
264'$lgt_member'(Head, [_| Tail]) :-
265    '$lgt_member'(Head, Tail).
266
267
268'$lgt_member_var'(V, [H| _]) :-
269    V == H.
270'$lgt_member_var'(V, [_| T]) :-
271    '$lgt_member_var'(V, T).
272
273
274'$lgt_is_list'([]) :-
275    !.
276'$lgt_is_list'([_| Tail]) :-
277    '$lgt_is_list'(Tail).
278
279
280'$lgt_is_proper_list'(List) :-
281    List == [], !.
282'$lgt_is_proper_list'([_| Tail]) :-
283    nonvar(Tail),
284    '$lgt_is_proper_list'(Tail).
285
286
287
288%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
289%
290%  file predicates
291%
292%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
293
294
295% '$lgt_file_exists'(+atom)
296%
297% checks if a file exist in the current directory
298
299'$lgt_file_exists'(File) :-
300    file_exists(File).
301
302
303% '$lgt_directory_exists'(+atom)
304%
305% checks if a directory exists
306
307'$lgt_directory_exists'(Directory) :-
308    absolute_file_name(Directory, [access(exist)], _),
309    absolute_file_name(Directory, [file_type(directory)], _).
310
311
312% '$lgt_current_directory'(-atom)
313%
314% gets current working directory
315
316'$lgt_current_directory'(Directory) :-
317    absolute_file_name('.', Directory).
318
319
320% '$lgt_change_directory'(+atom)
321%
322% changes current working directory
323
324'$lgt_change_directory'(Directory) :-
325    unix(cd(Directory)).
326
327
328% '$lgt_make_directory'(+atom)
329%
330% makes a new directory; succeeds if the directory already exists
331
332'$lgt_make_directory'(_) :-
333    concat_atom(['mkdir -p ', Directory], Command),
334    unix(system(Command)).
335
336
337% '$lgt_load_prolog_code'(+atom, +atom)
338%
339% compile and load a Prolog file
340
341'$lgt_load_prolog_code'(File, _) :-
342    compile(File).
343
344
345% '$lgt_compare_file_mtimes'(?atom, +atom, +atom)
346%
347% compare file modification times
348
349'$lgt_compare_file_mtimes'(Result, File1, File2) :-
350    file_property(File1, modify_time, Time1),
351    file_property(File2, modify_time, Time2),
352    compare(Result, Time1, Time2).
353
354
355
356%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
357%
358%  sorting predicates
359%
360%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
361
362
363% '$lgt_keysort'(+list, -list)
364
365'$lgt_keysort'(List, Sorted) :-
366    keysort(List, Sorted).
367
368
369% '$lgt_sort'(+list, -list)
370
371'$lgt_sort'(List, Sorted) :-
372    sort(List, Sorted).
373
374
375
376%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
377%
378%  time and date predicates
379%
380%  if your Prolog compiler does not provide access to the operating system
381%  time and date just write dummy definitions
382%
383%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
384
385
386% '$lgt_current_date'(?Year, ?Month, ?Day)
387
388'$lgt_current_date'(Year, Month, Day) :-
389    date(date(Day, Month, Year)).
390
391
392% '$lgt_current_time'(?Hours, ?Mins, ?Secs)
393
394'$lgt_current_time'(Hours, Mins, Secs) :-
395    time(time(Hours, Mins, Secs)).
396
397
398
399%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
400%
401%  timing predicate
402%
403%  if your Prolog compiler does not provide access to a timing predicate
404%  just write dummy definition
405%
406%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
407
408
409% '$lgt_cpu_time'(-Seconds)
410
411'$lgt_cpu_time'(Seconds) :-
412    statistics(runtime, [Miliseconds| _]),
413    Seconds is Miliseconds / 1000.
414
415
416
417%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
418%
419%  comparison predicate
420%
421%  the usual compare/3 definition
422%
423%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
424
425
426% compare(?atom, @term, @term) -- built-in
427
428
429
430%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
431%
432%  callable predicate
433%
434%  the usual callable/1 definition
435%
436%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
437
438
439% callable(@term) -- built-in
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    \+ \+ (
467        numbervars(Term, 0, _),
468        write_term(Stream, Term, [numbervars(true)])).
469
470
471'$lgt_pretty_print_vars_quoted'(Stream, Term) :-
472    \+ \+ (
473        numbervars(Term, 0, _),
474        write_term(Stream, Term, [numbervars(true), quoted(true)])).
475
476
477
478%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
479%
480%  getting stream current line number
481%  (needed for improved compiler error messages)
482%
483%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
484
485
486% '$lgt_stream_current_line_number'(@stream, -integer)
487
488'$lgt_stream_current_line_number'(Stream, Line) :-
489    line_count(Stream, Line).
490
491
492
493%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
494%
495%  handling of Prolog-proprietary directives on Logtalk source files
496%
497%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
498
499
500% '$lgt_ignore_pl_directive'(@callable)
501
502'$lgt_ignore_pl_directive'(_) :-
503    fail.
504
505
506% '$lgt_rewrite_and_copy_pl_directive'(@callable, -callable)
507
508'$lgt_rewrite_and_copy_pl_directive'(_, _) :-
509    fail.
510
511
512% '$lgt_rewrite_and_recompile_pl_directive'(@callable, -callable)
513
514'$lgt_rewrite_and_recompile_pl_directive'(_, _) :-
515    fail.
516
517
518
519%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
520%
521%  Shortcut to the Logtalk built-in predicate logtalk_load/1
522%
523%  defined in the config files in order to be able to comment it out in case
524%  of conflict with some Prolog native feature; it implies conformance with
525%  the ISO Prolog standard regarding the definition of the {}/1 syntax
526%
527%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
528
529{File, Files} :-
530    !,
531    logtalk_load(File),
532    {Files}.
533{File} :-
534    logtalk_load(File).
535
536
537
538%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
539%
540%  end!
541%
542%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.