root/tags/lgt290/configs/bin.config

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