root/tags/lgt2210/configs/open.config

Revision 1460, 10.9 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 Open Prolog 1.1b5
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
27initialization(Goal) :-
28    call(Goal).
29
30
31% '$lgt_iso_predicate'(?callable).
32
33'$lgt_iso_predicate'(abolish(_)).
34'$lgt_iso_predicate'(atom_codes(_, _)).
35'$lgt_iso_predicate'(atom_concat(_, _, _)).
36'$lgt_iso_predicate'(current_predicate(_)).
37'$lgt_iso_predicate'(float(_)).
38'$lgt_iso_predicate'(nl(_)).
39'$lgt_iso_predicate'(number_codes(_, _)).
40'$lgt_iso_predicate'(read_term(_, _, _)).
41'$lgt_iso_predicate'(write_canonical(_, _)).
42'$lgt_iso_predicate'(write_term(_, _, _)).
43
44
45abolish(Functor/Arity) :-
46    abolish(Functor, Arity).
47
48
49atom_codes(Atom, Codes) :-
50    name(Atom, Codes).
51
52
53atom_concat(Atom1, Atom2, Atom3) :-
54    nonvar(Atom1), nonvar(Atom2),
55    !,
56    name(Atom1, Codes1),
57    name(Atom2, Codes2),
58    '$lgt_append'(Codes1, Codes2, Codes3),
59    name(Atom3, Codes3).
60
61atom_concat(Atom1, Atom2, Atom3) :-
62    nonvar(Atom3),
63    !,
64    name(Atom3, Codes3),
65    '$lgt_append'(Codes1, Codes2, Codes3),
66    name(Atom1, Codes1),
67    name(Atom2, Codes2).
68
69
70current_predicate(Functor/Arity) :-
71    current_predicate(Functor, Term),
72    functor(Term, Functor, Arity).
73
74
75float(Term) :-
76    number(Term).
77
78
79nl(Stream) :-
80    telling(Current),
81    tell(Stream),
82    nl,
83    tell(Current).
84
85
86number_codes(Number, Codes) :-
87    name(Number, Codes).
88
89
90read_term(Stream, Term, Options) :-
91    seeing(Current),
92    see(Stream),
93    read_term(Term, Options),
94    see(Current).
95
96
97write_canonical(Stream, Term) :-
98    telling(Current),
99    tell(Stream),
100    writeq(Term),
101    tell(Current).
102
103
104write_term(Stream, Term, [quoted(true)]) :-
105    !,
106    telling(Current),
107    tell(Stream),
108    writeq(Term),
109    tell(Current).
110
111write_term(Stream, Term, _) :-
112    telling(Current),
113    tell(Stream),
114    write(Term),
115    tell(Current).
116
117
118
119%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
120%
121%  predicate properties
122%
123%  this predicate must return at least static, dynamic, and built_in
124%  properties for an existing predicate
125%
126%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
127
128
129% '$lgt_predicate_property'(+callable, ?predicate_property)
130
131'$lgt_predicate_property'(Term, built_in) :-
132    'system$predicate'(_, Term, 'built-in').
133
134'$lgt_predicate_property'(Term, static) :-
135    'system$predicate'(_, Term, 'built-in').
136
137'$lgt_predicate_property'(Term, (dynamic)) :-
138    'system$predicate'(_, Term, normal).
139
140
141
142%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
143%
144%  metapredicates
145%
146%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
147
148
149% forall(+callable, +callble)
150
151forall(Generate, Test) :-
152    \+ call((Generate, \+ call(Test))).
153
154
155% retractall(+callable)
156
157retractall(Head) :-
158    retract(Head),
159    fail.
160
161retractall(Head) :-
162    retract((Head :- _)),
163    fail.
164
165retractall(_).
166
167
168% lgt_call/2-8
169%
170% use these definitions only if your compiler does
171% not provide call/1-8 as built-in predicates
172
173'$lgt_call'(F, A) :-
174    Call =.. [F, A],
175    call(Call).
176
177
178'$lgt_call'(F, A1, A2) :-
179    Call =.. [F, A1, A2],
180    call(Call).
181
182
183'$lgt_call'(F, A1, A2, A3) :-
184    Call =.. [F, A1, A2, A3],
185    call(Call).
186
187
188'$lgt_call'(F, A1, A2, A3, A4) :-
189    Call =.. [F, A1, A2, A3, A4],
190    call(Call).
191
192
193'$lgt_call'(F, A1, A2, A3, A4, A5) :-
194    Call =.. [F, A1, A2, A3, A4, A5],
195    call(Call).
196
197
198'$lgt_call'(F, A1, A2, A3, A4, A5, A6) :-
199    Call =.. [F, A1, A2, A3, A4, A5, A6],
200    call(Call).
201
202
203'$lgt_call'(F, A1, A2, A3, A4, A5, A6, A7) :-
204    Call =.. [F, A1, A2, A3, A4, A5, A6, A7],
205    call(Call).
206
207
208% lgt_once/2-8
209%
210% if your compiler provides call/1-8 as built-in
211% predicates rewrite these definitions using call(...), !.
212
213'$lgt_once'(F, A) :-
214    Call =.. [F, A],
215    once(Call).
216
217
218'$lgt_once'(F, A1, A2) :-
219    Call =.. [F, A1, A2],
220    once(Call).
221
222
223'$lgt_once'(F, A1, A2, A3) :-
224    Call =.. [F, A1, A2, A3],
225    once(Call).
226
227
228'$lgt_once'(F, A1, A2, A3, A4) :-
229    Call =.. [F, A1, A2, A3, A4],
230    once(Call).
231
232
233'$lgt_once'(F, A1, A2, A3, A4, A5) :-
234    Call =.. [F, A1, A2, A3, A4, A5],
235    once(Call).
236
237
238'$lgt_once'(F, A1, A2, A3, A4, A5, A6) :-
239    Call =.. [F, A1, A2, A3, A4, A5, A6],
240    once(Call).
241
242
243'$lgt_once'(F, A1, A2, A3, A4, A5, A6, A7) :-
244    Call =.. [F, A1, A2, A3, A4, A5, A6, A7],
245    once(Call).
246
247
248
249%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
250%
251%  Prolog built-in metapredicates
252%
253%  (excluding ISO Prolog Standard metapredicates)
254%
255%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
256
257
258% '$lgt_pl_metapredicate'(?callable).
259
260'$lgt_pl_metapredicate'(_) :-
261    fail.
262
263
264
265%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
266%
267%  file extension predicates
268%
269%  these extensions are used by Logtalk load/compile predicates
270%
271%  you may want to change the extension for Prolog files to match
272%  the one expected by your Prolog compiler
273%
274%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
275
276
277% '$lgt_file_extension'(?atom, ?atom)
278
279'$lgt_file_extension'(metafile, '.mlgt').
280'$lgt_file_extension'(logtalk, '.lgt').
281'$lgt_file_extension'(prolog, '.pl').
282'$lgt_file_extension'(xml, '.xml').
283
284
285
286%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
287%
288%  default flag values
289%
290%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
291
292
293% '$lgt_default_flag'(?atom, ?atom)
294%
295% default values for all flags
296
297'$lgt_default_flag'(iso_initialization_dir, false).
298
299'$lgt_default_flag'(xml, on).
300'$lgt_default_flag'(xsl, 'lgtxml.xsl').
301'$lgt_default_flag'(xmlspec, dtd).
302'$lgt_default_flag'(doctype, local).
303
304'$lgt_default_flag'(unknown, warning).
305'$lgt_default_flag'(misspelt, warning).
306'$lgt_default_flag'(singletons, warning).
307'$lgt_default_flag'(lgtredef, warning).
308'$lgt_default_flag'(plredef, silent).
309'$lgt_default_flag'(portability, silent).
310
311'$lgt_default_flag'(report, on).
312
313'$lgt_default_flag'(smart_compilation, off).
314
315'$lgt_default_flag'(startup_message, flags).
316
317'$lgt_default_flag'(underscore_vars, singletons).
318
319'$lgt_default_flag'(code_prefix, '').
320
321'$lgt_default_flag'(debug, off).
322'$lgt_default_flag'(supports_break_predicate, false).
323
324
325
326%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
327%
328%  list predicates
329%
330%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
331
332
333'$lgt_append'([], List, List).
334'$lgt_append'([Head| Tail], List, [Head| Tail2]) :-
335    '$lgt_append'(Tail, List, Tail2).
336
337
338'$lgt_member'(Head, [Head| _]).
339'$lgt_member'(Head, [_| Tail]) :-
340    '$lgt_member'(Head, Tail).
341
342
343'$lgt_member_var'(V, [H| _]) :-
344    V == H.
345'$lgt_member_var'(V, [_| T]) :-
346    '$lgt_member_var'(V, T).
347
348
349'$lgt_proper_list'([]).
350'$lgt_proper_list'([_| List]) :-
351    '$lgt_proper_list'(List).
352
353
354'$lgt_reverse'(List, Reversed) :-
355    '$lgt_reverse'(List, [], Reversed, Reversed).
356
357'$lgt_reverse'([], Reversed, Reversed, []).
358'$lgt_reverse'([Head| Tail], List, Reversed, [_| Bound]) :-
359    '$lgt_reverse'(Tail, [Head| List], Reversed, Bound).
360
361
362
363%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
364%
365%  file predicates
366%
367%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
368
369
370% '$lgt_file_exists'(+atom)
371%
372% see if a file exist in the current directory
373
374'$lgt_file_exists'(File) :-
375    exists(File).
376
377
378% '$lgt_load_prolog_code'(+atom)
379%
380% compile and load a Prolog file
381
382'$lgt_load_prolog_code'(File) :-
383    reconsult(File).
384
385
386% '$lgt_compare_file_mtimes'(?atom, +atom, +atom)
387%
388% compare file modification times
389
390'$lgt_compare_file_mtimes'(Result, File1, File2) :-
391    current_folder(Folder),
392    op_oracle(file(Folder, File1), modification_date(Time1)),
393    op_oracle(file(Folder, File2), modification_date(Time2)),
394    compare(Result, Time1, Time2).
395
396
397
398%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
399%
400%  sorting predicates
401%
402%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
403
404
405% '$lgt_keysort'(+list, -list)
406
407'$lgt_keysort'(List, Sorted) :-
408    keysort(List, Sorted).
409
410
411% '$lgt_sort'(+list, -list)
412
413'$lgt_sort'(List, Sorted) :-
414    sort(List, Sorted).
415
416
417
418%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
419%
420%  time and date predicates
421%
422%  if your Prolog compiler does not provide access to the operating system
423%  time and date just write dummy definitions
424%
425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
426
427
428% '$lgt_current_date'(?Year, ?Month, ?Day)
429
430'$lgt_current_date'(98, 11, 5).
431
432
433% '$lgt_current_time'(?Hours, ?Mins, ?Secs)
434
435'$lgt_current_time'(Hours, Mins, Secs) :-
436    'system$seconds'(Seconds),
437    'system$time'(Seconds, Time),
438    name(Time, [H1, H2, _, M1, M2, _, S1, S2]),
439    name(Hours, [H1, H2]),
440    name(Mins, [M1, M2]),
441    name(Secs, [S1, S2]).
442
443
444
445%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
446%
447%  timing predicate
448%
449%  if your Prolog compiler does not provide access to a timing predicate
450%  just write dummy definition
451%
452%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
453
454
455% '$lgt_cpu_time'(-Seconds)
456
457'$lgt_cpu_time'(Seconds) :-
458    statistics(runtime, [Miliseconds,_]),
459    Seconds is Miliseconds / 1000.
460
461
462
463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
464%
465%  comparison predicate
466%
467%  the usual compare/3 definition
468%
469%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
470
471
472% compare(?atom, @term, @term) -- built-in
473
474
475
476%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
477%
478%  callable predicate
479%
480%  the usual callable/1 definition
481%
482%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
483
484
485% callable(@term)
486
487callable(Term) :-
488    once((atom(Term); compound(Term))).
489
490
491
492%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
493%
494%  read character predicate
495%
496%  read a single character echoing it and writing a newline after
497%
498%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
499
500
501'$lgt_read_single_char'(Char) :-
502    get(Code), name(Char, [Code]).
503
504
505
506%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
507%
508%  pretty print a term by naming its free variables
509%  (avoid instantiating variables in term by using double negation if necessary)
510%
511%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
512
513
514'$lgt_pretty_print_vars'(Stream, Term) :-
515    \+ \+ (numbervars(Term, 0, _), write(Stream, Term)).
516
517
518'$lgt_pretty_print_vars_quoted'(Stream, Term) :-
519    \+ \+ (numbervars(Term, 0, _), writeq(Stream, Term)).
520
521
522
523%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
524%
525%  end!
526%
527%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.