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