new tool to strip comments from headers
[rofl0r-c-split.git] / find-in-headers.pl
blobcb2b3a23ee8a6ee039223206b7b6555d62be9933
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
5 use File::Basename;
6 use Cwd 'abs_path';
7 use lib dirname(abs_path($0));
8 use CParser;
9 use Data::Dump qw(dump);
11 my $file = $ARGV[0] or die ("need filename");
12 my $dir = $ARGV[1] or die ("need dir with headers as second arg");
14 #print "processing $file\n";
16 my $p = CParser->new($file);
17 $p->parse();
19 my @hdrs=`find $dir -name '*.h'`;
20 for(@hdrs) {
21 chomp;
22 #print "processing $_\n";
23 #next unless /unistd/;
24 my $h = CParser->new($_);
25 $h->parse();
26 #dump $h;
27 #exit;
28 for(keys %{$p->{funcs}}) {
29 print "$_ defined in $file and $h->{cfile}\n" if(defined($h->{funcs}->{$_}));