list_hooks.pl revision a267a4bcefedcaa9fdf7cb26aa603525ec4853c3
bff4b3f816be4c1e1d8ded76f1d5af786839e1a9Christian Maeder for my $x (qw(declared implemented type args)) {
bff4b3f816be4c1e1d8ded76f1d5af786839e1a9Christian Maeder print "$hook datum '$x' missing\n" if !exists $h->{$x};
bff4b3f816be4c1e1d8ded76f1d5af786839e1a9Christian Maeder print "$hook\n";
bff4b3f816be4c1e1d8ded76f1d5af786839e1a9Christian Maeder print " declared in $h->{declared}\n" if defined $h->{declared};
bff4b3f816be4c1e1d8ded76f1d5af786839e1a9Christian Maeder print " implemented in $h->{implemented}\n" if defined $h->{implemented};
bff4b3f816be4c1e1d8ded76f1d5af786839e1a9Christian Maeder print " type is $h->{type}\n" if defined $h->{type};
c04cc42aa672aa49b45005e6eed77cc80e0d6ae0Christian Maeder print " $h->{ret} $hook($h->{args})\n" if defined $h->{args};
bff4b3f816be4c1e1d8ded76f1d5af786839e1a9Christian Maeder opendir(D,$path) || croak "Can't open $path: $!";
bff4b3f816be4c1e1d8ded76f1d5af786839e1a9Christian Maeder while(my $f=readdir D) {
bff4b3f816be4c1e1d8ded76f1d5af786839e1a9Christian Maeder next if $f=~/^\./;
bff4b3f816be4c1e1d8ded76f1d5af786839e1a9Christian Maeder# print "scanning $file\n";
bff4b3f816be4c1e1d8ded76f1d5af786839e1a9Christian Maeder open(F,$file) || croak "Can't open $file: $!";
329c739bc05b8ce8d54f81071d0826ff771d1f78Christian Maeder next if /\#define/;
4bbd808612c2580ae6e0495a155997a6bb47ecf3Christian Maeder my($ret,$name,$args)=$def=~/([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*\((.*)\)/;
bff4b3f816be4c1e1d8ded76f1d5af786839e1a9Christian Maeder croak "Don't understand $def in $file" if !defined $args;
bff4b3f816be4c1e1d8ded76f1d5af786839e1a9Christian Maeder# print "found $ret $name($args) in $file\n";
bff4b3f816be4c1e1d8ded76f1d5af786839e1a9Christian Maeder croak "$name declared twice! ($_)"
d6c6b2543c509ec7f6213e4cba675d96304a7fd6Christian Maeder } elsif(/AP_DECLARE_HOOK\((\s*[^,\s]+)\s*,\s*([^,\s]+)/) {
d6c6b2543c509ec7f6213e4cba675d96304a7fd6Christian Maeder# really we should swallow subsequent lines to get the arguments...
bff4b3f816be4c1e1d8ded76f1d5af786839e1a9Christian Maeder croak "$name declared twice! ($_)"
7857a35e3af533dfbd0f0e18638ebd211e6358a0Christian Maeder || /AP_IMPLEMENT(_OPTIONAL|)_HOOK_(.*?)\([^,]+?\s*,\s*([^,\s]+)/) {
bff4b3f816be4c1e1d8ded76f1d5af786839e1a9Christian Maeder my($type,$name)=($1 ? "OPTIONAL $2" : $2,$3);
bff4b3f816be4c1e1d8ded76f1d5af786839e1a9Christian Maeder# print "found $name $type in $file\n";
bff4b3f816be4c1e1d8ded76f1d5af786839e1a9Christian Maeder croak "$name implemented twice ($::Hooks{$name}->{implemented} and $file) ($_)"