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