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