root/tags/lgt2210/configs/quintus.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 Quintus Prolog 3.3~3.5
7%
8%  last updated: July 17, 2004
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%  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
122'$lgt_call'(F, A) :-
123    Call =.. [F, A],
124    call(Call).
125
126
127'$lgt_call'(F, A1, A2) :-
128    Call =.. [F, A1, A2],
129    call(Call).
130
131
132'$lgt_call'(F, A1, A2, A3) :-
133    Call =.. [F, A1, A2, A3],
134    call(Call).
135
136
137'$lgt_call'(F, A1, A2, A3, A4) :-
138    Call =.. [F, A1, A2, A3, A4],
139    call(Call).
140
141
142'$lgt_call'(F, A1, A2, A3, A4, A5) :-
143    Call =.. [F, A1, A2, A3, A4, A5],
144    call(Call).
145
146
147'$lgt_call'(F, A1, A2, A3, A4, A5, A6) :-
148    Call =.. [F, A1, A2, A3, A4, A5, A6],
149    call(Call).
150
151
152'$lgt_call'(F, A1, A2, A3, A4, A5, A6, A7) :-
153    Call =.. [F, A1, A2, A3, A4, A5, A6, A7],
154    call(Call).
155
156
157% lgt_once/2-8
158%
159% if your compiler provides call/1-8 as built-in
160% predicates rewrite these definitions using call(...), !.
161
162'$lgt_once'(F, A) :-
163    Call =.. [F, A],
164    once(Call).
165
166
167'$lgt_once'(F, A1, A2) :-
168    Call =.. [F, A1, A2],
169    once(Call).
170
171
172'$lgt_once'(F, A1, A2, A3) :-
173    Call =.. [F, A1, A2, A3],
174    once(Call).
175
176
177'$lgt_once'(F, A1, A2, A3, A4) :-
178    Call =.. [F, A1, A2, A3, A4],
179    once(Call).
180
181
182'$lgt_once'(F, A1, A2, A3, A4, A5) :-
183    Call =.. [F, A1, A2, A3, A4, A5],
184    once(Call).
185
186
187'$lgt_once'(F, A1, A2, A3, A4, A5, A6) :-
188    Call =.. [F, A1, A2, A3, A4, A5, A6],
189    once(Call).
190
191
192'$lgt_once'(F, A1, A2, A3, A4, A5, A6, A7) :-
193    Call =.. [F, A1, A2, A3, A4, A5, A6, A7],
194    once(Call).
195
196
197
198%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
199%
200%  Prolog built-in metapredicates
201%
202%  (excluding ISO Prolog Standard metapredicates)
203%
204%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
205
206
207% '$lgt_pl_metapredicate'(?callable).
208
209'$lgt_pl_metapredicate'(on_exception(*, ::, ::)).
210
211
212
213%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
214%
215%  file extension predicates
216%
217%  these extensions are used by Logtalk load/compile predicates
218%
219%  you may want to change the extension for Prolog files to match
220%  the one expected by your Prolog compiler
221%
222%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
223
224
225% '$lgt_file_extension'(?atom, ?atom)
226
227'$lgt_file_extension'(metafile, '.mlgt').
228'$lgt_file_extension'(logtalk, '.lgt').
229'$lgt_file_extension'(prolog, '.pl').
230'$lgt_file_extension'(xml, '.xml').
231
232
233
234%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
235%
236%  default flag values
237%
238%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
239
240
241% '$lgt_default_flag'(?atom, ?atom)
242%
243% default values for all flags
244
245'$lgt_default_flag'(iso_initialization_dir, true).
246
247'$lgt_default_flag'(xml, on).
248'$lgt_default_flag'(xsl, 'lgtxml.xsl').
249'$lgt_default_flag'(xmlspec, dtd).
250'$lgt_default_flag'(doctype, local).
251
252'$lgt_default_flag'(unknown, warning).
253'$lgt_default_flag'(misspelt, warning).
254'$lgt_default_flag'(singletons, warning).
255'$lgt_default_flag'(lgtredef, warning).
256'$lgt_default_flag'(plredef, silent).
257'$lgt_default_flag'(portability, silent).
258
259'$lgt_default_flag'(report, on).
260
261'$lgt_default_flag'(smart_compilation, off).
262
263'$lgt_default_flag'(startup_message, flags).
264
265'$lgt_default_flag'(underscore_vars, singletons).
266
267'$lgt_default_flag'(code_prefix, '').
268
269'$lgt_default_flag'(debug, off).
270'$lgt_default_flag'(supports_break_predicate, true).
271
272
273
274%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
275%
276%  list predicates
277%
278%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
279
280
281'$lgt_append'([], List, List).
282'$lgt_append'([Head| Tail], List, [Head| Tail2]) :-
283    '$lgt_append'(Tail, List, Tail2).
284
285
286'$lgt_member'(Head, [Head| _]).
287'$lgt_member'(Head, [_| Tail]) :-
288    '$lgt_member'(Head, Tail).
289
290
291'$lgt_member_var'(V, [H| _]) :-
292    V == H.
293'$lgt_member_var'(V, [_| T]) :-
294    '$lgt_member_var'(V, T).
295
296
297'$lgt_proper_list'([]).
298'$lgt_proper_list'([_| List]) :-
299    '$lgt_proper_list'(List).
300
301
302'$lgt_reverse'(List, Reversed) :-
303    '$lgt_reverse'(List, [], Reversed, Reversed).
304
305'$lgt_reverse'([], Reversed, Reversed, []).
306'$lgt_reverse'([Head| Tail], List, Reversed, [_| Bound]) :-
307    '$lgt_reverse'(Tail, [Head| List], Reversed, Bound).
308
309
310
311%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
312%
313%  file predicates
314%
315%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
316
317
318% '$lgt_file_exists'(+atom)
319%
320% see if a file exist in the current directory
321
322'$lgt_file_exists'(File) :-
323    file_exists(File).
324
325
326% '$lgt_load_prolog_code'(+atom)
327%
328% compile and load a Prolog file
329
330'$lgt_load_prolog_code'(File) :-
331    compile(File).
332
333
334% '$lgt_compare_file_mtimes'(?atom, +atom, +atom)
335%
336% compare file modification times
337
338'$lgt_compare_file_mtimes'(Result, File1, File2) :-
339    file_property(File1, modify_time, Time1),
340    file_property(File2, modify_time, Time2),
341    compare(Result, Time1, Time2).
342
343
344
345%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
346%
347%  sorting predicates
348%
349%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
350
351
352% '$lgt_keysort'(+list, -list)
353
354'$lgt_keysort'(List, Sorted) :-
355    keysort(List, Sorted).
356
357
358% '$lgt_sort'(+list, -list)
359
360'$lgt_sort'(List, Sorted) :-
361    sort(List, Sorted).
362
363
364
365%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
366%
367%  time and date predicates
368%
369%  if your Prolog compiler does not provide access to the operating system
370%  time and date just write dummy definitions
371%
372%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
373
374
375% '$lgt_current_date'(?Year, ?Month, ?Day)
376
377'$lgt_current_date'(Year, Month, Day) :-
378    date(date(Day, Month, Year)).
379
380
381% '$lgt_current_time'(?Hours, ?Mins, ?Secs)
382
383'$lgt_current_time'(Hours, Mins, Secs) :-
384    time(time(Hours, Mins, Secs)).
385
386
387
388%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
389%
390%  timing predicate
391%
392%  if your Prolog compiler does not provide access to a timing predicate
393%  just write dummy definition
394%
395%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
396
397
398% '$lgt_cpu_time'(-Seconds)
399
400'$lgt_cpu_time'(Seconds) :-
401    statistics(runtime, [Miliseconds| _]),
402    Seconds is Miliseconds / 1000.
403
404
405
406%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
407%
408%  comparison predicate
409%
410%  the usual compare/3 definition
411%
412%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
413
414
415% compare(?atom, @term, @term) -- built-in
416
417
418
419%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
420%
421%  callable predicate
422%
423%  the usual callable/1 definition
424%
425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
426
427
428% callable(@term) -- built-in
429
430
431
432%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
433%
434%  read character predicate
435%
436%  read a single character echoing it and writing a newline after
437%
438%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
439
440
441'$lgt_read_single_char'(Char) :-
442    get(Code), name(Char, [Code]).
443
444
445
446%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
447%
448%  pretty print a term by naming its free variables
449%  (avoid instantiating variables in term by using double negation if necessary)
450%
451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
452
453
454'$lgt_pretty_print_vars'(Stream, Term) :-
455    \+ \+ (
456        numbervars(Term, 0, _),
457        write_term(Stream, Term, [numbervars(true)])).
458
459
460'$lgt_pretty_print_vars_quoted'(Stream, Term) :-
461    \+ \+ (
462        numbervars(Term, 0, _),
463        write_term(Stream, Term, [numbervars(true), quoted(true)])).
464
465
466
467%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
468%
469%  end!
470%
471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.