root/tags/lgt291/configs/lpawin40.config

Revision 7, 8.3 KB (checked in by pmoura, 7 years ago)

Corrected compiler bug in the error checking code of directives info/1 and info/2.
Change the "mi" example objects loading order to avoid some "unknown entity" warnings.

  • 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.1
5%
6%  initialization file for LPA WinProlog 4.00
7%
8%  last updated: August 24, 2000
9%
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12
13:- prolog_flag(syntax_errors, _, error).
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:- dynamic(lgt_exception_/1).
30
31
32% lgt_iso_predicate(?callable).
33
34lgt_iso_predicate(atom_codes(_, _)).
35lgt_iso_predicate(atom_concat(_, _, _)).
36lgt_iso_predicate(catch(_, _, _)).
37lgt_iso_predicate(close(_)).
38lgt_iso_predicate(nl(_)).
39lgt_iso_predicate(number_codes(_, _)).
40lgt_iso_predicate(once(_)).
41lgt_iso_predicate(open(_, _, _)).
42lgt_iso_predicate(read_term(_, _, _)).
43lgt_iso_predicate(throw(_)).
44lgt_iso_predicate(write_term(_, _, _)).
45
46
47atom_codes(Atom, Codes) :-
48    atom_chars(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
68lpa_catch(Error, Goal) :-
69    catch(Error, Goal).
70
71
72:- hide(catch).
73
74
75catch(Error, Goal) :-
76    lpa_catch(Error, Goal).
77
78
79catch(Goal, Catcher, Recovery) :-
80    lpa_catch(Error, Goal),
81    (Error = 0 ->
82        true
83        ;
84        (Error = -1 ->
85            !, fail
86            ;
87            (Error = 999 ->
88                retract(lgt_exception_(Ball)),
89                !,
90                (Catcher = Ball ->
91                    call(Recovery)
92                    ;
93                    throw(Ball))
94                ;
95                error_message(Error, Message),
96                (Catcher = Message ->
97                    call(Recovery)
98                    ;
99                    write(Message), nl, abort)))).
100
101
102:- hide(close).
103
104
105close(Stream) :-
106    fclose(Stream).
107
108
109nl(Stream) :-
110    output(Current),
111    output(Stream),
112    nl,
113    output(Current).
114
115
116number_codes(Number, Codes) :-
117    number_chars(Number, Codes).
118
119
120once(Goal) :-
121    one(Goal).
122
123
124open(File, read, File) :-
125    fcreate(File, File, 0, 0).
126
127open(File, write, File) :-
128    fcreate(File, File, -1, 0).
129
130
131read_term(Stream, Term, [singletons([])]) :-
132    !,
133    input(Current),
134    input(Stream),
135    read(Term),
136    input(Current).
137
138read_term(Stream, Term, _) :-
139    input(Current),
140    input(Stream),
141    read(Term),
142    input(Current).
143
144
145throw(Error) :-
146    asserta(lgt_exception_(Error)),
147    throw(999, Error).
148
149
150write_term(Stream, Term, [quoted(true)]) :-
151    !,
152    output(Current),
153    output(Stream),
154    writeq(Term),
155    output(Current).
156
157write_term(Stream, Term, _) :-
158    output(Current),
159    output(Stream),
160    write(Term),
161    output(Current).
162
163
164
165%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
166%
167%  predicate properties
168%
169%  this predicate must return at least static, dynamic and built_in
170%  properties for an existing predicate
171%
172%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
173
174
175% lgt_predicate_property(+callable, ?predicate_property)
176
177lgt_predicate_property(Pred, Prop) :-
178    predicate_property(Pred, Prop).
179
180
181
182%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
183%
184%  metapredicates
185%
186%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
187
188
189% lgt_call/2-8
190%
191% use these definitions only if your compiler does
192% not provide call/1-8 as built-in predicates
193
194lgt_call(F, A) :-
195    F(A).
196
197
198lgt_call(F, A1, A2) :-
199    F(A1, A2).
200
201
202lgt_call(F, A1, A2, A3) :-
203    F(A1, A2, A3).
204
205
206lgt_call(F, A1, A2, A3, A4) :-
207    F(A1, A2, A3, A4).
208
209
210lgt_call(F, A1, A2, A3, A4, A5) :-
211    F(A1, A2, A3, A4, A5).
212
213
214lgt_call(F, A1, A2, A3, A4, A5, A6) :-
215    F(A1, A2, A3, A4, A5, A6).
216
217
218lgt_call(F, A1, A2, A3, A4, A5, A6, A7) :-
219    F(A1, A2, A3, A4, A5, A6, A7).
220
221
222% lgt_once/2-8
223%
224% if your compiler provides call/1-8 as built-in
225% predicates rewrite these definitions using call(...), !.
226
227lgt_once(F, A) :-
228    one(F(A)).
229
230
231lgt_once(F, A1, A2) :-
232    one(F(A1, A2)).
233
234
235lgt_once(F, A1, A2, A3) :-
236    one(F(A1, A2, A3)).
237
238
239lgt_once(F, A1, A2, A3, A4) :-
240    one(F(A1, A2, A3, A4)).
241
242
243lgt_once(F, A1, A2, A3, A4, A5) :-
244    one(F(A1, A2, A3, A4, A5)).
245
246
247lgt_once(F, A1, A2, A3, A4, A5, A6) :-
248    one(F(A1, A2, A3, A4, A5, A6)).
249
250
251lgt_once(F, A1, A2, A3, A4, A5, A6, A7) :-
252    one(F(A1, A2, A3, A4, A5, A6, A7)).
253
254
255
256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
257%
258%  file extension predicates
259%
260%  these extensions are used by Logtalk load/compile predicates
261%
262%  you may want to change the extension for Prolog files to match
263%  the one expected by your Prolog compiler
264%
265%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
266
267
268% lgt_file_extension(?atom, ?atom)
269
270lgt_file_extension(logtalk, '.lgt').
271lgt_file_extension(prolog, '.pl').
272lgt_file_extension(xml, '.xml').
273
274
275
276%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
277%
278%  default compiler options
279%
280%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
281
282
283% lgt_default_compiler_option(?atom, ?atom)
284%
285% default values for all compiler options
286
287lgt_default_compiler_option(iso_initialization_dir, true).
288
289lgt_default_compiler_option(xml, on).
290lgt_default_compiler_option(xsl, 'lgtxml.xsl').
291
292lgt_default_compiler_option(unknown, warning).
293lgt_default_compiler_option(misspelt, warning).
294lgt_default_compiler_option(singletons, warning).
295lgt_default_compiler_option(lgtredef, warning).
296lgt_default_compiler_option(plredef, silent).
297
298lgt_default_compiler_option(report, on).
299
300
301
302%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
303%
304%  list predicates
305%
306%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
307
308
309lgt_append([], List, List).
310lgt_append([Head| Tail], List, [Head| Tail2]) :-
311    lgt_append(Tail, List, Tail2).
312
313
314lgt_member(Head, [Head| _]).
315lgt_member(Head, [_| Tail]) :-
316    lgt_member(Head, Tail).
317
318
319lgt_member_var(V, [H| _]) :-
320    V == H.
321lgt_member_var(V, [_| T]) :-
322    lgt_member_var(V, T).
323
324
325lgt_proper_list([]).
326lgt_proper_list([_| List]) :-
327    lgt_proper_list(List).
328
329
330
331%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
332%
333%  file predicates
334%
335%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
336
337
338% lgt_file_exists(+atom)
339%
340% see if a file exist in the current directory
341
342lgt_file_exists(File) :-
343    file(File, -1, Result),
344    Result = 1.
345
346
347% lgt_load_prolog_code(+atom)
348%
349% compile and load a Prolog file
350
351lgt_load_prolog_code(File) :-
352    reconsult(File).
353
354
355
356%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
357%
358%  sorting predicates
359%
360%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
361
362
363% lgt_keysort(+list, -list)
364
365lgt_keysort(List, Sorted) :-
366    keysort(List, Sorted).
367
368
369% lgt_sort(+list, -list)
370
371lgt_sort(List, Sorted) :-
372    sort(List, Sorted).
373
374
375
376%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
377%
378%  time and date predicates
379%
380%  if your Prolog compiler does not provide access to the operating system
381%  time and date just write dummy definitions
382%
383%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
384
385
386% lgt_current_date(?Year, ?Month, ?Day)
387
388lgt_current_date(Year, Month, Day) :-
389    time(Year, Month, Day, _, _, _, _).
390
391
392% lgt_current_time(?Hours, ?Mins, ?Secs)
393
394lgt_current_time(Hours, Mins, Secs) :-
395    time(_, _, _, Hours, Mins, Secs, _).
396
397
398
399%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
400%
401%  timing predicate
402%
403%  if your Prolog compiler does not provide access to a timing predicate
404%  just write dummy definition
405%
406%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
407
408
409% lgt_cpu_time(-Seconds)
410
411lgt_cpu_time(Seconds) :-
412    ticks(Ticks),
413    AbsTicks is Ticks mod 2^32,
414    Seconds is AbsTicks / 4660.
415
416
417
418%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
419%
420%  comparison predicate
421%
422%  the usual compare/3 definition
423%
424%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
425
426
427% compare(?atom, @term, @term) -- built-in
428
429
430
431%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
432%
433%  end!
434%
435%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.