Update Changes.
[p5sagit/p5-mst-13.2.git] / makedef.pl
CommitLineData
549a6b10 1#
2# Create the export list for perl.
3#
3cfae81b 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 10my $PLATFORM;
11my $CCTYPE;
910dfcc8 12
4cb71bb6 13my %bincompat5005 =
732aff91 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 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 37 Perl_set_numeric_standard => "perl_set_numeric_standard",
38 Perl_malloc => "malloc",
39 Perl_mfree => "free",
40 Perl_realloc => "realloc",
732aff91 41 Perl_calloc => "calloc",
42 );
4cb71bb6 43
44my $bincompat5005 = join("|", keys %bincompat5005);
45
7766f137 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 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 73}
74elsif ($PLATFORM eq 'win32') {
549a6b10 75 $CCTYPE = "MSVC" unless defined $CCTYPE;
00b02797 76 foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym,
77 $pp_sym, $globvar_sym, $perlio_sym) {
549a6b10 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 85 if (/^(?:ccflags|optimize)='(.+)'$/) {
86 $_ = $1;
87 $define{$1} = 1 while /-D(\w+)/g;
88 }
3cfae81b 89 if ($PLATFORM eq 'os2') {
90 $CONFIG_ARGS = $1 if /^(?:config_args)='(.+)'$/;
0e32cd81 91 $ARCHNAME = $1 if /^(?:archname)='(.+)'$/;
3cfae81b 92 }
549a6b10 93 }
94 close(CFG);
95}
96
97open(CFG,$config_h) || die "Cannot open $config_h: $!\n";
7766f137 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 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 104close(CFG);
105
18c4b137 106# perl.h logic duplication begins
107
108if ($define{USE_ITHREADS}) {
341bd822 109 if (!$define{MULTIPLICITY} && !$define{PERL_OBJECT}) {
18c4b137 110 $define{MULTIPLICITY} = 1;
111 }
112}
113
114$define{PERL_IMPLICIT_CONTEXT} ||=
115 $define{USE_ITHREADS} ||
66cf6f75 116 $define{USE_5005THREADS} ||
18c4b137 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 133if ($PLATFORM eq 'win32') {
134 warn join(' ',keys %define)."\n";
dfdd1393 135 print "LIBRARY Perl56\n";
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 142}
143elsif ($PLATFORM eq 'os2') {
3cfae81b 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 159STACKSIZE 32768
160CODE LOADONCALL
161DATA LOADONCALL NONSHARED MULTIPLE
162EXPORTS
163---EOP---
7766f137 164}
165elsif ($PLATFORM eq 'aix') {
549a6b10 166 print "#!\n";
ac4c12e7 167}
bbc8f9de 168
22239a37 169my %skip;
170my %export;
171
51371543 172sub skip_symbols {
173 my $list = shift;
174 foreach my $symbol (@$list) {
175 $skip{$symbol} = 1;
176 }
22239a37 177}
178
51371543 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 185 $skipsym =~ s/^Perl_[GIT](\w+)_ptr$/PL_$1/;
186 }
187 emit_symbol($symbol) unless exists $skip{$skipsym};
188 }
22239a37 189}
190
549a6b10 191if ($PLATFORM eq 'win32') {
7766f137 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 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 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 271 ctermid
272 get_sysinfo
273 Perl_OS2_init
274 OS2_Perl_data
275 dlopen
276 dlsym
277 dlerror
403d6f8e 278 dlclose
7766f137 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 311}
312
7766f137 313unless ($define{'DEBUGGING'}) {
314 skip_symbols [qw(
315 Perl_deb
316 Perl_deb_growlevel
317 Perl_debop
318 Perl_debprofdump
319 Perl_debstack
320 Perl_debstackptrs
321 Perl_runops_debug
322 Perl_sv_peek
323 PL_block_type
324 PL_watchaddr
325 PL_watchok
326 )];
327}
328
329if ($define{'PERL_IMPLICIT_SYS'}) {
330 skip_symbols [qw(
331 Perl_getenv_len
332 Perl_my_popen
333 Perl_my_pclose
334 )];
335}
336else {
337 skip_symbols [qw(
338 PL_Mem
339 PL_MemShared
340 PL_MemParse
341 PL_Env
342 PL_StdIO
343 PL_LIO
344 PL_Dir
345 PL_Sock
346 PL_Proc
347 )];
348}
349
7c128300 350unless ($define{'PERL_FLEXIBLE_EXCEPTIONS'}) {
351 skip_symbols [qw(
352 PL_protect
353 Perl_default_protect
354 Perl_vdefault_protect
355 )];
356}
357
7766f137 358if ($define{'MYMALLOC'}) {
359 emit_symbols [qw(
360 Perl_dump_mstats
827e134a 361 Perl_get_mstats
7766f137 362 Perl_malloc
363 Perl_mfree
364 Perl_realloc
365 Perl_calloc
366 )];
bbda9c9d 367 if ($define{'USE_5005THREADS'} || $define{'USE_ITHREADS'}) {
1feb2720 368 emit_symbols [qw(
369 PL_malloc_mutex
370 )];
371 }
80fc1a6e 372 else {
373 skip_symbols [qw(
374 PL_malloc_mutex
375 )];
376 }
51371543 377}
378else {
7766f137 379 skip_symbols [qw(
380 PL_malloc_mutex
381 Perl_dump_mstats
6ecd3fcb 382 Perl_get_mstats
7766f137 383 Perl_malloc
384 Perl_mfree
385 Perl_realloc
386 Perl_calloc
387 Perl_malloced_size
388 )];
389}
390
f433d095 391unless ($define{'USE_5005THREADS'} || $define{'USE_ITHREADS'}) {
7766f137 392 skip_symbols [qw(
393 PL_thr_key
f433d095 394 )];
395}
396
397unless ($define{'USE_5005THREADS'}) {
398 skip_symbols [qw(
7766f137 399 PL_sv_mutex
400 PL_strtab_mutex
401 PL_svref_mutex
7766f137 402 PL_cred_mutex
403 PL_eval_mutex
6940069f 404 PL_fdpid_mutex
405 PL_sv_lock_mutex
7766f137 406 PL_eval_cond
407 PL_eval_owner
408 PL_threads_mutex
409 PL_nthreads
410 PL_nthreads_cond
411 PL_threadnum
412 PL_threadsv_names
413 PL_thrsv
414 PL_vtbl_mutex
7766f137 415 Perl_condpair_magic
416 Perl_new_struct_thread
417 Perl_per_thread_magicals
418 Perl_thread_create
419 Perl_find_threadsv
420 Perl_unlock_condpair
421 Perl_magic_mutexfree
4755096e 422 Perl_sv_lock
7766f137 423 )];
424}
425
426unless ($define{'USE_ITHREADS'}) {
427 skip_symbols [qw(
428 PL_ptr_table
534825c4 429 PL_op_mutex
7766f137 430 Perl_dirp_dup
431 Perl_cx_dup
432 Perl_si_dup
433 Perl_any_dup
434 Perl_ss_dup
435 Perl_fp_dup
436 Perl_gp_dup
437 Perl_he_dup
438 Perl_mg_dup
439 Perl_re_dup
440 Perl_sv_dup
441 Perl_sys_intern_dup
442 Perl_ptr_table_fetch
443 Perl_ptr_table_new
444 Perl_ptr_table_split
445 Perl_ptr_table_store
446 perl_clone
447 perl_clone_using
448 )];
449}
450
451unless ($define{'PERL_IMPLICIT_CONTEXT'}) {
452 skip_symbols [qw(
453 Perl_croak_nocontext
454 Perl_die_nocontext
455 Perl_deb_nocontext
456 Perl_form_nocontext
e0f4245d 457 Perl_load_module_nocontext
7766f137 458 Perl_mess_nocontext
459 Perl_warn_nocontext
460 Perl_warner_nocontext
461 Perl_newSVpvf_nocontext
462 Perl_sv_catpvf_nocontext
463 Perl_sv_setpvf_nocontext
464 Perl_sv_catpvf_mg_nocontext
465 Perl_sv_setpvf_mg_nocontext
466 )];
467}
468
469unless ($define{'PERL_IMPLICIT_SYS'}) {
470 skip_symbols [qw(
471 perl_alloc_using
014822e4 472 perl_clone_using
7766f137 473 )];
474}
475
476unless ($define{'FAKE_THREADS'}) {
477 skip_symbols [qw(PL_curthr)];
478}
479
0e32cd81 480# All quad int platforms are assumed to have broken SOCKS
481unless ($define{USE_SOCKS} && $define{USE_64_BIT_ALL}) {
482 skip_symbols [qw(
9d44748a 483 Perl_do_s64_delete_buffer
0e32cd81 484 Perl_do_s64_fread
485 Perl_do_s64_getc
9d44748a 486 Perl_do_s64_init_buffer
0e32cd81 487 Perl_do_s64_seek
488 Perl_do_s64_tell
9d44748a 489 Perl_do_s64_ungetc
0e32cd81 490 )];
491}
492
7766f137 493sub readvar {
494 my $file = shift;
495 my $proc = shift || sub { "PL_$_[2]" };
496 open(VARS,$file) || die "Cannot open $file: $!\n";
497 my @syms;
498 while (<VARS>) {
499 # All symbols have a Perl_ prefix because that's what embed.h
500 # sticks in front of them.
501 push(@syms, &$proc($1,$2,$3)) if (/\bPERLVAR(A?I?C?)\(([IGT])(\w+)/);
502 }
503 close(VARS);
504 return \@syms;
505}
506
6f4183fe 507if ($define{'USE_5005THREADS'}) {
7766f137 508 my $thrd = readvar($thrdvar_h);
509 skip_symbols $thrd;
510}
511
7766f137 512if ($define{'PERL_GLOBAL_STRUCT'}) {
513 my $global = readvar($perlvars_h);
514 skip_symbols $global;
515 emit_symbol('Perl_GetVars');
516 emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC';
517}
36c15d3f 518
22c35a8c 519# functions from *.sym files
520
954c1994 521my @syms = ($global_sym, $globvar_sym); # $pp_sym is not part of the API
549a6b10 522
7766f137 523if ($define{'USE_PERLIO'}) {
549a6b10 524 push @syms, $perlio_sym;
7766f137 525}
526
527for my $syms (@syms) {
528 open (GLOBAL, "<$syms") || die "failed to open $syms: $!\n";
529 while (<GLOBAL>) {
530 next if (!/^[A-Za-z]/);
531 # Functions have a Perl_ prefix
532 # Variables have a PL_ prefix
533 chomp($_);
534 my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : "");
535 $symbol .= $_;
536 emit_symbol($symbol) unless exists $skip{$symbol};
537 }
538 close(GLOBAL);
539}
0a753a76 540
22c35a8c 541# variables
0a753a76 542
6f4183fe 543if ($define{'PERL_OBJECT'} || $define{'MULTIPLICITY'}) {
1acb48c9 544 for my $f ($perlvars_h, $intrpvar_h, $thrdvar_h) {
18c4b137 545 my $glob = readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" });
546 emit_symbols $glob;
18c4b137 547 }
1acb48c9 548 # XXX AIX seems to want the perlvars.h symbols, for some reason
549 if ($PLATFORM eq 'aix') {
550 my $glob = readvar($perlvars_h);
51371543 551 emit_symbols $glob;
552 }
553}
554else {
555 unless ($define{'PERL_GLOBAL_STRUCT'}) {
549a6b10 556 my $glob = readvar($perlvars_h);
51371543 557 emit_symbols $glob;
558 }
559 unless ($define{'MULTIPLICITY'}) {
549a6b10 560 my $glob = readvar($intrpvar_h);
51371543 561 emit_symbols $glob;
562 }
bbda9c9d 563 unless ($define{'MULTIPLICITY'} || $define{'USE_5005THREADS'}) {
549a6b10 564 my $glob = readvar($thrdvar_h);
51371543 565 emit_symbols $glob;
566 }
567}
0a753a76 568
549a6b10 569sub try_symbol {
570 my $symbol = shift;
22239a37 571
549a6b10 572 return if $symbol !~ /^[A-Za-z]/;
573 return if $symbol =~ /^\#/;
574 $symbol =~s/\r//g;
575 chomp($symbol);
43cd9f80 576 return if exists $skip{$symbol};
549a6b10 577 emit_symbol($symbol);
3e3baf6d 578}
0a753a76 579
549a6b10 580while (<DATA>) {
581 try_symbol($_);
ac4c12e7 582}
583
549a6b10 584if ($PLATFORM eq 'win32') {
585 foreach my $symbol (qw(
00b02797 586 setuid
587 setgid
7766f137 588 boot_DynaLoader
7766f137 589 Perl_init_os_extras
c44d3fdb 590 Perl_thread_create
7766f137 591 Perl_win32_init
592 RunPerl
7766f137 593 win32_errno
594 win32_environ
7766f137 595 win32_abort
596 win32_fstat
597 win32_stat
598 win32_pipe
599 win32_popen
600 win32_pclose
601 win32_rename
602 win32_setmode
603 win32_lseek
604 win32_tell
605 win32_dup
606 win32_dup2
607 win32_open
608 win32_close
609 win32_eof
610 win32_read
611 win32_write
612 win32_spawnvp
613 win32_mkdir
614 win32_rmdir
615 win32_chdir
616 win32_flock
617 win32_execv
618 win32_execvp
619 win32_htons
620 win32_ntohs
621 win32_htonl
622 win32_ntohl
623 win32_inet_addr
624 win32_inet_ntoa
625 win32_socket
626 win32_bind
627 win32_listen
628 win32_accept
629 win32_connect
630 win32_send
631 win32_sendto
632 win32_recv
633 win32_recvfrom
634 win32_shutdown
635 win32_closesocket
636 win32_ioctlsocket
637 win32_setsockopt
638 win32_getsockopt
639 win32_getpeername
640 win32_getsockname
641 win32_gethostname
642 win32_gethostbyname
643 win32_gethostbyaddr
644 win32_getprotobyname
645 win32_getprotobynumber
646 win32_getservbyname
647 win32_getservbyport
648 win32_select
649 win32_endhostent
650 win32_endnetent
651 win32_endprotoent
652 win32_endservent
653 win32_getnetent
654 win32_getnetbyname
655 win32_getnetbyaddr
656 win32_getprotoent
657 win32_getservent
658 win32_sethostent
659 win32_setnetent
660 win32_setprotoent
661 win32_setservent
662 win32_getenv
663 win32_putenv
664 win32_perror
7766f137 665 win32_malloc
666 win32_calloc
667 win32_realloc
668 win32_free
669 win32_sleep
670 win32_times
671 win32_access
672 win32_alarm
673 win32_chmod
674 win32_open_osfhandle
675 win32_get_osfhandle
676 win32_ioctl
677 win32_link
678 win32_unlink
679 win32_utime
680 win32_uname
681 win32_wait
682 win32_waitpid
683 win32_kill
684 win32_str_os_error
685 win32_opendir
686 win32_readdir
687 win32_telldir
688 win32_seekdir
689 win32_rewinddir
690 win32_closedir
691 win32_longpath
692 win32_os_id
693 win32_getpid
694 win32_crypt
695 win32_dynaload
00b02797 696
697 win32_stdin
698 win32_stdout
699 win32_stderr
700 win32_ferror
701 win32_feof
702 win32_strerror
703 win32_fprintf
704 win32_printf
705 win32_vfprintf
706 win32_vprintf
707 win32_fread
708 win32_fwrite
709 win32_fopen
710 win32_fdopen
711 win32_freopen
712 win32_fclose
713 win32_fputs
714 win32_fputc
715 win32_ungetc
716 win32_getc
717 win32_fileno
718 win32_clearerr
719 win32_fflush
720 win32_ftell
721 win32_fseek
722 win32_fgetpos
723 win32_fsetpos
724 win32_rewind
725 win32_tmpfile
726 win32_setbuf
727 win32_setvbuf
728 win32_flushall
729 win32_fcloseall
730 win32_fgets
731 win32_gets
732 win32_fgetc
733 win32_putc
734 win32_puts
735 win32_getchar
736 win32_putchar
7766f137 737 ))
738 {
549a6b10 739 try_symbol($symbol);
740 }
741}
3cfae81b 742elsif ($PLATFORM eq 'os2') {
7766f137 743 open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
744 /^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>;
745 close MAP or die 'Cannot close miniperl.map';
746
747 @missing = grep { !exists $mapped{$_} and !exists $bincompat5005{$_} }
748 keys %export;
749 delete $export{$_} foreach @missing;
3cfae81b 750}
22239a37 751
549a6b10 752# Now all symbols should be defined because
753# next we are going to output them.
754
7766f137 755foreach my $symbol (sort keys %export) {
756 output_symbol($symbol);
757}
549a6b10 758
759sub emit_symbol {
7766f137 760 my $symbol = shift;
761 chomp($symbol);
762 $export{$symbol} = 1;
549a6b10 763}
764
765sub output_symbol {
766 my $symbol = shift;
4cb71bb6 767 $symbol = $bincompat5005{$symbol}
768 if $define{PERL_BINCOMPAT_5005} and $symbol =~ /^($bincompat5005)$/;
549a6b10 769 if ($PLATFORM eq 'win32') {
549a6b10 770 $symbol = "_$symbol" if $CCTYPE eq 'BORLAND';
520c758a 771 print "\t$symbol\n";
549a6b10 772# XXX: binary compatibility between compilers is an exercise
773# in frustration :-(
774# if ($CCTYPE eq "BORLAND") {
775# # workaround Borland quirk by exporting both the straight
776# # name and a name with leading underscore. Note the
777# # alias *must* come after the symbol itself, if both
778# # are to be exported. (Linker bug?)
779# print "\t_$symbol\n";
780# print "\t$symbol = _$symbol\n";
781# }
782# elsif ($CCTYPE eq 'GCC') {
783# # Symbols have leading _ whole process is $%@"% slow
784# # so skip aliases for now
785# nprint "\t$symbol\n";
786# }
787# else {
788# # for binary coexistence, export both the symbol and
789# # alias with leading underscore
790# print "\t$symbol\n";
791# print "\t_$symbol = $symbol\n";
792# }
7766f137 793 }
794 elsif ($PLATFORM eq 'os2') {
3cfae81b 795 print qq( "$symbol"\n);
7766f137 796 }
797 elsif ($PLATFORM eq 'aix') {
549a6b10 798 print "$symbol\n";
799 }
800}
801
8021;
803__DATA__
804# extra globals not included above.
805perl_alloc
7766f137 806perl_alloc_using
014822e4 807perl_clone
808perl_clone_using
549a6b10 809perl_construct
810perl_destruct
811perl_free
812perl_parse
813perl_run