File: chext

package info (click to toggle)
libtk-tablematrix-perl 1.22-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,624 kB
  • ctags: 1,274
  • sloc: ansic: 15,026; perl: 3,376; makefile: 156; sh: 16
file content (53 lines) | stat: -rwxr-xr-x 981 bytes parent folder | download | duplicates (22)
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
#!/usr/local/bin/perl -w

open(NEED,"<need") || die;
while (<NEED>)
 {
  if (/\b([A-Z])\b\s*_?(.*)$/)
   {
    if ($1 ne 'U')
     {
      $def{$2} = $1;
     }
    else
     {
      $ref{$2} = 1;
     }
   }
 }
close(NEED);

@ARGV = <*.h>;

while (<>)
 {
  if (/(extern|EXTERN|COREXT)\s*(.*)\s(\w+)\s+_ANSI_ARGS_/)
   {
    my $kind = $1;
    if (!exists($def{$3}))
     {
      if ($kind ne 'COREXT')
       {
        print STDERR "$ARGV:$.: $kind $3 not defined\n";
       }
      print "$ARGV:$.: $3 not defined";
      print " - but not referenced" unless (exists($ref{$3}));
      print "\n";
     }
   }
  elsif (/(extern|EXTERN|COREXT)\s*(.*)\s(\w+)\s*;/)
   {
    my $kind = $1;
    if (!exists($def{$3}))
     {
      if ($kind ne 'COREXT')
       {
        print STDERR "$ARGV:$.: $kind $3 not defined\n";
       }
      print "$ARGV:$.: $3 not defined";
      print " - but not referenced" unless (exists($ref{$3}));
      print "\n";
     }
   }
  $. = 0 if (eof);
 }