root/tags/lgt290/configs/k45.config

Revision 2, 8.1 KB (checked in by pmoura, 7 years ago)

Initial revision

  • 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.0
5%
6%  configuration file for K-Prolog 4.50
7%
8%  last updated: August 24, 2000
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 compiler options
255%
256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
257
258
259% lgt_default_compiler_option(?atom, ?atom)
260%
261% default values for all compiler options
262
263lgt_default_compiler_option(iso_initialization_dir, false).
264
265lgt_default_compiler_option(xml, on).
266lgt_default_compiler_option(xsl, 'lgtxml.xsl').
267
268lgt_default_compiler_option(unknown, warning).
269lgt_default_compiler_option(misspelt, warning).
270lgt_default_compiler_option(singletons, warning).
271lgt_default_compiler_option(lgtredef, warning).
272lgt_default_compiler_option(plredef, silent).
273
274lgt_default_compiler_option(report, on).
275
276
277
278%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
279%
280%  list predicates
281%
282%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
283
284
285lgt_append([], List, List).
286lgt_append([Head| Tail], List, [Head| Tail2]) :-
287    lgt_append(Tail, List, Tail2).
288
289
290lgt_member(Head, [Head| _]).
291lgt_member(Head, [_| Tail]) :-
292    lgt_member(Head, Tail).
293
294
295lgt_member_var(V, [H| _]) :-
296    V == H.
297lgt_member_var(V, [_| T]) :-
298    lgt_member_var(V, T).
299
300
301lgt_proper_list([]).
302lgt_proper_list([_| List]) :-
303    lgt_proper_list(List).
304
305
306
307%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
308%
309%  file predicates
310%
311%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
312
313
314% lgt_file_exists(+atom)
315%
316% see if a file exist in the current directory
317
318lgt_file_exists(File) :-
319    dir('.', Files, _),
320    lgt_member(Name, Files),
321    fname(Name, File),
322    !.
323
324
325% lgt_load_prolog_code(+atom)
326%
327% compile and load a Prolog file
328
329lgt_load_prolog_code(File) :-
330    reconsult(File).
331
332
333
334%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
335%
336%  sorting predicates
337%
338%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
339
340
341% lgt_keysort(+list, -list)
342
343lgt_keysort(List, Sorted) :-
344    keysort(List, Sorted).
345
346
347% lgt_sort(+list, -list)
348
349lgt_sort(List, Sorted) :-
350    sort(List, Sorted).
351
352
353
354%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
355%
356%  time and date predicates
357%
358%  if your Prolog compiler does not provide access to the operating system
359%  time and date just write dummy definitions
360%
361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
362
363
364% lgt_current_date(?Year, ?Month, ?Day)
365
366lgt_current_date(Year, Month, Day) :-
367    time(_, _, _, Day, Month, Year, _, _, _).
368
369
370% lgt_current_time(?Hours, ?Mins, ?Secs)
371
372lgt_current_time(Hours, Mins, Secs) :-
373    time(Secs, Mins, Hours, _, _, _, _, _, _).
374
375
376
377%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
378%
379%  timing predicate
380%
381%  if your Prolog compiler does not provide access to a timing predicate
382%  just write dummy definition
383%
384%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
385
386
387% lgt_cpu_time(-Seconds)
388
389lgt_cpu_time(Seconds) :-
390    statistics(_, _, _, _, Seconds, _, _).
391
392
393
394%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
395%
396%  comparison predicate
397%
398%  the usual compare/3 definition
399%
400%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
401
402
403% compare(?atom, @term, @term) -- built-in
404
405
406
407%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
408%
409%  end!
410%
411%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.