root/tags/lgt293/configs/sicstus35.config

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