root/tags/lgt290/configs/aquarius.config

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