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