root/tags/lgt293/configs/arity.config

Revision 70, 7.7 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%  Arity/Prolog32 V 1.1
7%
8%  last updated: December 30, 2001
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 flag values
252%
253%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
254
255
256% lgt_default_flag(?atom, ?atom)
257%
258% default values for all flags
259
260lgt_default_flag(iso_initialization_dir, false).
261
262lgt_default_flag(xml, on).
263lgt_default_flag(xsl, 'lgtxml.xsl').
264
265lgt_default_flag(unknown, warning).
266lgt_default_flag(misspelt, warning).
267lgt_default_flag(singletons, warning).
268lgt_default_flag(lgtredef, warning).
269lgt_default_flag(plredef, silent).
270lgt_default_flag(portability, silent).
271
272lgt_default_flag(report, on).
273
274
275
276%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
277%
278%  list predicates
279%
280%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
281
282
283lgt_append([], List, List).
284lgt_append([Head| Tail], List, [Head| Tail2]) :-
285    lgt_append(Tail, List, Tail2).
286
287
288lgt_member(Head, [Head| _]).
289lgt_member(Head, [_| Tail]) :-
290    lgt_member(Head, Tail).
291
292
293lgt_member_var(V, [H| _]) :-
294    V == H.
295lgt_member_var(V, [_| T]) :-
296    lgt_member_var(V, T).
297
298
299lgt_proper_list([]).
300lgt_proper_list([_| List]) :-
301    lgt_proper_list(List).
302
303
304
305%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
306%
307%  file predicates
308%
309%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
310
311
312% lgt_file_exists(+atom)
313%
314% see if a file exist in the current directory
315
316lgt_file_exists(File) :-
317    ??????
318
319
320% lgt_load_prolog_code(+atom)
321%
322% compile and load a Prolog file
323
324lgt_load_prolog_code(File) :-
325    reconsult(File).
326
327
328
329%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
330%
331%  sorting predicates
332%
333%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
334
335
336% lgt_keysort(+list, -list)
337
338lgt_keysort(List, Sorted) :-
339    keysort(List, Sorted).
340
341
342% lgt_sort( +List, -Sorted )
343
344lgt_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
361lgt_current_date(Year, Month, Day) :-
362    date(date(Year, Month, Day)).
363
364
365% lgt_current_time(?Hours, ?Mins, ?Secs)
366
367lgt_current_time(Hours, Mins, Secs) :-
368    time(time(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
384lgt_cpu_time(Seconds) :-
385    ??????
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%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
405%
406%  end!
407%
408%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.