1 #!/usr/local/bin/perl -w
5 # It does this by parsing the header files and looking for the
6 # prototyped functions: it then prunes the output.
8 # Intermediary files are created, call libeay.num and ssleay.num,...
9 # Previously, they had the following format:
13 # But that isn't enough for a number of reasons, the first on being that
14 # this format is (needlessly) very Win32-centric, and even then...
15 # One of the biggest problems is that there's no information about what
16 # routines should actually be used, which varies with what crypto algorithms
17 # are disabled. Also, some operating systems (for example VMS with VAX C)
18 # need to keep track of the global variables as well as the functions.
20 # So, a remake of this script is done so as to include information on the
21 # kind of symbol it is (function or variable) and what algorithms they're
22 # part of. This will allow easy translating to .def files or the corresponding
23 # file in other operating systems (a .opt file for VMS, possibly with a .mar
26 # The format now becomes:
28 # routine-name nnnn info
30 # and the "info" part is actually a colon-separated string of fields with
31 # the following meaning:
33 # existence:platform:kind:algorithms
35 # - "existence" can be "EXIST" or "NOEXIST" depending on if the symbol is
36 # found somewhere in the source,
37 # - "platforms" is empty if it exists on all platforms, otherwise it contains
38 # comma-separated list of the platform, just as they are if the symbol exists
39 # for those platforms, or prepended with a "!" if not. This helps resolve
40 # symbol name replacements for platforms where the names are too long for the
41 # compiler or linker, or if the systems is case insensitive and there is a
42 # clash. This script assumes those redefinitions are place in the file
44 # - "kind" is "FUNCTION" or "VARIABLE". The meaning of that is obvious.
45 # - "algorithms" is a comma-separated list of algorithm names. This helps
46 # exclude symbols that are part of an algorithm that some user wants to
50 my $crypto_num= "util/libeay.num";
51 my $ssl_num= "util/ssleay.num";
65 # Set this to make typesafe STACK definitions appear in DEF
66 my $safe_stack_def = 0;
68 my @known_platforms = ( "__FreeBSD__", "VMS", "WIN16", "WIN32",
69 "WINNT", "PERL5", "NeXT" );
70 my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF",
71 "CAST", "MD2", "MD4", "MD5", "SHA", "RIPEMD",
72 "MDC2", "RSA", "DSA", "DH", "HMAC", "FP_API" );
75 open(IN,"<Makefile.ssl") || die "unable to open Makefile.ssl!\n";
77 $options=$1 if (/^OPTIONS=(.*)$/);
81 # The following ciphers may be excluded (by Configure). This means functions
82 # defined with ifndef(NO_XXX) are not included in the .def file, and everything
83 # in directory xxx is ignored.
84 my $no_rc2; my $no_rc4; my $no_rc5; my $no_idea; my $no_des; my $no_bf;
86 my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2;
87 my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0;
90 foreach (@ARGV, split(/ /, $options))
98 $VMS=1 if $_ eq "VMS";
99 $do_ssl=1 if $_ eq "ssleay";
100 $do_ssl=1 if $_ eq "ssl";
101 $do_crypto=1 if $_ eq "libeay";
102 $do_crypto=1 if $_ eq "crypto";
103 $do_update=1 if $_ eq "update";
104 $do_rewrite=1 if $_ eq "rewrite";
105 $do_ctest=1 if $_ eq "ctest";
106 $do_ctestall=1 if $_ eq "ctestall";
107 $rsaref=1 if $_ eq "rsaref";
108 #$safe_stack_def=1 if $_ eq "-DDEBUG_SAFESTACK";
110 if (/^no-rc2$/) { $no_rc2=1; }
111 elsif (/^no-rc4$/) { $no_rc4=1; }
112 elsif (/^no-rc5$/) { $no_rc5=1; }
113 elsif (/^no-idea$/) { $no_idea=1; }
114 elsif (/^no-des$/) { $no_des=1; }
115 elsif (/^no-bf$/) { $no_bf=1; }
116 elsif (/^no-cast$/) { $no_cast=1; }
117 elsif (/^no-md2$/) { $no_md2=1; }
118 elsif (/^no-md4$/) { $no_md4=1; }
119 elsif (/^no-md5$/) { $no_md5=1; }
120 elsif (/^no-sha$/) { $no_sha=1; }
121 elsif (/^no-ripemd$/) { $no_ripemd=1; }
122 elsif (/^no-mdc2$/) { $no_mdc2=1; }
123 elsif (/^no-rsa$/) { $no_rsa=1; }
124 elsif (/^no-dsa$/) { $no_dsa=1; }
125 elsif (/^no-dh$/) { $no_dh=1; }
126 elsif (/^no-hmac$/) { $no_hmac=1; }
130 # If no platform is given, assume WIN32
131 if ($W32 + $W16 + $VMS == 0) {
135 # Add extra knowledge
140 if (!$do_ssl && !$do_crypto)
142 print STDERR "usage: $0 ( ssl | crypto ) [ 16 | 32 | NT ] [rsaref]\n";
146 %ssl_list=&load_numbers($ssl_num);
148 %crypto_list=&load_numbers($crypto_num);
149 $max_crypto = $max_num;
153 my $crypto ="crypto/crypto.h";
154 $crypto.=" crypto/des/des.h" unless $no_des;
155 $crypto.=" crypto/idea/idea.h" unless $no_idea;
156 $crypto.=" crypto/rc4/rc4.h" unless $no_rc4;
157 $crypto.=" crypto/rc5/rc5.h" unless $no_rc5;
158 $crypto.=" crypto/rc2/rc2.h" unless $no_rc2;
159 $crypto.=" crypto/bf/blowfish.h" unless $no_bf;
160 $crypto.=" crypto/cast/cast.h" unless $no_cast;
161 $crypto.=" crypto/md2/md2.h" unless $no_md2;
162 $crypto.=" crypto/md4/md4.h" unless $no_md4;
163 $crypto.=" crypto/md5/md5.h" unless $no_md5;
164 $crypto.=" crypto/mdc2/mdc2.h" unless $no_mdc2;
165 $crypto.=" crypto/sha/sha.h" unless $no_sha;
166 $crypto.=" crypto/ripemd/ripemd.h" unless $no_ripemd;
168 $crypto.=" crypto/bn/bn.h";
169 $crypto.=" crypto/rsa/rsa.h" unless $no_rsa;
170 $crypto.=" crypto/dsa/dsa.h" unless $no_dsa;
171 $crypto.=" crypto/dh/dh.h" unless $no_dh;
172 $crypto.=" crypto/hmac/hmac.h" unless $no_hmac;
174 $crypto.=" crypto/stack/stack.h";
175 $crypto.=" crypto/buffer/buffer.h";
176 $crypto.=" crypto/bio/bio.h";
177 $crypto.=" crypto/dso/dso.h";
178 $crypto.=" crypto/lhash/lhash.h";
179 $crypto.=" crypto/conf/conf.h";
180 $crypto.=" crypto/txt_db/txt_db.h";
182 $crypto.=" crypto/evp/evp.h";
183 $crypto.=" crypto/objects/objects.h";
184 $crypto.=" crypto/pem/pem.h";
185 #$crypto.=" crypto/meth/meth.h";
186 $crypto.=" crypto/asn1/asn1.h";
187 $crypto.=" crypto/asn1/asn1_mac.h";
188 $crypto.=" crypto/err/err.h";
189 $crypto.=" crypto/pkcs7/pkcs7.h";
190 $crypto.=" crypto/pkcs12/pkcs12.h";
191 $crypto.=" crypto/x509/x509.h";
192 $crypto.=" crypto/x509/x509_vfy.h";
193 $crypto.=" crypto/x509v3/x509v3.h";
194 $crypto.=" crypto/rand/rand.h";
195 $crypto.=" crypto/comp/comp.h";
196 $crypto.=" crypto/tmdiff.h";
198 my $symhacks="crypto/symhacks.h";
200 my @ssl_symbols = &do_defs("SSLEAY", $ssl, $symhacks);
201 my @crypto_symbols = &do_defs("LIBEAY", $crypto, $symhacks);
207 &maybe_add_info("SSLEAY",*ssl_list,@ssl_symbols);
208 if ($do_rewrite == 1) {
209 open(OUT, ">$ssl_num");
210 &rewrite_numbers(*OUT,"SSLEAY",*ssl_list,@ssl_symbols);
213 open(OUT, ">>$ssl_num");
215 &update_numbers(*OUT,"SSLEAY",*ssl_list,$max_ssl,@ssl_symbols);
219 if($do_crypto == 1) {
221 &maybe_add_info("LIBEAY",*crypto_list,@crypto_symbols);
222 if ($do_rewrite == 1) {
223 open(OUT, ">$crypto_num");
224 &rewrite_numbers(*OUT,"LIBEAY",*crypto_list,@crypto_symbols);
226 open(OUT, ">>$crypto_num");
228 &update_numbers(*OUT,"LIBEAY",*crypto_list,$max_crypto,@crypto_symbols);
232 } elsif ($do_ctest || $do_ctestall) {
236 /* Test file to check all DEF file symbols are present by trying
237 * to link to all of them. This is *not* intended to be run!
243 &print_test_file(*STDOUT,"SSLEAY",*ssl_list,$do_ctestall,@ssl_symbols)
246 &print_test_file(*STDOUT,"LIBEAY",*crypto_list,$do_ctestall,@crypto_symbols)
253 &print_def_file(*STDOUT,"SSLEAY",*ssl_list,@ssl_symbols)
256 &print_def_file(*STDOUT,"LIBEAY",*crypto_list,@crypto_symbols)
264 my($name,$files,$symhacksfile)=@_;
268 my %platform; # For anything undefined, we assume ""
269 my %kind; # For anything undefined, we assume "FUNCTION"
270 my %algorithm; # For anything undefined, we assume ""
274 foreach $file (split(/\s+/,$symhacksfile." ".$files))
276 open(IN,"<$file") || die "unable to open $file:$!\n";
277 my $line = "", my $def= "";
279 (map { $_ => 0 } @known_platforms),
280 (map { "NO_".$_ => 0 } @known_algorithms),
287 my $symhacking = $file eq $symhacksfile;
289 last if (/BEGIN ERROR CODES/);
300 $cpp = 1 if /^\#.*ifdef.*cplusplus/;
302 $cpp = 0 if /^\#.*endif/;
306 s/\/\*.*?\*\///gs; # ignore comments
307 s/{[^{}]*}//gs; # ignore {} blocks
308 if (/^\#\s*ifndef (.*)/) {
311 } elsif (/^\#\s*if !defined\(([^\)]+)\)/) {
314 } elsif (/^\#\s*ifdef (.*)/) {
317 } elsif (/^\#\s*if defined\(([^\)]+)\)/) {
320 } elsif (/^\#\s*error\s+(\w+) is disabled\./) {
321 if ($tag[$#tag] eq "NO_".$1) {
324 } elsif (/^\#\s*endif/) {
325 if ($tag{$tag[$#tag]}==2) {
326 $tag{$tag[$#tag]}=-1;
331 } elsif (/^\#\s*else/) {
334 } elsif (/^\#\s*if\s+1/) {
338 } elsif (/^\#\s*if\s+0/) {
342 } elsif (/^\#\s*define\s+(\w+)\s+(\w+)/
346 $2.":".join(",", grep(!/^$/,
347 map { $tag{$_} == 1 ?
354 map { $tag{$_} == 1 ? $_ :
355 $tag{$_} == -1 ? "!".$_ : "" }
358 map { $tag{"NO_".$_} == -1 ? $_ : "" }
360 $def .= "#INFO:".join(',',@p).":".join(',',@a).";";
363 if (/^\s*DECLARE_STACK_OF\s*\(\s*(\w*)\s*\)/) {
365 } elsif (/^\s*DECLARE_PKCS12_STACK_OF\s*\(\s*(\w*)\s*\)/) {
367 } elsif (/^\s*DECLARE_ASN1_SET_OF\s*\(\s*(\w*)\s*\)/) {
369 } elsif (/^DECLARE_PEM_rw\s*\(\s*(\w*)\s*,/ ||
370 /^DECLARE_PEM_rw_cb\s*\(\s*(\w*)\s*,/ ) {
371 # Things not in Win16
372 $syms{"PEM_read_${1}"} = 1;
373 $platform{"PEM_read_${1}"} = "!WIN16";
374 $syms{"PEM_write_${1}"} = 1;
375 $platform{"PEM_write_${1}"} = "!WIN16";
376 # Things that are everywhere
377 $syms{"PEM_read_bio_${1}"} = 1;
378 $syms{"PEM_write_bio_${1}"} = 1;
379 if ($1 eq "RSAPrivateKey" ||
380 $1 eq "RSAPublicKey" ||
381 $1 eq "RSA_PUBKEY") {
382 $algorithm{"PEM_read_${1}"} = "RSA";
383 $algorithm{"PEM_write_${1}"} = "RSA";
384 $algorithm{"PEM_read_bio_${1}"} = "RSA";
385 $algorithm{"PEM_write_bio_${1}"} = "RSA";
387 elsif ($1 eq "DSAPrivateKey" ||
389 $1 eq "RSA_PUBKEY") {
390 $algorithm{"PEM_read_${1}"} = "DSA";
391 $algorithm{"PEM_write_${1}"} = "DSA";
392 $algorithm{"PEM_read_bio_${1}"} = "DSA";
393 $algorithm{"PEM_write_bio_${1}"} = "DSA";
395 elsif ($1 eq "DHparams") {
396 $algorithm{"PEM_read_${1}"} = "DH";
397 $algorithm{"PEM_write_${1}"} = "DH";
398 $algorithm{"PEM_read_bio_${1}"} = "DH";
399 $algorithm{"PEM_write_bio_${1}"} = "DH";
401 } elsif (/^DECLARE_PEM_write\s*\(\s*(\w*)\s*,/ ||
402 /^DECLARE_PEM_write_cb\s*\(\s*(\w*)\s*,/ ) {
403 # Things not in Win16
404 $syms{"PEM_write_${1}"} = 1;
405 $platform{"PEM_write_${1}"} .= ",!WIN16";
406 # Things that are everywhere
407 $syms{"PEM_write_bio_${1}"} = 1;
408 if ($1 eq "RSAPrivateKey" ||
409 $1 eq "RSAPublicKey" ||
410 $1 eq "RSA_PUBKEY") {
411 $algorithm{"PEM_write_${1}"} = "RSA";
412 $algorithm{"PEM_write_bio_${1}"} = "RSA";
414 elsif ($1 eq "DSAPrivateKey" ||
416 $1 eq "RSA_PUBKEY") {
417 $algorithm{"PEM_write_${1}"} = "DSA";
418 $algorithm{"PEM_write_bio_${1}"} = "DSA";
420 elsif ($1 eq "DHparams") {
421 $algorithm{"PEM_write_${1}"} = "DH";
422 $algorithm{"PEM_write_bio_${1}"} = "DH";
424 } elsif (/^DECLARE_PEM_read\s*\(\s*(\w*)\s*,/ ||
425 /^DECLARE_PEM_read_cb\s*\(\s*(\w*)\s*,/ ) {
426 # Things not in Win16
427 $syms{"PEM_read_${1}"} = 1;
428 $platform{"PEM_read_${1}"} .= ",!WIN16";
429 # Things that are everywhere
430 $syms{"PEM_read_bio_${1}"} = 1;
433 && ($tag{'CONST_STRICT'} != 1)
436 if (/\{|\/\*|\([^\)]*$/) {
448 foreach (split /;/, $def) {
449 my $s; my $k = "FUNCTION"; my $p; my $a;
453 next if(/typedef\W/);
456 if (/^\#INFO:([^:]*):(.*)$/) {
460 } elsif (/^\s*OPENSSL_EXTERN\s.*?(\w+)(\[[0-9]*\])*\s*$/) {
463 } elsif (/\(\*(\w*)\([^\)]+/) {
465 } elsif (/\w+\W+(\w+)\W*\(\s*\)$/s) {
468 } elsif (/\w+\W+\w+\W*\(.*\)$/s) {
469 while (not /\(\)$/s) {
471 s/\([^\(\)]*\)\)$/\)/s;
476 } elsif (/\(/ and not (/=/)) {
477 print STDERR "File $file: cannot parse: $_;\n";
488 $a .= ",BF" if($s =~ /EVP_bf/);
489 $a .= ",CAST" if($s =~ /EVP_cast/);
490 $a .= ",DES" if($s =~ /EVP_des/);
491 $a .= ",DSA" if($s =~ /EVP_dss/);
492 $a .= ",IDEA" if($s =~ /EVP_idea/);
493 $a .= ",MD2" if($s =~ /EVP_md2/);
494 $a .= ",MD4" if($s =~ /EVP_md4/);
495 $a .= ",MD5" if($s =~ /EVP_md5/);
496 $a .= ",RC2" if($s =~ /EVP_rc2/);
497 $a .= ",RC4" if($s =~ /EVP_rc4/);
498 $a .= ",RC5" if($s =~ /EVP_rc5/);
499 $a .= ",RIPEMD" if($s =~ /EVP_ripemd/);
500 $a .= ",SHA" if($s =~ /EVP_sha/);
501 $a .= ",RSA" if($s =~ /EVP_(Open|Seal)(Final|Init)/);
502 $a .= ",RSA" if($s =~ /PEM_Seal(Final|Init|Update)/);
503 $a .= ",RSA" if($s =~ /RSAPrivateKey/);
504 $a .= ",RSA" if($s =~ /SSLv23?_((client|server)_)?method/);
506 $platform{$s} .= ','.$p;
507 $algorithm{$s} .= ','.$a;
509 if (defined($rename{$s})) {
510 (my $r, my $p) = split(/:/,$rename{$s});
511 my @ip = map { /^!(.*)$/ ? $1 : "!".$_ } split /,/, $p;
513 $kind{$r} = $kind{$s}."(".$s.")";
514 $algorithm{$r} = $algorithm{$s};
515 $platform{$r} = $platform{$s}.",".$p;
516 $platform{$s} .= ','.join(',', @ip).','.join(',', @ip);
521 # Prune the returned symbols
523 $platform{"crypt"} .= ",!PERL5,!__FreeBSD__,!NeXT";
525 delete $syms{"SSL_add_dir_cert_subjects_to_stack"};
526 delete $syms{"bn_dump1"};
528 $platform{"BIO_s_file_internal"} .= ",WIN16";
529 $platform{"BIO_new_file_internal"} .= ",WIN16";
530 $platform{"BIO_new_fp_internal"} .= ",WIN16";
532 $platform{"BIO_s_file"} .= ",!WIN16";
533 $platform{"BIO_new_file"} .= ",!WIN16";
534 $platform{"BIO_new_fp"} .= ",!WIN16";
536 $platform{"BIO_s_log"} .= ",!WIN32,!WIN16,!macintosh";
538 if(exists $syms{"ERR_load_CRYPTO_strings"}) {
539 $platform{"ERR_load_CRYPTO_strings"} .= ",!VMS,!WIN16";
540 $syms{"ERR_load_CRYPTOlib_strings"} = 1;
541 $platform{"ERR_load_CRYPTOlib_strings"} .= ",VMS,WIN16";
546 $platform{"RSA_PKCS1_RSAref"} = "RSAREF";
547 $algorithm{"RSA_PKCS1_RSAref"} = "RSA";
549 push @ret, map { $_."\\".&info_string($_,"EXIST",
552 $algorithm{$_}) } keys %syms;
558 (my $symbol, my $exist, my $platforms, my $kind, my $algorithms) = @_;
560 my %a = defined($algorithms) ?
561 map { $_ => 1 } split /,/, $algorithms : ();
562 my $pl = defined($platforms) ? $platforms : "";
563 my %p = map { $_ => 0 } split /,/, $pl;
564 my $k = defined($kind) ? $kind : "FUNCTION";
567 # We do this, because if there's code like the following, it really
568 # means the function exists in all cases and should therefore be
569 # everywhere. By increasing and decreasing, we may attain 0:
576 foreach $platform (split /,/, $pl) {
577 if ($platform =~ /^!(.*)$/) {
583 foreach $platform (keys %p) {
584 if ($p{$platform} == 0) { delete $p{$platform}; }
591 $ret .= ":".join(',',map { $p{$_} < 0 ? "!".$_ : $_ } keys %p);
593 $ret .= ":".join(',',keys %a);
598 (my $name, *nums, my @symbols) = @_;
602 print STDERR "Updating $name info\n";
603 foreach $sym (@symbols) {
604 (my $s, my $i) = split /\\/, $sym;
605 $i =~ s/^(.*?:.*?:\w+)(\(\w+\))?/$1/;
606 if (defined($nums{$s})) {
607 (my $n, my $dummy) = split /\\/, $nums{$s};
608 if (!defined($dummy) || $i ne $dummy) {
609 $nums{$s} = $n."\\".$i;
611 #print STDERR "DEBUG: maybe_add_info for $s: \"$dummy\" => \"$i\"\n";
616 print STDERR "$new_info old symbols got an info update\n";
618 print STDERR "No old symbols needed info update\n";
624 (*OUT,my $name,*nums,my @symbols)=@_;
625 my $n = 1; my @e; my @r;
626 my $sym; my $prev = ""; my $prefSSLeay;
628 (@e)=grep(/^SSLeay\\.*?:.*?:FUNCTION/,@symbols);
629 (@r)=grep(/^\w+\\.*?:.*?:FUNCTION/ && !/^SSLeay\\.*?:.*?:FUNCTION/,@symbols);
630 @symbols=((sort @e),(sort @r));
632 foreach $sym (@symbols) {
633 (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/;
635 if (!defined($nums{$sym})) {
636 printf STDERR "Warning: $sym does not have a number assigned\n"
640 print OUT "\t$s();\n";
643 $prev = $s; # To avoid duplicates...
649 (*OUT,my $name,*nums,my @symbols)=@_;
650 my $n = 1; my @e; my @r;
659 ; Definition file for the DLL version of the $name library from OpenSSL
664 DESCRIPTION 'OpenSSL $name - http://www.openssl.org/'
670 CODE PRELOAD MOVEABLE
671 DATA PRELOAD MOVEABLE SINGLE
683 (@e)=grep(/^SSLeay\\.*?:.*?:FUNCTION/,@symbols);
684 (@r)=grep(/^\w+\\.*?:.*?:FUNCTION/ && !/^SSLeay\\.*?:.*?:FUNCTION/,@symbols);
685 @symbols=((sort @e),(sort @r));
688 foreach $sym (@symbols) {
689 (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/;
690 if (!defined($nums{$s})) {
691 printf STDERR "Warning: $s does not have a number assigned\n"
694 (my $n, my $i) = split /\\/, $nums{$s};
695 my @p = split(/,/, ($i =~ /^.*?:(.*?):/,$1));
696 # It is very important to check NT before W32
697 if (($NT && (!@p || (grep(/^WINNT$/,@p)
698 || !grep(/^!WINNT$/,@p))))
699 || ($W32 && (!@p || (grep(/^WIN32$/,@p)
700 || !grep(/^!WIN32$/,@p))))
701 || ($W16 && (!@p || (grep(/^WIN16$/,@p)
702 || !grep(/^!WIN16$/,@p))))) {
703 printf OUT " %s%-40s@%d\n",($W32)?"":"_",$s,$n;
719 open(IN,"<$name") || die "unable to open $name:$!\n";
725 if (defined $ret{$a[0]}) {
726 print STDERR "Warning: Symbol '",$a[0],"' redefined. old=",$ret{$a[0]},", new=",$a[1],"\n";
728 if ($max_num > $a[1]) {
729 print STDERR "Warning: Number decreased from ",$max_num," to ",$a[1],"\n";
731 if ($max_num == $a[1]) {
732 # This is actually perfectly OK
733 #print STDERR "Warning: Symbol ",$a[0]," has same number as previous ",$prev,": ",$a[1],"\n";
736 # Existence will be proven later, in do_defs
740 $ret{$a[0]}=$a[1]."\\".$a[2]; # \\ is a special marker
742 $max_num = $a[1] if $a[1] > $max_num;
746 print STDERR "Warning: $num_noinfo symbols were without info.";
748 printf STDERR " The rewrite will fix this.\n";
750 printf STDERR " You should do a rewrite to fix this.\n";
759 (my $str, my $what) = @_;
760 (my $n, my $i) = split(/\\/,$str);
770 (*OUT,$name,*nums,@symbols)=@_;
773 print STDERR "Rewriting $name\n";
775 my @r = grep(/^\w+\\.*?:.*?:\w+\(\w+\)/,@symbols);
776 my $r; my %r; my %rsyms;
778 (my $s, my $i) = split /\\/, $r;
779 my $a = $1 if $i =~ /^.*?:.*?:\w+\((\w+)\)/;
780 $i =~ s/^(.*?:.*?:\w+)\(\w+\)/$1/;
785 my @s=sort { &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n") } keys %nums;
787 (my $n, my $i) = split /\\/, $nums{$sym};
788 next if defined($i) && $i =~ /^.*?:.*?:\w+\(\w+\)/;
789 next if defined($rsyms{$sym});
790 $i="NOEXIST::FUNCTION:" if !defined($i) || $i eq "";
791 printf OUT "%s%-40s%d\t%s\n","",$sym,$n,$i;
792 if (exists $r{$sym}) {
793 (my $s, $i) = split /\\/,$r{$sym};
794 printf OUT "%s%-40s%d\t%s\n","",$s,$n,$i;
801 (*OUT,$name,*nums,my $start_num, my @symbols)=@_;
804 print STDERR "Updating $name numbers\n";
806 my @r = grep(/^\w+\\.*?:.*?:\w+\(\w+\)/,@symbols);
807 my $r; my %r; my %rsyms;
809 (my $s, my $i) = split /\\/, $r;
810 my $a = $1 if $i =~ /^.*?:.*?:\w+\((\w+)\)/;
811 $i =~ s/^(.*?:.*?:\w+)\(\w+\)/$1/;
816 foreach $sym (@symbols) {
817 (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/;
818 next if $i =~ /^.*?:.*?:\w+\(\w+\)/;
819 next if defined($rsyms{$sym});
820 die "ERROR: Symbol $sym had no info attached to it."
822 if (!exists $nums{$s}) {
824 printf OUT "%s%-40s%d\t%s\n","",$s, ++$start_num,$i;
826 ($s, $i) = split /\\/,$r{$sym};
827 printf OUT "%s%-40s%d\t%s\n","",$s, $start_num,$i;
832 print STDERR "$new_syms New symbols added\n";
834 print STDERR "No New symbols Added\n";
840 (*nums, my @symbols)=@_;
841 my %existing; my @remaining;
843 foreach $sym (@symbols) {
844 (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/;
847 foreach $sym (keys %nums) {
848 if (!exists $existing{$sym}) {
849 push @remaining, $sym;
853 print STDERR "The following symbols do not seem to exist:\n";
854 foreach $sym (@remaining) {
855 print STDERR "\t",$sym,"\n";