root/tags/lgt293/configs/k45.config

Revision 70, 8.0 KB (checked in by pmoura, 7 years ago)

Changed comments about Logtalk flags.

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