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