root/tags/lgt293/configs/bin.config

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