root/tags/lgt2202/configs/yap.config

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