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