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