root/tags/lgt2202/configs/gnu.config

Revision 1438, 8.7 KB (checked in by pmoura, 4 years ago)

Updated Logtalk release number to 2.20.2.

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