root/tags/lgt290/configs/sicstus35.config

Revision 2, 7.7 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 SICStus Prolog 3.5
7%
8%  last updated: August 24, 2000
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 compiler options
225%
226%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
227
228
229% lgt_default_compiler_option(?atom, ?atom)
230%
231% default values for all compiler options
232
233lgt_default_compiler_option(iso_initialization_dir, false).
234
235lgt_default_compiler_option(xml, on).
236lgt_default_compiler_option(xsl, 'lgtxml.xsl').
237
238lgt_default_compiler_option(unknown, warning).
239lgt_default_compiler_option(misspelt, warning).
240lgt_default_compiler_option(singletons, warning).
241lgt_default_compiler_option(lgtredef, warning).
242lgt_default_compiler_option(plredef, silent).
243
244lgt_default_compiler_option(report, on).
245
246
247
248%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
249%
250%  list predicates
251%
252%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
253
254
255lgt_append([], List, List).
256lgt_append([Head| Tail], List, [Head| Tail2]) :-
257    lgt_append(Tail, List, Tail2).
258
259
260lgt_member(Head, [Head| _]).
261lgt_member(Head, [_| Tail]) :-
262    lgt_member(Head, Tail).
263
264
265lgt_member_var(V, [H| _]) :-
266    V == H.
267lgt_member_var(V, [_| T]) :-
268    lgt_member_var(V, T).
269
270
271lgt_proper_list([]).
272lgt_proper_list([_| List]) :-
273    lgt_proper_list(List).
274
275
276
277%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
278%
279%  file predicates
280%
281%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
282
283
284% lgt_file_exists(+atom)
285%
286% see if a file exist in the current directory
287
288lgt_file_exists(File) :-
289    file_exists(File).
290
291
292% lgt_load_prolog_code(+atom)
293%
294% compile and load a Prolog file
295
296lgt_load_prolog_code(File) :-
297    compile(File).
298
299
300
301%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
302%
303%  sorting predicates
304%
305%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
306
307
308% lgt_keysort(+list, -list)
309
310lgt_keysort(List, Sorted) :-
311    keysort(List, Sorted).
312
313
314% lgt_sort(+list, -list)
315
316lgt_sort(List, Sorted) :-
317    sort(List, Sorted).
318
319
320
321%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
322%
323%  time and date predicates
324%
325%  if your Prolog compiler does not provide access to the operating system
326%  time and date just write dummy definitions
327%
328%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
329
330
331% lgt_current_date(?Year, ?Month, ?Day)
332
333lgt_current_date(Year, Month, Day) :-
334    datime(datime(Year, Month, Day, _, _, _)).
335
336
337% lgt_current_time(?Hours, ?Mins, ?Secs)
338
339lgt_current_time(Hours, Mins, Secs) :-
340    datime(datime(_, _, _, Hours, Mins, Secs)).
341
342
343
344%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
345%
346%  timing predicate
347%
348%  if your Prolog compiler does not provide access to a timing predicate
349%  just write dummy definition
350%
351%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
352
353
354% lgt_cpu_time(-Seconds)
355
356lgt_cpu_time(Seconds) :-
357    statistics(runtime, [Miliseconds| _]),
358    Seconds is Miliseconds / 1000.
359
360
361
362%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
363%
364%  comparison predicate
365%
366%  the usual compare/3 definition
367%
368%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
369
370
371% compare(?atom, @term, @term) -- built-in
372
373
374
375%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
376%
377%  end!
378%
379%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.