From: Andy Polyakov Date: Mon, 2 Jan 2006 14:08:22 +0000 (+0000) Subject: util/*.pl update from HEAD. X-Git-Tag: OpenSSL_0_9_8b~56 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c4ac37361e40e6c42fbc3d03caacf7209a9bd218;p=oweals%2Fopenssl.git util/*.pl update from HEAD. --- diff --git a/util/copy.pl b/util/copy.pl index 73ac928ed2..e20b45530a 100644 --- a/util/copy.pl +++ b/util/copy.pl @@ -11,6 +11,7 @@ use Fcntl; my $arg; foreach $arg (@ARGV) { + $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob... foreach (glob $arg) { push @filelist, $_; diff --git a/util/mkdef.pl b/util/mkdef.pl index 8be2e39f54..24386009bf 100755 --- a/util/mkdef.pl +++ b/util/mkdef.pl @@ -452,17 +452,22 @@ sub do_defs next; } - $cpp = 1 if /^\#.*ifdef.*cplusplus/; + if(/\/\*/) { + if (not /\*\//) { # multiline comment... + $line = $_; # ... just accumulate + next; + } else { + s/\/\*.*?\*\///gs;# wipe it + } + } + if ($cpp) { - $cpp = 0 if /^\#.*endif/; + $cpp++ if /^#\s*if/; + $cpp-- if /^#\s*endif/; next; } + $cpp = 1 if /^#.*ifdef.*cplusplus/; - s/\/\*.*?\*\///gs; # ignore comments - if (/\/\*/) { # if we have part - $line = $_; # of a comment, - next; # continue reading - } s/{[^{}]*}//gs; # ignore {} blocks print STDERR "DEBUG: \$def=\"$def\"\n" if $debug && $def ne ""; print STDERR "DEBUG: \$_=\"$_\"\n" if $debug; @@ -740,6 +745,12 @@ sub do_defs $def .= "int i2d_$1_NDEF(void);"; } elsif (/^\s*DECLARE_ASN1_SET_OF\s*\(\s*(\w*)\s*\)/) { next; + } elsif (/^\s*DECLARE_ASN1_PRINT_FUNCTION\s*\(\s*(\w*)\s*\)/) { + $def .= "int $1_print_ctx(void);"; + next; + } elsif (/^\s*DECLARE_ASN1_PRINT_FUNCTION_name\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { + $def .= "int $2_print_ctx(void);"; + next; } elsif (/^\s*DECLARE_PKCS12_STACK_OF\s*\(\s*(\w*)\s*\)/) { next; } elsif (/^DECLARE_PEM_rw\s*\(\s*(\w*)\s*,/ || @@ -832,6 +843,17 @@ sub do_defs next if(/typedef\W/); next if(/\#define/); + # Reduce argument lists to empty () + # fold round brackets recursively: (t(*v)(t),t) -> (t{}{},t) -> {} + while(/\(.*\)/s) { + s/\([^\(\)]+\)/\{\}/gs; + s/\(\s*\*\s*(\w+)\s*\{\}\s*\)/$1/gs; #(*f{}) -> f + } + # pretend as we didn't use curly braces: {} -> () + s/\{\}/\(\)/gs; + + s/STACK_OF\(\)/void/gs; + print STDERR "DEBUG: \$_ = \"$_\"\n" if $debug; if (/^\#INFO:([^:]*):(.*)$/) { $plats = $1; @@ -842,25 +864,11 @@ sub do_defs $s = $1; $k = "VARIABLE"; print STDERR "DEBUG: found external variable $s\n" if $debug; - } elsif (/\(\*(\w*(\{[0-9]+\})?)\([^\)]+/) { - $s = $1; - print STDERR "DEBUG: found ANSI C function $s\n" if $debug; - } elsif (/\w+\W+(\w+)\W*\(\s*\)(\s*__attribute__\(.*\)\s*)?$/s) { - # K&R C - print STDERR "DEBUG: found K&R C function $s\n" if $debug; + } elsif (/TYPEDEF_\w+_OF/s) { next; - } elsif (/\w+\W+\w+(\{[0-9]+\})?\W*\(.*\)(\s*__attribute__\(.*\)\s*)?$/s) { - while (not /\(\)(\s*__attribute__\(.*\)\s*)?$/s) { - s/[^\(\)]*\)(\s*__attribute__\(.*\)\s*)?$/\)/s; - s/\([^\(\)]*\)\)(\s*__attribute__\(.*\)\s*)?$/\)/s; - } - s/\(void\)//; - /(\w+(\{[0-9]+\})?)\W*\(\)/s; - $s = $1; + } elsif (/(\w+)\s*\(\).*/s) { # first token prior [first] () is + $s = $1; # a function name! print STDERR "DEBUG: found function $s\n" if $debug; - - } elsif (/TYPEDEF_\w+_OF/) { - next; } elsif (/\(/ and not (/=/)) { print STDERR "File $file: cannot parse: $_;\n"; next; diff --git a/util/mkerr.pl b/util/mkerr.pl index 7e0bdff8cc..030899b7ab 100644 --- a/util/mkerr.pl +++ b/util/mkerr.pl @@ -143,11 +143,14 @@ while (($hdr, $lib) = each %libinc) s/[\n\s]*$//g; # Skip over recognized non-function declarations - next if(/typedef\W/ or /struct\W/ or /DECLARE_STACK_OF/ or /TYPEDEF_.*_OF/); + next if(/typedef\W/ or /DECLARE_STACK_OF/ or /TYPEDEF_.*_OF/); # Reduce argument lists to empty () # fold round brackets recursively: (t(*v)(t),t) -> (t{}{},t) -> {} - while(/\(.*\)/s) { s/\([^\(\)]+\)/\{\}/gs; } + while(/\(.*\)/s) { + s/\([^\(\)]+\)/\{\}/gs; + s/\(\s*\*\s*(\w+)\s*\{\}\s*\)/$1/gs; #(*f{}) -> f + } # pretend as we didn't use curly braces: {} -> () s/\{\}/\(\)/gs;