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