root/tags/lgt293/configs/open.config

Revision 70, 8.2 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%  configuration file for Open Prolog 1.1b4
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(abolish(_)).
34lgt_iso_predicate(atom_codes(_, _)).
35lgt_iso_predicate(atom_concat(_, _, _)).
36lgt_iso_predicate(current_predicate(_)).
37lgt_iso_predicate(float(_)).
38lgt_iso_predicate(nl(_)).
39lgt_iso_predicate(number_codes(_, _)).
40lgt_iso_predicate(read_term(_, _, _)).
41lgt_iso_predicate(write_term(_, _, _)).
42
43
44abolish(Functor/Arity) :-
45    abolish(Functor, Arity).
46
47
48atom_codes(Atom, Codes) :-
49    name(Atom, Codes).
50
51
52atom_concat(Atom1, Atom2, Atom3) :-
53    nonvar(Atom1), nonvar(Atom2),
54    !,
55    name(Atom1, Codes1),
56    name(Atom2, Codes2),
57    lgt_append(Codes1, Codes2, Codes3),
58    name(Atom3, Codes3).
59
60atom_concat(Atom1, Atom2, Atom3) :-
61    nonvar(Atom3),
62    !,
63    name(Atom3, Codes3),
64    lgt_append(Codes1, Codes2, Codes3),
65    name(Atom1, Codes1),
66    name(Atom2, Codes2).
67
68
69current_predicate(Functor/Arity) :-
70    current_predicate(Functor, Term),
71    functor(Term, Functor, Arity).
72
73
74float(Term) :-
75    number(Term).
76
77
78nl(Stream) :-
79    telling(Current),
80    tell(Stream),
81    nl,
82    tell(Current).
83
84
85number_codes(Number, Codes) :-
86    name(Number, Codes).
87
88
89read_term(Stream, Term, Options) :-
90    seeing(Current),
91    see(Stream),
92    read_term(Term, Options),
93    see(Current).
94
95
96write_term(Stream, Term, [quoted(true)]) :-
97    !,
98    telling(Current),
99    tell(Stream),
100    writeq(Term),
101    tell(Current).
102
103write_term(Stream, Term, _) :-
104    telling(Current),
105    tell(Stream),
106    write(Term),
107    tell(Current).
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(Term, built_in) :-
124    'system$predicate'(_, Term, 'built-in').
125
126lgt_predicate_property(Term, static) :-
127    'system$predicate'(_, Term, 'built-in').
128
129lgt_predicate_property(Term, (dynamic)) :-
130    'system$predicate'(_, Term, normal).
131
132
133
134%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
135%
136%  metapredicates
137%
138%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
139
140
141% forall(+callable, +callble)
142
143forall(Generate, Test) :-
144    \+ call((Generate, \+ call(Test))).
145
146
147% retractall(+callable)
148
149retractall(Head) :-
150    retract(Head),
151    fail.
152
153retractall(Head) :-
154    retract((Head :- _)),
155    fail.
156
157retractall(_).
158
159
160% lgt_call/2-8
161%
162% use these definitions only if your compiler does
163% not provide call/1-8 as built-in predicates
164
165lgt_call(F, A) :-
166    Call =.. [F, A],
167    call(Call).
168
169
170lgt_call(F, A1, A2) :-
171    Call =.. [F, A1, A2],
172    call(Call).
173
174
175lgt_call(F, A1, A2, A3) :-
176    Call =.. [F, A1, A2, A3],
177    call(Call).
178
179
180lgt_call(F, A1, A2, A3, A4) :-
181    Call =.. [F, A1, A2, A3, A4],
182    call(Call).
183
184
185lgt_call(F, A1, A2, A3, A4, A5) :-
186    Call =.. [F, A1, A2, A3, A4, A5],
187    call(Call).
188
189
190lgt_call(F, A1, A2, A3, A4, A5, A6) :-
191    Call =.. [F, A1, A2, A3, A4, A5, A6],
192    call(Call).
193
194
195lgt_call(F, A1, A2, A3, A4, A5, A6, A7) :-
196    Call =.. [F, A1, A2, A3, A4, A5, A6, A7],
197    call(Call).
198
199
200% lgt_once/2-8
201%
202% if your compiler provides call/1-8 as built-in
203% predicates rewrite these definitions using call(...), !.
204
205lgt_once(F, A) :-
206    Call =.. [F, A],
207    once(Call).
208
209
210lgt_once(F, A1, A2) :-
211    Call =.. [F, A1, A2],
212    once(Call).
213
214
215lgt_once(F, A1, A2, A3) :-
216    Call =.. [F, A1, A2, A3],
217    once(Call).
218
219
220lgt_once(F, A1, A2, A3, A4) :-
221    Call =.. [F, A1, A2, A3, A4],
222    once(Call).
223
224
225lgt_once(F, A1, A2, A3, A4, A5) :-
226    Call =.. [F, A1, A2, A3, A4, A5],
227    once(Call).
228
229
230lgt_once(F, A1, A2, A3, A4, A5, A6) :-
231    Call =.. [F, A1, A2, A3, A4, A5, A6],
232    once(Call).
233
234
235lgt_once(F, A1, A2, A3, A4, A5, A6, A7) :-
236    Call =.. [F, A1, A2, A3, A4, A5, A6, A7],
237    once(Call).
238
239
240
241%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
242%
243%  file extension predicates
244%
245%  these extensions are used by Logtalk load/compile predicates
246%
247%  you may want to change the extension for Prolog files to match
248%  the one expected by your Prolog compiler
249%
250%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
251
252
253% lgt_file_extension(?atom, ?atom)
254
255lgt_file_extension(logtalk, '.lgt').
256lgt_file_extension(prolog, '.pl').
257lgt_file_extension(xml, '.xml').
258
259
260
261%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
262%
263%  default flag values
264%
265%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
266
267
268% lgt_default_flag(?atom, ?atom)
269%
270% default values for all flags
271
272lgt_default_flag(iso_initialization_dir, false).
273
274lgt_default_flag(xml, on).
275lgt_default_flag(xsl, 'lgtxml.xsl').
276
277lgt_default_flag(unknown, warning).
278lgt_default_flag(misspelt, warning).
279lgt_default_flag(singletons, warning).
280lgt_default_flag(lgtredef, warning).
281lgt_default_flag(plredef, silent).
282lgt_default_flag(portability, silent).
283
284lgt_default_flag(report, on).
285
286
287
288%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
289%
290%  list predicates
291%
292%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
293
294
295lgt_append([], List, List).
296lgt_append([Head| Tail], List, [Head| Tail2]) :-
297    lgt_append(Tail, List, Tail2).
298
299
300lgt_member(Head, [Head| _]).
301lgt_member(Head, [_| Tail]) :-
302    lgt_member(Head, Tail).
303
304
305lgt_member_var(V, [H| _]) :-
306    V == H.
307lgt_member_var(V, [_| T]) :-
308    lgt_member_var(V, T).
309
310
311lgt_proper_list([]).
312lgt_proper_list([_| List]) :-
313    lgt_proper_list(List).
314
315
316
317%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
318%
319%  file predicates
320%
321%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
322
323
324% lgt_file_exists(+atom)
325%
326% see if a file exist in the current directory
327
328lgt_file_exists(File) :-
329    exists(File).
330
331
332% lgt_load_prolog_code(+atom)
333%
334% compile and load a Prolog file
335
336lgt_load_prolog_code(File) :-
337    reconsult(File).
338
339
340
341%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
342%
343%  sorting predicates
344%
345%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
346
347
348% lgt_keysort(+list, -list)
349
350lgt_keysort(List, Sorted) :-
351    keysort(List, Sorted).
352
353
354% lgt_sort(+list, -list)
355
356lgt_sort(List, Sorted) :-
357    sort(List, Sorted).
358
359
360
361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
362%
363%  time and date predicates
364%
365%  if your Prolog compiler does not provide access to the operating system
366%  time and date just write dummy definitions
367%
368%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
369
370
371% lgt_current_date(?Year, ?Month, ?Day)
372
373lgt_current_date(98, 11, 5).
374
375
376% lgt_current_time(?Hours, ?Mins, ?Secs)
377
378lgt_current_time(Hours, Mins, Secs) :-
379    'system$seconds'(Seconds),
380    'system$time'(Seconds, Time),
381    name(Time, [H1, H2, _, M1, M2, _, S1, S2]),
382    name(Hours, [H1, H2]),
383    name(Mins, [M1, M2]),
384    name(Secs, [S1, S2]).
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
400lgt_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%  end!
422%
423%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.