root/tags/lgt293/configs/xsb.config

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