Two changes:
[openssl.git] / util / mkdef.pl
index f2c8f55cd06db9b4af34e95ca06d75dd25adcbb1..b66d05c06e93d217bdaa5bf23c685463fc6c0d5e 100755 (executable)
@@ -60,7 +60,7 @@ my $crypto_num= "util/libeay.num";
 my $ssl_num=    "util/ssleay.num";
 
 my $do_update = 0;
-my $do_rewrite = 0;
+my $do_rewrite = 1;
 my $do_crypto = 0;
 my $do_ssl = 0;
 my $do_ctest = 0;
@@ -243,6 +243,8 @@ $crypto.=" crypto/x509v3/x509v3.h";
 $crypto.=" crypto/rand/rand.h";
 $crypto.=" crypto/comp/comp.h" ; # unless $no_comp;
 $crypto.=" crypto/ocsp/ocsp.h";
+$crypto.=" crypto/ui/ui.h crypto/ui/ui_compat.h";
+$crypto.=" crypto/krb5/krb5_asn.h";
 $crypto.=" crypto/tmdiff.h";
 
 my $symhacks="crypto/symhacks.h";
@@ -258,7 +260,6 @@ if ($do_ssl == 1) {
        if ($do_rewrite == 1) {
                open(OUT, ">$ssl_num");
                &rewrite_numbers(*OUT,"SSLEAY",*ssl_list,@ssl_symbols);
-               close OUT;
        } else {
                open(OUT, ">>$ssl_num");
        }
@@ -331,6 +332,7 @@ sub do_defs
 
        foreach $file (split(/\s+/,$symhacksfile." ".$files))
                {
+               print STDERR "DEBUG: starting on $file:\n" if $debug;
                open(IN,"<$file") || die "unable to open $file:$!\n";
                my $line = "", my $def= "";
                my %tag = (
@@ -399,7 +401,7 @@ sub do_defs
 
                print STDERR "DEBUG: parsing ----------\n" if $debug;
                while(<IN>) {
-                       last if (/BEGIN ERROR CODES/);
+                       last if (/\/\* Error codes for the \w+ functions\. \*\//);
                        if ($line ne '') {
                                $_ = $line . $_;
                                $line = '';
@@ -784,14 +786,18 @@ sub do_defs
                        if (/^\#INFO:([^:]*):(.*)$/) {
                                $plats = $1;
                                $algs = $2;
+                               print STDERR "DEBUG: found info on platforms ($plats) and algorithms ($algs)\n" if $debug;
                                next;
                        } elsif (/^\s*OPENSSL_EXTERN\s.*?(\w+(\{[0-9]+\})?)(\[[0-9]*\])*\s*$/) {
                                $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) {
                                # K&R C
+                               print STDERR "DEBUG: found K&R C function $s\n" if $debug;
                                next;
                        } elsif (/\w+\W+\w+(\{[0-9]+\})?\W*\(.*\)$/s) {
                                while (not /\(\)$/s) {
@@ -801,6 +807,7 @@ sub do_defs
                                s/\(void\)//;
                                /(\w+(\{[0-9]+\})?)\W*\(\)/s;
                                $s = $1;
+                               print STDERR "DEBUG: found function $s\n" if $debug;
                        } elsif (/\(/ and not (/=/)) {
                                print STDERR "File $file: cannot parse: $_;\n";
                                next;
@@ -993,7 +1000,7 @@ sub is_valid
                        # EXPORT_VAR_AS_FUNCTION means that global variables
                        # will be represented as functions.  This currently
                        # only happens on VMS-VAX.
-                       if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && $VMSVAX) {
+                       if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && ($VMSVAX || $W32 || $W16)) {
                                return 1;
                        }
                        return 0;
@@ -1243,7 +1250,10 @@ sub rewrite_numbers
                $syms{$n} = 1;
        }
 
-       my @s=sort { &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n") } keys %nums;
+       my @s=sort {
+           &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n")
+           || $a cmp $b
+       } keys %nums;
        foreach $sym (@s) {
                (my $n, my $i) = split /\\/, $nums{$sym};
                next if defined($i) && $i =~ /^.*?:.*?:\w+\(\w+\)/;