root/tags/lgt293/configs/master.config

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