File: check_syms

package info (click to toggle)
perl-tk 1:800.025-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 18,444 kB
  • ctags: 19,081
  • sloc: ansic: 206,740; perl: 40,187; makefile: 4,371; sh: 2,373; yacc: 762
file content (70 lines) | stat: -rwxr-xr-x 1,159 bytes parent folder | download | duplicates (3)
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
#!/usr/local/bin/perl -w
use File::Find;     
use Config; 
my @libs;
my $dlext = $Config{'dlext'};

my %ref;
my %def;
my %file;

sub read_object
{
 my $obj = shift;
 open(NM,"nm -p $obj|") || die "Cannot open nm $obj:$!";
 while (<NM>)
  {
   if (/\b([A-Z])\b\s*_?(.*)$/)
    {
     my ($kind,$name) = ($1,$2);
     if ($kind ne 'U')
      {
       $def{$name} = [] unless (exists $def{$name});
       push(@{$def{$name}},$obj);
      }
     else
      {
       $ref{$name} = [] unless (exists $ref{$name});
       push(@{$ref{$name}},$obj);
      }
    }
   if (/\b(f)\b\s*_?(.*)$/)
    {
     my ($kind,$name) = ($1,$2);
     $file{$name} = [] unless (exists $file{$name});
     push(@{$file{$name}},$obj);
    }
  }
 close(NM);
}


find(\&scan,'blib');
sub scan
{
 push(@libs,$File::Find::name) if /\.$dlext$/o;
}

foreach my $lib (@libs)
 {
  read_object($lib);
 }

foreach my $def (sort keys %def)
 {
  my $w = $def{$def};
  if (@$w > 1 && @$w != @libs)
   {
    print $def,' ',join(' ',@$w),"\n";
   }
 }

foreach my $file (sort keys %file)
 {
  my $w = $file{$file};
  if (@$w > 1 && @$w != @libs)
   {
    print $file,' ',join(' ',@$w),"\n";
   }
 }