root/tags/lgt290/configs/arity.config

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