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