11 foreach my $hook (sort keys %::Hooks) {
12 my $h=$::Hooks{$hook};
13 for my $x (qw(declared implemented type args)) {
14 print "$hook datum '$x' missing\n" if !exists $h->{$x};
17 print " declared in $h->{declared}\n" if defined $h->{declared};
18 print " implemented in $h->{implemented}\n" if defined $h->{implemented};
19 print " type is $h->{type}\n" if defined $h->{type};
20 print " $h->{ret} $hook($h->{args})\n" if defined $h->{args};
28 opendir(D,$path) || croak "Can't open $path: $!";
29 while(my $f=readdir D) {
37 next if $file !~ /\.[ch]$/;
47 # print "scanning $file\n";
49 open(F,$file) || croak "Can't open $file: $!";
53 if(/AP_DECLARE_HOOK\((.*)\)/) {
55 my($ret,$name,$args)=$def=~/([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*\((.*)\)/;
56 croak "Don't understand $def in $file" if !defined $args;
57 # print "found $ret $name($args) in $file\n";
59 croak "$name declared twice! ($_)"
60 if exists $::Hooks{$name}->{declared};
61 $::Hooks{$name}->{declared}=$file;
62 $::Hooks{$name}->{ret}=$ret;
63 $::Hooks{$name}->{args}=$args;
64 } elsif(/AP_DECLARE_HOOK\(([^,]+),([^,]+)/) {
65 # really we should swallow subsequent lines to get the arguments...
68 croak "$name declared twice! ($_)"
69 if exists $::Hooks{$name}->{declared};
70 $::Hooks{$name}->{declared}=$file;
71 $::Hooks{$name}->{ret}=$ret;
72 $::Hooks{$name}->{args}='???';
74 if(/AP_IMPLEMENT_HOOK_()(VOID)\(([^,\s]+)/
75 || /AP_IMPLEMENT(_OPTIONAL|)_HOOK_(.*?)\([^,]+?\s*,\s*([^,\s]+)/) {
76 my($type,$name)=($1 ? "OPTIONAL $2" : $2,$3);
78 # print "found $name $type in $file\n";
80 croak "$name implemented twice ($::Hooks{$name}->{implemented} and $file) ($_)"
81 if exists $::Hooks{$name}->{implemented};
82 $::Hooks{$name}->{implemented}=$file;
83 $::Hooks{$name}->{type}=$type;