root/tags/lgt293/configs/quintus.config

Revision 70, 7.5 KB (checked in by pmoura, 7 years ago)

Changed comments about Logtalk flags.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1we%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%
3%  Logtalk - Object oriented extension to Prolog
4%  Release 2.9.3
5%
6%  configuration file for Quintus Prolog 3.3
7%
8%  last updated: December 30, 2001
9%
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12
13:- [library(date)].
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%  you must define; there must be at least one clause for this predicate
24%  whose call should fail if you don't define any ISO predicates
25%
26%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27
28
29:- op(700, xfx, \=).
30
31
32% lgt_iso_predicate(?callable).
33
34lgt_iso_predicate(_ \= _).
35lgt_iso_predicate(atom_codes(_, _)).
36lgt_iso_predicate(atom_concat(_, _, _)).
37lgt_iso_predicate(catch(_, _, _)).
38lgt_iso_predicate(number_codes(_, _)).
39lgt_iso_predicate(once(_)).
40lgt_iso_predicate(throw(_)).
41
42
43Term1 \= Term2 :-
44    \+ (Term1 = Term2).
45
46
47atom_codes(Atom, Codes) :-
48    atom_chars(Atom, Codes).
49
50
51atom_concat(Atom1, Atom2, Atom3) :-
52    nonvar(Atom1), nonvar(Atom2),
53    !,
54    atom_chars(Atom1, Codes1),
55    atom_chars(Atom2, Codes2),
56    lgt_append(Codes1, Codes2, Codes3),
57    atom_chars(Atom3, Codes3).
58
59atom_concat(Atom1, Atom2, Atom3) :-
60    nonvar(Atom3),
61    !,
62    atom_chars(Atom3, Codes3),
63    lgt_append(Codes1, Codes2, Codes3),
64    atom_chars(Atom1, Codes1),
65    atom_chars(Atom2, Codes2).
66
67
68catch(Goal, Catcher, Recovery) :-
69    on_exception(Catcher, Goal, Recovery).
70
71
72number_codes(Number, Codes) :-
73    number_chars(Number, Codes).
74
75
76once(Goal) :-
77    call(Goal),
78    !.
79
80
81throw(Ball) :-
82    raise_exception(Ball).
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(Pred, Prop) :-
99    predicate_property(Pred, Prop).
100
101
102
103%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
104%
105%  metapredicates
106%
107%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
108
109
110% forall(+callable, +callble)
111
112forall(Generate, Test) :-
113    \+ call((Generate, \+ call(Test))).
114
115
116% lgt_call/2-8
117%
118% use these definitions only if your compiler does
119% not provide call/1-8 as built-in predicates
120
121lgt_call(F, A) :-
122    Call =.. [F, A],
123    call(Call).
124
125
126lgt_call(F, A1, A2) :-
127    Call =.. [F, A1, A2],
128    call(Call).
129
130
131lgt_call(F, A1, A2, A3) :-
132    Call =.. [F, A1, A2, A3],
133    call(Call).
134
135
136lgt_call(F, A1, A2, A3, A4) :-
137    Call =.. [F, A1, A2, A3, A4],
138    call(Call).
139
140
141lgt_call(F, A1, A2, A3, A4, A5) :-
142    Call =.. [F, A1, A2, A3, A4, A5],
143    call(Call).
144
145
146lgt_call(F, A1, A2, A3, A4, A5, A6) :-
147    Call =.. [F, A1, A2, A3, A4, A5, A6],
148    call(Call).
149
150
151lgt_call(F, A1, A2, A3, A4, A5, A6, A7) :-
152    Call =.. [F, A1, A2, A3, A4, A5, A6, A7],
153    call(Call).
154
155
156% lgt_once/2-8
157%
158% if your compiler provides call/1-8 as built-in
159% predicates rewrite these definitions using call(...), !.
160
161lgt_once(F, A) :-
162    Call =.. [F, A],
163    once(Call).
164
165
166lgt_once(F, A1, A2) :-
167    Call =.. [F, A1, A2],
168    once(Call).
169
170
171lgt_once(F, A1, A2, A3) :-
172    Call =.. [F, A1, A2, A3],
173    once(Call).
174
175
176lgt_once(F, A1, A2, A3, A4) :-
177    Call =.. [F, A1, A2, A3, A4],
178    once(Call).
179
180
181lgt_once(F, A1, A2, A3, A4, A5) :-
182    Call =.. [F, A1, A2, A3, A4, A5],
183    once(Call).
184
185
186lgt_once(F, A1, A2, A3, A4, A5, A6) :-
187    Call =.. [F, A1, A2, A3, A4, A5, A6],
188    once(Call).
189
190
191lgt_once(F, A1, A2, A3, A4, A5, A6, A7) :-
192    Call =.. [F, A1, A2, A3, A4, A5, A6, A7],
193    once(Call).
194
195
196
197%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
198%
199%  file extension predicates
200%
201%  these extensions are used by Logtalk load/compile predicates
202%
203%  you may want to change the extension for Prolog files to match
204%  the one expected by your Prolog compiler
205%
206%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
207
208
209% lgt_file_extension(?atom, ?atom)
210
211lgt_file_extension(logtalk, '.lgt').
212lgt_file_extension(prolog, '.pl').
213lgt_file_extension(xml, '.xml').
214
215
216
217%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
218%
219%  default flag values
220%
221%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
222
223
224% lgt_default_flag(?atom, ?atom)
225%
226% default values for all flags
227
228lgt_default_flag(iso_initialization_dir, true).
229
230lgt_default_flag(xml, on).
231lgt_default_flag(xsl, 'lgtxml.xsl').
232
233lgt_default_flag(unknown, warning).
234lgt_default_flag(misspelt, warning).
235lgt_default_flag(singletons, warning).
236lgt_default_flag(lgtredef, warning).
237lgt_default_flag(plredef, silent).
238lgt_default_flag(portability, silent).
239
240lgt_default_flag(report, on).
241
242
243
244%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
245%
246%  list predicates
247%
248%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
249
250
251lgt_append([], List, List).
252lgt_append([Head| Tail], List, [Head| Tail2]) :-
253    lgt_append(Tail, List, Tail2).
254
255
256lgt_member(Head, [Head| _]).
257lgt_member(Head, [_| Tail]) :-
258    lgt_member(Head, Tail).
259
260
261lgt_member_var(V, [H| _]) :-
262    V == H.
263lgt_member_var(V, [_| T]) :-
264    lgt_member_var(V, T).
265
266
267lgt_proper_list([]).
268lgt_proper_list([_| List]) :-
269    lgt_proper_list(List).
270
271
272
273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
274%
275%  file predicates
276%
277%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
278
279
280% lgt_file_exists(+atom)
281%
282% see if a file exist in the current directory
283
284lgt_file_exists(File) :-
285    absolute_file_name(File, [access(exist), file_errors(fail)], _).
286
287
288% lgt_load_prolog_code(+atom)
289%
290% compile and load a Prolog file
291
292lgt_load_prolog_code(File) :-
293    compile(File).
294
295
296
297%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
298%
299%  sorting predicates
300%
301%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
302
303
304% lgt_keysort(+list, -list)
305
306lgt_keysort(List, Sorted) :-
307    keysort(List, Sorted).
308
309
310% lgt_sort(+list, -list)
311
312lgt_sort(List, Sorted) :-
313    sort(List, Sorted).
314
315
316
317%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
318%
319%  time and date predicates
320%
321%  if your Prolog compiler does not provide access to the operating system
322%  time and date just write dummy definitions
323%
324%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
325
326
327% lgt_current_date(?Year, ?Month, ?Day)
328
329lgt_current_date(Year, Month, Day) :-
330    date(date(Day, Month, Year)).
331
332
333% lgt_current_time(?Hours, ?Mins, ?Secs)
334
335lgt_current_time(Hours, Mins, Secs) :-
336    time(time(Hours, Mins, Secs)).
337
338
339
340%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
341%
342%  timing predicate
343%
344%  if your Prolog compiler does not provide access to a timing predicate
345%  just write dummy definition
346%
347%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
348
349
350% lgt_cpu_time(-Seconds)
351
352lgt_cpu_time(Seconds) :-
353    statistics(runtime, [Miliseconds| _]),
354    Seconds is Miliseconds / 1000.
355
356
357
358%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
359%
360%  comparison predicate
361%
362%  the usual compare/3 definition
363%
364%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
365
366
367% compare(?atom, @term, @term) -- built-in
368
369
370
371%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
372%
373%  end!
374%
375%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.