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