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