]> git.ipfire.org Git - thirdparty/openssl.git/blame - util/mkdef.pl
I had forgotten to change mkerr.pl to use the new macro system.
[thirdparty/openssl.git] / util / mkdef.pl
CommitLineData
ce9449cf 1#!/usr/local/bin/perl -w
d02b48c6
RE
2#
3# generate a .def file
4#
5# It does this by parsing the header files and looking for the
47339f61 6# prototyped functions: it then prunes the output.
d02b48c6 7#
948d0125
RL
8# Intermediary files are created, call libeay.num and ssleay.num,...
9# Previously, they had the following format:
10#
11# routine-name nnnn
12#
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.
19#
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
24# file).
25#
26# The format now becomes:
27#
28# routine-name nnnn info
29#
30# and the "info" part is actually a colon-separated string of fields with
31# the following meaning:
32#
33# existence:platform:kind:algorithms
34#
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
d63b8db8
RL
43# crypto/symhacks.h.
44# The semantics for the platforms list is a bit complicated. The rule of
45# thumb is that the list is exclusive, but it seems to mean different things.
46# So, if the list is all negatives (like "!VMS,!WIN16"), the symbol exists
47# on all platforms except those listed. If the list is all positives (like
48# "VMS,WIN16"), the symbol exists only on those platforms and nowhere else.
49# The combination of positives and negatives will act as if the positives
50# weren't there.
948d0125
RL
51# - "kind" is "FUNCTION" or "VARIABLE". The meaning of that is obvious.
52# - "algorithms" is a comma-separated list of algorithm names. This helps
53# exclude symbols that are part of an algorithm that some user wants to
54# exclude.
55#
d02b48c6 56
948d0125
RL
57my $crypto_num= "util/libeay.num";
58my $ssl_num= "util/ssleay.num";
d02b48c6 59
47339f61 60my $do_update = 0;
948d0125 61my $do_rewrite = 0;
47339f61
DSH
62my $do_crypto = 0;
63my $do_ssl = 0;
0f583f69 64my $do_ctest = 0;
967f4ca8 65my $do_ctestall = 0;
c47c6196 66my $do_checkexist = 0;
47339f61 67
948d0125
RL
68my $VMS=0;
69my $W32=0;
70my $W16=0;
0f583f69 71my $NT=0;
28a98809 72# Set this to make typesafe STACK definitions appear in DEF
e41c8d6a 73my $safe_stack_def = 0;
31ff97b2 74
948d0125
RL
75my @known_platforms = ( "__FreeBSD__", "VMS", "WIN16", "WIN32",
76 "WINNT", "PERL5", "NeXT" );
77my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF",
3f07fe09
RL
78 "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1",
79 "RIPEMD",
c47c6196 80 "MDC2", "RSA", "DSA", "DH", "HMAC", "AES",
3f07fe09
RL
81 # Envelope "algorithms"
82 "EVP", "X509", "ASN1_TYPEDEFS",
83 # Helper "algorithms"
84 "BIO", "COMP", "BUFFER", "LHASH", "STACK", "ERR",
85 "LOCKING",
86 # External "algorithms"
87 "FP_API", "STDIO", "SOCK", "KRB5" );
948d0125 88
0f583f69 89my $options="";
31ff97b2
UM
90open(IN,"<Makefile.ssl") || die "unable to open Makefile.ssl!\n";
91while(<IN>) {
92 $options=$1 if (/^OPTIONS=(.*)$/);
93}
ce457a54 94close(IN);
31ff97b2 95
0f583f69
UM
96# The following ciphers may be excluded (by Configure). This means functions
97# defined with ifndef(NO_XXX) are not included in the .def file, and everything
98# in directory xxx is ignored.
99my $no_rc2; my $no_rc4; my $no_rc5; my $no_idea; my $no_des; my $no_bf;
3009458e
RL
100my $no_cast;
101my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2;
c063f2c5 102my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5;
948d0125 103my $no_fp_api;
0f583f69 104
31ff97b2 105foreach (@ARGV, split(/ /, $options))
d02b48c6 106 {
06c68491 107 $W32=1 if $_ eq "32";
948d0125 108 $W16=1 if $_ eq "16";
06c68491
DSH
109 if($_ eq "NT") {
110 $W32 = 1;
111 $NT = 1;
112 }
948d0125 113 $VMS=1 if $_ eq "VMS";
d63b8db8 114
d02b48c6 115 $do_ssl=1 if $_ eq "ssleay";
55a9cc6e 116 $do_ssl=1 if $_ eq "ssl";
d02b48c6 117 $do_crypto=1 if $_ eq "libeay";
55a9cc6e
DSH
118 $do_crypto=1 if $_ eq "crypto";
119 $do_update=1 if $_ eq "update";
948d0125 120 $do_rewrite=1 if $_ eq "rewrite";
12aefe78 121 $do_ctest=1 if $_ eq "ctest";
967f4ca8 122 $do_ctestall=1 if $_ eq "ctestall";
c47c6196 123 $do_checkexist=1 if $_ eq "exist";
a8b07aa4 124 #$safe_stack_def=1 if $_ eq "-DDEBUG_SAFESTACK";
8cf65228
UM
125
126 if (/^no-rc2$/) { $no_rc2=1; }
127 elsif (/^no-rc4$/) { $no_rc4=1; }
128 elsif (/^no-rc5$/) { $no_rc5=1; }
129 elsif (/^no-idea$/) { $no_idea=1; }
be054868 130 elsif (/^no-des$/) { $no_des=1; $no_mdc2=1; }
8cf65228
UM
131 elsif (/^no-bf$/) { $no_bf=1; }
132 elsif (/^no-cast$/) { $no_cast=1; }
133 elsif (/^no-md2$/) { $no_md2=1; }
3009458e 134 elsif (/^no-md4$/) { $no_md4=1; }
8cf65228
UM
135 elsif (/^no-md5$/) { $no_md5=1; }
136 elsif (/^no-sha$/) { $no_sha=1; }
137 elsif (/^no-ripemd$/) { $no_ripemd=1; }
138 elsif (/^no-mdc2$/) { $no_mdc2=1; }
139 elsif (/^no-rsa$/) { $no_rsa=1; }
140 elsif (/^no-dsa$/) { $no_dsa=1; }
141 elsif (/^no-dh$/) { $no_dh=1; }
142 elsif (/^no-hmac$/) { $no_hmac=1; }
c47c6196 143 elsif (/^no-aes$/) { $no_aes=1; }
3f07fe09
RL
144 elsif (/^no-evp$/) { $no_evp=1; }
145 elsif (/^no-lhash$/) { $no_lhash=1; }
146 elsif (/^no-stack$/) { $no_stack=1; }
147 elsif (/^no-err$/) { $no_err=1; }
148 elsif (/^no-buffer$/) { $no_buffer=1; }
149 elsif (/^no-bio$/) { $no_bio=1; }
150 #elsif (/^no-locking$/) { $no_locking=1; }
151 elsif (/^no-comp$/) { $no_comp=1; }
152 elsif (/^no-dso$/) { $no_dso=1; }
c063f2c5 153 elsif (/^no-krb5$/) { $no_krb5=1; }
d02b48c6
RE
154 }
155
12aefe78 156
948d0125
RL
157# If no platform is given, assume WIN32
158if ($W32 + $W16 + $VMS == 0) {
159 $W32 = 1;
160}
161
162# Add extra knowledge
163if ($W16) {
164 $no_fp_api=1;
165}
166
d02b48c6
RE
167if (!$do_ssl && !$do_crypto)
168 {
ccb9643f 169 print STDERR "usage: $0 ( ssl | crypto ) [ 16 | 32 | NT ]\n";
d02b48c6
RE
170 exit(1);
171 }
172
173%ssl_list=&load_numbers($ssl_num);
55a9cc6e 174$max_ssl = $max_num;
d02b48c6 175%crypto_list=&load_numbers($crypto_num);
55a9cc6e 176$max_crypto = $max_num;
d02b48c6 177
0f583f69 178my $ssl="ssl/ssl.h";
3f07fe09 179$ssl.=" ssl/kssl.h";
d02b48c6 180
0f583f69 181my $crypto ="crypto/crypto.h";
8cf65228
UM
182$crypto.=" crypto/des/des.h" unless $no_des;
183$crypto.=" crypto/idea/idea.h" unless $no_idea;
184$crypto.=" crypto/rc4/rc4.h" unless $no_rc4;
185$crypto.=" crypto/rc5/rc5.h" unless $no_rc5;
186$crypto.=" crypto/rc2/rc2.h" unless $no_rc2;
187$crypto.=" crypto/bf/blowfish.h" unless $no_bf;
188$crypto.=" crypto/cast/cast.h" unless $no_cast;
189$crypto.=" crypto/md2/md2.h" unless $no_md2;
3009458e 190$crypto.=" crypto/md4/md4.h" unless $no_md4;
8cf65228
UM
191$crypto.=" crypto/md5/md5.h" unless $no_md5;
192$crypto.=" crypto/mdc2/mdc2.h" unless $no_mdc2;
193$crypto.=" crypto/sha/sha.h" unless $no_sha;
194$crypto.=" crypto/ripemd/ripemd.h" unless $no_ripemd;
c47c6196
DSH
195$crypto.=" crypto/rijndael/rijndael.h" unless $no_aes;
196$crypto.=" crypto/rijndael/rd_fst.h" unless $no_aes;
d02b48c6
RE
197
198$crypto.=" crypto/bn/bn.h";
8cf65228
UM
199$crypto.=" crypto/rsa/rsa.h" unless $no_rsa;
200$crypto.=" crypto/dsa/dsa.h" unless $no_dsa;
201$crypto.=" crypto/dh/dh.h" unless $no_dh;
202$crypto.=" crypto/hmac/hmac.h" unless $no_hmac;
d02b48c6 203
5270e702 204$crypto.=" crypto/engine/engine.h";
3f07fe09
RL
205$crypto.=" crypto/stack/stack.h" unless $no_stack;
206$crypto.=" crypto/buffer/buffer.h" unless $no_buffer;
207$crypto.=" crypto/bio/bio.h" unless $no_bio;
208$crypto.=" crypto/dso/dso.h" unless $no_dso;
209$crypto.=" crypto/lhash/lhash.h" unless $no_lhash;
d02b48c6
RE
210$crypto.=" crypto/conf/conf.h";
211$crypto.=" crypto/txt_db/txt_db.h";
212
3f07fe09 213$crypto.=" crypto/evp/evp.h" unless $no_evp;
d02b48c6
RE
214$crypto.=" crypto/objects/objects.h";
215$crypto.=" crypto/pem/pem.h";
216#$crypto.=" crypto/meth/meth.h";
217$crypto.=" crypto/asn1/asn1.h";
9c67ab2f 218$crypto.=" crypto/asn1/asn1t.h";
d02b48c6 219$crypto.=" crypto/asn1/asn1_mac.h";
3f07fe09 220$crypto.=" crypto/err/err.h" unless $no_err;
d02b48c6 221$crypto.=" crypto/pkcs7/pkcs7.h";
ee0508d4 222$crypto.=" crypto/pkcs12/pkcs12.h";
d02b48c6
RE
223$crypto.=" crypto/x509/x509.h";
224$crypto.=" crypto/x509/x509_vfy.h";
679ab7c3 225$crypto.=" crypto/x509v3/x509v3.h";
d02b48c6 226$crypto.=" crypto/rand/rand.h";
3f07fe09 227$crypto.=" crypto/comp/comp.h" unless $no_comp;
eb64730b 228$crypto.=" crypto/ocsp/ocsp.h";
dfeab068 229$crypto.=" crypto/tmdiff.h";
d02b48c6 230
948d0125 231my $symhacks="crypto/symhacks.h";
55a9cc6e 232
948d0125
RL
233my @ssl_symbols = &do_defs("SSLEAY", $ssl, $symhacks);
234my @crypto_symbols = &do_defs("LIBEAY", $crypto, $symhacks);
47339f61 235
55a9cc6e
DSH
236if ($do_update) {
237
238if ($do_ssl == 1) {
948d0125
RL
239
240 &maybe_add_info("SSLEAY",*ssl_list,@ssl_symbols);
241 if ($do_rewrite == 1) {
242 open(OUT, ">$ssl_num");
243 &rewrite_numbers(*OUT,"SSLEAY",*ssl_list,@ssl_symbols);
244 close OUT;
245 } else {
246 open(OUT, ">>$ssl_num");
247 }
248 &update_numbers(*OUT,"SSLEAY",*ssl_list,$max_ssl,@ssl_symbols);
55a9cc6e
DSH
249 close OUT;
250}
251
252if($do_crypto == 1) {
948d0125
RL
253
254 &maybe_add_info("LIBEAY",*crypto_list,@crypto_symbols);
255 if ($do_rewrite == 1) {
256 open(OUT, ">$crypto_num");
257 &rewrite_numbers(*OUT,"LIBEAY",*crypto_list,@crypto_symbols);
258 } else {
259 open(OUT, ">>$crypto_num");
260 }
261 &update_numbers(*OUT,"LIBEAY",*crypto_list,$max_crypto,@crypto_symbols);
55a9cc6e 262 close OUT;
12aefe78
DSH
263}
264
c47c6196
DSH
265} elsif ($do_checkexist) {
266 &check_existing(*ssl_list, @ssl_symbols)
267 if $do_ssl == 1;
268 &check_existing(*crypto_list, @crypto_symbols)
269 if $do_crypto == 1;
967f4ca8 270} elsif ($do_ctest || $do_ctestall) {
12aefe78
DSH
271
272 print <<"EOF";
273
274/* Test file to check all DEF file symbols are present by trying
275 * to link to all of them. This is *not* intended to be run!
276 */
277
278int main()
279{
280EOF
948d0125 281 &print_test_file(*STDOUT,"SSLEAY",*ssl_list,$do_ctestall,@ssl_symbols)
12aefe78
DSH
282 if $do_ssl == 1;
283
948d0125 284 &print_test_file(*STDOUT,"LIBEAY",*crypto_list,$do_ctestall,@crypto_symbols)
12aefe78
DSH
285 if $do_crypto == 1;
286
287 print "}\n";
55a9cc6e
DSH
288
289} else {
8cf65228 290
948d0125 291 &print_def_file(*STDOUT,"SSLEAY",*ssl_list,@ssl_symbols)
55a9cc6e
DSH
292 if $do_ssl == 1;
293
948d0125 294 &print_def_file(*STDOUT,"LIBEAY",*crypto_list,@crypto_symbols)
55a9cc6e 295 if $do_crypto == 1;
8cf65228 296
55a9cc6e 297}
d02b48c6 298
d02b48c6
RE
299
300sub do_defs
47339f61 301{
948d0125 302 my($name,$files,$symhacksfile)=@_;
0f583f69 303 my $file;
47339f61 304 my @ret;
948d0125
RL
305 my %syms;
306 my %platform; # For anything undefined, we assume ""
307 my %kind; # For anything undefined, we assume "FUNCTION"
308 my %algorithm; # For anything undefined, we assume ""
309 my %rename;
0f583f69 310 my $cpp;
3f07fe09 311 my %unknown_algorithms = ();
d02b48c6 312
948d0125 313 foreach $file (split(/\s+/,$symhacksfile." ".$files))
d02b48c6 314 {
d02b48c6 315 open(IN,"<$file") || die "unable to open $file:$!\n";
0f583f69 316 my $line = "", my $def= "";
47339f61 317 my %tag = (
cf1b7d96
RL
318 (map { "OPENSSL_SYS_".$_ => 0 } @known_platforms),
319 (map { "OPENSSL_NO_".$_ => 0 } @known_algorithms),
47339f61 320 NOPROTO => 0,
47339f61
DSH
321 PERL5 => 0,
322 _WINDLL => 0,
47339f61
DSH
323 CONST_STRICT => 0,
324 TRUE => 1,
325 );
948d0125 326 my $symhacking = $file eq $symhacksfile;
267a1927
RL
327 my @current_platforms = ();
328 my @current_algorithms = ();
329
47339f61
DSH
330 while(<IN>) {
331 last if (/BEGIN ERROR CODES/);
332 if ($line ne '') {
333 $_ = $line . $_;
334 $line = '';
d02b48c6 335 }
47339f61
DSH
336
337 if (/\\$/) {
338 $line = $_;
339 next;
340 }
341
948d0125 342 $cpp = 1 if /^\#.*ifdef.*cplusplus/;
47339f61 343 if ($cpp) {
948d0125 344 $cpp = 0 if /^\#.*endif/;
47339f61
DSH
345 next;
346 }
347
348 s/\/\*.*?\*\///gs; # ignore comments
349 s/{[^{}]*}//gs; # ignore {} blocks
3f07fe09
RL
350 #print STDERR "DEBUG: \$_=\"$_\"\n";
351 if (/^\#\s*ifndef\s+(.*)/) {
d02b48c6
RE
352 push(@tag,$1);
353 $tag{$1}=-1;
3f07fe09 354 } elsif (/^\#\s*if\s+!defined\(([^\)]+)\)/) {
d02b48c6
RE
355 push(@tag,$1);
356 $tag{$1}=-1;
3f07fe09 357 } elsif (/^\#\s*ifdef\s+(.*)/) {
d02b48c6
RE
358 push(@tag,$1);
359 $tag{$1}=1;
3f07fe09 360 } elsif (/^\#\s*if\s+defined\(([^\)]+)\)/) {
d02b48c6
RE
361 push(@tag,$1);
362 $tag{$1}=1;
948d0125 363 } elsif (/^\#\s*error\s+(\w+) is disabled\./) {
cf1b7d96 364 if ($tag[$#tag] eq "OPENSSL_NO_".$1) {
948d0125
RL
365 $tag{$tag[$#tag]}=2;
366 }
47339f61 367 } elsif (/^\#\s*endif/) {
3f07fe09
RL
368 my $oldtag=$tag[$#tag];
369 #print STDERR "DEBUG: \$oldtag=\"$oldtag\"\n";
948d0125
RL
370 if ($tag{$tag[$#tag]}==2) {
371 $tag{$tag[$#tag]}=-1;
372 } else {
373 $tag{$tag[$#tag]}=0;
374 }
d02b48c6 375 pop(@tag);
cf1b7d96 376 if ($oldtag =~ /^OPENSSL_NO_([A-Z0-9_]+)$/) {
3f07fe09
RL
377 $oldtag=$1;
378 } else {
379 $oldtag="";
380 }
381 if ($oldtag ne ""
382 && !grep(/^$oldtag$/, @known_algorithms)) {
383 $unknown_algorithms{$oldtag} = 1;
384 #print STDERR "DEBUG: Added as unknown algorithm: $oldtag\n";
385 }
47339f61
DSH
386 } elsif (/^\#\s*else/) {
387 my $t=$tag[$#tag];
d02b48c6 388 $tag{$t}= -$tag{$t};
47339f61
DSH
389 } elsif (/^\#\s*if\s+1/) {
390 # Dummy tag
391 push(@tag,"TRUE");
392 $tag{"TRUE"}=1;
1e414935
BM
393 } elsif (/^\#\s*if\s+0/) {
394 # Dummy tag
395 push(@tag,"TRUE");
396 $tag{"TRUE"}=-1;
948d0125
RL
397 } elsif (/^\#\s*define\s+(\w+)\s+(\w+)/
398 && $symhacking) {
399 my $s = $1;
400 my $a =
cf1b7d96
RL
401 $2.":".join(",",
402 grep(!/^$/,
403 map { $tag{"OPENSSL_SYS_".$_} == 1 ?
404 $_ : "" }
405 @known_platforms));
948d0125
RL
406 $rename{$s} = $a;
407 }
408 if (/^\#/) {
267a1927
RL
409 @current_platforms =
410 grep(!/^$/,
cf1b7d96
RL
411 map { $tag{"OPENSSL_SYS_".$_} == 1 ? $_ :
412 $tag{"OPENSSL_SYS_".$_} == -1 ? "!".$_ : "" }
267a1927
RL
413 @known_platforms);
414 @current_algorithms =
415 grep(!/^$/,
cf1b7d96 416 map { $tag{"OPENSSL_NO_".$_} == -1 ? $_ : "" }
267a1927
RL
417 @known_algorithms);
418 $def .=
419 "#INFO:"
420 .join(',',@current_platforms).":"
421 .join(',',@current_algorithms).";";
47339f61
DSH
422 next;
423 }
13083215 424 if (/^\s*DECLARE_STACK_OF\s*\(\s*(\w*)\s*\)/) {
a8b07aa4 425 next;
c47c6196 426 } elsif (/^\s*DECLARE_ASN1_ENCODE_FUNCTIONS\s*\(\s*(\w*)\s*,\s*(\w*)\s*,\s*(\w*)\s*\)/) {
267a1927
RL
427 $def .= "int d2i_$3(void);";
428 $def .= "int i2d_$3(void);";
429 $def .= "OPENSSL_EXTERN int $2_it;";
c47c6196 430 next;
3c07b4c2 431 } elsif (/^\s*DECLARE_ASN1_FUNCTIONS_fname\s*\(\s*(\w*)\s*,\s*(\w*)\s*,\s*(\w*)\s*\)/) {
267a1927
RL
432 $def .= "int d2i_$3(void);";
433 $def .= "int i2d_$3(void);";
434 $def .= "int $3_free(void);";
435 $def .= "int $3_new(void);";
436 $def .= "OPENSSL_EXTERN int $2_it;";
c47c6196
DSH
437 } elsif (/^\s*DECLARE_ASN1_FUNCTIONS\s*\(\s*(\w*)\s*\)/ ||
438 /^\s*DECLARE_ASN1_FUNCTIONS_const\s*\(\s*(\w*)\s*\)/) {
267a1927
RL
439 $def .= "int d2i_$1(void);";
440 $def .= "int i2d_$1(void);";
441 $def .= "int $1_free(void);";
442 $def .= "int $1_new(void);";
443 $def .= "OPENSSL_EXTERN int $1_it;";
9c67ab2f 444 next;
c47c6196 445 } elsif (/^\s*DECLARE_ASN1_ENCODE_FUNCTIONS_const\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) {
267a1927
RL
446 $def .= "int d2i_$2(void);";
447 $def .= "int i2d_$2(void);";
448 $def .= "OPENSSL_EXTERN int $2_it;";
c47c6196
DSH
449 next;
450 } elsif (/^\s*DECLARE_ASN1_FUNCTIONS_name\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) {
267a1927
RL
451 $def .= "int d2i_$2(void);";
452 $def .= "int i2d_$2(void);";
453 $def .= "int $2_free(void);";
454 $def .= "int $2_new(void);";
455 $def .= "OPENSSL_EXTERN int $2_it;";
c47c6196
DSH
456 next;
457 } elsif (/^\s*DECLARE_ASN1_ITEM\s*\(\s*(\w*)\s*,(\w*)\s*\)/) {
267a1927 458 $def .= "OPENSSL_EXTERN int $1_it;";
c47c6196 459 next;
948d0125
RL
460 } elsif (/^\s*DECLARE_PKCS12_STACK_OF\s*\(\s*(\w*)\s*\)/) {
461 next;
13083215 462 } elsif (/^\s*DECLARE_ASN1_SET_OF\s*\(\s*(\w*)\s*\)/) {
a8b07aa4 463 next;
dbd665c2 464 } elsif (/^DECLARE_PEM_rw\s*\(\s*(\w*)\s*,/ ||
948d0125
RL
465 /^DECLARE_PEM_rw_cb\s*\(\s*(\w*)\s*,/ ) {
466 # Things not in Win16
267a1927
RL
467 $def .=
468 "#INFO:"
469 .join(',',"!WIN16",@current_platforms).":"
470 .join(',',@current_algorithms).";";
471 $def .= "int PEM_read_$1(void);";
472 $def .= "int PEM_write_$1(void);";
473 $def .=
474 "#INFO:"
475 .join(',',@current_platforms).":"
476 .join(',',@current_algorithms).";";
948d0125 477 # Things that are everywhere
267a1927
RL
478 $def .= "int PEM_read_bio_$1(void);";
479 $def .= "int PEM_write_bio_$1(void);";
8a208cba
DSH
480 } elsif (/^DECLARE_PEM_write\s*\(\s*(\w*)\s*,/ ||
481 /^DECLARE_PEM_write_cb\s*\(\s*(\w*)\s*,/ ) {
948d0125 482 # Things not in Win16
267a1927
RL
483 $def .=
484 "#INFO:"
485 .join(',',"!WIN16",@current_platforms).":"
486 .join(',',@current_algorithms).";";
487 $def .= "int PEM_write_$1(void);";
488 $def .=
489 "#INFO:"
490 .join(',',@current_platforms).":"
491 .join(',',@current_algorithms).";";
948d0125 492 # Things that are everywhere
267a1927 493 $def .= "int PEM_write_bio_$1(void);";
8a208cba
DSH
494 } elsif (/^DECLARE_PEM_read\s*\(\s*(\w*)\s*,/ ||
495 /^DECLARE_PEM_read_cb\s*\(\s*(\w*)\s*,/ ) {
948d0125 496 # Things not in Win16
267a1927
RL
497 $def .=
498 "#INFO:"
499 .join(',',"!WIN16",@current_platforms).":"
500 .join(',',@current_algorithms).";";
501 $def .= "int PEM_read_$1(void);";
502 $def .=
503 "#INFO:"
504 .join(',',@current_platforms).":"
505 .join(',',@current_algorithms).";";
948d0125 506 # Things that are everywhere
267a1927 507 $def .= "int PEM_read_bio_$1(void);";
0f583f69 508 } elsif (
948d0125
RL
509 ($tag{'TRUE'} != -1)
510 && ($tag{'CONST_STRICT'} != 1)
511 )
d02b48c6 512 {
948d0125 513 if (/\{|\/\*|\([^\)]*$/) {
47339f61
DSH
514 $line = $_;
515 } else {
516 $def .= $_;
517 }
d02b48c6
RE
518 }
519 }
520 close(IN);
47339f61 521
948d0125
RL
522 my $algs;
523 my $plays;
524
47339f61 525 foreach (split /;/, $def) {
948d0125 526 my $s; my $k = "FUNCTION"; my $p; my $a;
47339f61
DSH
527 s/^[\n\s]*//g;
528 s/[\n\s]*$//g;
948d0125 529 next if(/\#undef/);
47339f61 530 next if(/typedef\W/);
948d0125
RL
531 next if(/\#define/);
532
533 if (/^\#INFO:([^:]*):(.*)$/) {
534 $plats = $1;
535 $algs = $2;
536 next;
537 } elsif (/^\s*OPENSSL_EXTERN\s.*?(\w+)(\[[0-9]*\])*\s*$/) {
538 $s = $1;
539 $k = "VARIABLE";
540 } elsif (/\(\*(\w*)\([^\)]+/) {
541 $s = $1;
47339f61
DSH
542 } elsif (/\w+\W+(\w+)\W*\(\s*\)$/s) {
543 # K&R C
544 next;
545 } elsif (/\w+\W+\w+\W*\(.*\)$/s) {
546 while (not /\(\)$/s) {
547 s/[^\(\)]*\)$/\)/s;
548 s/\([^\(\)]*\)\)$/\)/s;
549 }
550 s/\(void\)//;
551 /(\w+)\W*\(\)/s;
948d0125 552 $s = $1;
47339f61
DSH
553 } elsif (/\(/ and not (/=/)) {
554 print STDERR "File $file: cannot parse: $_;\n";
948d0125
RL
555 next;
556 } else {
557 next;
558 }
559
560 $syms{$s} = 1;
561 $kind{$s} = $k;
562
563 $p = $plats;
564 $a = $algs;
565 $a .= ",BF" if($s =~ /EVP_bf/);
566 $a .= ",CAST" if($s =~ /EVP_cast/);
567 $a .= ",DES" if($s =~ /EVP_des/);
568 $a .= ",DSA" if($s =~ /EVP_dss/);
569 $a .= ",IDEA" if($s =~ /EVP_idea/);
570 $a .= ",MD2" if($s =~ /EVP_md2/);
571 $a .= ",MD4" if($s =~ /EVP_md4/);
572 $a .= ",MD5" if($s =~ /EVP_md5/);
573 $a .= ",RC2" if($s =~ /EVP_rc2/);
574 $a .= ",RC4" if($s =~ /EVP_rc4/);
575 $a .= ",RC5" if($s =~ /EVP_rc5/);
576 $a .= ",RIPEMD" if($s =~ /EVP_ripemd/);
577 $a .= ",SHA" if($s =~ /EVP_sha/);
578 $a .= ",RSA" if($s =~ /EVP_(Open|Seal)(Final|Init)/);
579 $a .= ",RSA" if($s =~ /PEM_Seal(Final|Init|Update)/);
580 $a .= ",RSA" if($s =~ /RSAPrivateKey/);
581 $a .= ",RSA" if($s =~ /SSLv23?_((client|server)_)?method/);
582
583 $platform{$s} .= ','.$p;
584 $algorithm{$s} .= ','.$a;
585
586 if (defined($rename{$s})) {
587 (my $r, my $p) = split(/:/,$rename{$s});
588 my @ip = map { /^!(.*)$/ ? $1 : "!".$_ } split /,/, $p;
589 $syms{$r} = 1;
590 $kind{$r} = $kind{$s}."(".$s.")";
591 $algorithm{$r} = $algorithm{$s};
592 $platform{$r} = $platform{$s}.",".$p;
593 $platform{$s} .= ','.join(',', @ip).','.join(',', @ip);
47339f61 594 }
d02b48c6 595 }
d02b48c6
RE
596 }
597
948d0125 598 # Prune the returned symbols
47339f61 599
948d0125 600 $platform{"crypt"} .= ",!PERL5,!__FreeBSD__,!NeXT";
47339f61 601
948d0125
RL
602 delete $syms{"SSL_add_dir_cert_subjects_to_stack"};
603 delete $syms{"bn_dump1"};
604
605 $platform{"BIO_s_file_internal"} .= ",WIN16";
606 $platform{"BIO_new_file_internal"} .= ",WIN16";
607 $platform{"BIO_new_fp_internal"} .= ",WIN16";
608
609 $platform{"BIO_s_file"} .= ",!WIN16";
610 $platform{"BIO_new_file"} .= ",!WIN16";
611 $platform{"BIO_new_fp"} .= ",!WIN16";
612
613 $platform{"BIO_s_log"} .= ",!WIN32,!WIN16,!macintosh";
614
615 if(exists $syms{"ERR_load_CRYPTO_strings"}) {
616 $platform{"ERR_load_CRYPTO_strings"} .= ",!VMS,!WIN16";
617 $syms{"ERR_load_CRYPTOlib_strings"} = 1;
618 $platform{"ERR_load_CRYPTOlib_strings"} .= ",VMS,WIN16";
619 }
620
621 # Info we know about
622
948d0125
RL
623 push @ret, map { $_."\\".&info_string($_,"EXIST",
624 $platform{$_},
625 $kind{$_},
626 $algorithm{$_}) } keys %syms;
627
3f07fe09
RL
628 if (keys %unknown_algorithms) {
629 print STDERR "WARNING: mkdef.pl doesn't know the following algorithms:\n";
630 print STDERR "\t",join("\n\t",keys %unknown_algorithms),"\n";
631 }
948d0125
RL
632 return(@ret);
633}
634
635sub info_string {
636 (my $symbol, my $exist, my $platforms, my $kind, my $algorithms) = @_;
637
638 my %a = defined($algorithms) ?
639 map { $_ => 1 } split /,/, $algorithms : ();
640 my $pl = defined($platforms) ? $platforms : "";
641 my %p = map { $_ => 0 } split /,/, $pl;
642 my $k = defined($kind) ? $kind : "FUNCTION";
643 my $ret;
644
645 # We do this, because if there's code like the following, it really
646 # means the function exists in all cases and should therefore be
647 # everywhere. By increasing and decreasing, we may attain 0:
648 #
649 # ifndef WIN16
650 # int foo();
651 # else
652 # int _fat foo();
653 # endif
654 foreach $platform (split /,/, $pl) {
655 if ($platform =~ /^!(.*)$/) {
656 $p{$1}--;
657 } else {
658 $p{$platform}++;
d02b48c6 659 }
47339f61 660 }
948d0125
RL
661 foreach $platform (keys %p) {
662 if ($p{$platform} == 0) { delete $p{$platform}; }
d02b48c6
RE
663 }
664
948d0125
RL
665 delete $p{""};
666 delete $a{""};
d02b48c6 667
948d0125
RL
668 $ret = $exist;
669 $ret .= ":".join(',',map { $p{$_} < 0 ? "!".$_ : $_ } keys %p);
670 $ret .= ":".$k;
671 $ret .= ":".join(',',keys %a);
672 return $ret;
673}
674
675sub maybe_add_info {
676 (my $name, *nums, my @symbols) = @_;
677 my $sym;
678 my $new_info = 0;
451e60e9 679 my %syms=();
948d0125
RL
680
681 print STDERR "Updating $name info\n";
682 foreach $sym (@symbols) {
683 (my $s, my $i) = split /\\/, $sym;
684 $i =~ s/^(.*?:.*?:\w+)(\(\w+\))?/$1/;
685 if (defined($nums{$s})) {
686 (my $n, my $dummy) = split /\\/, $nums{$s};
687 if (!defined($dummy) || $i ne $dummy) {
688 $nums{$s} = $n."\\".$i;
689 $new_info++;
690 #print STDERR "DEBUG: maybe_add_info for $s: \"$dummy\" => \"$i\"\n";
691 }
692 }
451e60e9
RL
693 $syms{sym} = 1;
694 }
695
696 my @s=sort { &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n") } keys %nums;
697 foreach $sym (@s) {
698 (my $n, my $i) = split /\\/, $nums{$sym};
699 if (!defined($syms{sym})) {
700 $new_info++;
701 #print STDERR "DEBUG: maybe_add_info for $sym: -> undefined\n";
702 }
948d0125
RL
703 }
704 if ($new_info) {
705 print STDERR "$new_info old symbols got an info update\n";
6d50071e
RL
706 if (!$do_rewrite) {
707 print STDERR "You should do a rewrite to fix this.\n";
708 }
948d0125
RL
709 } else {
710 print STDERR "No old symbols needed info update\n";
711 }
47339f61 712}
d02b48c6 713
12aefe78
DSH
714sub print_test_file
715{
948d0125 716 (*OUT,my $name,*nums,my @symbols)=@_;
0f583f69 717 my $n = 1; my @e; my @r;
948d0125
RL
718 my $sym; my $prev = ""; my $prefSSLeay;
719
720 (@e)=grep(/^SSLeay\\.*?:.*?:FUNCTION/,@symbols);
721 (@r)=grep(/^\w+\\.*?:.*?:FUNCTION/ && !/^SSLeay\\.*?:.*?:FUNCTION/,@symbols);
722 @symbols=((sort @e),(sort @r));
723
724 foreach $sym (@symbols) {
725 (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/;
726 if ($s ne $prev) {
c063f2c5 727 if (!defined($nums{$s})) {
cf1b7d96 728 print STDERR "Warning: $s does not have a number assigned\n"
948d0125 729 if(!$do_update);
967f4ca8 730 } else {
948d0125
RL
731 $n=$nums{$s};
732 print OUT "\t$s();\n";
967f4ca8 733 }
12aefe78 734 }
948d0125 735 $prev = $s; # To avoid duplicates...
12aefe78
DSH
736 }
737}
738
d02b48c6 739sub print_def_file
47339f61 740{
948d0125 741 (*OUT,my $name,*nums,my @symbols)=@_;
9c67ab2f 742 my $n = 1; my @e; my @r; my @v;
d02b48c6 743
06c68491 744 if ($W32)
d02b48c6
RE
745 { $name.="32"; }
746 else
747 { $name.="16"; }
748
749 print OUT <<"EOF";
750;
9b3086fe 751; Definition file for the DLL version of the $name library from OpenSSL
d02b48c6
RE
752;
753
754LIBRARY $name
755
9b3086fe 756DESCRIPTION 'OpenSSL $name - http://www.openssl.org/'
d02b48c6
RE
757
758EOF
759
47339f61 760 if (!$W32) {
d02b48c6
RE
761 print <<"EOF";
762CODE PRELOAD MOVEABLE
763DATA PRELOAD MOVEABLE SINGLE
764
765EXETYPE WINDOWS
766
767HEAPSIZE 4096
768STACKSIZE 8192
769
770EOF
47339f61 771 }
d02b48c6
RE
772
773 print "EXPORTS\n";
774
948d0125
RL
775 (@e)=grep(/^SSLeay\\.*?:.*?:FUNCTION/,@symbols);
776 (@r)=grep(/^\w+\\.*?:.*?:FUNCTION/ && !/^SSLeay\\.*?:.*?:FUNCTION/,@symbols);
9c67ab2f
DSH
777 (@v)=grep(/^\w+\\.*?:.*?:VARIABLE/,@symbols);
778 @symbols=((sort @e),(sort @r), (sort @v));
d02b48c6 779
d02b48c6 780
948d0125
RL
781 foreach $sym (@symbols) {
782 (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/;
9c67ab2f
DSH
783 my $v = 0;
784 $v = 1 if $sym=~ /^\w+\\.*?:.*?:VARIABLE/;
948d0125
RL
785 if (!defined($nums{$s})) {
786 printf STDERR "Warning: $s does not have a number assigned\n"
8cf65228 787 if(!$do_update);
47339f61 788 } else {
948d0125 789 (my $n, my $i) = split /\\/, $nums{$s};
d63b8db8 790 my %pf = ();
be054868
RL
791 my @p = split(/,/, ($i =~ /^[^:]*:([^:]*):/,$1));
792 my @a = split(/,/, ($i =~ /^[^:]*:[^:]*:[^:]*:([^:]*)/,$1));
d63b8db8
RL
793 # @p_purged must contain hardware platforms only
794 my @p_purged = ();
795 foreach $ptmp (@p) {
d63b8db8
RL
796 push @p_purged, $ptmp;
797 }
798 my $negatives = !!grep(/^!/,@p);
965c1775 799 # It is very important to check NT before W32
d63b8db8
RL
800 if ((($NT && (!@p_purged
801 || (!$negatives && grep(/^WINNT$/,@p))
802 || ($negatives && !grep(/^!WINNT$/,@p))))
803 || ($W32 && (!@p_purged
804 || (!$negatives && grep(/^WIN32$/,@p))
805 || ($negatives && !grep(/^!WIN32$/,@p))))
806 || ($W16 && (!@p_purged
807 || (!$negatives && grep(/^WIN16$/,@p))
808 || ($negatives && !grep(/^!WIN16$/,@p)))))
be054868
RL
809 && (!@a || (!$no_rc2 || !grep(/^RC2$/,@a)))
810 && (!@a || (!$no_rc4 || !grep(/^RC4$/,@a)))
811 && (!@a || (!$no_rc5 || !grep(/^RC5$/,@a)))
812 && (!@a || (!$no_idea || !grep(/^IDEA$/,@a)))
813 && (!@a || (!$no_des || !grep(/^DES$/,@a)))
814 && (!@a || (!$no_bf || !grep(/^BF$/,@a)))
815 && (!@a || (!$no_cast || !grep(/^CAST$/,@a)))
816 && (!@a || (!$no_md2 || !grep(/^MD2$/,@a)))
817 && (!@a || (!$no_md4 || !grep(/^MD4$/,@a)))
818 && (!@a || (!$no_md5 || !grep(/^MD5$/,@a)))
819 && (!@a || (!$no_sha || !grep(/^SHA$/,@a)))
820 && (!@a || (!$no_ripemd || !grep(/^RIPEMD$/,@a)))
821 && (!@a || (!$no_mdc2 || !grep(/^MDC2$/,@a)))
822 && (!@a || (!$no_rsa || !grep(/^RSA$/,@a)))
823 && (!@a || (!$no_dsa || !grep(/^DSA$/,@a)))
824 && (!@a || (!$no_dh || !grep(/^DH$/,@a)))
825 && (!@a || (!$no_hmac || !grep(/^HMAC$/,@a)))
c47c6196 826 && (!@a || (!$no_aes || !grep(/^AES$/,@a)))
c063f2c5 827 && (!@a || (!$no_krb5 || !grep(/^KRB5$/,@a)))
be054868
RL
828 && (!@a || (!$no_fp_api || !grep(/^FP_API$/,@a)))
829 ) {
9c67ab2f
DSH
830 if($v) {
831 printf OUT " %s%-40s@%-8d DATA\n",($W32)?"":"_",$s,$n;
832 } else {
833 printf OUT " %s%-40s@%d\n",($W32)?"":"_",$s,$n;
834 }
d63b8db8
RL
835# } else {
836# print STDERR "DEBUG: \"$sym\" (@p):",
837# " rsaref:", !!(!@p
838# || (!$negatives
839# && ($rsaref || !grep(/^RSAREF$/,@p)))
840# || ($negatives
841# && (!$rsaref || !grep(/^!RSAREF$/,@p))))?1:0,
842# " 16:", !!($W16 && (!@p_purged
843# || (!$negatives && grep(/^WIN16$/,@p))
844# || ($negatives && !grep(/^!WIN16$/,@p)))),
845# " 32:", !!($W32 && (!@p_purged
846# || (!$negatives && grep(/^WIN32$/,@p))
847# || ($negatives && !grep(/^!WIN32$/,@p)))),
848# " NT:", !!($NT && (!@p_purged
849# || (!$negatives && grep(/^WINNT$/,@p))
850# || ($negatives && !grep(/^!WINNT$/,@p)))),
851# "\n";
965c1775 852 }
d02b48c6 853 }
d02b48c6 854 }
47339f61
DSH
855 printf OUT "\n";
856}
d02b48c6
RE
857
858sub load_numbers
47339f61
DSH
859{
860 my($name)=@_;
861 my(@a,%ret);
d02b48c6 862
55a9cc6e 863 $max_num = 0;
948d0125
RL
864 $num_noinfo = 0;
865 $prev = "";
55a9cc6e 866
d02b48c6 867 open(IN,"<$name") || die "unable to open $name:$!\n";
47339f61 868 while (<IN>) {
d02b48c6
RE
869 chop;
870 s/#.*$//;
871 next if /^\s*$/;
872 @a=split;
948d0125
RL
873 if (defined $ret{$a[0]}) {
874 print STDERR "Warning: Symbol '",$a[0],"' redefined. old=",$ret{$a[0]},", new=",$a[1],"\n";
875 }
876 if ($max_num > $a[1]) {
877 print STDERR "Warning: Number decreased from ",$max_num," to ",$a[1],"\n";
878 }
879 if ($max_num == $a[1]) {
880 # This is actually perfectly OK
881 #print STDERR "Warning: Symbol ",$a[0]," has same number as previous ",$prev,": ",$a[1],"\n";
882 }
883 if ($#a < 2) {
884 # Existence will be proven later, in do_defs
885 $ret{$a[0]}=$a[1];
886 $num_noinfo++;
887 } else {
888 $ret{$a[0]}=$a[1]."\\".$a[2]; # \\ is a special marker
889 }
55a9cc6e 890 $max_num = $a[1] if $a[1] > $max_num;
948d0125
RL
891 $prev=$a[0];
892 }
893 if ($num_noinfo) {
894 print STDERR "Warning: $num_noinfo symbols were without info.";
895 if ($do_rewrite) {
896 printf STDERR " The rewrite will fix this.\n";
897 } else {
898 printf STDERR " You should do a rewrite to fix this.\n";
899 }
47339f61 900 }
d02b48c6
RE
901 close(IN);
902 return(%ret);
47339f61 903}
55a9cc6e 904
948d0125
RL
905sub parse_number
906{
907 (my $str, my $what) = @_;
908 (my $n, my $i) = split(/\\/,$str);
909 if ($what eq "n") {
910 return $n;
911 } else {
912 return $i;
913 }
914}
915
916sub rewrite_numbers
917{
918 (*OUT,$name,*nums,@symbols)=@_;
919 my $thing;
920
921 print STDERR "Rewriting $name\n";
922
923 my @r = grep(/^\w+\\.*?:.*?:\w+\(\w+\)/,@symbols);
924 my $r; my %r; my %rsyms;
925 foreach $r (@r) {
926 (my $s, my $i) = split /\\/, $r;
927 my $a = $1 if $i =~ /^.*?:.*?:\w+\((\w+)\)/;
928 $i =~ s/^(.*?:.*?:\w+)\(\w+\)/$1/;
929 $r{$a} = $s."\\".$i;
930 $rsyms{$s} = 1;
931 }
932
451e60e9
RL
933 my %syms = ();
934 foreach $_ (@symbols) {
935 (my $n, my $i) = split /\\/;
936 $syms{$n} = 1;
937 }
938
948d0125
RL
939 my @s=sort { &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n") } keys %nums;
940 foreach $sym (@s) {
941 (my $n, my $i) = split /\\/, $nums{$sym};
cf1b7d96 942 #print STDERR "DEBUG: rewrite_numbers for sym = ",$sym,": i = ",$i,", n = ",$n,", rsym{sym} = ",$rsyms{$sym},"syms{sym} = ",$syms{$sym},"\n";
948d0125
RL
943 next if defined($i) && $i =~ /^.*?:.*?:\w+\(\w+\)/;
944 next if defined($rsyms{$sym});
451e60e9
RL
945 $i="NOEXIST::FUNCTION:"
946 if !defined($i) || $i eq "" || !defined($syms{$sym});
948d0125
RL
947 printf OUT "%s%-40s%d\t%s\n","",$sym,$n,$i;
948 if (exists $r{$sym}) {
949 (my $s, $i) = split /\\/,$r{$sym};
950 printf OUT "%s%-40s%d\t%s\n","",$s,$n,$i;
951 }
952 }
953}
954
55a9cc6e 955sub update_numbers
47339f61 956{
948d0125
RL
957 (*OUT,$name,*nums,my $start_num, my @symbols)=@_;
958 my $new_syms = 0;
959
960 print STDERR "Updating $name numbers\n";
961
962 my @r = grep(/^\w+\\.*?:.*?:\w+\(\w+\)/,@symbols);
963 my $r; my %r; my %rsyms;
964 foreach $r (@r) {
965 (my $s, my $i) = split /\\/, $r;
966 my $a = $1 if $i =~ /^.*?:.*?:\w+\((\w+)\)/;
967 $i =~ s/^(.*?:.*?:\w+)\(\w+\)/$1/;
968 $r{$a} = $s."\\".$i;
969 $rsyms{$s} = 1;
970 }
971
972 foreach $sym (@symbols) {
973 (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/;
974 next if $i =~ /^.*?:.*?:\w+\(\w+\)/;
975 next if defined($rsyms{$sym});
976 die "ERROR: Symbol $sym had no info attached to it."
977 if $i eq "";
978 if (!exists $nums{$s}) {
979 $new_syms++;
980 printf OUT "%s%-40s%d\t%s\n","",$s, ++$start_num,$i;
981 if (exists $r{$s}) {
33b1a4c2 982 ($s, $i) = split /\\/,$r{$s};
948d0125
RL
983 printf OUT "%s%-40s%d\t%s\n","",$s, $start_num,$i;
984 }
55a9cc6e 985 }
47339f61 986 }
948d0125
RL
987 if($new_syms) {
988 print STDERR "$new_syms New symbols added\n";
55a9cc6e 989 } else {
948d0125
RL
990 print STDERR "No New symbols Added\n";
991 }
992}
993
994sub check_existing
995{
996 (*nums, my @symbols)=@_;
997 my %existing; my @remaining;
998 @remaining=();
999 foreach $sym (@symbols) {
1000 (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/;
1001 $existing{$s}=1;
1002 }
1003 foreach $sym (keys %nums) {
1004 if (!exists $existing{$sym}) {
1005 push @remaining, $sym;
1006 }
1007 }
1008 if(@remaining) {
1009 print STDERR "The following symbols do not seem to exist:\n";
1010 foreach $sym (@remaining) {
1011 print STDERR "\t",$sym,"\n";
1012 }
55a9cc6e 1013 }
47339f61 1014}
948d0125 1015