View | Details | Raw Unified | Return to bug 44453
Collapse All | Expand All

(-)- (-21 / +23 lines)
Lines 1-4 Link Here
1
#!/usr/bin/perl -w
1
#!/usr/bin/perl -w
2
# -*- mode:cperl;cperl-indent-level:4;cperl-continued-statement-offset:4;indent-tabs-mode:nil -*-
2
#
3
#
3
# Licensed to the Apache Software Foundation (ASF) under one or more
4
# Licensed to the Apache Software Foundation (ASF) under one or more
4
# contributor license agreements.  See the NOTICE file distributed with
5
# contributor license agreements.  See the NOTICE file distributed with
Lines 36-41 Link Here
36
    print "\n";
37
    print "\n";
37
}
38
}
38
39
40
#warn "found ".keys(%::Hooks)." hooks\n";
41
39
sub findInDir {
42
sub findInDir {
40
    my $path=shift;
43
    my $path=shift;
41
44
Lines 65-96 Link Here
65
    while(<F>) {
68
    while(<F>) {
66
	next if /\#define/;
69
	next if /\#define/;
67
	next if /\@deffunc/;
70
	next if /\@deffunc/;
68
	if(/AP_DECLARE_HOOK\((.*)\)/) {
71
	if(/AP_DECLARE_HOOK\s*\(/) {
69
	    my $def=$1;
72
            my($ret,$name,$args);
70
	    my($ret,$name,$args)=$def=~/([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*\((.*)\)/;
73
            while(!(($ret,$name,$args)=
71
	    croak "Don't understand $def in $file" if !defined $args;
74
                    /AP_DECLARE_HOOK\s*\(\s*([^,]+)\s*,\s*([^,\s]+)\s*,\s*\((.*?)\)\)/s)) {
72
#	    print "found $ret $name($args) in $file\n";
75
                chomp;
73
76
                my $l=<F>;
74
	    croak "$name declared twice! ($_)"
77
                return unless defined $l;
75
		if exists $::Hooks{$name}->{declared};
78
                $l=~s/^\s*/ /;
76
	    $::Hooks{$name}->{declared}=$file;
79
                $_.=$l;
77
	    $::Hooks{$name}->{ret}=$ret;
80
            }
78
	    $::Hooks{$name}->{args}=$args;
81
            $ret=~s/\s*$//;
79
	} elsif(/AP_DECLARE_HOOK\((\s*[^,\s]+)\s*,\s*([^,\s]+)/) {
82
            $args=~s/^\s*//; $args=~s/\s*$//;
80
# really we should swallow subsequent lines to get the arguments...
83
#            warn "found $ret $name($args) in $file\n";
81
	    my $name=$2;
84
82
	    my $ret=$1;
85
            croak "$name declared twice! ($_)"
83
	    croak "$name declared twice! ($_)"
86
                if exists $::Hooks{$name}->{declared};
84
		if exists $::Hooks{$name}->{declared};
87
            $::Hooks{$name}->{declared}=$file;
85
	    $::Hooks{$name}->{declared}=$file;
88
            $::Hooks{$name}->{ret}=$ret;
86
	    $::Hooks{$name}->{ret}=$ret;
89
            $::Hooks{$name}->{args}=$args;
87
	    $::Hooks{$name}->{args}='???';
88
	}
90
	}
89
	if(/AP_IMPLEMENT_HOOK_()(VOID)\(([^,\s]+)/
91
	if(/AP_IMPLEMENT_HOOK_()(VOID)\(([^,\s]+)/
90
	   || /AP_IMPLEMENT(_OPTIONAL|)_HOOK_(.*?)\([^,]+?\s*,\s*([^,\s]+)/) {
92
	   || /AP_IMPLEMENT(_OPTIONAL|)_HOOK_(.*?)\([^,]+?\s*,\s*([^,\s]+)/) {
91
	    my($type,$name)=($1 ? "OPTIONAL $2" : $2,$3);
93
	    my($type,$name)=($1 ? "OPTIONAL $2" : $2,$3);
92
94
93
#	    print "found $name $type in $file\n";
95
#            warn "found $name $type in $file\n";
94
96
95
	    croak "$name implemented twice ($::Hooks{$name}->{implemented} and $file) ($_)"
97
	    croak "$name implemented twice ($::Hooks{$name}->{implemented} and $file) ($_)"
96
		if exists $::Hooks{$name}->{implemented};
98
		if exists $::Hooks{$name}->{implemented};

Return to bug 44453