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