root/tags/lgt2210/configs/ifprolog.config

Revision 1460, 8.8 KB (checked in by pmoura, 4 years ago)

Updated release number to 2.21.0.

  • 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.21.0
5%
6%  configuration file for IF/Prolog 5.1
7%
8%  last updated: July 17, 2004
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
27% '$lgt_iso_predicate'(?callable).
28
29'$lgt_iso_predicate'(_) :-
30    fail.
31
32
33
34%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35%
36%  predicate properties
37%
38%  this predicate must return at least static, dynamic, and built_in
39%  properties for an existing predicate
40%
41%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42
43
44% '$lgt_predicate_property'(+callable, ?predicate_property)
45
46'$lgt_predicate_property'(Pred, Prop) :-
47    predicate_property(Pred, Prop).
48
49
50
51%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52%
53%  metapredicates
54%
55%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56
57
58% forall(+callable, +callble)
59
60forall(Generate, Test) :-
61    \+ call((Generate, \+ call(Test))).
62
63
64% lgt_call/2-8
65%
66% use these definitions only if your compiler does
67% not provide call/1-8 as built-in predicates
68
69'$lgt_call'(F, A) :-
70    Call =.. [F, A],
71    call(Call).
72
73
74'$lgt_call'(F, A1, A2) :-
75    Call =.. [F, A1, A2],
76    call(Call).
77
78
79'$lgt_call'(F, A1, A2, A3) :-
80    Call =.. [F, A1, A2, A3],
81    call(Call).
82
83
84'$lgt_call'(F, A1, A2, A3, A4) :-
85    Call =.. [F, A1, A2, A3, A4],
86    call(Call).
87
88
89'$lgt_call'(F, A1, A2, A3, A4, A5) :-
90    Call =.. [F, A1, A2, A3, A4, A5],
91    call(Call).
92
93
94'$lgt_call'(F, A1, A2, A3, A4, A5, A6) :-
95    Call =.. [F, A1, A2, A3, A4, A5, A6],
96    call(Call).
97
98
99'$lgt_call'(F, A1, A2, A3, A4, A5, A6, A7) :-
100    Call =.. [F, A1, A2, A3, A4, A5, A6, A7],
101    call(Call).
102
103
104% lgt_once/2-8
105%
106% if your compiler provides call/1-8 as built-in
107% predicates rewrite these definitions using call(...), !.
108
109'$lgt_once'(F, A) :-
110    Call =.. [F, A],
111    once(Call).
112
113
114'$lgt_once'(F, A1, A2) :-
115    Call =.. [F, A1, A2],
116    once(Call).
117
118
119'$lgt_once'(F, A1, A2, A3) :-
120    Call =.. [F, A1, A2, A3],
121    once(Call).
122
123
124'$lgt_once'(F, A1, A2, A3, A4) :-
125    Call =.. [F, A1, A2, A3, A4],
126    once(Call).
127
128
129'$lgt_once'(F, A1, A2, A3, A4, A5) :-
130    Call =.. [F, A1, A2, A3, A4, A5],
131    once(Call).
132
133
134'$lgt_once'(F, A1, A2, A3, A4, A5, A6) :-
135    Call =.. [F, A1, A2, A3, A4, A5, A6],
136    once(Call).
137
138
139'$lgt_once'(F, A1, A2, A3, A4, A5, A6, A7) :-
140    Call =.. [F, A1, A2, A3, A4, A5, A6, A7],
141    once(Call).
142
143
144
145%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
146%
147%  Prolog built-in metapredicates
148%
149%  (excluding ISO Prolog Standard metapredicates)
150%
151%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
152
153
154% '$lgt_pl_metapredicate'(?callable).
155
156'$lgt_pl_metapredicate'(_) :-
157    fail.
158
159
160
161%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
162%
163%  file extension predicates
164%
165%  these extensions are used by Logtalk load/compile predicates
166%
167%  you may want to change the extension for Prolog files to match
168%  the one expected by your Prolog compiler
169%
170%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
171
172
173% '$lgt_file_extension'(?atom, ?atom)
174
175'$lgt_file_extension'(metafile, '.mlgt').
176'$lgt_file_extension'(logtalk, '.lgt').
177'$lgt_file_extension'(prolog, '.pl').
178'$lgt_file_extension'(xml, '.xml').
179
180
181
182%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
183%
184%  default flag values
185%
186%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
187
188
189% '$lgt_default_flag'(?atom, ?atom)
190%
191% default values for all flags
192
193'$lgt_default_flag'(iso_initialization_dir, true).
194
195'$lgt_default_flag'(xml, on).
196'$lgt_default_flag'(xsl, 'lgtxml.xsl').
197'$lgt_default_flag'(xmlspec, dtd).
198'$lgt_default_flag'(doctype, local).
199
200'$lgt_default_flag'(unknown, warning).
201'$lgt_default_flag'(misspelt, warning).
202'$lgt_default_flag'(singletons, warning).
203'$lgt_default_flag'(lgtredef, warning).
204'$lgt_default_flag'(plredef, silent).
205'$lgt_default_flag'(portability, silent).
206
207'$lgt_default_flag'(report, on).
208
209'$lgt_default_flag'(smart_compilation, off).
210
211'$lgt_default_flag'(startup_message, flags).
212
213'$lgt_default_flag'(underscore_vars, singletons).
214
215'$lgt_default_flag'(code_prefix, '').
216
217'$lgt_default_flag'(debug, off).
218'$lgt_default_flag'(supports_break_predicate, true).
219
220
221
222%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
223%
224%  list predicates
225%
226%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
227
228
229'$lgt_append'([], List, List).
230'$lgt_append'([Head| Tail], List, [Head| Tail2]) :-
231    '$lgt_append'(Tail, List, Tail2).
232
233
234'$lgt_member'(Head, [Head| _]).
235'$lgt_member'(Head, [_| Tail]) :-
236    '$lgt_member'(Head, Tail).
237
238
239'$lgt_member_var'(V, [H| _]) :-
240    V == H.
241'$lgt_member_var'(V, [_| T]) :-
242    '$lgt_member_var'(V, T).
243
244
245'$lgt_proper_list'([]).
246'$lgt_proper_list'([_| List]) :-
247    '$lgt_proper_list'(List).
248
249
250'$lgt_reverse'(List, Reversed) :-
251    '$lgt_reverse'(List, [], Reversed, Reversed).
252
253'$lgt_reverse'([], Reversed, Reversed, []).
254'$lgt_reverse'([Head| Tail], List, Reversed, [_| Bound]) :-
255    '$lgt_reverse'(Tail, [Head| List], Reversed, Bound).
256
257
258
259%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
260%
261%  file predicates
262%
263%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
264
265
266% '$lgt_file_exists'(+atom)
267%
268% see if a file exist in the current directory
269
270'$lgt_file_exists'(File) :-
271    file_test(File, read).
272
273
274% '$lgt_load_prolog_code'(+atom)
275%
276% compile and load a Prolog file
277
278'$lgt_load_prolog_code'(File) :-
279    reconsult(File).
280
281
282% '$lgt_compare_file_mtimes'(?atom, +atom, +atom)
283%
284% compare file modification times
285
286'$lgt_compare_file_mtimes'(Result, File1, File2) :-
287    get_file_info(File1, mtime, Time1),
288    get_file_info(File2, mtime, Time2),
289    compare(Result, Time1, Time2).
290
291
292
293%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
294%
295%  sorting predicates
296%
297%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
298
299
300% '$lgt_keysort'(+list, -list)
301
302'$lgt_keysort'(List, Sorted) :-
303    throw(error(not_implemented, keysort/2)).
304
305
306% '$lgt_sort'(+list, -list)
307
308'$lgt_sort'(List, Sorted) :-
309    sort(List, Sorted).
310
311
312
313%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
314%
315%  time and date predicates
316%
317%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
318
319
320% '$lgt_current_date'(?Year, ?Month, ?Day)
321
322'$lgt_current_date'(Year, Month, Day) :-
323    localtime(time, Year, Month, Day, _, _, _, _, _).
324
325
326% '$lgt_current_time'(?Hours, ?Mins, ?Secs)
327
328'$lgt_current_time'(Hours, Mins, Secs) :-
329    localtime(time, _, _, _, _, _, Hours, Min, Secs).
330
331
332
333%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
334%
335%  timing predicate
336%
337%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
338
339
340% '$lgt_cpu_time'(-Seconds)
341
342'$lgt_cpu_time'(Seconds) :-
343    Seconds is cputime.
344
345
346
347%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
348%
349%  comparison predicate
350%
351%  the usual compare/3 definition
352%
353%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
354
355
356% compare(?atom, @term, @term) -- built-in
357
358
359
360%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
361%
362%  callable predicate
363%
364%  the usual callable/1 definition
365%
366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
367
368
369% callable(@term)
370
371callable(Term) :-
372    once((atom(Term); compound(Term))).
373
374
375
376%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
377%
378%  read character predicate
379%
380%  read a single character echoing it and writing a newline after
381%
382%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
383
384
385'$lgt_read_single_char'(Char) :-
386    get_char(Char).
387
388
389
390%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
391%
392%  pretty print a term by naming its free variables
393%  (avoid instantiating variables in term by using double negation if necessary)
394%
395%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
396
397
398'$lgt_pretty_print_vars'(Stream, Term) :-
399    \+ \+ (
400        numbervars(Term, 0, _),
401        write_term(Stream, Term, [numbervars(true)])).
402
403
404'$lgt_pretty_print_vars_quoted'(Stream, Term) :-
405    \+ \+ (
406        numbervars(Term, 0, _),
407        write_term(Stream, Term, [numbervars(true), quoted(true)])).
408
409
410
411%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
412%
413%  end!
414%
415%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.