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