root/tags/lgt2212/configs/prologII.config

Revision 1540, 9.1 KB (checked in by pmoura, 4 years ago)

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