This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to Getopt::Long 2.24_01, from Johan Vromans.
[perl5.git] / makedef.pl
CommitLineData
549a6b10
JH
1#
2# Create the export list for perl.
3#
3cfae81b
IZ
4# Needed by WIN32 and OS/2 for creating perl.dll
5# and by AIX for creating libperl.a when -Dusershrplib is in effect.
549a6b10 6#
22c35a8c 7# reads global.sym, pp.sym, perlvars.h, intrpvar.h, thrdvar.h, config.h
3cfae81b 8# On OS/2 reads miniperl.map as well
0a753a76 9
549a6b10
JH
10my $PLATFORM;
11my $CCTYPE;
910dfcc8 12
4cb71bb6 13my %bincompat5005 =
732aff91
GS
14 (
15 Perl_call_atexit => "perl_atexit",
16 Perl_eval_sv => "perl_eval_sv",
17 Perl_eval_pv => "perl_eval_pv",
18 Perl_call_argv => "perl_call_argv",
4cb71bb6
GS
19 Perl_call_method => "perl_call_method",
20 Perl_call_pv => "perl_call_pv",
21 Perl_call_sv => "perl_call_sv",
22 Perl_get_av => "perl_get_av",
23 Perl_get_cv => "perl_get_cv",
24 Perl_get_hv => "perl_get_hv",
25 Perl_get_sv => "perl_get_sv",
26 Perl_init_i18nl10n => "perl_init_i18nl10n",
27 Perl_init_i18nl14n => "perl_init_i18nl14n",
28 Perl_new_collate => "perl_new_collate",
29 Perl_new_ctype => "perl_new_ctype",
30 Perl_new_numeric => "perl_new_numeric",
31 Perl_require_pv => "perl_require_pv",
32 Perl_safesyscalloc => "Perl_safecalloc",
33 Perl_safesysfree => "Perl_safefree",
34 Perl_safesysmalloc => "Perl_safemalloc",
35 Perl_safesysrealloc => "Perl_saferealloc",
36 Perl_set_numeric_local => "perl_set_numeric_local",
62457c2b
IZ
37 Perl_set_numeric_standard => "perl_set_numeric_standard",
38 Perl_malloc => "malloc",
39 Perl_mfree => "free",
40 Perl_realloc => "realloc",
732aff91
GS
41 Perl_calloc => "calloc",
42 );
4cb71bb6
GS
43
44my $bincompat5005 = join("|", keys %bincompat5005);
45
7766f137
GS
46while (@ARGV) {
47 my $flag = shift;
48 $define{$1} = 1 if ($flag =~ /^-D(\w+)$/);
49 $define{$1} = $2 if ($flag =~ /^-D(\w+)=(.+)$/);
50 $CCTYPE = $1 if ($flag =~ /^CCTYPE=(\w+)$/);
51 $PLATFORM = $1 if ($flag =~ /^PLATFORM=(\w+)$/);
52}
d55594ae 53
3cfae81b 54my @PLATFORM = qw(aix win32 os2);
549a6b10
JH
55my %PLATFORM;
56@PLATFORM{@PLATFORM} = ();
57
58defined $PLATFORM || die "PLATFORM undefined, must be one of: @PLATFORM\n";
59exists $PLATFORM{$PLATFORM} || die "PLATFORM must be one of: @PLATFORM\n";
60
61my $config_sh = "config.sh";
62my $config_h = "config.h";
63my $thrdvar_h = "thrdvar.h";
64my $intrpvar_h = "intrpvar.h";
65my $perlvars_h = "perlvars.h";
66my $global_sym = "global.sym";
67my $pp_sym = "pp.sym";
68my $globvar_sym = "globvar.sym";
69my $perlio_sym = "perlio.sym";
70
71if ($PLATFORM eq 'aix') {
72 # Nothing for now.
7766f137
GS
73}
74elsif ($PLATFORM eq 'win32') {
549a6b10 75 $CCTYPE = "MSVC" unless defined $CCTYPE;
00b02797
JH
76 foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym,
77 $pp_sym, $globvar_sym, $perlio_sym) {
549a6b10
JH
78 s!^!..\\!;
79 }
80}
81
82unless ($PLATFORM eq 'win32') {
83 open(CFG,$config_sh) || die "Cannot open $config_sh: $!\n";
7766f137 84 while (<CFG>) {
549a6b10
JH
85 if (/^(?:ccflags|optimize)='(.+)'$/) {
86 $_ = $1;
87 $define{$1} = 1 while /-D(\w+)/g;
88 }
3cfae81b
IZ
89 if ($PLATFORM eq 'os2') {
90 $CONFIG_ARGS = $1 if /^(?:config_args)='(.+)'$/;
0e32cd81 91 $ARCHNAME = $1 if /^(?:archname)='(.+)'$/;
3cfae81b 92 }
549a6b10
JH
93 }
94 close(CFG);
95}
96
97open(CFG,$config_h) || die "Cannot open $config_h: $!\n";
7766f137
GS
98while (<CFG>) {
99 $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/;
7766f137 100 $define{$1} = 1 if /^\s*#\s*define\s+(MULTIPLICITY)\b/;
0e32cd81
JH
101 $define{$1} = 1 if /^\s*#\s*define\s+(PERL_\w+)\b/;
102 $define{$1} = 1 if /^\s*#\s*define\s+(USE_\w+)\b/;
7766f137 103}
bbc8f9de
NIS
104close(CFG);
105
18c4b137
JH
106# perl.h logic duplication begins
107
108if ($define{USE_ITHREADS}) {
341bd822 109 if (!$define{MULTIPLICITY} && !$define{PERL_OBJECT}) {
18c4b137
JH
110 $define{MULTIPLICITY} = 1;
111 }
112}
113
114$define{PERL_IMPLICIT_CONTEXT} ||=
115 $define{USE_ITHREADS} ||
66cf6f75 116 $define{USE_5005THREADS} ||
18c4b137
JH
117 $define{MULTIPLICITY} ;
118
119if ($define{PERL_CAPI}) {
120 delete $define{PERL_OBJECT};
121 $define{MULTIPLICITY} = 1;
122 $define{PERL_IMPLICIT_CONTEXT} = 1;
123 $define{PERL_IMPLICIT_SYS} = 1;
124}
125
126if ($define{PERL_OBJECT}) {
127 $define{PERL_IMPLICIT_CONTEXT} = 1;
128 $define{PERL_IMPLICIT_SYS} = 1;
129}
130
131# perl.h logic duplication ends
132
549a6b10
JH
133if ($PLATFORM eq 'win32') {
134 warn join(' ',keys %define)."\n";
7d4dff66 135 print "LIBRARY Perl57\n";
dfdd1393
GS
136 print "DESCRIPTION 'Perl interpreter'\n";
137 print "EXPORTS\n";
138 if ($define{PERL_IMPLICIT_SYS}) {
549a6b10 139 output_symbol("perl_get_host_info");
7766f137 140 output_symbol("perl_alloc_override");
51371543 141 }
7766f137
GS
142}
143elsif ($PLATFORM eq 'os2') {
3cfae81b
IZ
144 ($v = $]) =~ s/(\d\.\d\d\d)(\d\d)$/$1_$2/;
145 $v .= '-thread' if $ARCHNAME =~ /-thread/;
3cfae81b 146 ($dll = $define{PERL_DLL}) =~ s/\.dll$//i;
3cfae81b
IZ
147 print <<"---EOP---";
148LIBRARY '$dll' INITINSTANCE TERMINSTANCE
23da6c43 149DESCRIPTION '\@#perl5-porters\@perl.org:$v#\@ Perl interpreter'
3cfae81b
IZ
150STACKSIZE 32768
151CODE LOADONCALL
152DATA LOADONCALL NONSHARED MULTIPLE
153EXPORTS
154---EOP---
7766f137
GS
155}
156elsif ($PLATFORM eq 'aix') {
549a6b10 157 print "#!\n";
ac4c12e7 158}
bbc8f9de 159
22239a37
NIS
160my %skip;
161my %export;
162
51371543
GS
163sub skip_symbols {
164 my $list = shift;
165 foreach my $symbol (@$list) {
166 $skip{$symbol} = 1;
167 }
22239a37
NIS
168}
169
51371543
GS
170sub emit_symbols {
171 my $list = shift;
172 foreach my $symbol (@$list) {
173 my $skipsym = $symbol;
174 # XXX hack
6f4183fe 175 if ($define{PERL_OBJECT} || $define{MULTIPLICITY}) {
51371543
GS
176 $skipsym =~ s/^Perl_[GIT](\w+)_ptr$/PL_$1/;
177 }
178 emit_symbol($symbol) unless exists $skip{$skipsym};
179 }
22239a37
NIS
180}
181
549a6b10 182if ($PLATFORM eq 'win32') {
7766f137
GS
183 skip_symbols [qw(
184 PL_statusvalue_vms
185 PL_archpat_auto
186 PL_cryptseen
187 PL_DBcv
188 PL_generation
189 PL_lastgotoprobe
190 PL_linestart
191 PL_modcount
192 PL_pending_ident
193 PL_sortcxix
194 PL_sublex_info
195 PL_timesbuf
196 main
197 Perl_ErrorNo
198 Perl_GetVars
199 Perl_do_exec3
200 Perl_do_ipcctl
201 Perl_do_ipcget
202 Perl_do_msgrcv
203 Perl_do_msgsnd
204 Perl_do_semop
205 Perl_do_shmio
206 Perl_dump_fds
207 Perl_init_thread_intern
208 Perl_my_bzero
209 Perl_my_htonl
210 Perl_my_ntohl
211 Perl_my_swap
212 Perl_my_chsize
213 Perl_same_dirent
214 Perl_setenv_getix
215 Perl_unlnk
216 Perl_watch
217 Perl_safexcalloc
218 Perl_safexmalloc
219 Perl_safexfree
220 Perl_safexrealloc
221 Perl_my_memcmp
222 Perl_my_memset
223 PL_cshlen
224 PL_cshname
225 PL_opsave
226 Perl_do_exec
227 Perl_getenv_len
228 Perl_my_pclose
229 Perl_my_popen
230 )];
231}
232elsif ($PLATFORM eq 'aix') {
549a6b10 233 skip_symbols([qw(
7766f137
GS
234 Perl_dump_fds
235 Perl_ErrorNo
236 Perl_GetVars
237 Perl_my_bcopy
238 Perl_my_bzero
239 Perl_my_chsize
240 Perl_my_htonl
241 Perl_my_memcmp
242 Perl_my_memset
243 Perl_my_ntohl
244 Perl_my_swap
245 Perl_safexcalloc
246 Perl_safexfree
247 Perl_safexmalloc
248 Perl_safexrealloc
249 Perl_same_dirent
250 Perl_unlnk
6c644e78 251 Perl_sys_intern_clear
95151ede 252 Perl_sys_intern_dup
52853b95 253 Perl_sys_intern_init
7766f137
GS
254 PL_cryptseen
255 PL_opsave
256 PL_statusvalue_vms
257 PL_sys_intern
258 )]);
259}
260elsif ($PLATFORM eq 'os2') {
3cfae81b 261 emit_symbols([qw(
7766f137
GS
262 ctermid
263 get_sysinfo
264 Perl_OS2_init
265 OS2_Perl_data
266 dlopen
267 dlsym
268 dlerror
403d6f8e 269 dlclose
7766f137
GS
270 my_tmpfile
271 my_tmpnam
272 my_flock
273 malloc_mutex
274 threads_mutex
275 nthreads
276 nthreads_cond
277 os2_cond_wait
278 os2_stat
279 pthread_join
280 pthread_create
281 pthread_detach
282 XS_Cwd_change_drive
283 XS_Cwd_current_drive
284 XS_Cwd_extLibpath
285 XS_Cwd_extLibpath_set
286 XS_Cwd_sys_abspath
287 XS_Cwd_sys_chdir
288 XS_Cwd_sys_cwd
289 XS_Cwd_sys_is_absolute
290 XS_Cwd_sys_is_relative
291 XS_Cwd_sys_is_rooted
292 XS_DynaLoader_mod2fname
293 XS_File__Copy_syscopy
294 Perl_Register_MQ
295 Perl_Deregister_MQ
296 Perl_Serve_Messages
297 Perl_Process_Messages
298 init_PMWIN_entries
299 PMWIN_entries
300 Perl_hab_GET
301 )]);
3cfae81b
IZ
302}
303
7766f137
GS
304unless ($define{'DEBUGGING'}) {
305 skip_symbols [qw(
7766f137
GS
306 Perl_deb_growlevel
307 Perl_debop
308 Perl_debprofdump
309 Perl_debstack
310 Perl_debstackptrs
311 Perl_runops_debug
312 Perl_sv_peek
313 PL_block_type
314 PL_watchaddr
315 PL_watchok
316 )];
317}
318
319if ($define{'PERL_IMPLICIT_SYS'}) {
320 skip_symbols [qw(
321 Perl_getenv_len
322 Perl_my_popen
323 Perl_my_pclose
324 )];
325}
326else {
327 skip_symbols [qw(
328 PL_Mem
329 PL_MemShared
330 PL_MemParse
331 PL_Env
332 PL_StdIO
333 PL_LIO
334 PL_Dir
335 PL_Sock
336 PL_Proc
337 )];
338}
339
7c128300
GS
340unless ($define{'PERL_FLEXIBLE_EXCEPTIONS'}) {
341 skip_symbols [qw(
342 PL_protect
343 Perl_default_protect
344 Perl_vdefault_protect
345 )];
346}
347
7766f137
GS
348if ($define{'MYMALLOC'}) {
349 emit_symbols [qw(
350 Perl_dump_mstats
827e134a 351 Perl_get_mstats
7766f137
GS
352 Perl_malloc
353 Perl_mfree
354 Perl_realloc
355 Perl_calloc
356 )];
bbda9c9d 357 if ($define{'USE_5005THREADS'} || $define{'USE_ITHREADS'}) {
1feb2720
GS
358 emit_symbols [qw(
359 PL_malloc_mutex
360 )];
361 }
80fc1a6e
GS
362 else {
363 skip_symbols [qw(
364 PL_malloc_mutex
365 )];
366 }
51371543
GS
367}
368else {
7766f137
GS
369 skip_symbols [qw(
370 PL_malloc_mutex
371 Perl_dump_mstats
6ecd3fcb 372 Perl_get_mstats
7766f137
GS
373 Perl_malloc
374 Perl_mfree
375 Perl_realloc
376 Perl_calloc
377 Perl_malloced_size
378 )];
379}
380
f433d095 381unless ($define{'USE_5005THREADS'} || $define{'USE_ITHREADS'}) {
7766f137
GS
382 skip_symbols [qw(
383 PL_thr_key
f433d095
GS
384 )];
385}
386
387unless ($define{'USE_5005THREADS'}) {
388 skip_symbols [qw(
7766f137
GS
389 PL_sv_mutex
390 PL_strtab_mutex
391 PL_svref_mutex
7766f137
GS
392 PL_cred_mutex
393 PL_eval_mutex
6940069f
GS
394 PL_fdpid_mutex
395 PL_sv_lock_mutex
7766f137
GS
396 PL_eval_cond
397 PL_eval_owner
398 PL_threads_mutex
399 PL_nthreads
400 PL_nthreads_cond
401 PL_threadnum
402 PL_threadsv_names
403 PL_thrsv
404 PL_vtbl_mutex
7766f137
GS
405 Perl_condpair_magic
406 Perl_new_struct_thread
407 Perl_per_thread_magicals
408 Perl_thread_create
409 Perl_find_threadsv
410 Perl_unlock_condpair
411 Perl_magic_mutexfree
4755096e 412 Perl_sv_lock
7766f137
GS
413 )];
414}
415
416unless ($define{'USE_ITHREADS'}) {
417 skip_symbols [qw(
418 PL_ptr_table
534825c4 419 PL_op_mutex
7766f137
GS
420 Perl_dirp_dup
421 Perl_cx_dup
422 Perl_si_dup
423 Perl_any_dup
424 Perl_ss_dup
425 Perl_fp_dup
426 Perl_gp_dup
427 Perl_he_dup
428 Perl_mg_dup
429 Perl_re_dup
430 Perl_sv_dup
431 Perl_sys_intern_dup
432 Perl_ptr_table_fetch
433 Perl_ptr_table_new
434 Perl_ptr_table_split
435 Perl_ptr_table_store
436 perl_clone
437 perl_clone_using
438 )];
439}
440
441unless ($define{'PERL_IMPLICIT_CONTEXT'}) {
442 skip_symbols [qw(
443 Perl_croak_nocontext
444 Perl_die_nocontext
445 Perl_deb_nocontext
446 Perl_form_nocontext
e0f4245d 447 Perl_load_module_nocontext
7766f137
GS
448 Perl_mess_nocontext
449 Perl_warn_nocontext
450 Perl_warner_nocontext
451 Perl_newSVpvf_nocontext
452 Perl_sv_catpvf_nocontext
453 Perl_sv_setpvf_nocontext
454 Perl_sv_catpvf_mg_nocontext
455 Perl_sv_setpvf_mg_nocontext
456 )];
457}
458
459unless ($define{'PERL_IMPLICIT_SYS'}) {
460 skip_symbols [qw(
461 perl_alloc_using
014822e4 462 perl_clone_using
7766f137
GS
463 )];
464}
465
466unless ($define{'FAKE_THREADS'}) {
467 skip_symbols [qw(PL_curthr)];
468}
469
470sub readvar {
471 my $file = shift;
472 my $proc = shift || sub { "PL_$_[2]" };
473 open(VARS,$file) || die "Cannot open $file: $!\n";
474 my @syms;
475 while (<VARS>) {
476 # All symbols have a Perl_ prefix because that's what embed.h
477 # sticks in front of them.
478 push(@syms, &$proc($1,$2,$3)) if (/\bPERLVAR(A?I?C?)\(([IGT])(\w+)/);
479 }
480 close(VARS);
481 return \@syms;
482}
483
6f4183fe 484if ($define{'USE_5005THREADS'}) {
7766f137
GS
485 my $thrd = readvar($thrdvar_h);
486 skip_symbols $thrd;
487}
488
7766f137
GS
489if ($define{'PERL_GLOBAL_STRUCT'}) {
490 my $global = readvar($perlvars_h);
491 skip_symbols $global;
492 emit_symbol('Perl_GetVars');
493 emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC';
494}
36c15d3f 495
22c35a8c
GS
496# functions from *.sym files
497
954c1994 498my @syms = ($global_sym, $globvar_sym); # $pp_sym is not part of the API
549a6b10 499
7766f137 500if ($define{'USE_PERLIO'}) {
549a6b10 501 push @syms, $perlio_sym;
7766f137
GS
502}
503
504for my $syms (@syms) {
505 open (GLOBAL, "<$syms") || die "failed to open $syms: $!\n";
506 while (<GLOBAL>) {
507 next if (!/^[A-Za-z]/);
508 # Functions have a Perl_ prefix
509 # Variables have a PL_ prefix
510 chomp($_);
511 my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : "");
512 $symbol .= $_;
513 emit_symbol($symbol) unless exists $skip{$symbol};
514 }
515 close(GLOBAL);
516}
0a753a76 517
22c35a8c 518# variables
0a753a76 519
6f4183fe 520if ($define{'PERL_OBJECT'} || $define{'MULTIPLICITY'}) {
1acb48c9 521 for my $f ($perlvars_h, $intrpvar_h, $thrdvar_h) {
18c4b137
JH
522 my $glob = readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" });
523 emit_symbols $glob;
18c4b137 524 }
1acb48c9
GS
525 # XXX AIX seems to want the perlvars.h symbols, for some reason
526 if ($PLATFORM eq 'aix') {
527 my $glob = readvar($perlvars_h);
51371543
GS
528 emit_symbols $glob;
529 }
530}
531else {
532 unless ($define{'PERL_GLOBAL_STRUCT'}) {
549a6b10 533 my $glob = readvar($perlvars_h);
51371543
GS
534 emit_symbols $glob;
535 }
536 unless ($define{'MULTIPLICITY'}) {
549a6b10 537 my $glob = readvar($intrpvar_h);
51371543
GS
538 emit_symbols $glob;
539 }
bbda9c9d 540 unless ($define{'MULTIPLICITY'} || $define{'USE_5005THREADS'}) {
549a6b10 541 my $glob = readvar($thrdvar_h);
51371543
GS
542 emit_symbols $glob;
543 }
544}
0a753a76 545
549a6b10
JH
546sub try_symbol {
547 my $symbol = shift;
22239a37 548
549a6b10
JH
549 return if $symbol !~ /^[A-Za-z]/;
550 return if $symbol =~ /^\#/;
551 $symbol =~s/\r//g;
552 chomp($symbol);
43cd9f80 553 return if exists $skip{$symbol};
549a6b10 554 emit_symbol($symbol);
3e3baf6d 555}
0a753a76 556
549a6b10
JH
557while (<DATA>) {
558 try_symbol($_);
ac4c12e7
GS
559}
560
549a6b10
JH
561if ($PLATFORM eq 'win32') {
562 foreach my $symbol (qw(
00b02797
JH
563 setuid
564 setgid
7766f137 565 boot_DynaLoader
7766f137 566 Perl_init_os_extras
c44d3fdb 567 Perl_thread_create
7766f137
GS
568 Perl_win32_init
569 RunPerl
7766f137
GS
570 win32_errno
571 win32_environ
7766f137
GS
572 win32_abort
573 win32_fstat
574 win32_stat
575 win32_pipe
576 win32_popen
577 win32_pclose
578 win32_rename
579 win32_setmode
580 win32_lseek
581 win32_tell
582 win32_dup
583 win32_dup2
584 win32_open
585 win32_close
586 win32_eof
587 win32_read
588 win32_write
589 win32_spawnvp
590 win32_mkdir
591 win32_rmdir
592 win32_chdir
593 win32_flock
594 win32_execv
595 win32_execvp
596 win32_htons
597 win32_ntohs
598 win32_htonl
599 win32_ntohl
600 win32_inet_addr
601 win32_inet_ntoa
602 win32_socket
603 win32_bind
604 win32_listen
605 win32_accept
606 win32_connect
607 win32_send
608 win32_sendto
609 win32_recv
610 win32_recvfrom
611 win32_shutdown
612 win32_closesocket
613 win32_ioctlsocket
614 win32_setsockopt
615 win32_getsockopt
616 win32_getpeername
617 win32_getsockname
618 win32_gethostname
619 win32_gethostbyname
620 win32_gethostbyaddr
621 win32_getprotobyname
622 win32_getprotobynumber
623 win32_getservbyname
624 win32_getservbyport
625 win32_select
626 win32_endhostent
627 win32_endnetent
628 win32_endprotoent
629 win32_endservent
630 win32_getnetent
631 win32_getnetbyname
632 win32_getnetbyaddr
633 win32_getprotoent
634 win32_getservent
635 win32_sethostent
636 win32_setnetent
637 win32_setprotoent
638 win32_setservent
639 win32_getenv
640 win32_putenv
641 win32_perror
7766f137
GS
642 win32_malloc
643 win32_calloc
644 win32_realloc
645 win32_free
646 win32_sleep
647 win32_times
648 win32_access
649 win32_alarm
650 win32_chmod
651 win32_open_osfhandle
652 win32_get_osfhandle
653 win32_ioctl
654 win32_link
655 win32_unlink
656 win32_utime
657 win32_uname
658 win32_wait
659 win32_waitpid
660 win32_kill
661 win32_str_os_error
662 win32_opendir
663 win32_readdir
664 win32_telldir
665 win32_seekdir
666 win32_rewinddir
667 win32_closedir
668 win32_longpath
669 win32_os_id
670 win32_getpid
671 win32_crypt
672 win32_dynaload
00b02797
JH
673
674 win32_stdin
675 win32_stdout
676 win32_stderr
677 win32_ferror
678 win32_feof
679 win32_strerror
680 win32_fprintf
681 win32_printf
682 win32_vfprintf
683 win32_vprintf
684 win32_fread
685 win32_fwrite
686 win32_fopen
687 win32_fdopen
688 win32_freopen
689 win32_fclose
690 win32_fputs
691 win32_fputc
692 win32_ungetc
693 win32_getc
694 win32_fileno
695 win32_clearerr
696 win32_fflush
697 win32_ftell
698 win32_fseek
699 win32_fgetpos
700 win32_fsetpos
701 win32_rewind
702 win32_tmpfile
703 win32_setbuf
704 win32_setvbuf
705 win32_flushall
706 win32_fcloseall
707 win32_fgets
708 win32_gets
709 win32_fgetc
710 win32_putc
711 win32_puts
712 win32_getchar
713 win32_putchar
7766f137
GS
714 ))
715 {
549a6b10
JH
716 try_symbol($symbol);
717 }
718}
3cfae81b 719elsif ($PLATFORM eq 'os2') {
7766f137
GS
720 open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
721 /^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>;
722 close MAP or die 'Cannot close miniperl.map';
723
724 @missing = grep { !exists $mapped{$_} and !exists $bincompat5005{$_} }
725 keys %export;
726 delete $export{$_} foreach @missing;
3cfae81b 727}
22239a37 728
549a6b10
JH
729# Now all symbols should be defined because
730# next we are going to output them.
731
7766f137
GS
732foreach my $symbol (sort keys %export) {
733 output_symbol($symbol);
734}
549a6b10
JH
735
736sub emit_symbol {
7766f137
GS
737 my $symbol = shift;
738 chomp($symbol);
739 $export{$symbol} = 1;
549a6b10
JH
740}
741
742sub output_symbol {
743 my $symbol = shift;
4cb71bb6
GS
744 $symbol = $bincompat5005{$symbol}
745 if $define{PERL_BINCOMPAT_5005} and $symbol =~ /^($bincompat5005)$/;
549a6b10 746 if ($PLATFORM eq 'win32') {
549a6b10 747 $symbol = "_$symbol" if $CCTYPE eq 'BORLAND';
520c758a 748 print "\t$symbol\n";
549a6b10
JH
749# XXX: binary compatibility between compilers is an exercise
750# in frustration :-(
751# if ($CCTYPE eq "BORLAND") {
752# # workaround Borland quirk by exporting both the straight
753# # name and a name with leading underscore. Note the
754# # alias *must* come after the symbol itself, if both
755# # are to be exported. (Linker bug?)
756# print "\t_$symbol\n";
757# print "\t$symbol = _$symbol\n";
758# }
759# elsif ($CCTYPE eq 'GCC') {
760# # Symbols have leading _ whole process is $%@"% slow
761# # so skip aliases for now
762# nprint "\t$symbol\n";
763# }
764# else {
765# # for binary coexistence, export both the symbol and
766# # alias with leading underscore
767# print "\t$symbol\n";
768# print "\t_$symbol = $symbol\n";
769# }
7766f137
GS
770 }
771 elsif ($PLATFORM eq 'os2') {
3cfae81b 772 print qq( "$symbol"\n);
7766f137
GS
773 }
774 elsif ($PLATFORM eq 'aix') {
549a6b10
JH
775 print "$symbol\n";
776 }
777}
778
7791;
780__DATA__
781# extra globals not included above.
782perl_alloc
7766f137 783perl_alloc_using
014822e4
GS
784perl_clone
785perl_clone_using
549a6b10
JH
786perl_construct
787perl_destruct
788perl_free
789perl_parse
790perl_run
18b7339f
NIS
791PerlIO_define_layer
792PerlIOBuf_set_ptrcnt
793PerlIOBuf_get_cnt
794PerlIOBuf_get_ptr
795PerlIOBuf_bufsiz
796PerlIOBuf_setlinebuf
797PerlIOBase_clearerr
798PerlIOBase_error
799PerlIOBase_eof
800PerlIOBuf_tell
801PerlIOBuf_seek
802PerlIOBuf_write
803PerlIOBuf_unread
804PerlIOBuf_read
805PerlIOBuf_reopen
806PerlIOBuf_open
807PerlIOBuf_fdopen
808PerlIOBase_fileno
809PerlIOBuf_pushed
810PerlIOBuf_fill
811PerlIOBuf_flush
812PerlIOBase_close
813PerlIO_define_layer
814PerlIO_pending
815PerlIO_unread
568ad336
NIS
816PerlIO_push
817PerlIO_apply_layers
818perlsio_binmode
819PerlIO_binmode
820PerlIO_init
821PerlIO_tmpfile
822PerlIO_setpos
823PerlIO_getpos
824PerlIO_vsprintf
825PerlIO_sprintf