3 # Licensed to the Apache Software Foundation (ASF) under one or more
4 # contributor license agreements. See the NOTICE file distributed with
5 # this work for additional information regarding copyright ownership.
6 # The ASF licenses this file to You under the Apache License, Version 2.0
7 # (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
22 my $path=shift || '.';
26 foreach my $hook (sort keys %::Hooks) {
27 my $h=$::Hooks{$hook};
28 for my $x (qw(declared implemented type args)) {
29 print "$hook datum '$x' missing\n" if !exists $h->{$x};
32 print " declared in $h->{declared}\n" if defined $h->{declared};
33 print " implemented in $h->{implemented}\n" if defined $h->{implemented};
34 print " type is $h->{type}\n" if defined $h->{type};
35 print " $h->{ret} $hook($h->{args})\n" if defined $h->{args};
43 opendir(D,$path) || croak "Can't open $path: $!";
44 while(my $f=readdir D) {
52 next if $file !~ /\.[ch]$/;
62 # print "scanning $file\n";
64 open(F,$file) || croak "Can't open $file: $!";
68 if(/AP_DECLARE_HOOK\s*\(/) {
70 while(!(($ret,$name,$args)=
71 /AP_DECLARE_HOOK\s*\(\s*([^,]+)\s*,\s*([^,\s]+)\s*,\s*\((.*?)\)\)/s)) {
73 # swallow subsequent lines if needed to get all the required info
75 return unless defined $l;
80 $args=~s/^\s*//; $args=~s/\s*$//;
81 # print "found $ret $name($args) in $file\n";
83 croak "$name declared twice! ($_)"
84 if exists $::Hooks{$name}->{declared};
85 $::Hooks{$name}->{declared}=$file;
86 $::Hooks{$name}->{ret}=$ret;
87 $::Hooks{$name}->{args}=$args;
89 if(/AP_IMPLEMENT_HOOK_()(VOID)\(([^,\s]+)/
90 || /AP_IMPLEMENT(_OPTIONAL|)_HOOK_(.*?)\([^,]+?\s*,\s*([^,\s]+)/) {
91 my($type,$name)=($1 ? "OPTIONAL $2" : $2,$3);
93 # print "found $name $type in $file\n";
95 croak "$name implemented twice ($::Hooks{$name}->{implemented} and $file) ($_)"
96 if exists $::Hooks{$name}->{implemented};
97 $::Hooks{$name}->{implemented}=$file;
98 $::Hooks{$name}->{type}=$type;