root/tags/lgt290/configs/ciao_aux16.config

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