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