root/tags/lgt293/configs/aquarius.config

Revision 70, 7.7 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 
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%
3%  Logtalk - Object oriented extension to Prolog
4%  Release 2.9.3
5%
6%  initialization file for Aquarius Prolog 1.0
7%
8%  last updated: December 30, 2001
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 flag values
245%
246%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
247
248
249% lgt_default_flag(?atom, ?atom)
250%
251% default values for all flags
252
253lgt_default_flag(iso_initialization_dir, false).
254
255lgt_default_flag(xml, on).
256lgt_default_flag(xsl, 'lgtxml.xsl').
257
258lgt_default_flag(unknown, warning).
259lgt_default_flag(misspelt, warning).
260lgt_default_flag(singletons, warning).
261lgt_default_flag(lgtredef, warning).
262lgt_default_flag(plredef, silent).
263lgt_default_flag(portability, silent).
264
265lgt_default_flag(report, on).
266
267
268
269%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
270%
271%  list predicates
272%
273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
274
275
276lgt_append([], List, List).
277lgt_append([Head| Tail], List, [Head| Tail2]) :-
278    lgt_append(Tail, List, Tail2).
279
280
281lgt_member(Head, [Head| _]).
282lgt_member(Head, [_| Tail]) :-
283    lgt_member(Head, Tail).
284
285
286lgt_member_var(V, [H| _]) :-
287    V == H.
288lgt_member_var(V, [_| T]) :-
289    lgt_member_var(V, T).
290
291
292lgt_proper_list([]).
293lgt_proper_list([_| List]) :-
294    lgt_proper_list(List).
295
296
297
298%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
299%
300%  file predicates
301%
302%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
303
304
305% lgt_file_exists(+atom)
306%
307% see if a file exist in the current directory
308
309lgt_file_exists(File) :-
310    ?????
311
312
313% lgt_load_prolog_code(+atom)
314%
315% compile and load a Prolog file
316
317lgt_load_prolog_code(File) :-
318    reconsult(File).
319
320
321
322%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
323%
324%  sorting predicates
325%
326%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
327
328
329% lgt_keysort(+list, -list)
330
331lgt_keysort(List, Sorted) :-
332    keysort(List, Sorted).
333
334
335% lgt_sort(+list, -list)
336
337lgt_sort(List, Sorted) :-
338    sort(List, Sorted).
339
340
341
342%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
343%
344%  time and date predicates
345%
346%  if your Prolog compiler does not provide access to the operating system
347%  time and date just write dummy definitions
348%
349%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
350
351
352% lgt_current_date(?Year, ?Month, ?Day)
353
354lgt_current_date(1998, 2, 27).
355
356
357% lgt_current_time(?Hours, ?Mins, ?Secs)
358
359lgt_current_time(0, 0, 0).
360
361
362
363%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
364%
365%  timing predicate
366%
367%  if your Prolog compiler does not provide access to a timing predicate
368%  just write dummy definition
369%
370%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
371
372
373% lgt_cpu_time(-Seconds)
374
375lgt_cpu_time(Seconds) :-
376    statistics(runtime, [Miliseconds| _]),
377    Seconds is Miliseconds / 1000.
378
379
380
381%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
382%
383%  comparison predicate
384%
385%  the usual compare/3 definition
386%
387%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
388
389
390% compare(?atom, @term, @term) -- built-in
391
392
393
394%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
395%
396%  end!
397%
398%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.