improve CParser
[rofl0r-c-split.git] / find-in-headers.pl
blobd9e575e0a5beb794e05e23ed89997adee78bc0bc
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 my $p = CParser->new($file);
15 $p->parse();
17 my @hdrs=`find $dir -name '*.h'`;
18 for(@hdrs) {
19 chomp;
20 #print "processing $_\n";
21 #next unless /unistd/;
22 my $h = CParser->new($_);
23 $h->parse();
24 #dump $h;
25 #exit;
26 for(keys %{$p->{funcs}}) {
27 print "$_ defined in $file and $h->{cfile}\n" if(defined($h->{funcs}->{$_}));