really should test compile in AIX or something (fixup after the Series 90 patch)
[p5sagit/p5-mst-13.2.git] / makedef.pl
CommitLineData
549a6b10 1#
2# Create the export list for perl.
3#
86593e8d 4# Needed by WIN32 and OS/2 for creating perl.dll,
5# and by AIX for creating libperl.a when -Dusershrplib is in effect,
6# and by MacOS Classic.
549a6b10 7#
22c35a8c 8# reads global.sym, pp.sym, perlvars.h, intrpvar.h, thrdvar.h, config.h
5c728af0 9# On OS/2 reads miniperl.map and the previous version of perl5.def as well
0a753a76 10
549a6b10 11my $PLATFORM;
12my $CCTYPE;
910dfcc8 13
7766f137 14while (@ARGV) {
15 my $flag = shift;
5c728af0 16 if ($flag =~ s/^CC_FLAGS=/ /) {
17 for my $fflag ($flag =~ /(?:^|\s)-D(\S+)/g) {
18 $fflag .= '=1' unless $fflag =~ /^(\w+)=/;
19 $define{$1} = $2 if $fflag =~ /^(\w+)=(.+)$/;
20 }
21 next;
22 }
7766f137 23 $define{$1} = 1 if ($flag =~ /^-D(\w+)$/);
24 $define{$1} = $2 if ($flag =~ /^-D(\w+)=(.+)$/);
25 $CCTYPE = $1 if ($flag =~ /^CCTYPE=(\w+)$/);
26 $PLATFORM = $1 if ($flag =~ /^PLATFORM=(\w+)$/);
18f68570 27 if ($PLATFORM eq 'netware') {
28 $FILETYPE = $1 if ($flag =~ /^FILETYPE=(\w+)$/);
29 }
7766f137 30}
d55594ae 31
18f68570 32my @PLATFORM = qw(aix win32 wince os2 MacOS netware);
549a6b10 33my %PLATFORM;
34@PLATFORM{@PLATFORM} = ();
35
36defined $PLATFORM || die "PLATFORM undefined, must be one of: @PLATFORM\n";
9df9a5cd 37exists $PLATFORM{$PLATFORM} || die "PLATFORM must be one of: @PLATFORM\n";
549a6b10 38
1829b0dc 39if ($PLATFORM eq 'win32' or $PLATFORM eq 'wince' or $PLATFORM eq "aix") {
17bdc114 40 # Add the compile-time options that miniperl was built with to %define.
dcddf0a3 41 # On Win32 these are not the same options as perl itself will be built
42 # with since miniperl is built with a canned config (one of the win32/
43 # config_H.*) and none of the BUILDOPT's that are set in the makefiles,
44 # but they do include some #define's that are hard-coded in various
45 # source files and header files and don't include any BUILDOPT's that
46 # the user might have chosen to disable because the canned configs are
47 # minimal configs that don't include any of those options.
75472953 48 my $opts = ($PLATFORM eq 'wince' ? '-MCross' : ''); # for wince need Cross.pm to get Config.pm
1829b0dc 49 my $config = `$^X $opts -Ilib -V`;
dcddf0a3 50 my($options) = $config =~ /^ Compile-time options: (.*?)\n^ \S/ms;
51 $options =~ s/\s+/ /g;
40dfc4d2 52 print STDERR "Options: ($options)\n";
17bdc114 53 foreach (split /\s+/, $options) {
54 $define{$_} = 1;
55 }
56}
57
c6261f3b 58my %exportperlmalloc =
59 (
60 Perl_malloc => "malloc",
61 Perl_mfree => "free",
62 Perl_realloc => "realloc",
63 Perl_calloc => "calloc",
64 );
65
66my $exportperlmalloc = $PLATFORM eq 'os2';
67
549a6b10 68my $config_sh = "config.sh";
69my $config_h = "config.h";
70my $thrdvar_h = "thrdvar.h";
71my $intrpvar_h = "intrpvar.h";
72my $perlvars_h = "perlvars.h";
73my $global_sym = "global.sym";
74my $pp_sym = "pp.sym";
75my $globvar_sym = "globvar.sym";
76my $perlio_sym = "perlio.sym";
d2b25974 77my $static_ext = "";
549a6b10 78
9df9a5cd 79if ($PLATFORM eq 'aix') {
549a6b10 80 # Nothing for now.
7766f137 81}
18f68570 82elsif ($PLATFORM =~ /^win(?:32|ce)$/ || $PLATFORM eq 'netware') {
549a6b10 83 $CCTYPE = "MSVC" unless defined $CCTYPE;
00b02797 84 foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym,
aadb217d 85 $pp_sym, $globvar_sym, $perlio_sym) {
549a6b10 86 s!^!..\\!;
87 }
88}
084592ab 89elsif ($PLATFORM eq 'MacOS') {
90 foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym,
aadb217d 91 $pp_sym, $globvar_sym, $perlio_sym) {
084592ab 92 s!^!::!;
93 }
94}
549a6b10 95
18f68570 96unless ($PLATFORM eq 'win32' || $PLATFORM eq 'wince' || $PLATFORM eq 'MacOS' || $PLATFORM eq 'netware') {
549a6b10 97 open(CFG,$config_sh) || die "Cannot open $config_sh: $!\n";
7766f137 98 while (<CFG>) {
549a6b10 99 if (/^(?:ccflags|optimize)='(.+)'$/) {
100 $_ = $1;
101 $define{$1} = 1 while /-D(\w+)/g;
102 }
aadb217d 103 if (/^(d_(?:mmap|sigaction))='(.+)'$/) {
104 $define{$1} = $2;
105 }
3cfae81b 106 if ($PLATFORM eq 'os2') {
52e4c282 107 $CONFIG_ARGS = $1 if /^config_args='(.+)'$/;
108 $ARCHNAME = $1 if /^archname='(.+)'$/;
109 $PATCHLEVEL = $1 if /^perl_patchlevel='(.+)'$/;
3cfae81b 110 }
549a6b10 111 }
112 close(CFG);
113}
d2b25974 114if ($PLATFORM eq 'win32' || $PLATFORM eq 'wince') {
115 open(CFG,"<..\\$config_sh") || die "Cannot open ..\\$config_sh: $!\n";
116 if ((join '', <CFG>) =~ /^static_ext='(.*)'$/m) {
117 $static_ext = $1;
118 }
119 close(CFG);
120}
549a6b10 121
122open(CFG,$config_h) || die "Cannot open $config_h: $!\n";
7766f137 123while (<CFG>) {
124 $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/;
7766f137 125 $define{$1} = 1 if /^\s*#\s*define\s+(MULTIPLICITY)\b/;
0e32cd81 126 $define{$1} = 1 if /^\s*#\s*define\s+(PERL_\w+)\b/;
127 $define{$1} = 1 if /^\s*#\s*define\s+(USE_\w+)\b/;
7766f137 128}
bbc8f9de 129close(CFG);
130
18c4b137 131# perl.h logic duplication begins
132
894ccb8c 133if ($define{PERL_IMPLICIT_SYS}) {
134 $define{PL_OP_SLAB_ALLOC} = 1;
135}
ac6bedea 136
18c4b137 137if ($define{USE_ITHREADS}) {
acfe0abc 138 if (!$define{MULTIPLICITY}) {
18c4b137 139 $define{MULTIPLICITY} = 1;
140 }
141}
142
143$define{PERL_IMPLICIT_CONTEXT} ||=
144 $define{USE_ITHREADS} ||
18c4b137 145 $define{MULTIPLICITY} ;
146
10bc17b6 147if ($define{USE_ITHREADS} && $PLATFORM ne 'win32' && $^O ne 'darwin') {
148 $define{USE_REENTRANT_API} = 1;
149}
150
18c4b137 151# perl.h logic duplication ends
152
ac6bedea 153my $sym_ord = 0;
154
dcddf0a3 155print STDERR "Defines: (" . join(' ', sort keys %define) . ")\n";
156
18f68570 157if ($PLATFORM =~ /^win(?:32|ce)$/) {
78a7c709 158 ($dll = ($define{PERL_DLL} || "perl59")) =~ s/\.dll$//i;
18f68570 159 print "LIBRARY $dll\n";
dfdd1393 160 print "DESCRIPTION 'Perl interpreter'\n";
161 print "EXPORTS\n";
162 if ($define{PERL_IMPLICIT_SYS}) {
549a6b10 163 output_symbol("perl_get_host_info");
7766f137 164 output_symbol("perl_alloc_override");
0295eab8 165 }
b54a2e1e 166 if ($define{USE_ITHREADS} and $define{PERL_IMPLICIT_SYS}) {
ac6bedea 167 output_symbol("perl_clone_host");
51371543 168 }
7766f137 169}
170elsif ($PLATFORM eq 'os2') {
52e4c282 171 if (open my $fh, '<', 'perl5.def') {
172 while (<$fh>) {
173 last if /^\s*EXPORTS\b/;
174 }
175 while (<$fh>) {
78232bc0 176 $ordinal{$1} = $2 if /^\s*"(\w+)"\s*(?:=\s*"\w+"\s*)?\@(\d+)\s*$/;
52e4c282 177 # This allows skipping ordinals which were used in older versions
178 $sym_ord = $1 if /^\s*;\s*LAST_ORDINAL\s*=\s*(\d+)\s*$/;
179 }
180 $sym_ord < $_ and $sym_ord = $_ for values %ordinal; # Take the max
181 }
3cfae81b 182 ($v = $]) =~ s/(\d\.\d\d\d)(\d\d)$/$1_$2/;
183 $v .= '-thread' if $ARCHNAME =~ /-thread/;
3cfae81b 184 ($dll = $define{PERL_DLL}) =~ s/\.dll$//i;
52e4c282 185 $v .= "\@$PATCHLEVEL" if $PATCHLEVEL;
1102eebe 186 $d = "DESCRIPTION '\@#perl5-porters\@perl.org:$v#\@ Perl interpreter, configured as $CONFIG_ARGS'";
187 $d = substr($d, 0, 249) . "...'" if length $d > 253;
3cfae81b 188 print <<"---EOP---";
189LIBRARY '$dll' INITINSTANCE TERMINSTANCE
1102eebe 190$d
3cfae81b 191STACKSIZE 32768
192CODE LOADONCALL
193DATA LOADONCALL NONSHARED MULTIPLE
194EXPORTS
195---EOP---
7766f137 196}
197elsif ($PLATFORM eq 'aix') {
61d42ce4 198 $OSVER = `uname -v`;
199 chop $OSVER;
200 $OSREL = `uname -r`;
201 chop $OSREL;
202 if ($OSVER > 4 || ($OSVER == 4 && $OSREL >= 3)) {
203 print "#! ..\n";
204 } else {
205 print "#!\n";
206 }
ac4c12e7 207}
2986a63f 208elsif ($PLATFORM eq 'netware') {
209 if ($FILETYPE eq 'def') {
78a7c709 210 print "LIBRARY perl59\n";
2986a63f 211 print "DESCRIPTION 'Perl interpreter for NetWare'\n";
212 print "EXPORTS\n";
213 }
214 if ($define{PERL_IMPLICIT_SYS}) {
ac6bedea 215 output_symbol("perl_get_host_info");
216 output_symbol("perl_alloc_override");
217 output_symbol("perl_clone_host");
2986a63f 218 }
219}
bbc8f9de 220
22239a37 221my %skip;
222my %export;
223
51371543 224sub skip_symbols {
225 my $list = shift;
226 foreach my $symbol (@$list) {
227 $skip{$symbol} = 1;
228 }
22239a37 229}
230
51371543 231sub emit_symbols {
232 my $list = shift;
233 foreach my $symbol (@$list) {
234 my $skipsym = $symbol;
235 # XXX hack
acfe0abc 236 if ($define{MULTIPLICITY}) {
51371543 237 $skipsym =~ s/^Perl_[GIT](\w+)_ptr$/PL_$1/;
238 }
239 emit_symbol($symbol) unless exists $skip{$skipsym};
240 }
22239a37 241}
242
549a6b10 243if ($PLATFORM eq 'win32') {
7766f137 244 skip_symbols [qw(
245 PL_statusvalue_vms
246 PL_archpat_auto
247 PL_cryptseen
248 PL_DBcv
249 PL_generation
250 PL_lastgotoprobe
251 PL_linestart
252 PL_modcount
253 PL_pending_ident
7766f137 254 PL_sublex_info
255 PL_timesbuf
256 main
257 Perl_ErrorNo
aadb217d 258 Perl_GetVars
7766f137 259 Perl_do_exec3
260 Perl_do_ipcctl
261 Perl_do_ipcget
262 Perl_do_msgrcv
263 Perl_do_msgsnd
264 Perl_do_semop
265 Perl_do_shmio
266 Perl_dump_fds
267 Perl_init_thread_intern
268 Perl_my_bzero
9d50d399 269 Perl_my_bcopy
7766f137 270 Perl_my_htonl
271 Perl_my_ntohl
272 Perl_my_swap
273 Perl_my_chsize
274 Perl_same_dirent
275 Perl_setenv_getix
276 Perl_unlnk
277 Perl_watch
278 Perl_safexcalloc
279 Perl_safexmalloc
280 Perl_safexfree
281 Perl_safexrealloc
282 Perl_my_memcmp
283 Perl_my_memset
284 PL_cshlen
285 PL_cshname
286 PL_opsave
287 Perl_do_exec
288 Perl_getenv_len
289 Perl_my_pclose
290 Perl_my_popen
cec8d04d 291 Perl_my_sprintf
7766f137 292 )];
293}
54725af6 294else {
295 skip_symbols [qw(
296 Perl_do_spawn
297 Perl_do_spawn_nowait
298 Perl_do_aspawn
299 )];
300}
301if ($PLATFORM eq 'wince') {
18f68570 302 skip_symbols [qw(
303 PL_statusvalue_vms
304 PL_archpat_auto
305 PL_cryptseen
306 PL_DBcv
307 PL_generation
308 PL_lastgotoprobe
309 PL_linestart
310 PL_modcount
311 PL_pending_ident
18f68570 312 PL_sublex_info
313 PL_timesbuf
314 PL_collation_ix
315 PL_collation_name
316 PL_collation_standard
317 PL_collxfrm_base
318 PL_collxfrm_mult
319 PL_numeric_compat1
320 PL_numeric_local
321 PL_numeric_name
322 PL_numeric_radix_sv
323 PL_numeric_standard
324 PL_vtbl_collxfrm
325 Perl_sv_collxfrm
326 setgid
327 setuid
18f68570 328 win32_free_childdir
329 win32_free_childenv
330 win32_get_childdir
331 win32_get_childenv
332 win32_spawnvp
333 main
334 Perl_ErrorNo
aadb217d 335 Perl_GetVars
18f68570 336 Perl_do_exec3
337 Perl_do_ipcctl
338 Perl_do_ipcget
339 Perl_do_msgrcv
340 Perl_do_msgsnd
341 Perl_do_semop
342 Perl_do_shmio
343 Perl_dump_fds
344 Perl_init_thread_intern
345 Perl_my_bzero
346 Perl_my_bcopy
347 Perl_my_htonl
348 Perl_my_ntohl
349 Perl_my_swap
350 Perl_my_chsize
351 Perl_same_dirent
352 Perl_setenv_getix
353 Perl_unlnk
354 Perl_watch
355 Perl_safexcalloc
356 Perl_safexmalloc
357 Perl_safexfree
358 Perl_safexrealloc
359 Perl_my_memcmp
360 Perl_my_memset
361 PL_cshlen
362 PL_cshname
363 PL_opsave
364 Perl_do_exec
365 Perl_getenv_len
366 Perl_my_pclose
367 Perl_my_popen
cec8d04d 368 Perl_my_sprintf
18f68570 369 )];
370}
7766f137 371elsif ($PLATFORM eq 'aix') {
549a6b10 372 skip_symbols([qw(
7766f137 373 Perl_dump_fds
374 Perl_ErrorNo
aadb217d 375 Perl_GetVars
7766f137 376 Perl_my_bcopy
377 Perl_my_bzero
378 Perl_my_chsize
379 Perl_my_htonl
380 Perl_my_memcmp
381 Perl_my_memset
382 Perl_my_ntohl
383 Perl_my_swap
384 Perl_safexcalloc
385 Perl_safexfree
386 Perl_safexmalloc
387 Perl_safexrealloc
388 Perl_same_dirent
389 Perl_unlnk
6c644e78 390 Perl_sys_intern_clear
95151ede 391 Perl_sys_intern_dup
52853b95 392 Perl_sys_intern_init
d0ade26c 393 Perl_my_sprintf
7766f137 394 PL_cryptseen
395 PL_opsave
396 PL_statusvalue_vms
397 PL_sys_intern
398 )]);
399}
400elsif ($PLATFORM eq 'os2') {
3cfae81b 401 emit_symbols([qw(
7766f137 402 ctermid
403 get_sysinfo
404 Perl_OS2_init
764df951 405 Perl_OS2_init3
406 Perl_OS2_term
7766f137 407 OS2_Perl_data
408 dlopen
409 dlsym
410 dlerror
403d6f8e 411 dlclose
59ad941d 412 dup2
413 dup
7766f137 414 my_tmpfile
415 my_tmpnam
416 my_flock
9c130f5b 417 my_rmdir
418 my_mkdir
f72c975a 419 my_getpwuid
420 my_getpwnam
421 my_getpwent
422 my_setpwent
423 my_endpwent
622913ab 424 fork_with_resources
425 croak_with_os2error
f72c975a 426 setgrent
427 endgrent
428 getgrent
7766f137 429 malloc_mutex
430 threads_mutex
431 nthreads
432 nthreads_cond
433 os2_cond_wait
434 os2_stat
1933e12c 435 os2_execname
436 async_mssleep
437 msCounter
438 InfoTable
7766f137 439 pthread_join
440 pthread_create
441 pthread_detach
442 XS_Cwd_change_drive
443 XS_Cwd_current_drive
444 XS_Cwd_extLibpath
445 XS_Cwd_extLibpath_set
446 XS_Cwd_sys_abspath
447 XS_Cwd_sys_chdir
448 XS_Cwd_sys_cwd
449 XS_Cwd_sys_is_absolute
450 XS_Cwd_sys_is_relative
451 XS_Cwd_sys_is_rooted
452 XS_DynaLoader_mod2fname
453 XS_File__Copy_syscopy
454 Perl_Register_MQ
455 Perl_Deregister_MQ
456 Perl_Serve_Messages
457 Perl_Process_Messages
458 init_PMWIN_entries
459 PMWIN_entries
460 Perl_hab_GET
35bc1fdc 461 loadByOrdinal
462 pExtFCN
30500b05 463 os2error
464 ResetWinError
465 CroakWinError
5c728af0 466 PL_do_undump
7766f137 467 )]);
5c728af0 468 emit_symbols([qw(os2_cond_wait
469 pthread_join
470 pthread_create
471 pthread_detach
472 )])
473 if $define{'USE_5005THREADS'} or $define{'USE_ITHREADS'};
3cfae81b 474}
084592ab 475elsif ($PLATFORM eq 'MacOS') {
476 skip_symbols [qw(
aadb217d 477 Perl_GetVars
084592ab 478 PL_cryptseen
479 PL_cshlen
480 PL_cshname
481 PL_statusvalue_vms
482 PL_sys_intern
483 PL_opsave
484 PL_timesbuf
485 Perl_dump_fds
486 Perl_my_bcopy
487 Perl_my_bzero
488 Perl_my_chsize
489 Perl_my_htonl
490 Perl_my_memcmp
491 Perl_my_memset
492 Perl_my_ntohl
493 Perl_my_swap
494 Perl_safexcalloc
495 Perl_safexfree
496 Perl_safexmalloc
497 Perl_safexrealloc
498 Perl_unlnk
fe05f414 499 Perl_sys_intern_clear
500 Perl_sys_intern_init
084592ab 501 )];
502}
2986a63f 503elsif ($PLATFORM eq 'netware') {
504 skip_symbols [qw(
505 PL_statusvalue_vms
506 PL_archpat_auto
507 PL_cryptseen
508 PL_DBcv
509 PL_generation
510 PL_lastgotoprobe
511 PL_linestart
512 PL_modcount
513 PL_pending_ident
2986a63f 514 PL_sublex_info
515 PL_timesbuf
516 main
517 Perl_ErrorNo
aadb217d 518 Perl_GetVars
2986a63f 519 Perl_do_exec3
520 Perl_do_ipcctl
521 Perl_do_ipcget
522 Perl_do_msgrcv
523 Perl_do_msgsnd
524 Perl_do_semop
525 Perl_do_shmio
526 Perl_dump_fds
527 Perl_init_thread_intern
528 Perl_my_bzero
529 Perl_my_htonl
530 Perl_my_ntohl
531 Perl_my_swap
532 Perl_my_chsize
533 Perl_same_dirent
534 Perl_setenv_getix
535 Perl_unlnk
536 Perl_watch
537 Perl_safexcalloc
538 Perl_safexmalloc
539 Perl_safexfree
540 Perl_safexrealloc
541 Perl_my_memcmp
542 Perl_my_memset
543 PL_cshlen
544 PL_cshname
545 PL_opsave
546 Perl_do_exec
547 Perl_getenv_len
548 Perl_my_pclose
549 Perl_my_popen
011f1a1a 550 Perl_sys_intern_init
551 Perl_sys_intern_dup
552 Perl_sys_intern_clear
553 Perl_my_bcopy
554 Perl_PerlIO_write
555 Perl_PerlIO_unread
556 Perl_PerlIO_tell
557 Perl_PerlIO_stdout
558 Perl_PerlIO_stdin
559 Perl_PerlIO_stderr
560 Perl_PerlIO_setlinebuf
561 Perl_PerlIO_set_ptrcnt
562 Perl_PerlIO_set_cnt
563 Perl_PerlIO_seek
564 Perl_PerlIO_read
565 Perl_PerlIO_get_ptr
566 Perl_PerlIO_get_cnt
567 Perl_PerlIO_get_bufsiz
568 Perl_PerlIO_get_base
569 Perl_PerlIO_flush
570 Perl_PerlIO_fill
571 Perl_PerlIO_fileno
572 Perl_PerlIO_error
573 Perl_PerlIO_eof
574 Perl_PerlIO_close
575 Perl_PerlIO_clearerr
576 PerlIO_perlio
2986a63f 577 )];
578}
3cfae81b 579
7766f137 580unless ($define{'DEBUGGING'}) {
581 skip_symbols [qw(
7766f137 582 Perl_deb_growlevel
583 Perl_debop
584 Perl_debprofdump
585 Perl_debstack
586 Perl_debstackptrs
5cbf7fcf 587 Perl_pad_sv
7766f137 588 Perl_sv_peek
943795c2 589 Perl_hv_assert
7766f137 590 PL_block_type
591 PL_watchaddr
592 PL_watchok
e0cde265 593 PL_watch_pvx
7766f137 594 )];
595}
596
605881df 597if ($define{'PERL_IMPLICIT_CONTEXT'}) {
598 skip_symbols [qw(
599 PL_sig_sv
600 )];
601}
602
7766f137 603if ($define{'PERL_IMPLICIT_SYS'}) {
604 skip_symbols [qw(
605 Perl_getenv_len
606 Perl_my_popen
607 Perl_my_pclose
608 )];
609}
610else {
611 skip_symbols [qw(
612 PL_Mem
613 PL_MemShared
614 PL_MemParse
615 PL_Env
616 PL_StdIO
617 PL_LIO
618 PL_Dir
619 PL_Sock
620 PL_Proc
621 )];
622}
623
f8c7b90f 624unless ($define{'PERL_OLD_COPY_ON_WRITE'}) {
0190f6ec 625 skip_symbols [qw(
626 Perl_sv_setsv_cow
2aa6a103 627 Perl_sv_release_IVX
0190f6ec 628 )];
629}
630
5bcb3f6c 631unless ($define{'USE_REENTRANT_API'}) {
632 skip_symbols [qw(
633 PL_reentrant_buffer
634 )];
635}
636
7766f137 637if ($define{'MYMALLOC'}) {
638 emit_symbols [qw(
639 Perl_dump_mstats
827e134a 640 Perl_get_mstats
9c130f5b 641 Perl_strdup
642 Perl_putenv
6af660ee 643 MallocCfg_ptr
644 MallocCfgP_ptr
7766f137 645 )];
3db8f154 646 if ($define{'USE_ITHREADS'}) {
1feb2720 647 emit_symbols [qw(
648 PL_malloc_mutex
649 )];
650 }
80fc1a6e 651 else {
652 skip_symbols [qw(
653 PL_malloc_mutex
654 )];
655 }
51371543 656}
657else {
7766f137 658 skip_symbols [qw(
659 PL_malloc_mutex
660 Perl_dump_mstats
6ecd3fcb 661 Perl_get_mstats
7766f137 662 Perl_malloced_size
6af660ee 663 MallocCfg_ptr
664 MallocCfgP_ptr
7766f137 665 )];
666}
667
8852afe9 668if ($define{'PERL_USE_SAFE_PUTENV'}) {
669 skip_symbols [qw(
670 PL_use_safe_putenv
671 )];
672}
673
3db8f154 674unless ($define{'USE_ITHREADS'}) {
7766f137 675 skip_symbols [qw(
676 PL_thr_key
f433d095 677 )];
678}
679
3db8f154 680# USE_5005THREADS symbols. Kept as reference for easier removal
f433d095 681 skip_symbols [qw(
7766f137 682 PL_sv_mutex
683 PL_strtab_mutex
684 PL_svref_mutex
7766f137 685 PL_cred_mutex
686 PL_eval_mutex
6940069f 687 PL_fdpid_mutex
688 PL_sv_lock_mutex
7766f137 689 PL_eval_cond
690 PL_eval_owner
691 PL_threads_mutex
692 PL_nthreads
693 PL_nthreads_cond
694 PL_threadnum
695 PL_threadsv_names
696 PL_thrsv
697 PL_vtbl_mutex
7766f137 698 Perl_condpair_magic
699 Perl_new_struct_thread
700 Perl_per_thread_magicals
701 Perl_thread_create
702 Perl_find_threadsv
703 Perl_unlock_condpair
704 Perl_magic_mutexfree
4755096e 705 Perl_sv_lock
7766f137 706 )];
7766f137 707
708unless ($define{'USE_ITHREADS'}) {
709 skip_symbols [qw(
710 PL_ptr_table
6e72d904 711 PL_pte_root
712 PL_pte_arenaroot
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
7766f137 722 Perl_dirp_dup
723 Perl_cx_dup
724 Perl_si_dup
725 Perl_any_dup
726 Perl_ss_dup
727 Perl_fp_dup
728 Perl_gp_dup
729 Perl_he_dup
730 Perl_mg_dup
731 Perl_re_dup
732 Perl_sv_dup
aeef2723 733 Perl_rvpv_dup
88daff13 734 Perl_hek_dup
7766f137 735 Perl_sys_intern_dup
86593e8d 736 Perl_ptr_table_clear
7766f137 737 Perl_ptr_table_fetch
86593e8d 738 Perl_ptr_table_free
7766f137 739 Perl_ptr_table_new
4ac9195f 740 Perl_ptr_table_clear
741 Perl_ptr_table_free
7766f137 742 Perl_ptr_table_split
743 Perl_ptr_table_store
744 perl_clone
745 perl_clone_using
038f0558 746 Perl_sharedsv_find
747 Perl_sharedsv_init
748 Perl_sharedsv_lock
749 Perl_sharedsv_new
750 Perl_sharedsv_thrcnt_dec
751 Perl_sharedsv_thrcnt_inc
752 Perl_sharedsv_unlock
dc1061dc 753 Perl_stashpv_hvname_match
1fa600a7 754 Perl_regdupe_internal
7766f137 755 )];
756}
757
758unless ($define{'PERL_IMPLICIT_CONTEXT'}) {
759 skip_symbols [qw(
1f9ecdc6 760 PL_my_ctx_mutex
761 PL_my_cxt_index
762 PL_my_cxt_list
763 PL_my_cxt_size
ecb9cc66 764 PL_my_cxt_keys
7766f137 765 Perl_croak_nocontext
766 Perl_die_nocontext
767 Perl_deb_nocontext
768 Perl_form_nocontext
e0f4245d 769 Perl_load_module_nocontext
7766f137 770 Perl_mess_nocontext
771 Perl_warn_nocontext
772 Perl_warner_nocontext
773 Perl_newSVpvf_nocontext
774 Perl_sv_catpvf_nocontext
775 Perl_sv_setpvf_nocontext
776 Perl_sv_catpvf_mg_nocontext
777 Perl_sv_setpvf_mg_nocontext
484eff17 778 Perl_my_cxt_init
ecb9cc66 779 Perl_my_cxt_index
7766f137 780 )];
781}
782
783unless ($define{'PERL_IMPLICIT_SYS'}) {
784 skip_symbols [qw(
785 perl_alloc_using
014822e4 786 perl_clone_using
7766f137 787 )];
788}
789
790unless ($define{'FAKE_THREADS'}) {
791 skip_symbols [qw(PL_curthr)];
792}
793
aadb217d 794unless ($define{'PL_OP_SLAB_ALLOC'}) {
e0cde265 795 skip_symbols [qw(
aadb217d 796 PL_OpPtr
797 PL_OpSlab
798 PL_OpSpace
799 Perl_Slab_Alloc
800 Perl_Slab_Free
801 )];
802}
803
804unless ($define{'THREADS_HAVE_PIDS'}) {
805 skip_symbols [qw(PL_ppid)];
e0cde265 806}
807
aadb217d 808unless ($define{'PERL_NEED_APPCTX'}) {
e0cde265 809 skip_symbols [qw(
aadb217d 810 PL_appctx
e0cde265 811 )];
812}
813
aadb217d 814unless ($define{'PERL_NEED_TIMESBASE'}) {
e0cde265 815 skip_symbols [qw(
aadb217d 816 PL_timesbase
e0cde265 817 )];
818}
819
808e2276 820unless ($define{'DEBUG_LEAKING_SCALARS_FORK_DUMP'}) {
821 skip_symbols [qw(
822 PL_dumper_fd
823 )];
824}
c69033f2 825unless ($define{'PERL_DONT_CREATE_GVSV'}) {
826 skip_symbols [qw(
827 Perl_gv_SVadd
828 )];
829}
ce582cee 830if ($define{'SPRINTF_RETURNS_STRLEN'}) {
831 skip_symbols [qw(
832 Perl_my_sprintf
833 )];
834}
ca0c25f6 835unless ($define{'PERL_USES_PL_PIDSTATUS'}) {
836 skip_symbols [qw(
837 Perl_pidgone
838 PL_pidstatus
839 )];
840}
808e2276 841
02ca4724 842unless ($define{'PERL_TRACK_MEMPOOL'}) {
843 skip_symbols [qw(
844 PL_memory_debug_header
845 )];
846}
847
f8565a66 848if ($define{'PERL_MAD'}) {
849 skip_symbols [qw(
850 PL_nextval
851 PL_nexttype
852 )];
853} else {
e3e31fab 854 skip_symbols [qw(
855 PL_madskills
856 PL_xmlfp
f8565a66 857 PL_lasttoke
5336380d 858 PL_realtokenstart
859 PL_faketokens
860 PL_thismad
861 PL_thistoken
862 PL_thisopen
863 PL_thisstuff
864 PL_thisclose
865 PL_thiswhite
866 PL_nextwhite
867 PL_skipwhite
868 PL_endwhite
869 PL_curforce
1dba731d 870 Perl_pad_peg
3b721df9 871 Perl_xmldump_indent
872 Perl_xmldump_vindent
873 Perl_xmldump_all
874 Perl_xmldump_packsubs
875 Perl_xmldump_sub
876 Perl_xmldump_form
877 Perl_xmldump_eval
878 Perl_sv_catxmlsv
879 Perl_sv_catxmlpvn
880 Perl_sv_xmlpeek
881 Perl_do_pmop_xmldump
882 Perl_pmop_xmldump
883 Perl_do_op_xmldump
884 Perl_op_xmldump
e3e31fab 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
1303 win32_os_id
1304 win32_getpid
1305 win32_crypt
1306 win32_dynaload
df3728a2 1307 win32_get_childenv
1308 win32_free_childenv
1309 win32_clearenv
1310 win32_get_childdir
1311 win32_free_childdir
00b02797 1312 win32_stdin
1313 win32_stdout
1314 win32_stderr
1315 win32_ferror
1316 win32_feof
1317 win32_strerror
1318 win32_fprintf
1319 win32_printf
1320 win32_vfprintf
1321 win32_vprintf
1322 win32_fread
1323 win32_fwrite
1324 win32_fopen
1325 win32_fdopen
1326 win32_freopen
1327 win32_fclose
1328 win32_fputs
1329 win32_fputc
1330 win32_ungetc
1331 win32_getc
1332 win32_fileno
1333 win32_clearerr
1334 win32_fflush
1335 win32_ftell
1336 win32_fseek
1337 win32_fgetpos
1338 win32_fsetpos
1339 win32_rewind
1340 win32_tmpfile
1341 win32_setbuf
1342 win32_setvbuf
1343 win32_flushall
1344 win32_fcloseall
1345 win32_fgets
1346 win32_gets
1347 win32_fgetc
1348 win32_putc
1349 win32_puts
1350 win32_getchar
1351 win32_putchar
7766f137 1352 ))
1353 {
549a6b10 1354 try_symbol($symbol);
1355 }
3a00b83e 1356 if ($CCTYPE eq "BORLAND") {
1357 try_symbol('_matherr');
1358 }
549a6b10 1359}
3cfae81b 1360elsif ($PLATFORM eq 'os2') {
7766f137 1361 open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
1362 /^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>;
1363 close MAP or die 'Cannot close miniperl.map';
1364
ad6971c8 1365 @missing = grep { !exists $mapped{$_} }
7766f137 1366 keys %export;
c6261f3b 1367 @missing = grep { !exists $exportperlmalloc{$_} } @missing;
7766f137 1368 delete $export{$_} foreach @missing;
3cfae81b 1369}
084592ab 1370elsif ($PLATFORM eq 'MacOS') {
1371 open MACSYMS, 'macperl.sym' or die 'Cannot read macperl.sym';
1372
1373 while (<MACSYMS>) {
1374 try_symbol($_);
1375 }
1376
1377 close MACSYMS;
1378}
2986a63f 1379elsif ($PLATFORM eq 'netware') {
1380foreach my $symbol (qw(
1381 boot_DynaLoader
1382 Perl_init_os_extras
1383 Perl_thread_create
1384 Perl_nw5_init
1385 RunPerl
1386 AllocStdPerl
1387 FreeStdPerl
1388 do_spawn2
1389 do_aspawn
1390 nw_uname
1391 nw_stdin
1392 nw_stdout
1393 nw_stderr
1394 nw_feof
1395 nw_ferror
1396 nw_fopen
1397 nw_fclose
1398 nw_clearerr
1399 nw_getc
1400 nw_fgets
1401 nw_fputc
1402 nw_fputs
1403 nw_fflush
1404 nw_ungetc
1405 nw_fileno
1406 nw_fdopen
1407 nw_freopen
1408 nw_fread
1409 nw_fwrite
1410 nw_setbuf
1411 nw_setvbuf
1412 nw_vfprintf
1413 nw_ftell
1414 nw_fseek
1415 nw_rewind
1416 nw_tmpfile
1417 nw_fgetpos
1418 nw_fsetpos
1419 nw_dup
1420 nw_access
1421 nw_chmod
1422 nw_chsize
1423 nw_close
1424 nw_dup2
1425 nw_flock
1426 nw_isatty
1427 nw_link
1428 nw_lseek
1429 nw_stat
1430 nw_mktemp
1431 nw_open
1432 nw_read
1433 nw_rename
1434 nw_setmode
1435 nw_unlink
1436 nw_utime
1437 nw_write
1438 nw_chdir
1439 nw_rmdir
1440 nw_closedir
1441 nw_opendir
1442 nw_readdir
1443 nw_rewinddir
1444 nw_seekdir
1445 nw_telldir
1446 nw_htonl
1447 nw_htons
1448 nw_ntohl
1449 nw_ntohs
1450 nw_accept
1451 nw_bind
1452 nw_connect
1453 nw_endhostent
1454 nw_endnetent
1455 nw_endprotoent
1456 nw_endservent
1457 nw_gethostbyaddr
1458 nw_gethostbyname
1459 nw_gethostent
1460 nw_gethostname
1461 nw_getnetbyaddr
1462 nw_getnetbyname
1463 nw_getnetent
1464 nw_getpeername
1465 nw_getprotobyname
1466 nw_getprotobynumber
1467 nw_getprotoent
1468 nw_getservbyname
1469 nw_getservbyport
1470 nw_getservent
1471 nw_getsockname
1472 nw_getsockopt
1473 nw_inet_addr
1474 nw_listen
1475 nw_socket
1476 nw_recv
1477 nw_recvfrom
1478 nw_select
1479 nw_send
1480 nw_sendto
1481 nw_sethostent
1482 nw_setnetent
1483 nw_setprotoent
1484 nw_setservent
3a0827a6 1485 nw_setsockopt
4d76e4b4 1486 nw_inet_ntoa
2986a63f 1487 nw_shutdown
1488 nw_crypt
1489 nw_execvp
1490 nw_kill
1491 nw_Popen
1492 nw_Pclose
1493 nw_Pipe
1494 nw_times
1495 nw_waitpid
1496 nw_getpid
1497 nw_spawnvp
1498 nw_os_id
1499 nw_open_osfhandle
1500 nw_get_osfhandle
1501 nw_abort
1502 nw_sleep
1503 nw_wait
1504 nw_dynaload
1505 nw_strerror
1506 fnFpSetMode
1507 fnInsertHashListAddrs
1508 fnGetHashListAddrs
1509 Perl_deb
011f1a1a 1510 Perl_sv_setsv
1511 Perl_sv_catsv
1512 Perl_sv_catpvn
1513 Perl_sv_2pv
f355267c 1514 nw_freeenviron
1515 Remove_Thread_Ctx
2986a63f 1516 ))
1517 {
1518 try_symbol($symbol);
1519 }
1520}
22239a37 1521
d2b25974 1522# records of type boot_module for statically linked modules (except Dynaloader)
1523$static_ext =~ s/\//__/g;
1524$static_ext =~ s/\bDynaLoader\b//;
1525my @stat_mods = map {"boot_$_"} grep {/\S/} split /\s+/, $static_ext;
1526foreach my $symbol (@stat_mods)
1527 {
1528 try_symbol($symbol);
1529 }
1530
549a6b10 1531# Now all symbols should be defined because
1532# next we are going to output them.
1533
7766f137 1534foreach my $symbol (sort keys %export) {
1535 output_symbol($symbol);
1536}
549a6b10 1537
011f1a1a 1538if ($PLATFORM eq 'os2') {
59ad941d 1539 print <<EOP;
1540 dll_perlmain=main
1933e12c 1541 fill_extLibpath
1542 dir_subst
1543 Perl_OS2_handler_install
1544
59ad941d 1545; LAST_ORDINAL=$sym_ord
1546EOP
2986a63f 1547}
1548
549a6b10 1549sub emit_symbol {
7766f137 1550 my $symbol = shift;
9df9a5cd 1551 chomp($symbol);
7766f137 1552 $export{$symbol} = 1;
549a6b10 1553}
1554
1555sub output_symbol {
1556 my $symbol = shift;
18f68570 1557 if ($PLATFORM =~ /^win(?:32|ce)$/) {
549a6b10 1558 $symbol = "_$symbol" if $CCTYPE eq 'BORLAND';
520c758a 1559 print "\t$symbol\n";
549a6b10 1560# XXX: binary compatibility between compilers is an exercise
1561# in frustration :-(
1562# if ($CCTYPE eq "BORLAND") {
1563# # workaround Borland quirk by exporting both the straight
1564# # name and a name with leading underscore. Note the
1565# # alias *must* come after the symbol itself, if both
1566# # are to be exported. (Linker bug?)
1567# print "\t_$symbol\n";
1568# print "\t$symbol = _$symbol\n";
1569# }
1570# elsif ($CCTYPE eq 'GCC') {
1571# # Symbols have leading _ whole process is $%@"% slow
1572# # so skip aliases for now
1573# nprint "\t$symbol\n";
1574# }
1575# else {
1576# # for binary coexistence, export both the symbol and
1577# # alias with leading underscore
1578# print "\t$symbol\n";
1579# print "\t_$symbol = $symbol\n";
1580# }
7766f137 1581 }
1582 elsif ($PLATFORM eq 'os2') {
52e4c282 1583 printf qq( %-31s \@%s\n),
1584 qq("$symbol"), $ordinal{$symbol} || ++$sym_ord;
78232bc0 1585 printf qq( %-31s \@%s\n),
1586 qq("$exportperlmalloc{$symbol}" = "$symbol"),
1587 $ordinal{$exportperlmalloc{$symbol}} || ++$sym_ord
1588 if $exportperlmalloc and exists $exportperlmalloc{$symbol};
7766f137 1589 }
084592ab 1590 elsif ($PLATFORM eq 'aix' || $PLATFORM eq 'MacOS') {
549a6b10 1591 print "$symbol\n";
1592 }
2986a63f 1593 elsif ($PLATFORM eq 'netware') {
1594 print "\t$symbol,\n";
1595 }
549a6b10 1596}
1597
15981;
1599__DATA__
44798d05 1600# Oddities from PerlIO
568ad336 1601PerlIO_binmode
8437356b 1602PerlIO_getpos
568ad336 1603PerlIO_init
568ad336 1604PerlIO_setpos
568ad336 1605PerlIO_sprintf
8437356b 1606PerlIO_sv_dup
1607PerlIO_tmpfile
8437356b 1608PerlIO_vsprintf