File: get-definitions.red

package info (click to toggle)
mathpiper 0.81f%2Bsvn4469%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 36,572 kB
  • sloc: java: 57,479; lisp: 13,721; objc: 1,300; xml: 988; makefile: 114; awk: 95; sh: 38
file content (71 lines) | stat: -rwxr-xr-x 2,096 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
% Get definitions for Reduce functions

lisp;
on echo, comp, backtrace;

load!-module 'compiler;

% The following line will be left over from the system build if you build
% bootstrapreduce.img on the system you are now using! If not you need
% to adjust and activate this.

% @srcdir := "/cygdrive/c/projects/reduce-algebra/trunk/csl/cslbase";

<< m := open("$srcdir/../../src/packages/package.map", 'input);
   oldi := rds m;
   off echo;
   packages := read();
   on echo;
   rds oldi;
   close m >>;

symbolic procedure record!-a!-def(name, modname, type, d);
  put(name, 'definition, union(get(name, 'definition),
     list list(modname, type, d)));

symbolic procedure record!-defs!-for!-name(name, modname);
  begin
    scalar d, c;
    if (d := get(name, 'smacro)) and
       (c := md5 d) neq get(name, 'smacro!-checksum) then <<
       record!-a!-def(name, modname, 'smacro, d);
       put(name, 'smacro!-checksum, c) >>;
    if (d := get(name, '!*savedef)) and
       (c := md5 d) neq get(name, 'expr!-checksum) then <<
       record!-a!-def(name, modname, 'expr, d);
       put(name, 'expr!-checksum, c) >>;
  end;

symbolic procedure record!-defs modname;
  for each name in oblist() do record!-defs!-for!-name(name, modname);

record!-defs 'core;

load!-source := t; % So that savedefs get loaded without any checksum checking.

for each modname in packages do if modulep car modname then <<
%  princ "+++ About to load "; print car modname;
   load!-source car modname;
   record!-defs car modname >>;

defined := nil;

for each name in oblist() do
   if get(name, 'definition) then defined := name . defined;

defined := sort(defined, 'orderp)$

% Here I illustrate what I have collected by displaying cases where
% there seem to be two (or more) potentially conflicting definitions.

<< terpri();
   for each name in defined do
      if length get(name, 'definition) > 1 then <<
         print name;
         for each d in get(name, 'definition) do <<
            princ "Defined as "; prin cadr d;
            princ " in package "; print car d >>;
         terpri() >> >>;

end;