root/tags/lgt290/configs/quintus.config

Revision 2, 7.6 KB (checked in by pmoura, 7 years ago)

Initial revision

  • 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.0
5%
6%  configuration file for Quintus Prolog 3.3
7%
8%  last updated: August 24, 2000
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 compiler options
220%
221%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
222
223
224% lgt_default_compiler_option(?atom, ?atom)
225%
226% default values for all compiler options
227
228lgt_default_compiler_option(iso_initialization_dir, true).
229
230lgt_default_compiler_option(xml, on).
231lgt_default_compiler_option(xsl, 'lgtxml.xsl').
232
233lgt_default_compiler_option(unknown, warning).
234lgt_default_compiler_option(misspelt, warning).
235lgt_default_compiler_option(singletons, warning).
236lgt_default_compiler_option(lgtredef, warning).
237lgt_default_compiler_option(plredef, silent).
238
239lgt_default_compiler_option(report, on).
240
241
242
243%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
244%
245%  list predicates
246%
247%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
248
249
250lgt_append([], List, List).
251lgt_append([Head| Tail], List, [Head| Tail2]) :-
252    lgt_append(Tail, List, Tail2).
253
254
255lgt_member(Head, [Head| _]).
256lgt_member(Head, [_| Tail]) :-
257    lgt_member(Head, Tail).
258
259
260lgt_member_var(V, [H| _]) :-
261    V == H.
262lgt_member_var(V, [_| T]) :-
263    lgt_member_var(V, T).
264
265
266lgt_proper_list([]).
267lgt_proper_list([_| List]) :-
268    lgt_proper_list(List).
269
270
271
272%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
273%
274%  file predicates
275%
276%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
277
278
279% lgt_file_exists(+atom)
280%
281% see if a file exist in the current directory
282
283lgt_file_exists(File) :-
284    absolute_file_name(File, [access(exist), file_errors(fail)], _).
285
286
287% lgt_load_prolog_code(+atom)
288%
289% compile and load a Prolog file
290
291lgt_load_prolog_code(File) :-
292    compile(File).
293
294
295
296%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
297%
298%  sorting predicates
299%
300%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
301
302
303% lgt_keysort(+list, -list)
304
305lgt_keysort(List, Sorted) :-
306    keysort(List, Sorted).
307
308
309% lgt_sort(+list, -list)
310
311lgt_sort(List, Sorted) :-
312    sort(List, Sorted).
313
314
315
316%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
317%
318%  time and date predicates
319%
320%  if your Prolog compiler does not provide access to the operating system
321%  time and date just write dummy definitions
322%
323%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
324
325
326% lgt_current_date(?Year, ?Month, ?Day)
327
328lgt_current_date(Year, Month, Day) :-
329    date(date(Day, Month, Year)).
330
331
332% lgt_current_time(?Hours, ?Mins, ?Secs)
333
334lgt_current_time(Hours, Mins, Secs) :-
335    time(time(Hours, Mins, Secs)).
336
337
338
339%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
340%
341%  timing predicate
342%
343%  if your Prolog compiler does not provide access to a timing predicate
344%  just write dummy definition
345%
346%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
347
348
349% lgt_cpu_time(-Seconds)
350
351lgt_cpu_time(Seconds) :-
352    statistics(runtime, [Miliseconds| _]),
353    Seconds is Miliseconds / 1000.
354
355
356
357%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
358%
359%  comparison predicate
360%
361%  the usual compare/3 definition
362%
363%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
364
365
366% compare(?atom, @term, @term) -- built-in
367
368
369
370%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
371%
372%  end!
373%
374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.