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