RE: [PATCH] compress 2.018
[p5sagit/p5-mst-13.2.git] / makedef.pl
CommitLineData
3df97b6d 1#./perl -w
549a6b10 2#
3# Create the export list for perl.
4#
86593e8d 5# Needed by WIN32 and OS/2 for creating perl.dll,
6# and by AIX for creating libperl.a when -Dusershrplib is in effect,
7# and by MacOS Classic.
549a6b10 8#
907b3e23 9# reads global.sym, pp.sym, perlvars.h, intrpvar.h, config.h
5c728af0 10# On OS/2 reads miniperl.map and the previous version of perl5.def as well
c560d966 11
12BEGIN { unshift @INC, "lib" }
3df97b6d 13use strict;
0a753a76 14
3df97b6d 15use vars qw($PLATFORM $CCTYPE $FILETYPE $CONFIG_ARGS $ARCHNAME $PATCHLEVEL);
16
17my (%define, %ordinal);
910dfcc8 18
7766f137 19while (@ARGV) {
20 my $flag = shift;
5c728af0 21 if ($flag =~ s/^CC_FLAGS=/ /) {
22 for my $fflag ($flag =~ /(?:^|\s)-D(\S+)/g) {
23 $fflag .= '=1' unless $fflag =~ /^(\w+)=/;
24 $define{$1} = $2 if $fflag =~ /^(\w+)=(.+)$/;
25 }
26 next;
27 }
7766f137 28 $define{$1} = 1 if ($flag =~ /^-D(\w+)$/);
29 $define{$1} = $2 if ($flag =~ /^-D(\w+)=(.+)$/);
30 $CCTYPE = $1 if ($flag =~ /^CCTYPE=(\w+)$/);
31 $PLATFORM = $1 if ($flag =~ /^PLATFORM=(\w+)$/);
18f68570 32 if ($PLATFORM eq 'netware') {
33 $FILETYPE = $1 if ($flag =~ /^FILETYPE=(\w+)$/);
34 }
7766f137 35}
d55594ae 36
18f68570 37my @PLATFORM = qw(aix win32 wince os2 MacOS netware);
549a6b10 38my %PLATFORM;
39@PLATFORM{@PLATFORM} = ();
40
41defined $PLATFORM || die "PLATFORM undefined, must be one of: @PLATFORM\n";
9df9a5cd 42exists $PLATFORM{$PLATFORM} || die "PLATFORM must be one of: @PLATFORM\n";
549a6b10 43
1829b0dc 44if ($PLATFORM eq 'win32' or $PLATFORM eq 'wince' or $PLATFORM eq "aix") {
17bdc114 45 # Add the compile-time options that miniperl was built with to %define.
dcddf0a3 46 # On Win32 these are not the same options as perl itself will be built
47 # with since miniperl is built with a canned config (one of the win32/
48 # config_H.*) and none of the BUILDOPT's that are set in the makefiles,
49 # but they do include some #define's that are hard-coded in various
50 # source files and header files and don't include any BUILDOPT's that
51 # the user might have chosen to disable because the canned configs are
52 # minimal configs that don't include any of those options.
75472953 53 my $opts = ($PLATFORM eq 'wince' ? '-MCross' : ''); # for wince need Cross.pm to get Config.pm
1829b0dc 54 my $config = `$^X $opts -Ilib -V`;
dcddf0a3 55 my($options) = $config =~ /^ Compile-time options: (.*?)\n^ \S/ms;
56 $options =~ s/\s+/ /g;
40dfc4d2 57 print STDERR "Options: ($options)\n";
17bdc114 58 foreach (split /\s+/, $options) {
59 $define{$_} = 1;
60 }
61}
62
c6261f3b 63my %exportperlmalloc =
64 (
65 Perl_malloc => "malloc",
66 Perl_mfree => "free",
67 Perl_realloc => "realloc",
68 Perl_calloc => "calloc",
69 );
70
71my $exportperlmalloc = $PLATFORM eq 'os2';
72
549a6b10 73my $config_sh = "config.sh";
74my $config_h = "config.h";
549a6b10 75my $intrpvar_h = "intrpvar.h";
76my $perlvars_h = "perlvars.h";
77my $global_sym = "global.sym";
78my $pp_sym = "pp.sym";
79my $globvar_sym = "globvar.sym";
80my $perlio_sym = "perlio.sym";
d2b25974 81my $static_ext = "";
549a6b10 82
9df9a5cd 83if ($PLATFORM eq 'aix') {
549a6b10 84 # Nothing for now.
7766f137 85}
18f68570 86elsif ($PLATFORM =~ /^win(?:32|ce)$/ || $PLATFORM eq 'netware') {
549a6b10 87 $CCTYPE = "MSVC" unless defined $CCTYPE;
907b3e23 88 foreach ($intrpvar_h, $perlvars_h, $global_sym,
aadb217d 89 $pp_sym, $globvar_sym, $perlio_sym) {
549a6b10 90 s!^!..\\!;
91 }
92}
084592ab 93elsif ($PLATFORM eq 'MacOS') {
907b3e23 94 foreach ($intrpvar_h, $perlvars_h, $global_sym,
aadb217d 95 $pp_sym, $globvar_sym, $perlio_sym) {
084592ab 96 s!^!::!;
97 }
98}
549a6b10 99
18f68570 100unless ($PLATFORM eq 'win32' || $PLATFORM eq 'wince' || $PLATFORM eq 'MacOS' || $PLATFORM eq 'netware') {
549a6b10 101 open(CFG,$config_sh) || die "Cannot open $config_sh: $!\n";
7766f137 102 while (<CFG>) {
549a6b10 103 if (/^(?:ccflags|optimize)='(.+)'$/) {
104 $_ = $1;
105 $define{$1} = 1 while /-D(\w+)/g;
106 }
aadb217d 107 if (/^(d_(?:mmap|sigaction))='(.+)'$/) {
108 $define{$1} = $2;
109 }
3cfae81b 110 if ($PLATFORM eq 'os2') {
52e4c282 111 $CONFIG_ARGS = $1 if /^config_args='(.+)'$/;
112 $ARCHNAME = $1 if /^archname='(.+)'$/;
113 $PATCHLEVEL = $1 if /^perl_patchlevel='(.+)'$/;
3cfae81b 114 }
549a6b10 115 }
116 close(CFG);
117}
d2b25974 118if ($PLATFORM eq 'win32' || $PLATFORM eq 'wince') {
119 open(CFG,"<..\\$config_sh") || die "Cannot open ..\\$config_sh: $!\n";
120 if ((join '', <CFG>) =~ /^static_ext='(.*)'$/m) {
121 $static_ext = $1;
122 }
123 close(CFG);
124}
549a6b10 125
126open(CFG,$config_h) || die "Cannot open $config_h: $!\n";
7766f137 127while (<CFG>) {
128 $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/;
7766f137 129 $define{$1} = 1 if /^\s*#\s*define\s+(MULTIPLICITY)\b/;
0e32cd81 130 $define{$1} = 1 if /^\s*#\s*define\s+(PERL_\w+)\b/;
131 $define{$1} = 1 if /^\s*#\s*define\s+(USE_\w+)\b/;
5cdbb95e 132 $define{$1} = 1 if /^\s*#\s*define\s+(HAS_\w+)\b/;
7766f137 133}
bbc8f9de 134close(CFG);
135
18c4b137 136# perl.h logic duplication begins
137
894ccb8c 138if ($define{PERL_IMPLICIT_SYS}) {
139 $define{PL_OP_SLAB_ALLOC} = 1;
140}
ac6bedea 141
18c4b137 142if ($define{USE_ITHREADS}) {
acfe0abc 143 if (!$define{MULTIPLICITY}) {
18c4b137 144 $define{MULTIPLICITY} = 1;
145 }
146}
147
148$define{PERL_IMPLICIT_CONTEXT} ||=
149 $define{USE_ITHREADS} ||
18c4b137 150 $define{MULTIPLICITY} ;
151
10bc17b6 152if ($define{USE_ITHREADS} && $PLATFORM ne 'win32' && $^O ne 'darwin') {
153 $define{USE_REENTRANT_API} = 1;
154}
155
18c4b137 156# perl.h logic duplication ends
157
ac6bedea 158my $sym_ord = 0;
159
dcddf0a3 160print STDERR "Defines: (" . join(' ', sort keys %define) . ")\n";
161
18f68570 162if ($PLATFORM =~ /^win(?:32|ce)$/) {
abf0ed0d 163 (my $dll = ($define{PERL_DLL} || "perl511")) =~ s/\.dll$//i;
18f68570 164 print "LIBRARY $dll\n";
574e26a8 165 # The DESCRIPTION module definition file statement is not supported
166 # by VC7 onwards.
4a3cf07b 167 if ($CCTYPE !~ /^MSVC7/ && $CCTYPE !~ /^MSVC8/ && $CCTYPE !~ /^MSVC9/) {
574e26a8 168 print "DESCRIPTION 'Perl interpreter'\n";
169 }
dfdd1393 170 print "EXPORTS\n";
171 if ($define{PERL_IMPLICIT_SYS}) {
549a6b10 172 output_symbol("perl_get_host_info");
7766f137 173 output_symbol("perl_alloc_override");
0295eab8 174 }
b54a2e1e 175 if ($define{USE_ITHREADS} and $define{PERL_IMPLICIT_SYS}) {
ac6bedea 176 output_symbol("perl_clone_host");
51371543 177 }
7766f137 178}
179elsif ($PLATFORM eq 'os2') {
52e4c282 180 if (open my $fh, '<', 'perl5.def') {
181 while (<$fh>) {
182 last if /^\s*EXPORTS\b/;
183 }
184 while (<$fh>) {
78232bc0 185 $ordinal{$1} = $2 if /^\s*"(\w+)"\s*(?:=\s*"\w+"\s*)?\@(\d+)\s*$/;
52e4c282 186 # This allows skipping ordinals which were used in older versions
187 $sym_ord = $1 if /^\s*;\s*LAST_ORDINAL\s*=\s*(\d+)\s*$/;
188 }
189 $sym_ord < $_ and $sym_ord = $_ for values %ordinal; # Take the max
190 }
3df97b6d 191 (my $v = $]) =~ s/(\d\.\d\d\d)(\d\d)$/$1_$2/;
3cfae81b 192 $v .= '-thread' if $ARCHNAME =~ /-thread/;
3df97b6d 193 (my $dll = $define{PERL_DLL}) =~ s/\.dll$//i;
52e4c282 194 $v .= "\@$PATCHLEVEL" if $PATCHLEVEL;
3df97b6d 195 my $d = "DESCRIPTION '\@#perl5-porters\@perl.org:$v#\@ Perl interpreter, configured as $CONFIG_ARGS'";
1102eebe 196 $d = substr($d, 0, 249) . "...'" if length $d > 253;
3cfae81b 197 print <<"---EOP---";
198LIBRARY '$dll' INITINSTANCE TERMINSTANCE
1102eebe 199$d
3cfae81b 200STACKSIZE 32768
201CODE LOADONCALL
202DATA LOADONCALL NONSHARED MULTIPLE
203EXPORTS
204---EOP---
7766f137 205}
206elsif ($PLATFORM eq 'aix') {
3df97b6d 207 my $OSVER = `uname -v`;
61d42ce4 208 chop $OSVER;
3df97b6d 209 my $OSREL = `uname -r`;
61d42ce4 210 chop $OSREL;
211 if ($OSVER > 4 || ($OSVER == 4 && $OSREL >= 3)) {
212 print "#! ..\n";
213 } else {
214 print "#!\n";
215 }
ac4c12e7 216}
2986a63f 217elsif ($PLATFORM eq 'netware') {
218 if ($FILETYPE eq 'def') {
abf0ed0d 219 print "LIBRARY perl511\n";
2986a63f 220 print "DESCRIPTION 'Perl interpreter for NetWare'\n";
221 print "EXPORTS\n";
222 }
223 if ($define{PERL_IMPLICIT_SYS}) {
ac6bedea 224 output_symbol("perl_get_host_info");
225 output_symbol("perl_alloc_override");
226 output_symbol("perl_clone_host");
2986a63f 227 }
228}
bbc8f9de 229
22239a37 230my %skip;
231my %export;
232
51371543 233sub skip_symbols {
234 my $list = shift;
235 foreach my $symbol (@$list) {
236 $skip{$symbol} = 1;
237 }
22239a37 238}
239
51371543 240sub emit_symbols {
241 my $list = shift;
242 foreach my $symbol (@$list) {
243 my $skipsym = $symbol;
244 # XXX hack
acfe0abc 245 if ($define{MULTIPLICITY}) {
51371543 246 $skipsym =~ s/^Perl_[GIT](\w+)_ptr$/PL_$1/;
247 }
248 emit_symbol($symbol) unless exists $skip{$skipsym};
249 }
22239a37 250}
251
549a6b10 252if ($PLATFORM eq 'win32') {
7766f137 253 skip_symbols [qw(
254 PL_statusvalue_vms
255 PL_archpat_auto
256 PL_cryptseen
257 PL_DBcv
258 PL_generation
259 PL_lastgotoprobe
260 PL_linestart
261 PL_modcount
262 PL_pending_ident
7766f137 263 PL_sublex_info
264 PL_timesbuf
265 main
266 Perl_ErrorNo
aadb217d 267 Perl_GetVars
7766f137 268 Perl_do_exec3
269 Perl_do_ipcctl
270 Perl_do_ipcget
271 Perl_do_msgrcv
272 Perl_do_msgsnd
273 Perl_do_semop
274 Perl_do_shmio
275 Perl_dump_fds
276 Perl_init_thread_intern
277 Perl_my_bzero
9d50d399 278 Perl_my_bcopy
7766f137 279 Perl_my_htonl
280 Perl_my_ntohl
281 Perl_my_swap
282 Perl_my_chsize
283 Perl_same_dirent
284 Perl_setenv_getix
285 Perl_unlnk
286 Perl_watch
287 Perl_safexcalloc
288 Perl_safexmalloc
289 Perl_safexfree
290 Perl_safexrealloc
291 Perl_my_memcmp
292 Perl_my_memset
293 PL_cshlen
294 PL_cshname
295 PL_opsave
296 Perl_do_exec
297 Perl_getenv_len
298 Perl_my_pclose
299 Perl_my_popen
cec8d04d 300 Perl_my_sprintf
7766f137 301 )];
302}
54725af6 303else {
304 skip_symbols [qw(
305 Perl_do_spawn
306 Perl_do_spawn_nowait
307 Perl_do_aspawn
308 )];
309}
310if ($PLATFORM eq 'wince') {
18f68570 311 skip_symbols [qw(
312 PL_statusvalue_vms
313 PL_archpat_auto
314 PL_cryptseen
315 PL_DBcv
316 PL_generation
317 PL_lastgotoprobe
318 PL_linestart
319 PL_modcount
320 PL_pending_ident
18f68570 321 PL_sublex_info
322 PL_timesbuf
323 PL_collation_ix
324 PL_collation_name
325 PL_collation_standard
326 PL_collxfrm_base
327 PL_collxfrm_mult
328 PL_numeric_compat1
329 PL_numeric_local
330 PL_numeric_name
331 PL_numeric_radix_sv
332 PL_numeric_standard
333 PL_vtbl_collxfrm
334 Perl_sv_collxfrm
335 setgid
336 setuid
18f68570 337 win32_free_childdir
338 win32_free_childenv
339 win32_get_childdir
340 win32_get_childenv
341 win32_spawnvp
342 main
343 Perl_ErrorNo
aadb217d 344 Perl_GetVars
18f68570 345 Perl_do_exec3
346 Perl_do_ipcctl
347 Perl_do_ipcget
348 Perl_do_msgrcv
349 Perl_do_msgsnd
350 Perl_do_semop
351 Perl_do_shmio
352 Perl_dump_fds
353 Perl_init_thread_intern
354 Perl_my_bzero
355 Perl_my_bcopy
356 Perl_my_htonl
357 Perl_my_ntohl
358 Perl_my_swap
359 Perl_my_chsize
360 Perl_same_dirent
361 Perl_setenv_getix
362 Perl_unlnk
363 Perl_watch
364 Perl_safexcalloc
365 Perl_safexmalloc
366 Perl_safexfree
367 Perl_safexrealloc
368 Perl_my_memcmp
369 Perl_my_memset
370 PL_cshlen
371 PL_cshname
372 PL_opsave
373 Perl_do_exec
374 Perl_getenv_len
375 Perl_my_pclose
376 Perl_my_popen
cec8d04d 377 Perl_my_sprintf
18f68570 378 )];
379}
7766f137 380elsif ($PLATFORM eq 'aix') {
549a6b10 381 skip_symbols([qw(
7766f137 382 Perl_dump_fds
383 Perl_ErrorNo
aadb217d 384 Perl_GetVars
7766f137 385 Perl_my_bcopy
386 Perl_my_bzero
387 Perl_my_chsize
388 Perl_my_htonl
389 Perl_my_memcmp
390 Perl_my_memset
391 Perl_my_ntohl
392 Perl_my_swap
393 Perl_safexcalloc
394 Perl_safexfree
395 Perl_safexmalloc
396 Perl_safexrealloc
397 Perl_same_dirent
398 Perl_unlnk
6c644e78 399 Perl_sys_intern_clear
95151ede 400 Perl_sys_intern_dup
52853b95 401 Perl_sys_intern_init
d0ade26c 402 Perl_my_sprintf
7766f137 403 PL_cryptseen
404 PL_opsave
405 PL_statusvalue_vms
406 PL_sys_intern
407 )]);
5cdbb95e 408 skip_symbols([qw(
409 Perl_signbit
410 )])
411 if $define{'HAS_SIGNBIT'};
f2b0c9f7 412 emit_symbols([qw(
413 boot_DynaLoader
309c1fb6 414 )]);
7766f137 415}
416elsif ($PLATFORM eq 'os2') {
3cfae81b 417 emit_symbols([qw(
7766f137 418 ctermid
419 get_sysinfo
420 Perl_OS2_init
764df951 421 Perl_OS2_init3
422 Perl_OS2_term
7766f137 423 OS2_Perl_data
424 dlopen
425 dlsym
426 dlerror
403d6f8e 427 dlclose
59ad941d 428 dup2
429 dup
7766f137 430 my_tmpfile
431 my_tmpnam
432 my_flock
9c130f5b 433 my_rmdir
434 my_mkdir
f72c975a 435 my_getpwuid
436 my_getpwnam
437 my_getpwent
438 my_setpwent
439 my_endpwent
622913ab 440 fork_with_resources
441 croak_with_os2error
f72c975a 442 setgrent
443 endgrent
444 getgrent
7766f137 445 malloc_mutex
446 threads_mutex
447 nthreads
448 nthreads_cond
449 os2_cond_wait
450 os2_stat
1933e12c 451 os2_execname
452 async_mssleep
453 msCounter
454 InfoTable
7766f137 455 pthread_join
456 pthread_create
457 pthread_detach
458 XS_Cwd_change_drive
459 XS_Cwd_current_drive
460 XS_Cwd_extLibpath
461 XS_Cwd_extLibpath_set
462 XS_Cwd_sys_abspath
463 XS_Cwd_sys_chdir
464 XS_Cwd_sys_cwd
465 XS_Cwd_sys_is_absolute
466 XS_Cwd_sys_is_relative
467 XS_Cwd_sys_is_rooted
468 XS_DynaLoader_mod2fname
469 XS_File__Copy_syscopy
470 Perl_Register_MQ
471 Perl_Deregister_MQ
472 Perl_Serve_Messages
473 Perl_Process_Messages
474 init_PMWIN_entries
475 PMWIN_entries
476 Perl_hab_GET
35bc1fdc 477 loadByOrdinal
478 pExtFCN
30500b05 479 os2error
480 ResetWinError
481 CroakWinError
5c728af0 482 PL_do_undump
7766f137 483 )]);
5c728af0 484 emit_symbols([qw(os2_cond_wait
485 pthread_join
486 pthread_create
487 pthread_detach
488 )])
489 if $define{'USE_5005THREADS'} or $define{'USE_ITHREADS'};
3cfae81b 490}
084592ab 491elsif ($PLATFORM eq 'MacOS') {
492 skip_symbols [qw(
aadb217d 493 Perl_GetVars
084592ab 494 PL_cryptseen
495 PL_cshlen
496 PL_cshname
497 PL_statusvalue_vms
498 PL_sys_intern
499 PL_opsave
500 PL_timesbuf
501 Perl_dump_fds
502 Perl_my_bcopy
503 Perl_my_bzero
504 Perl_my_chsize
505 Perl_my_htonl
506 Perl_my_memcmp
507 Perl_my_memset
508 Perl_my_ntohl
509 Perl_my_swap
510 Perl_safexcalloc
511 Perl_safexfree
512 Perl_safexmalloc
513 Perl_safexrealloc
514 Perl_unlnk
fe05f414 515 Perl_sys_intern_clear
516 Perl_sys_intern_init
084592ab 517 )];
518}
2986a63f 519elsif ($PLATFORM eq 'netware') {
520 skip_symbols [qw(
521 PL_statusvalue_vms
522 PL_archpat_auto
523 PL_cryptseen
524 PL_DBcv
525 PL_generation
526 PL_lastgotoprobe
527 PL_linestart
528 PL_modcount
529 PL_pending_ident
2986a63f 530 PL_sublex_info
531 PL_timesbuf
532 main
533 Perl_ErrorNo
aadb217d 534 Perl_GetVars
2986a63f 535 Perl_do_exec3
536 Perl_do_ipcctl
537 Perl_do_ipcget
538 Perl_do_msgrcv
539 Perl_do_msgsnd
540 Perl_do_semop
541 Perl_do_shmio
542 Perl_dump_fds
543 Perl_init_thread_intern
544 Perl_my_bzero
545 Perl_my_htonl
546 Perl_my_ntohl
547 Perl_my_swap
548 Perl_my_chsize
549 Perl_same_dirent
550 Perl_setenv_getix
551 Perl_unlnk
552 Perl_watch
553 Perl_safexcalloc
554 Perl_safexmalloc
555 Perl_safexfree
556 Perl_safexrealloc
557 Perl_my_memcmp
558 Perl_my_memset
559 PL_cshlen
560 PL_cshname
561 PL_opsave
562 Perl_do_exec
563 Perl_getenv_len
564 Perl_my_pclose
565 Perl_my_popen
011f1a1a 566 Perl_sys_intern_init
567 Perl_sys_intern_dup
568 Perl_sys_intern_clear
569 Perl_my_bcopy
570 Perl_PerlIO_write
571 Perl_PerlIO_unread
572 Perl_PerlIO_tell
573 Perl_PerlIO_stdout
574 Perl_PerlIO_stdin
575 Perl_PerlIO_stderr
576 Perl_PerlIO_setlinebuf
577 Perl_PerlIO_set_ptrcnt
578 Perl_PerlIO_set_cnt
579 Perl_PerlIO_seek
580 Perl_PerlIO_read
581 Perl_PerlIO_get_ptr
582 Perl_PerlIO_get_cnt
583 Perl_PerlIO_get_bufsiz
584 Perl_PerlIO_get_base
585 Perl_PerlIO_flush
586 Perl_PerlIO_fill
587 Perl_PerlIO_fileno
588 Perl_PerlIO_error
589 Perl_PerlIO_eof
590 Perl_PerlIO_close
591 Perl_PerlIO_clearerr
592 PerlIO_perlio
2986a63f 593 )];
594}
3cfae81b 595
7766f137 596unless ($define{'DEBUGGING'}) {
597 skip_symbols [qw(
7766f137 598 Perl_deb_growlevel
599 Perl_debop
600 Perl_debprofdump
601 Perl_debstack
602 Perl_debstackptrs
5cbf7fcf 603 Perl_pad_sv
943795c2 604 Perl_hv_assert
7766f137 605 PL_block_type
606 PL_watchaddr
607 PL_watchok
e0cde265 608 PL_watch_pvx
7766f137 609 )];
610}
611
605881df 612if ($define{'PERL_IMPLICIT_CONTEXT'}) {
613 skip_symbols [qw(
614 PL_sig_sv
615 )];
616}
617
7766f137 618if ($define{'PERL_IMPLICIT_SYS'}) {
619 skip_symbols [qw(
620 Perl_getenv_len
621 Perl_my_popen
622 Perl_my_pclose
623 )];
624}
625else {
626 skip_symbols [qw(
627 PL_Mem
628 PL_MemShared
629 PL_MemParse
630 PL_Env
631 PL_StdIO
632 PL_LIO
633 PL_Dir
634 PL_Sock
635 PL_Proc
636 )];
637}
638
f8c7b90f 639unless ($define{'PERL_OLD_COPY_ON_WRITE'}) {
0190f6ec 640 skip_symbols [qw(
641 Perl_sv_setsv_cow
642 )];
643}
644
5bcb3f6c 645unless ($define{'USE_REENTRANT_API'}) {
646 skip_symbols [qw(
647 PL_reentrant_buffer
648 )];
649}
650
7766f137 651if ($define{'MYMALLOC'}) {
652 emit_symbols [qw(
653 Perl_dump_mstats
827e134a 654 Perl_get_mstats
9c130f5b 655 Perl_strdup
656 Perl_putenv
6af660ee 657 MallocCfg_ptr
658 MallocCfgP_ptr
7766f137 659 )];
3db8f154 660 if ($define{'USE_ITHREADS'}) {
1feb2720 661 emit_symbols [qw(
662 PL_malloc_mutex
663 )];
664 }
80fc1a6e 665 else {
666 skip_symbols [qw(
667 PL_malloc_mutex
668 )];
669 }
51371543 670}
671else {
7766f137 672 skip_symbols [qw(
673 PL_malloc_mutex
674 Perl_dump_mstats
6ecd3fcb 675 Perl_get_mstats
7766f137 676 Perl_malloced_size
64107180 677 Perl_malloc_good_size
6af660ee 678 MallocCfg_ptr
679 MallocCfgP_ptr
7766f137 680 )];
681}
682
8852afe9 683if ($define{'PERL_USE_SAFE_PUTENV'}) {
684 skip_symbols [qw(
685 PL_use_safe_putenv
686 )];
687}
688
3db8f154 689unless ($define{'USE_ITHREADS'}) {
7766f137 690 skip_symbols [qw(
691 PL_thr_key
f433d095 692 )];
693}
694
3db8f154 695# USE_5005THREADS symbols. Kept as reference for easier removal
f433d095 696 skip_symbols [qw(
7766f137 697 PL_sv_mutex
698 PL_strtab_mutex
699 PL_svref_mutex
7766f137 700 PL_cred_mutex
701 PL_eval_mutex
6940069f 702 PL_fdpid_mutex
703 PL_sv_lock_mutex
7766f137 704 PL_eval_cond
705 PL_eval_owner
706 PL_threads_mutex
707 PL_nthreads
708 PL_nthreads_cond
709 PL_threadnum
710 PL_threadsv_names
711 PL_thrsv
712 PL_vtbl_mutex
7766f137 713 Perl_condpair_magic
714 Perl_new_struct_thread
715 Perl_per_thread_magicals
716 Perl_thread_create
717 Perl_find_threadsv
718 Perl_unlock_condpair
719 Perl_magic_mutexfree
4755096e 720 Perl_sv_lock
7766f137 721 )];
7766f137 722
723unless ($define{'USE_ITHREADS'}) {
724 skip_symbols [qw(
534825c4 725 PL_op_mutex
7e95b20d 726 PL_regex_pad
727 PL_regex_padav
f2f7cecd 728 PL_sharedsv_space
729 PL_sharedsv_space_mutex
e2975953 730 PL_dollarzero_mutex
b60bf3b9 731 PL_hints_mutex
f1791e53 732 PL_perlio_mutex
517dbd53 733 PL_regdupe
b0bb49b6 734 Perl_parser_dup
7766f137 735 Perl_dirp_dup
736 Perl_cx_dup
737 Perl_si_dup
738 Perl_any_dup
739 Perl_ss_dup
740 Perl_fp_dup
741 Perl_gp_dup
742 Perl_he_dup
743 Perl_mg_dup
81621b66 744 Perl_mro_meta_dup
7f605079 745 Perl_re_dup_guts
7766f137 746 Perl_sv_dup
aeef2723 747 Perl_rvpv_dup
88daff13 748 Perl_hek_dup
7766f137 749 Perl_sys_intern_dup
7766f137 750 perl_clone
751 perl_clone_using
038f0558 752 Perl_sharedsv_find
753 Perl_sharedsv_init
754 Perl_sharedsv_lock
755 Perl_sharedsv_new
756 Perl_sharedsv_thrcnt_dec
757 Perl_sharedsv_thrcnt_inc
758 Perl_sharedsv_unlock
dc1061dc 759 Perl_stashpv_hvname_match
1fa600a7 760 Perl_regdupe_internal
392d04bb 761 Perl_newPADOP
7766f137 762 )];
763}
764
765unless ($define{'PERL_IMPLICIT_CONTEXT'}) {
766 skip_symbols [qw(
1f9ecdc6 767 PL_my_ctx_mutex
768 PL_my_cxt_index
769 PL_my_cxt_list
770 PL_my_cxt_size
ecb9cc66 771 PL_my_cxt_keys
7766f137 772 Perl_croak_nocontext
773 Perl_die_nocontext
774 Perl_deb_nocontext
775 Perl_form_nocontext
e0f4245d 776 Perl_load_module_nocontext
7766f137 777 Perl_mess_nocontext
778 Perl_warn_nocontext
779 Perl_warner_nocontext
780 Perl_newSVpvf_nocontext
781 Perl_sv_catpvf_nocontext
782 Perl_sv_setpvf_nocontext
783 Perl_sv_catpvf_mg_nocontext
784 Perl_sv_setpvf_mg_nocontext
484eff17 785 Perl_my_cxt_init
ecb9cc66 786 Perl_my_cxt_index
7766f137 787 )];
788}
789
790unless ($define{'PERL_IMPLICIT_SYS'}) {
791 skip_symbols [qw(
792 perl_alloc_using
014822e4 793 perl_clone_using
7766f137 794 )];
795}
796
797unless ($define{'FAKE_THREADS'}) {
798 skip_symbols [qw(PL_curthr)];
799}
800
aadb217d 801unless ($define{'PL_OP_SLAB_ALLOC'}) {
e0cde265 802 skip_symbols [qw(
aadb217d 803 PL_OpPtr
804 PL_OpSlab
805 PL_OpSpace
806 Perl_Slab_Alloc
807 Perl_Slab_Free
808 )];
8d2d9fd7 809}
810
811unless ($define{'PERL_DEBUG_READONLY_OPS'}) {
812 skip_symbols [qw(
813 PL_slab_count
814 PL_slabs
815 )];
aadb217d 816}
817
818unless ($define{'THREADS_HAVE_PIDS'}) {
819 skip_symbols [qw(PL_ppid)];
e0cde265 820}
821
aadb217d 822unless ($define{'PERL_NEED_APPCTX'}) {
e0cde265 823 skip_symbols [qw(
aadb217d 824 PL_appctx
e0cde265 825 )];
826}
827
aadb217d 828unless ($define{'PERL_NEED_TIMESBASE'}) {
e0cde265 829 skip_symbols [qw(
aadb217d 830 PL_timesbase
e0cde265 831 )];
832}
833
dfc72f41 834unless ($define{'DEBUG_LEAKING_SCALARS'}) {
835 skip_symbols [qw(
836 PL_sv_serial
837 )];
838}
839
808e2276 840unless ($define{'DEBUG_LEAKING_SCALARS_FORK_DUMP'}) {
841 skip_symbols [qw(
842 PL_dumper_fd
843 )];
844}
c69033f2 845unless ($define{'PERL_DONT_CREATE_GVSV'}) {
846 skip_symbols [qw(
847 Perl_gv_SVadd
848 )];
849}
ce582cee 850if ($define{'SPRINTF_RETURNS_STRLEN'}) {
851 skip_symbols [qw(
852 Perl_my_sprintf
853 )];
854}
ca0c25f6 855unless ($define{'PERL_USES_PL_PIDSTATUS'}) {
856 skip_symbols [qw(
857 Perl_pidgone
858 PL_pidstatus
859 )];
860}
808e2276 861
02ca4724 862unless ($define{'PERL_TRACK_MEMPOOL'}) {
863 skip_symbols [qw(
864 PL_memory_debug_header
865 )];
866}
867
f8565a66 868if ($define{'PERL_MAD'}) {
869 skip_symbols [qw(
870 PL_nextval
871 PL_nexttype
872 )];
873} else {
e3e31fab 874 skip_symbols [qw(
875 PL_madskills
876 PL_xmlfp
f8565a66 877 PL_lasttoke
5336380d 878 PL_realtokenstart
879 PL_faketokens
880 PL_thismad
881 PL_thistoken
882 PL_thisopen
883 PL_thisstuff
884 PL_thisclose
885 PL_thiswhite
886 PL_nextwhite
887 PL_skipwhite
888 PL_endwhite
889 PL_curforce
1dba731d 890 Perl_pad_peg
3b721df9 891 Perl_xmldump_indent
892 Perl_xmldump_vindent
893 Perl_xmldump_all
894 Perl_xmldump_packsubs
895 Perl_xmldump_sub
896 Perl_xmldump_form
897 Perl_xmldump_eval
898 Perl_sv_catxmlsv
899 Perl_sv_catxmlpvn
900 Perl_sv_xmlpeek
901 Perl_do_pmop_xmldump
902 Perl_pmop_xmldump
903 Perl_do_op_xmldump
904 Perl_op_xmldump
e3e31fab 905 )];
906}
907
2a5adacc 908unless ($define{'MULTIPLICITY'}) {
909 skip_symbols [qw(
01523419 910 PL_interp_size
911 PL_interp_size_5_10_0
2a5adacc 912 )];
913}
914
915unless ($define{'PERL_GLOBAL_STRUCT'}) {
916 skip_symbols [qw(
917 PL_global_struct_size
918 )];
919}
920
436dbe32 921unless ($define{'PERL_GLOBAL_STRUCT_PRIVATE'}) {
922 skip_symbols [qw(
923 PL_my_cxt_keys
924 Perl_my_cxt_index
925 )];
926}
927
aadb217d 928unless ($define{'d_mmap'}) {
ac6bedea 929 skip_symbols [qw(
aadb217d 930 PL_mmap_page_size
931 )];
ac6bedea 932}
933
aadb217d 934if ($define{'d_sigaction'}) {
935 skip_symbols [qw(
936 PL_sig_trapped
937 )];
d97afc04 938}
939
aadb217d 940if ($^O ne 'vms') {
941 # VMS does its own thing for these symbols.
942 skip_symbols [qw(PL_sig_handlers_initted
943 PL_sig_ignoring
944 PL_sig_defaulting)];
945}
946
7766f137 947sub readvar {
948 my $file = shift;
949 my $proc = shift || sub { "PL_$_[2]" };
950 open(VARS,$file) || die "Cannot open $file: $!\n";
951 my @syms;
952 while (<VARS>) {
953 # All symbols have a Perl_ prefix because that's what embed.h
aadb217d 954 # sticks in front of them. The A?I?S?C? is strictly speaking
955 # wrong.
313fe300 956 push(@syms, &$proc($1,$2,$3)) if (/\bPERLVAR(A?I?S?C?)\(([IGT])(\w+)/);
9df9a5cd 957 }
958 close(VARS);
7766f137 959 return \@syms;
960}
961
7766f137 962if ($define{'PERL_GLOBAL_STRUCT'}) {
963 my $global = readvar($perlvars_h);
964 skip_symbols $global;
965 emit_symbol('Perl_GetVars');
966 emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC';
aadb217d 967} else {
968 skip_symbols [qw(Perl_init_global_struct Perl_free_global_struct)];
7766f137 969}
36c15d3f 970
22c35a8c 971# functions from *.sym files
972
954c1994 973my @syms = ($global_sym, $globvar_sym); # $pp_sym is not part of the API
549a6b10 974
d892637e 975# Symbols that are the public face of the PerlIO layers implementation
976# These are in _addition to_ the public face of the abstraction
977# and need to be exported to allow XS modules to implement layers
9df9a5cd 978my @layer_syms = qw(
db76e01e 979 PerlIOBase_binmode
980 PerlIOBase_clearerr
981 PerlIOBase_close
982 PerlIOBase_dup
983 PerlIOBase_eof
984 PerlIOBase_error
985 PerlIOBase_fileno
986 PerlIOBase_noop_fail
987 PerlIOBase_noop_ok
988 PerlIOBase_popped
7e700b9a 989 PerlIOBase_pushed
db76e01e 990 PerlIOBase_read
991 PerlIOBase_setlinebuf
992 PerlIOBase_unread
993 PerlIOBuf_bufsiz
994 PerlIOBuf_close
995 PerlIOBuf_dup
996 PerlIOBuf_fill
997 PerlIOBuf_flush
998 PerlIOBuf_get_base
999 PerlIOBuf_get_cnt
1000 PerlIOBuf_get_ptr
1001 PerlIOBuf_open
1002 PerlIOBuf_popped
1003 PerlIOBuf_pushed
1004 PerlIOBuf_read
1005 PerlIOBuf_seek
1006 PerlIOBuf_set_ptrcnt
1007 PerlIOBuf_tell
1008 PerlIOBuf_unread
1009 PerlIOBuf_write
1010 PerlIO_allocate
8ffeedc3 1011 PerlIO_apply_layera
db76e01e 1012 PerlIO_apply_layers
1013 PerlIO_arg_fetch
1014 PerlIO_debug
1015 PerlIO_define_layer
51d05609 1016 PerlIO_isutf8
db76e01e 1017 PerlIO_layer_fetch
1018 PerlIO_list_free
1019 PerlIO_modestr
1020 PerlIO_parse_layers
1021 PerlIO_pending
1022 PerlIO_perlio
1023 PerlIO_pop
1024 PerlIO_push
1025 PerlIO_sv_dup
1026 Perl_PerlIO_clearerr
1027 Perl_PerlIO_close
188f0c84 1028 Perl_PerlIO_context_layers
db76e01e 1029 Perl_PerlIO_eof
1030 Perl_PerlIO_error
1031 Perl_PerlIO_fileno
1032 Perl_PerlIO_fill
1033 Perl_PerlIO_flush
1034 Perl_PerlIO_get_base
1035 Perl_PerlIO_get_bufsiz
1036 Perl_PerlIO_get_cnt
1037 Perl_PerlIO_get_ptr
1038 Perl_PerlIO_read
1039 Perl_PerlIO_seek
1040 Perl_PerlIO_set_cnt
1041 Perl_PerlIO_set_ptrcnt
1042 Perl_PerlIO_setlinebuf
1043 Perl_PerlIO_stderr
1044 Perl_PerlIO_stdin
1045 Perl_PerlIO_stdout
1046 Perl_PerlIO_tell
1047 Perl_PerlIO_unread
1048 Perl_PerlIO_write
9df9a5cd 1049);
a5564b91 1050if ($PLATFORM eq 'netware') {
1051 push(@layer_syms,'PL_def_layerlist','PL_known_layers','PL_perlio');
1052}
d892637e 1053
7766f137 1054if ($define{'USE_PERLIO'}) {
d892637e 1055 # Export the symols that make up the PerlIO abstraction, regardless
1056 # of its implementation - read from a file
084592ab 1057 push @syms, $perlio_sym;
d892637e 1058
1059 # This part is then dependent on how the abstraction is implemented
084592ab 1060 if ($define{'USE_SFIO'}) {
d892637e 1061 # Old legacy non-stdio "PerlIO"
9df9a5cd 1062 skip_symbols \@layer_syms;
954fb84e 1063 skip_symbols [qw(perlsio_binmode)];
084592ab 1064 # SFIO defines most of the PerlIO routines as macros
d892637e 1065 # So undo most of what $perlio_sym has just done - d'oh !
1066 # Perhaps it would be better to list the ones which do exist
1067 # And emit them
084592ab 1068 skip_symbols [qw(
1069 PerlIO_canset_cnt
1070 PerlIO_clearerr
1071 PerlIO_close
1072 PerlIO_eof
1073 PerlIO_error
1074 PerlIO_exportFILE
1075 PerlIO_fast_gets
1076 PerlIO_fdopen
1077 PerlIO_fileno
1078 PerlIO_findFILE
1079 PerlIO_flush
1080 PerlIO_get_base
1081 PerlIO_get_bufsiz
1082 PerlIO_get_cnt
1083 PerlIO_get_ptr
1084 PerlIO_getc
1085 PerlIO_getname
1086 PerlIO_has_base
1087 PerlIO_has_cntptr
1088 PerlIO_importFILE
1089 PerlIO_open
1090 PerlIO_printf
1091 PerlIO_putc
1092 PerlIO_puts
1093 PerlIO_read
1094 PerlIO_releaseFILE
1095 PerlIO_reopen
1096 PerlIO_rewind
1097 PerlIO_seek
1098 PerlIO_set_cnt
1099 PerlIO_set_ptrcnt
1100 PerlIO_setlinebuf
1101 PerlIO_sprintf
1102 PerlIO_stderr
1103 PerlIO_stdin
1104 PerlIO_stdout
1105 PerlIO_stdoutf
1106 PerlIO_tell
1107 PerlIO_ungetc
1108 PerlIO_vprintf
1109 PerlIO_write
bcdb689b 1110 PerlIO_perlio
1111 Perl_PerlIO_clearerr
1112 Perl_PerlIO_close
1113 Perl_PerlIO_eof
1114 Perl_PerlIO_error
1115 Perl_PerlIO_fileno
1116 Perl_PerlIO_fill
1117 Perl_PerlIO_flush
1118 Perl_PerlIO_get_base
1119 Perl_PerlIO_get_bufsiz
1120 Perl_PerlIO_get_cnt
1121 Perl_PerlIO_get_ptr
1122 Perl_PerlIO_read
1123 Perl_PerlIO_seek
1124 Perl_PerlIO_set_cnt
1125 Perl_PerlIO_set_ptrcnt
1126 Perl_PerlIO_setlinebuf
1127 Perl_PerlIO_stderr
1128 Perl_PerlIO_stdin
1129 Perl_PerlIO_stdout
1130 Perl_PerlIO_tell
1131 Perl_PerlIO_unread
1132 Perl_PerlIO_write
ffcf5686 1133 PL_def_layerlist
1134 PL_known_layers
1135 PL_perlio
084592ab 1136 )];
1137 }
d892637e 1138 else {
1139 # PerlIO with layers - export implementation
1140 emit_symbols \@layer_syms;
954fb84e 1141 emit_symbols [qw(perlsio_binmode)];
d892637e 1142 }
f1791e53 1143 if ($define{'USE_ITHREADS'}) {
1144 emit_symbols [qw(
1145 PL_perlio_mutex
1146 )];
1147 }
1148 else {
1149 skip_symbols [qw(
1150 PL_perlio_mutex
1151 )];
1152 }
5138f914 1153} else {
d892637e 1154 # -Uuseperlio
1155 # Skip the PerlIO layer symbols - although
aadb217d 1156 # nothing should have exported them anyway.
9df9a5cd 1157 skip_symbols \@layer_syms;
a6272963 1158 skip_symbols [qw(
1159 perlsio_binmode
1160 PL_def_layerlist
1161 PL_known_layers
1162 PL_perlio
1163 PL_perlio_debug_fd
1164 PL_perlio_fd_refcnt
1165 PL_perlio_fd_refcnt_size
1166 )];
1e8a8f59 1167
d892637e 1168 # Also do NOT add abstraction symbols from $perlio_sym
1169 # abstraction is done as #define to stdio
1170 # Remaining remnants that _may_ be functions
1171 # are handled in <DATA>
9df9a5cd 1172}
7766f137 1173
1174for my $syms (@syms) {
1175 open (GLOBAL, "<$syms") || die "failed to open $syms: $!\n";
1176 while (<GLOBAL>) {
1177 next if (!/^[A-Za-z]/);
1178 # Functions have a Perl_ prefix
1179 # Variables have a PL_ prefix
1180 chomp($_);
1181 my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : "");
1182 $symbol .= $_;
1183 emit_symbol($symbol) unless exists $skip{$symbol};
1184 }
1185 close(GLOBAL);
1186}
0a753a76 1187
22c35a8c 1188# variables
0a753a76 1189
acfe0abc 1190if ($define{'MULTIPLICITY'}) {
907b3e23 1191 for my $f ($perlvars_h, $intrpvar_h) {
18c4b137 1192 my $glob = readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" });
1193 emit_symbols $glob;
18c4b137 1194 }
1acb48c9 1195 # XXX AIX seems to want the perlvars.h symbols, for some reason
5c728af0 1196 if ($PLATFORM eq 'aix' or $PLATFORM eq 'os2') { # OS/2 needs PL_thr_key
1acb48c9 1197 my $glob = readvar($perlvars_h);
51371543 1198 emit_symbols $glob;
1199 }
1200}
1201else {
1202 unless ($define{'PERL_GLOBAL_STRUCT'}) {
549a6b10 1203 my $glob = readvar($perlvars_h);
51371543 1204 emit_symbols $glob;
9df9a5cd 1205 }
51371543 1206 unless ($define{'MULTIPLICITY'}) {
549a6b10 1207 my $glob = readvar($intrpvar_h);
51371543 1208 emit_symbols $glob;
9df9a5cd 1209 }
51371543 1210}
0a753a76 1211
549a6b10 1212sub try_symbol {
1213 my $symbol = shift;
22239a37 1214
4d6b4052 1215 return if $symbol !~ /^[A-Za-z_]/;
549a6b10 1216 return if $symbol =~ /^\#/;
1217 $symbol =~s/\r//g;
1218 chomp($symbol);
43cd9f80 1219 return if exists $skip{$symbol};
549a6b10 1220 emit_symbol($symbol);
3e3baf6d 1221}
0a753a76 1222
549a6b10 1223while (<DATA>) {
1224 try_symbol($_);
ac4c12e7 1225}
1226
18f68570 1227if ($PLATFORM =~ /^win(?:32|ce)$/) {
549a6b10 1228 foreach my $symbol (qw(
00b02797 1229 setuid
1230 setgid
7766f137 1231 boot_DynaLoader
7766f137 1232 Perl_init_os_extras
c44d3fdb 1233 Perl_thread_create
7766f137 1234 Perl_win32_init
23f519f0 1235 Perl_win32_term
7766f137 1236 RunPerl
5290524f 1237 win32_async_check
7766f137 1238 win32_errno
1239 win32_environ
7766f137 1240 win32_abort
1241 win32_fstat
1242 win32_stat
1243 win32_pipe
1244 win32_popen
1245 win32_pclose
1246 win32_rename
1247 win32_setmode
11bb82ff 1248 win32_chsize
7766f137 1249 win32_lseek
1250 win32_tell
1251 win32_dup
1252 win32_dup2
1253 win32_open
1254 win32_close
1255 win32_eof
1256 win32_read
1257 win32_write
1258 win32_spawnvp
1259 win32_mkdir
1260 win32_rmdir
1261 win32_chdir
1262 win32_flock
1263 win32_execv
1264 win32_execvp
1265 win32_htons
1266 win32_ntohs
1267 win32_htonl
1268 win32_ntohl
1269 win32_inet_addr
1270 win32_inet_ntoa
1271 win32_socket
1272 win32_bind
1273 win32_listen
1274 win32_accept
1275 win32_connect
1276 win32_send
1277 win32_sendto
1278 win32_recv
1279 win32_recvfrom
1280 win32_shutdown
1281 win32_closesocket
1282 win32_ioctlsocket
1283 win32_setsockopt
1284 win32_getsockopt
1285 win32_getpeername
1286 win32_getsockname
1287 win32_gethostname
1288 win32_gethostbyname
1289 win32_gethostbyaddr
1290 win32_getprotobyname
1291 win32_getprotobynumber
1292 win32_getservbyname
1293 win32_getservbyport
1294 win32_select
1295 win32_endhostent
1296 win32_endnetent
1297 win32_endprotoent
1298 win32_endservent
1299 win32_getnetent
1300 win32_getnetbyname
1301 win32_getnetbyaddr
1302 win32_getprotoent
1303 win32_getservent
1304 win32_sethostent
1305 win32_setnetent
1306 win32_setprotoent
1307 win32_setservent
1308 win32_getenv
1309 win32_putenv
1310 win32_perror
7766f137 1311 win32_malloc
1312 win32_calloc
1313 win32_realloc
1314 win32_free
1315 win32_sleep
1316 win32_times
1317 win32_access
1318 win32_alarm
1319 win32_chmod
1320 win32_open_osfhandle
1321 win32_get_osfhandle
1322 win32_ioctl
1323 win32_link
1324 win32_unlink
1325 win32_utime
57ab3dfe 1326 win32_gettimeofday
7766f137 1327 win32_uname
1328 win32_wait
1329 win32_waitpid
1330 win32_kill
1331 win32_str_os_error
1332 win32_opendir
1333 win32_readdir
1334 win32_telldir
1335 win32_seekdir
1336 win32_rewinddir
1337 win32_closedir
1338 win32_longpath
aa2b96ec 1339 win32_ansipath
7766f137 1340 win32_os_id
1341 win32_getpid
1342 win32_crypt
1343 win32_dynaload
df3728a2 1344 win32_get_childenv
1345 win32_free_childenv
1346 win32_clearenv
1347 win32_get_childdir
1348 win32_free_childdir
00b02797 1349 win32_stdin
1350 win32_stdout
1351 win32_stderr
1352 win32_ferror
1353 win32_feof
1354 win32_strerror
1355 win32_fprintf
1356 win32_printf
1357 win32_vfprintf
1358 win32_vprintf
1359 win32_fread
1360 win32_fwrite
1361 win32_fopen
1362 win32_fdopen
1363 win32_freopen
1364 win32_fclose
1365 win32_fputs
1366 win32_fputc
1367 win32_ungetc
1368 win32_getc
1369 win32_fileno
1370 win32_clearerr
1371 win32_fflush
1372 win32_ftell
1373 win32_fseek
1374 win32_fgetpos
1375 win32_fsetpos
1376 win32_rewind
1377 win32_tmpfile
1378 win32_setbuf
1379 win32_setvbuf
1380 win32_flushall
1381 win32_fcloseall
1382 win32_fgets
1383 win32_gets
1384 win32_fgetc
1385 win32_putc
1386 win32_puts
1387 win32_getchar
1388 win32_putchar
7766f137 1389 ))
1390 {
549a6b10 1391 try_symbol($symbol);
1392 }
3a00b83e 1393 if ($CCTYPE eq "BORLAND") {
1394 try_symbol('_matherr');
1395 }
549a6b10 1396}
3cfae81b 1397elsif ($PLATFORM eq 'os2') {
3df97b6d 1398 my (%mapped, @missing);
7766f137 1399 open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
1400 /^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>;
1401 close MAP or die 'Cannot close miniperl.map';
1402
ad6971c8 1403 @missing = grep { !exists $mapped{$_} }
7766f137 1404 keys %export;
c6261f3b 1405 @missing = grep { !exists $exportperlmalloc{$_} } @missing;
7766f137 1406 delete $export{$_} foreach @missing;
3cfae81b 1407}
084592ab 1408elsif ($PLATFORM eq 'MacOS') {
1409 open MACSYMS, 'macperl.sym' or die 'Cannot read macperl.sym';
1410
1411 while (<MACSYMS>) {
1412 try_symbol($_);
1413 }
1414
1415 close MACSYMS;
1416}
2986a63f 1417elsif ($PLATFORM eq 'netware') {
1418foreach my $symbol (qw(
1419 boot_DynaLoader
1420 Perl_init_os_extras
1421 Perl_thread_create
1422 Perl_nw5_init
1423 RunPerl
1424 AllocStdPerl
1425 FreeStdPerl
1426 do_spawn2
1427 do_aspawn
1428 nw_uname
1429 nw_stdin
1430 nw_stdout
1431 nw_stderr
1432 nw_feof
1433 nw_ferror
1434 nw_fopen
1435 nw_fclose
1436 nw_clearerr
1437 nw_getc
1438 nw_fgets
1439 nw_fputc
1440 nw_fputs
1441 nw_fflush
1442 nw_ungetc
1443 nw_fileno
1444 nw_fdopen
1445 nw_freopen
1446 nw_fread
1447 nw_fwrite
1448 nw_setbuf
1449 nw_setvbuf
1450 nw_vfprintf
1451 nw_ftell
1452 nw_fseek
1453 nw_rewind
1454 nw_tmpfile
1455 nw_fgetpos
1456 nw_fsetpos
1457 nw_dup
1458 nw_access
1459 nw_chmod
1460 nw_chsize
1461 nw_close
1462 nw_dup2
1463 nw_flock
1464 nw_isatty
1465 nw_link
1466 nw_lseek
1467 nw_stat
1468 nw_mktemp
1469 nw_open
1470 nw_read
1471 nw_rename
1472 nw_setmode
1473 nw_unlink
1474 nw_utime
1475 nw_write
1476 nw_chdir
1477 nw_rmdir
1478 nw_closedir
1479 nw_opendir
1480 nw_readdir
1481 nw_rewinddir
1482 nw_seekdir
1483 nw_telldir
1484 nw_htonl
1485 nw_htons
1486 nw_ntohl
1487 nw_ntohs
1488 nw_accept
1489 nw_bind
1490 nw_connect
1491 nw_endhostent
1492 nw_endnetent
1493 nw_endprotoent
1494 nw_endservent
1495 nw_gethostbyaddr
1496 nw_gethostbyname
1497 nw_gethostent
1498 nw_gethostname
1499 nw_getnetbyaddr
1500 nw_getnetbyname
1501 nw_getnetent
1502 nw_getpeername
1503 nw_getprotobyname
1504 nw_getprotobynumber
1505 nw_getprotoent
1506 nw_getservbyname
1507 nw_getservbyport
1508 nw_getservent
1509 nw_getsockname
1510 nw_getsockopt
1511 nw_inet_addr
1512 nw_listen
1513 nw_socket
1514 nw_recv
1515 nw_recvfrom
1516 nw_select
1517 nw_send
1518 nw_sendto
1519 nw_sethostent
1520 nw_setnetent
1521 nw_setprotoent
1522 nw_setservent
3a0827a6 1523 nw_setsockopt
4d76e4b4 1524 nw_inet_ntoa
2986a63f 1525 nw_shutdown
1526 nw_crypt
1527 nw_execvp
1528 nw_kill
1529 nw_Popen
1530 nw_Pclose
1531 nw_Pipe
1532 nw_times
1533 nw_waitpid
1534 nw_getpid
1535 nw_spawnvp
1536 nw_os_id
1537 nw_open_osfhandle
1538 nw_get_osfhandle
1539 nw_abort
1540 nw_sleep
1541 nw_wait
1542 nw_dynaload
1543 nw_strerror
1544 fnFpSetMode
1545 fnInsertHashListAddrs
1546 fnGetHashListAddrs
1547 Perl_deb
011f1a1a 1548 Perl_sv_setsv
1549 Perl_sv_catsv
1550 Perl_sv_catpvn
1551 Perl_sv_2pv
f355267c 1552 nw_freeenviron
1553 Remove_Thread_Ctx
2986a63f 1554 ))
1555 {
1556 try_symbol($symbol);
1557 }
1558}
22239a37 1559
d2b25974 1560# records of type boot_module for statically linked modules (except Dynaloader)
1561$static_ext =~ s/\//__/g;
1562$static_ext =~ s/\bDynaLoader\b//;
1563my @stat_mods = map {"boot_$_"} grep {/\S/} split /\s+/, $static_ext;
1564foreach my $symbol (@stat_mods)
1565 {
1566 try_symbol($symbol);
1567 }
1568
9fb265f7 1569try_symbol("init_Win32CORE") if $static_ext =~ /\bWin32CORE\b/;
1570
549a6b10 1571# Now all symbols should be defined because
1572# next we are going to output them.
1573
7766f137 1574foreach my $symbol (sort keys %export) {
1575 output_symbol($symbol);
1576}
549a6b10 1577
011f1a1a 1578if ($PLATFORM eq 'os2') {
59ad941d 1579 print <<EOP;
1580 dll_perlmain=main
1933e12c 1581 fill_extLibpath
1582 dir_subst
1583 Perl_OS2_handler_install
1584
59ad941d 1585; LAST_ORDINAL=$sym_ord
1586EOP
2986a63f 1587}
1588
549a6b10 1589sub emit_symbol {
7766f137 1590 my $symbol = shift;
9df9a5cd 1591 chomp($symbol);
7766f137 1592 $export{$symbol} = 1;
549a6b10 1593}
1594
1595sub output_symbol {
1596 my $symbol = shift;
18f68570 1597 if ($PLATFORM =~ /^win(?:32|ce)$/) {
549a6b10 1598 $symbol = "_$symbol" if $CCTYPE eq 'BORLAND';
520c758a 1599 print "\t$symbol\n";
549a6b10 1600# XXX: binary compatibility between compilers is an exercise
1601# in frustration :-(
1602# if ($CCTYPE eq "BORLAND") {
1603# # workaround Borland quirk by exporting both the straight
1604# # name and a name with leading underscore. Note the
1605# # alias *must* come after the symbol itself, if both
1606# # are to be exported. (Linker bug?)
1607# print "\t_$symbol\n";
1608# print "\t$symbol = _$symbol\n";
1609# }
1610# elsif ($CCTYPE eq 'GCC') {
1611# # Symbols have leading _ whole process is $%@"% slow
1612# # so skip aliases for now
1613# nprint "\t$symbol\n";
1614# }
1615# else {
1616# # for binary coexistence, export both the symbol and
1617# # alias with leading underscore
1618# print "\t$symbol\n";
1619# print "\t_$symbol = $symbol\n";
1620# }
7766f137 1621 }
1622 elsif ($PLATFORM eq 'os2') {
52e4c282 1623 printf qq( %-31s \@%s\n),
1624 qq("$symbol"), $ordinal{$symbol} || ++$sym_ord;
78232bc0 1625 printf qq( %-31s \@%s\n),
1626 qq("$exportperlmalloc{$symbol}" = "$symbol"),
1627 $ordinal{$exportperlmalloc{$symbol}} || ++$sym_ord
1628 if $exportperlmalloc and exists $exportperlmalloc{$symbol};
7766f137 1629 }
084592ab 1630 elsif ($PLATFORM eq 'aix' || $PLATFORM eq 'MacOS') {
549a6b10 1631 print "$symbol\n";
1632 }
2986a63f 1633 elsif ($PLATFORM eq 'netware') {
1634 print "\t$symbol,\n";
1635 }
549a6b10 1636}
1637
16381;
1639__DATA__
44798d05 1640# Oddities from PerlIO
568ad336 1641PerlIO_binmode
8437356b 1642PerlIO_getpos
568ad336 1643PerlIO_init
568ad336 1644PerlIO_setpos
568ad336 1645PerlIO_sprintf
8437356b 1646PerlIO_sv_dup
1647PerlIO_tmpfile
8437356b 1648PerlIO_vsprintf