Re: [ID 20020305.018] test failures with perl5.7.3 on FreeBSD 4.3
[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+)$/);
2986a63f 53 if ($PLATFORM eq 'netware') {
54 $FILETYPE = $1 if ($flag =~ /^FILETYPE=(\w+)$/);
55 }
7766f137 56}
d55594ae 57
2986a63f 58my @PLATFORM = qw(aix win32 os2 MacOS netware);
549a6b10 59my %PLATFORM;
60@PLATFORM{@PLATFORM} = ();
61
62defined $PLATFORM || die "PLATFORM undefined, must be one of: @PLATFORM\n";
9df9a5cd 63exists $PLATFORM{$PLATFORM} || die "PLATFORM must be one of: @PLATFORM\n";
549a6b10 64
65my $config_sh = "config.sh";
66my $config_h = "config.h";
67my $thrdvar_h = "thrdvar.h";
68my $intrpvar_h = "intrpvar.h";
69my $perlvars_h = "perlvars.h";
70my $global_sym = "global.sym";
71my $pp_sym = "pp.sym";
72my $globvar_sym = "globvar.sym";
73my $perlio_sym = "perlio.sym";
74
9df9a5cd 75if ($PLATFORM eq 'aix') {
549a6b10 76 # Nothing for now.
7766f137 77}
2986a63f 78elsif ($PLATFORM eq 'win32' || $PLATFORM eq 'netware') {
549a6b10 79 $CCTYPE = "MSVC" unless defined $CCTYPE;
00b02797 80 foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym,
81 $pp_sym, $globvar_sym, $perlio_sym) {
549a6b10 82 s!^!..\\!;
83 }
84}
084592ab 85elsif ($PLATFORM eq 'MacOS') {
86 foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym,
87 $pp_sym, $globvar_sym, $perlio_sym) {
88 s!^!::!;
89 }
90}
549a6b10 91
2986a63f 92unless ($PLATFORM eq 'win32' || $PLATFORM eq 'MacOS' || $PLATFORM eq 'netware') {
549a6b10 93 open(CFG,$config_sh) || die "Cannot open $config_sh: $!\n";
7766f137 94 while (<CFG>) {
549a6b10 95 if (/^(?:ccflags|optimize)='(.+)'$/) {
96 $_ = $1;
97 $define{$1} = 1 while /-D(\w+)/g;
98 }
3cfae81b 99 if ($PLATFORM eq 'os2') {
52e4c282 100 $CONFIG_ARGS = $1 if /^config_args='(.+)'$/;
101 $ARCHNAME = $1 if /^archname='(.+)'$/;
102 $PATCHLEVEL = $1 if /^perl_patchlevel='(.+)'$/;
3cfae81b 103 }
549a6b10 104 }
105 close(CFG);
106}
107
108open(CFG,$config_h) || die "Cannot open $config_h: $!\n";
7766f137 109while (<CFG>) {
110 $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/;
7766f137 111 $define{$1} = 1 if /^\s*#\s*define\s+(MULTIPLICITY)\b/;
0e32cd81 112 $define{$1} = 1 if /^\s*#\s*define\s+(PERL_\w+)\b/;
113 $define{$1} = 1 if /^\s*#\s*define\s+(USE_\w+)\b/;
7766f137 114}
bbc8f9de 115close(CFG);
116
18c4b137 117# perl.h logic duplication begins
118
ac6bedea 119if ($define{PERL_IMPLICIT_SYS}) {
120 $define{PL_OP_SLAB_ALLOC} = 1;
121}
122
18c4b137 123if ($define{USE_ITHREADS}) {
acfe0abc 124 if (!$define{MULTIPLICITY}) {
18c4b137 125 $define{MULTIPLICITY} = 1;
126 }
127}
128
129$define{PERL_IMPLICIT_CONTEXT} ||=
130 $define{USE_ITHREADS} ||
66cf6f75 131 $define{USE_5005THREADS} ||
18c4b137 132 $define{MULTIPLICITY} ;
133
18c4b137 134# perl.h logic duplication ends
135
ac6bedea 136my $sym_ord = 0;
137
549a6b10 138if ($PLATFORM eq 'win32') {
139 warn join(' ',keys %define)."\n";
7d4dff66 140 print "LIBRARY Perl57\n";
dfdd1393 141 print "DESCRIPTION 'Perl interpreter'\n";
142 print "EXPORTS\n";
143 if ($define{PERL_IMPLICIT_SYS}) {
549a6b10 144 output_symbol("perl_get_host_info");
7766f137 145 output_symbol("perl_alloc_override");
ac6bedea 146 output_symbol("perl_clone_host");
51371543 147 }
7766f137 148}
149elsif ($PLATFORM eq 'os2') {
52e4c282 150 if (open my $fh, '<', 'perl5.def') {
151 while (<$fh>) {
152 last if /^\s*EXPORTS\b/;
153 }
154 while (<$fh>) {
155 $ordinal{$1} = $2 if /^\s*"(\w+)"\s*\@(\d+)\s*$/;
156 # This allows skipping ordinals which were used in older versions
157 $sym_ord = $1 if /^\s*;\s*LAST_ORDINAL\s*=\s*(\d+)\s*$/;
158 }
159 $sym_ord < $_ and $sym_ord = $_ for values %ordinal; # Take the max
160 }
3cfae81b 161 ($v = $]) =~ s/(\d\.\d\d\d)(\d\d)$/$1_$2/;
162 $v .= '-thread' if $ARCHNAME =~ /-thread/;
3cfae81b 163 ($dll = $define{PERL_DLL}) =~ s/\.dll$//i;
52e4c282 164 $v .= "\@$PATCHLEVEL" if $PATCHLEVEL;
1102eebe 165 $d = "DESCRIPTION '\@#perl5-porters\@perl.org:$v#\@ Perl interpreter, configured as $CONFIG_ARGS'";
166 $d = substr($d, 0, 249) . "...'" if length $d > 253;
3cfae81b 167 print <<"---EOP---";
168LIBRARY '$dll' INITINSTANCE TERMINSTANCE
1102eebe 169$d
3cfae81b 170STACKSIZE 32768
171CODE LOADONCALL
172DATA LOADONCALL NONSHARED MULTIPLE
173EXPORTS
174---EOP---
7766f137 175}
176elsif ($PLATFORM eq 'aix') {
61d42ce4 177 $OSVER = `uname -v`;
178 chop $OSVER;
179 $OSREL = `uname -r`;
180 chop $OSREL;
181 if ($OSVER > 4 || ($OSVER == 4 && $OSREL >= 3)) {
182 print "#! ..\n";
183 } else {
184 print "#!\n";
185 }
ac4c12e7 186}
2986a63f 187elsif ($PLATFORM eq 'netware') {
188 if ($FILETYPE eq 'def') {
189 print "LIBRARY Perl57\n";
190 print "DESCRIPTION 'Perl interpreter for NetWare'\n";
191 print "EXPORTS\n";
192 }
193 if ($define{PERL_IMPLICIT_SYS}) {
ac6bedea 194 output_symbol("perl_get_host_info");
195 output_symbol("perl_alloc_override");
196 output_symbol("perl_clone_host");
2986a63f 197 }
198}
bbc8f9de 199
22239a37 200my %skip;
201my %export;
202
51371543 203sub skip_symbols {
204 my $list = shift;
205 foreach my $symbol (@$list) {
206 $skip{$symbol} = 1;
207 }
22239a37 208}
209
51371543 210sub emit_symbols {
211 my $list = shift;
212 foreach my $symbol (@$list) {
213 my $skipsym = $symbol;
214 # XXX hack
acfe0abc 215 if ($define{MULTIPLICITY}) {
51371543 216 $skipsym =~ s/^Perl_[GIT](\w+)_ptr$/PL_$1/;
217 }
218 emit_symbol($symbol) unless exists $skip{$skipsym};
219 }
22239a37 220}
221
549a6b10 222if ($PLATFORM eq 'win32') {
7766f137 223 skip_symbols [qw(
224 PL_statusvalue_vms
225 PL_archpat_auto
226 PL_cryptseen
227 PL_DBcv
228 PL_generation
229 PL_lastgotoprobe
230 PL_linestart
231 PL_modcount
232 PL_pending_ident
233 PL_sortcxix
234 PL_sublex_info
235 PL_timesbuf
236 main
237 Perl_ErrorNo
238 Perl_GetVars
239 Perl_do_exec3
240 Perl_do_ipcctl
241 Perl_do_ipcget
242 Perl_do_msgrcv
243 Perl_do_msgsnd
244 Perl_do_semop
245 Perl_do_shmio
246 Perl_dump_fds
247 Perl_init_thread_intern
248 Perl_my_bzero
9d50d399 249 Perl_my_bcopy
7766f137 250 Perl_my_htonl
251 Perl_my_ntohl
252 Perl_my_swap
253 Perl_my_chsize
254 Perl_same_dirent
255 Perl_setenv_getix
256 Perl_unlnk
257 Perl_watch
258 Perl_safexcalloc
259 Perl_safexmalloc
260 Perl_safexfree
261 Perl_safexrealloc
262 Perl_my_memcmp
263 Perl_my_memset
264 PL_cshlen
265 PL_cshname
266 PL_opsave
267 Perl_do_exec
268 Perl_getenv_len
269 Perl_my_pclose
270 Perl_my_popen
271 )];
272}
273elsif ($PLATFORM eq 'aix') {
549a6b10 274 skip_symbols([qw(
7766f137 275 Perl_dump_fds
276 Perl_ErrorNo
277 Perl_GetVars
278 Perl_my_bcopy
279 Perl_my_bzero
280 Perl_my_chsize
281 Perl_my_htonl
282 Perl_my_memcmp
283 Perl_my_memset
284 Perl_my_ntohl
285 Perl_my_swap
286 Perl_safexcalloc
287 Perl_safexfree
288 Perl_safexmalloc
289 Perl_safexrealloc
290 Perl_same_dirent
291 Perl_unlnk
6c644e78 292 Perl_sys_intern_clear
95151ede 293 Perl_sys_intern_dup
52853b95 294 Perl_sys_intern_init
7766f137 295 PL_cryptseen
296 PL_opsave
297 PL_statusvalue_vms
298 PL_sys_intern
299 )]);
300}
301elsif ($PLATFORM eq 'os2') {
3cfae81b 302 emit_symbols([qw(
7766f137 303 ctermid
304 get_sysinfo
305 Perl_OS2_init
764df951 306 Perl_OS2_init3
307 Perl_OS2_term
7766f137 308 OS2_Perl_data
309 dlopen
310 dlsym
311 dlerror
403d6f8e 312 dlclose
7766f137 313 my_tmpfile
314 my_tmpnam
315 my_flock
9c130f5b 316 my_rmdir
317 my_mkdir
f72c975a 318 my_getpwuid
319 my_getpwnam
320 my_getpwent
321 my_setpwent
322 my_endpwent
323 setgrent
324 endgrent
325 getgrent
7766f137 326 malloc_mutex
327 threads_mutex
328 nthreads
329 nthreads_cond
330 os2_cond_wait
331 os2_stat
332 pthread_join
333 pthread_create
334 pthread_detach
335 XS_Cwd_change_drive
336 XS_Cwd_current_drive
337 XS_Cwd_extLibpath
338 XS_Cwd_extLibpath_set
339 XS_Cwd_sys_abspath
340 XS_Cwd_sys_chdir
341 XS_Cwd_sys_cwd
342 XS_Cwd_sys_is_absolute
343 XS_Cwd_sys_is_relative
344 XS_Cwd_sys_is_rooted
345 XS_DynaLoader_mod2fname
346 XS_File__Copy_syscopy
347 Perl_Register_MQ
348 Perl_Deregister_MQ
349 Perl_Serve_Messages
350 Perl_Process_Messages
351 init_PMWIN_entries
352 PMWIN_entries
353 Perl_hab_GET
35bc1fdc 354 loadByOrdinal
355 pExtFCN
30500b05 356 os2error
357 ResetWinError
358 CroakWinError
7766f137 359 )]);
3cfae81b 360}
084592ab 361elsif ($PLATFORM eq 'MacOS') {
362 skip_symbols [qw(
363 Perl_GetVars
364 PL_cryptseen
365 PL_cshlen
366 PL_cshname
367 PL_statusvalue_vms
368 PL_sys_intern
369 PL_opsave
370 PL_timesbuf
371 Perl_dump_fds
372 Perl_my_bcopy
373 Perl_my_bzero
374 Perl_my_chsize
375 Perl_my_htonl
376 Perl_my_memcmp
377 Perl_my_memset
378 Perl_my_ntohl
379 Perl_my_swap
380 Perl_safexcalloc
381 Perl_safexfree
382 Perl_safexmalloc
383 Perl_safexrealloc
384 Perl_unlnk
fe05f414 385 Perl_sys_intern_clear
386 Perl_sys_intern_init
084592ab 387 )];
388}
2986a63f 389elsif ($PLATFORM eq 'netware') {
390 skip_symbols [qw(
391 PL_statusvalue_vms
392 PL_archpat_auto
393 PL_cryptseen
394 PL_DBcv
395 PL_generation
396 PL_lastgotoprobe
397 PL_linestart
398 PL_modcount
399 PL_pending_ident
400 PL_sortcxix
401 PL_sublex_info
402 PL_timesbuf
403 main
404 Perl_ErrorNo
405 Perl_GetVars
406 Perl_do_exec3
407 Perl_do_ipcctl
408 Perl_do_ipcget
409 Perl_do_msgrcv
410 Perl_do_msgsnd
411 Perl_do_semop
412 Perl_do_shmio
413 Perl_dump_fds
414 Perl_init_thread_intern
415 Perl_my_bzero
416 Perl_my_htonl
417 Perl_my_ntohl
418 Perl_my_swap
419 Perl_my_chsize
420 Perl_same_dirent
421 Perl_setenv_getix
422 Perl_unlnk
423 Perl_watch
424 Perl_safexcalloc
425 Perl_safexmalloc
426 Perl_safexfree
427 Perl_safexrealloc
428 Perl_my_memcmp
429 Perl_my_memset
430 PL_cshlen
431 PL_cshname
432 PL_opsave
433 Perl_do_exec
434 Perl_getenv_len
435 Perl_my_pclose
436 Perl_my_popen
437 )];
438}
3cfae81b 439
7766f137 440unless ($define{'DEBUGGING'}) {
441 skip_symbols [qw(
7766f137 442 Perl_deb_growlevel
443 Perl_debop
444 Perl_debprofdump
445 Perl_debstack
446 Perl_debstackptrs
7766f137 447 Perl_sv_peek
448 PL_block_type
449 PL_watchaddr
450 PL_watchok
451 )];
452}
453
454if ($define{'PERL_IMPLICIT_SYS'}) {
455 skip_symbols [qw(
456 Perl_getenv_len
457 Perl_my_popen
458 Perl_my_pclose
459 )];
460}
461else {
462 skip_symbols [qw(
463 PL_Mem
464 PL_MemShared
465 PL_MemParse
466 PL_Env
467 PL_StdIO
468 PL_LIO
469 PL_Dir
470 PL_Sock
471 PL_Proc
472 )];
473}
474
7c128300 475unless ($define{'PERL_FLEXIBLE_EXCEPTIONS'}) {
476 skip_symbols [qw(
477 PL_protect
478 Perl_default_protect
479 Perl_vdefault_protect
480 )];
481}
482
5bcb3f6c 483unless ($define{'USE_REENTRANT_API'}) {
484 skip_symbols [qw(
485 PL_reentrant_buffer
486 )];
487}
488
7766f137 489if ($define{'MYMALLOC'}) {
490 emit_symbols [qw(
491 Perl_dump_mstats
827e134a 492 Perl_get_mstats
9c130f5b 493 Perl_strdup
494 Perl_putenv
7766f137 495 )];
bbda9c9d 496 if ($define{'USE_5005THREADS'} || $define{'USE_ITHREADS'}) {
1feb2720 497 emit_symbols [qw(
498 PL_malloc_mutex
499 )];
500 }
80fc1a6e 501 else {
502 skip_symbols [qw(
503 PL_malloc_mutex
504 )];
505 }
51371543 506}
507else {
7766f137 508 skip_symbols [qw(
509 PL_malloc_mutex
510 Perl_dump_mstats
6ecd3fcb 511 Perl_get_mstats
7766f137 512 Perl_malloced_size
513 )];
514}
515
f433d095 516unless ($define{'USE_5005THREADS'} || $define{'USE_ITHREADS'}) {
7766f137 517 skip_symbols [qw(
518 PL_thr_key
f433d095 519 )];
520}
521
522unless ($define{'USE_5005THREADS'}) {
523 skip_symbols [qw(
7766f137 524 PL_sv_mutex
525 PL_strtab_mutex
526 PL_svref_mutex
7766f137 527 PL_cred_mutex
528 PL_eval_mutex
6940069f 529 PL_fdpid_mutex
530 PL_sv_lock_mutex
7766f137 531 PL_eval_cond
532 PL_eval_owner
533 PL_threads_mutex
534 PL_nthreads
535 PL_nthreads_cond
536 PL_threadnum
537 PL_threadsv_names
538 PL_thrsv
539 PL_vtbl_mutex
7766f137 540 Perl_condpair_magic
541 Perl_new_struct_thread
542 Perl_per_thread_magicals
543 Perl_thread_create
544 Perl_find_threadsv
545 Perl_unlock_condpair
546 Perl_magic_mutexfree
4755096e 547 Perl_sv_lock
7766f137 548 )];
549}
550
551unless ($define{'USE_ITHREADS'}) {
552 skip_symbols [qw(
553 PL_ptr_table
534825c4 554 PL_op_mutex
7e95b20d 555 PL_regex_pad
556 PL_regex_padav
f2f7cecd 557 PL_sharedsv_space
558 PL_sharedsv_space_mutex
7766f137 559 Perl_dirp_dup
560 Perl_cx_dup
561 Perl_si_dup
562 Perl_any_dup
563 Perl_ss_dup
564 Perl_fp_dup
565 Perl_gp_dup
566 Perl_he_dup
567 Perl_mg_dup
568 Perl_re_dup
569 Perl_sv_dup
570 Perl_sys_intern_dup
86593e8d 571 Perl_ptr_table_clear
7766f137 572 Perl_ptr_table_fetch
86593e8d 573 Perl_ptr_table_free
7766f137 574 Perl_ptr_table_new
4ac9195f 575 Perl_ptr_table_clear
576 Perl_ptr_table_free
7766f137 577 Perl_ptr_table_split
578 Perl_ptr_table_store
579 perl_clone
580 perl_clone_using
038f0558 581 Perl_sharedsv_find
582 Perl_sharedsv_init
583 Perl_sharedsv_lock
584 Perl_sharedsv_new
585 Perl_sharedsv_thrcnt_dec
586 Perl_sharedsv_thrcnt_inc
587 Perl_sharedsv_unlock
7766f137 588 )];
589}
590
591unless ($define{'PERL_IMPLICIT_CONTEXT'}) {
592 skip_symbols [qw(
593 Perl_croak_nocontext
594 Perl_die_nocontext
595 Perl_deb_nocontext
596 Perl_form_nocontext
e0f4245d 597 Perl_load_module_nocontext
7766f137 598 Perl_mess_nocontext
599 Perl_warn_nocontext
600 Perl_warner_nocontext
601 Perl_newSVpvf_nocontext
602 Perl_sv_catpvf_nocontext
603 Perl_sv_setpvf_nocontext
604 Perl_sv_catpvf_mg_nocontext
605 Perl_sv_setpvf_mg_nocontext
606 )];
607}
608
609unless ($define{'PERL_IMPLICIT_SYS'}) {
610 skip_symbols [qw(
611 perl_alloc_using
014822e4 612 perl_clone_using
7766f137 613 )];
614}
615
616unless ($define{'FAKE_THREADS'}) {
617 skip_symbols [qw(PL_curthr)];
618}
619
ac6bedea 620unless ($define{'PL_OP_SLAB_ALLOC'}) {
621 skip_symbols [qw(
622 PL_OpPtr
623 PL_OpSlab
624 PL_OpSpace
625 )];
626}
627
7766f137 628sub readvar {
629 my $file = shift;
630 my $proc = shift || sub { "PL_$_[2]" };
631 open(VARS,$file) || die "Cannot open $file: $!\n";
632 my @syms;
633 while (<VARS>) {
634 # All symbols have a Perl_ prefix because that's what embed.h
635 # sticks in front of them.
636 push(@syms, &$proc($1,$2,$3)) if (/\bPERLVAR(A?I?C?)\(([IGT])(\w+)/);
9df9a5cd 637 }
638 close(VARS);
7766f137 639 return \@syms;
640}
641
6f4183fe 642if ($define{'USE_5005THREADS'}) {
7766f137 643 my $thrd = readvar($thrdvar_h);
644 skip_symbols $thrd;
645}
646
7766f137 647if ($define{'PERL_GLOBAL_STRUCT'}) {
648 my $global = readvar($perlvars_h);
649 skip_symbols $global;
650 emit_symbol('Perl_GetVars');
651 emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC';
652}
36c15d3f 653
22c35a8c 654# functions from *.sym files
655
954c1994 656my @syms = ($global_sym, $globvar_sym); # $pp_sym is not part of the API
549a6b10 657
9df9a5cd 658my @layer_syms = qw(
659 PerlIOBase_clearerr
660 PerlIOBase_close
8437356b 661 PerlIOBase_dup
9df9a5cd 662 PerlIOBase_eof
663 PerlIOBase_error
664 PerlIOBase_fileno
8c0134a8 665 PerlIOBase_pushed
666 PerlIOBase_read
55ac2d47 667 PerlIOBase_setlinebuf
a555790d 668 PerlIOBase_unread
9df9a5cd 669 PerlIOBuf_bufsiz
9df9a5cd 670 PerlIOBuf_fill
671 PerlIOBuf_flush
672 PerlIOBuf_get_cnt
673 PerlIOBuf_get_ptr
674 PerlIOBuf_open
675 PerlIOBuf_pushed
676 PerlIOBuf_read
9df9a5cd 677 PerlIOBuf_seek
678 PerlIOBuf_set_ptrcnt
9df9a5cd 679 PerlIOBuf_tell
680 PerlIOBuf_unread
681 PerlIOBuf_write
55ac2d47 682 PerlIO_allocate
8c0134a8 683 PerlIO_arg_fetch
55ac2d47 684 PerlIO_define_layer
63bdf6c4 685 PerlIO_modestr
9df9a5cd 686 PerlIO_pending
687 PerlIO_push
8437356b 688 PerlIO_sv_dup
17782128 689 PL_def_layerlist
690 PL_known_layers
691 PL_perlio
9df9a5cd 692);
693
7766f137 694if ($define{'USE_PERLIO'}) {
084592ab 695 push @syms, $perlio_sym;
696 if ($define{'USE_SFIO'}) {
9df9a5cd 697 skip_symbols \@layer_syms;
084592ab 698 # SFIO defines most of the PerlIO routines as macros
699 skip_symbols [qw(
700 PerlIO_canset_cnt
701 PerlIO_clearerr
702 PerlIO_close
703 PerlIO_eof
704 PerlIO_error
705 PerlIO_exportFILE
706 PerlIO_fast_gets
707 PerlIO_fdopen
708 PerlIO_fileno
709 PerlIO_findFILE
710 PerlIO_flush
711 PerlIO_get_base
712 PerlIO_get_bufsiz
713 PerlIO_get_cnt
714 PerlIO_get_ptr
715 PerlIO_getc
716 PerlIO_getname
717 PerlIO_has_base
718 PerlIO_has_cntptr
719 PerlIO_importFILE
720 PerlIO_open
721 PerlIO_printf
722 PerlIO_putc
723 PerlIO_puts
724 PerlIO_read
725 PerlIO_releaseFILE
726 PerlIO_reopen
727 PerlIO_rewind
728 PerlIO_seek
729 PerlIO_set_cnt
730 PerlIO_set_ptrcnt
731 PerlIO_setlinebuf
732 PerlIO_sprintf
733 PerlIO_stderr
734 PerlIO_stdin
735 PerlIO_stdout
736 PerlIO_stdoutf
737 PerlIO_tell
738 PerlIO_ungetc
739 PerlIO_vprintf
740 PerlIO_write
741 )];
742 }
5138f914 743} else {
86593e8d 744 # Skip the PerlIO New Generation symbols.
9df9a5cd 745 skip_symbols \@layer_syms;
746}
7766f137 747
748for my $syms (@syms) {
749 open (GLOBAL, "<$syms") || die "failed to open $syms: $!\n";
750 while (<GLOBAL>) {
751 next if (!/^[A-Za-z]/);
752 # Functions have a Perl_ prefix
753 # Variables have a PL_ prefix
754 chomp($_);
755 my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : "");
756 $symbol .= $_;
757 emit_symbol($symbol) unless exists $skip{$symbol};
758 }
759 close(GLOBAL);
760}
0a753a76 761
22c35a8c 762# variables
0a753a76 763
acfe0abc 764if ($define{'MULTIPLICITY'}) {
1acb48c9 765 for my $f ($perlvars_h, $intrpvar_h, $thrdvar_h) {
18c4b137 766 my $glob = readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" });
767 emit_symbols $glob;
18c4b137 768 }
1acb48c9 769 # XXX AIX seems to want the perlvars.h symbols, for some reason
770 if ($PLATFORM eq 'aix') {
771 my $glob = readvar($perlvars_h);
51371543 772 emit_symbols $glob;
773 }
774}
775else {
776 unless ($define{'PERL_GLOBAL_STRUCT'}) {
549a6b10 777 my $glob = readvar($perlvars_h);
51371543 778 emit_symbols $glob;
9df9a5cd 779 }
51371543 780 unless ($define{'MULTIPLICITY'}) {
549a6b10 781 my $glob = readvar($intrpvar_h);
51371543 782 emit_symbols $glob;
9df9a5cd 783 }
bbda9c9d 784 unless ($define{'MULTIPLICITY'} || $define{'USE_5005THREADS'}) {
549a6b10 785 my $glob = readvar($thrdvar_h);
51371543 786 emit_symbols $glob;
9df9a5cd 787 }
51371543 788}
0a753a76 789
549a6b10 790sub try_symbol {
791 my $symbol = shift;
22239a37 792
4d6b4052 793 return if $symbol !~ /^[A-Za-z_]/;
549a6b10 794 return if $symbol =~ /^\#/;
795 $symbol =~s/\r//g;
796 chomp($symbol);
43cd9f80 797 return if exists $skip{$symbol};
549a6b10 798 emit_symbol($symbol);
3e3baf6d 799}
0a753a76 800
549a6b10 801while (<DATA>) {
802 try_symbol($_);
ac4c12e7 803}
804
549a6b10 805if ($PLATFORM eq 'win32') {
806 foreach my $symbol (qw(
00b02797 807 setuid
808 setgid
7766f137 809 boot_DynaLoader
7766f137 810 Perl_init_os_extras
c44d3fdb 811 Perl_thread_create
7766f137 812 Perl_win32_init
813 RunPerl
5290524f 814 win32_async_check
7766f137 815 win32_errno
816 win32_environ
7766f137 817 win32_abort
818 win32_fstat
819 win32_stat
820 win32_pipe
821 win32_popen
822 win32_pclose
823 win32_rename
824 win32_setmode
825 win32_lseek
826 win32_tell
827 win32_dup
828 win32_dup2
829 win32_open
830 win32_close
831 win32_eof
832 win32_read
833 win32_write
834 win32_spawnvp
835 win32_mkdir
836 win32_rmdir
837 win32_chdir
838 win32_flock
839 win32_execv
840 win32_execvp
841 win32_htons
842 win32_ntohs
843 win32_htonl
844 win32_ntohl
845 win32_inet_addr
846 win32_inet_ntoa
847 win32_socket
848 win32_bind
849 win32_listen
850 win32_accept
851 win32_connect
852 win32_send
853 win32_sendto
854 win32_recv
855 win32_recvfrom
856 win32_shutdown
857 win32_closesocket
858 win32_ioctlsocket
859 win32_setsockopt
860 win32_getsockopt
861 win32_getpeername
862 win32_getsockname
863 win32_gethostname
864 win32_gethostbyname
865 win32_gethostbyaddr
866 win32_getprotobyname
867 win32_getprotobynumber
868 win32_getservbyname
869 win32_getservbyport
870 win32_select
871 win32_endhostent
872 win32_endnetent
873 win32_endprotoent
874 win32_endservent
875 win32_getnetent
876 win32_getnetbyname
877 win32_getnetbyaddr
878 win32_getprotoent
879 win32_getservent
880 win32_sethostent
881 win32_setnetent
882 win32_setprotoent
883 win32_setservent
884 win32_getenv
885 win32_putenv
886 win32_perror
7766f137 887 win32_malloc
888 win32_calloc
889 win32_realloc
890 win32_free
891 win32_sleep
892 win32_times
893 win32_access
894 win32_alarm
895 win32_chmod
896 win32_open_osfhandle
897 win32_get_osfhandle
898 win32_ioctl
899 win32_link
900 win32_unlink
901 win32_utime
902 win32_uname
903 win32_wait
904 win32_waitpid
905 win32_kill
906 win32_str_os_error
907 win32_opendir
908 win32_readdir
909 win32_telldir
910 win32_seekdir
911 win32_rewinddir
912 win32_closedir
913 win32_longpath
914 win32_os_id
915 win32_getpid
916 win32_crypt
917 win32_dynaload
df3728a2 918 win32_get_childenv
919 win32_free_childenv
920 win32_clearenv
921 win32_get_childdir
922 win32_free_childdir
00b02797 923 win32_stdin
924 win32_stdout
925 win32_stderr
926 win32_ferror
927 win32_feof
928 win32_strerror
929 win32_fprintf
930 win32_printf
931 win32_vfprintf
932 win32_vprintf
933 win32_fread
934 win32_fwrite
935 win32_fopen
936 win32_fdopen
937 win32_freopen
938 win32_fclose
939 win32_fputs
940 win32_fputc
941 win32_ungetc
942 win32_getc
943 win32_fileno
944 win32_clearerr
945 win32_fflush
946 win32_ftell
947 win32_fseek
948 win32_fgetpos
949 win32_fsetpos
950 win32_rewind
951 win32_tmpfile
952 win32_setbuf
953 win32_setvbuf
954 win32_flushall
955 win32_fcloseall
956 win32_fgets
957 win32_gets
958 win32_fgetc
959 win32_putc
960 win32_puts
961 win32_getchar
962 win32_putchar
7766f137 963 ))
964 {
549a6b10 965 try_symbol($symbol);
966 }
967}
3cfae81b 968elsif ($PLATFORM eq 'os2') {
7766f137 969 open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
970 /^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>;
971 close MAP or die 'Cannot close miniperl.map';
972
973 @missing = grep { !exists $mapped{$_} and !exists $bincompat5005{$_} }
974 keys %export;
975 delete $export{$_} foreach @missing;
3cfae81b 976}
084592ab 977elsif ($PLATFORM eq 'MacOS') {
978 open MACSYMS, 'macperl.sym' or die 'Cannot read macperl.sym';
979
980 while (<MACSYMS>) {
981 try_symbol($_);
982 }
983
984 close MACSYMS;
985}
2986a63f 986elsif ($PLATFORM eq 'netware') {
987foreach my $symbol (qw(
988 boot_DynaLoader
989 Perl_init_os_extras
990 Perl_thread_create
991 Perl_nw5_init
992 RunPerl
993 AllocStdPerl
994 FreeStdPerl
995 do_spawn2
996 do_aspawn
997 nw_uname
998 nw_stdin
999 nw_stdout
1000 nw_stderr
1001 nw_feof
1002 nw_ferror
1003 nw_fopen
1004 nw_fclose
1005 nw_clearerr
1006 nw_getc
1007 nw_fgets
1008 nw_fputc
1009 nw_fputs
1010 nw_fflush
1011 nw_ungetc
1012 nw_fileno
1013 nw_fdopen
1014 nw_freopen
1015 nw_fread
1016 nw_fwrite
1017 nw_setbuf
1018 nw_setvbuf
1019 nw_vfprintf
1020 nw_ftell
1021 nw_fseek
1022 nw_rewind
1023 nw_tmpfile
1024 nw_fgetpos
1025 nw_fsetpos
1026 nw_dup
1027 nw_access
1028 nw_chmod
1029 nw_chsize
1030 nw_close
1031 nw_dup2
1032 nw_flock
1033 nw_isatty
1034 nw_link
1035 nw_lseek
1036 nw_stat
1037 nw_mktemp
1038 nw_open
1039 nw_read
1040 nw_rename
1041 nw_setmode
1042 nw_unlink
1043 nw_utime
1044 nw_write
1045 nw_chdir
1046 nw_rmdir
1047 nw_closedir
1048 nw_opendir
1049 nw_readdir
1050 nw_rewinddir
1051 nw_seekdir
1052 nw_telldir
1053 nw_htonl
1054 nw_htons
1055 nw_ntohl
1056 nw_ntohs
1057 nw_accept
1058 nw_bind
1059 nw_connect
1060 nw_endhostent
1061 nw_endnetent
1062 nw_endprotoent
1063 nw_endservent
1064 nw_gethostbyaddr
1065 nw_gethostbyname
1066 nw_gethostent
1067 nw_gethostname
1068 nw_getnetbyaddr
1069 nw_getnetbyname
1070 nw_getnetent
1071 nw_getpeername
1072 nw_getprotobyname
1073 nw_getprotobynumber
1074 nw_getprotoent
1075 nw_getservbyname
1076 nw_getservbyport
1077 nw_getservent
1078 nw_getsockname
1079 nw_getsockopt
1080 nw_inet_addr
1081 nw_listen
1082 nw_socket
1083 nw_recv
1084 nw_recvfrom
1085 nw_select
1086 nw_send
1087 nw_sendto
1088 nw_sethostent
1089 nw_setnetent
1090 nw_setprotoent
1091 nw_setservent
3a0827a6 1092 nw_setsockopt
4d76e4b4 1093 nw_inet_ntoa
2986a63f 1094 nw_shutdown
1095 nw_crypt
1096 nw_execvp
1097 nw_kill
1098 nw_Popen
1099 nw_Pclose
1100 nw_Pipe
1101 nw_times
1102 nw_waitpid
1103 nw_getpid
1104 nw_spawnvp
1105 nw_os_id
1106 nw_open_osfhandle
1107 nw_get_osfhandle
1108 nw_abort
1109 nw_sleep
1110 nw_wait
1111 nw_dynaload
1112 nw_strerror
1113 fnFpSetMode
1114 fnInsertHashListAddrs
1115 fnGetHashListAddrs
1116 Perl_deb
1117 ))
1118 {
1119 try_symbol($symbol);
1120 }
1121}
22239a37 1122
549a6b10 1123# Now all symbols should be defined because
1124# next we are going to output them.
1125
7766f137 1126foreach my $symbol (sort keys %export) {
1127 output_symbol($symbol);
1128}
549a6b10 1129
2986a63f 1130if ($PLATFORM eq 'netware') {
1131 # This may not be the right way to do. This is to make sure
1132 # that the last symbol will not contain a comma else
1133 # Watcom linker cribs
1134 print "\tdummy\n";
52e4c282 1135} elsif ($PLATFORM eq 'os2') {
1136 print "; LAST_ORDINAL=$sym_ord\n";
2986a63f 1137}
1138
549a6b10 1139sub emit_symbol {
7766f137 1140 my $symbol = shift;
9df9a5cd 1141 chomp($symbol);
7766f137 1142 $export{$symbol} = 1;
549a6b10 1143}
1144
1145sub output_symbol {
1146 my $symbol = shift;
4cb71bb6 1147 $symbol = $bincompat5005{$symbol}
1148 if $define{PERL_BINCOMPAT_5005} and $symbol =~ /^($bincompat5005)$/;
549a6b10 1149 if ($PLATFORM eq 'win32') {
549a6b10 1150 $symbol = "_$symbol" if $CCTYPE eq 'BORLAND';
520c758a 1151 print "\t$symbol\n";
549a6b10 1152# XXX: binary compatibility between compilers is an exercise
1153# in frustration :-(
1154# if ($CCTYPE eq "BORLAND") {
1155# # workaround Borland quirk by exporting both the straight
1156# # name and a name with leading underscore. Note the
1157# # alias *must* come after the symbol itself, if both
1158# # are to be exported. (Linker bug?)
1159# print "\t_$symbol\n";
1160# print "\t$symbol = _$symbol\n";
1161# }
1162# elsif ($CCTYPE eq 'GCC') {
1163# # Symbols have leading _ whole process is $%@"% slow
1164# # so skip aliases for now
1165# nprint "\t$symbol\n";
1166# }
1167# else {
1168# # for binary coexistence, export both the symbol and
1169# # alias with leading underscore
1170# print "\t$symbol\n";
1171# print "\t_$symbol = $symbol\n";
1172# }
7766f137 1173 }
1174 elsif ($PLATFORM eq 'os2') {
52e4c282 1175 printf qq( %-31s \@%s\n),
1176 qq("$symbol"), $ordinal{$symbol} || ++$sym_ord;
7766f137 1177 }
084592ab 1178 elsif ($PLATFORM eq 'aix' || $PLATFORM eq 'MacOS') {
549a6b10 1179 print "$symbol\n";
1180 }
2986a63f 1181 elsif ($PLATFORM eq 'netware') {
1182 print "\t$symbol,\n";
1183 }
549a6b10 1184}
1185
11861;
1187__DATA__
1188# extra globals not included above.
8437356b 1189Perl_cxinc
549a6b10 1190perl_alloc
7766f137 1191perl_alloc_using
014822e4 1192perl_clone
1193perl_clone_using
549a6b10 1194perl_construct
1195perl_destruct
1196perl_free
1197perl_parse
1198perl_run
18b7339f 1199PerlIOBase_clearerr
8437356b 1200PerlIOBase_close
1201PerlIOBase_dup
1202PerlIOBase_eof
1203PerlIOBase_error
1204PerlIOBase_fileno
8c0134a8 1205PerlIOBase_pushed
1206PerlIOBase_read
8437356b 1207PerlIOBase_setlinebuf
9156fa33 1208PerlIOBase_unread
8437356b 1209PerlIOBuf_bufsiz
18b7339f 1210PerlIOBuf_fill
1211PerlIOBuf_flush
8437356b 1212PerlIOBuf_get_cnt
1213PerlIOBuf_get_ptr
1214PerlIOBuf_open
1215PerlIOBuf_pushed
1216PerlIOBuf_read
1217PerlIOBuf_seek
1218PerlIOBuf_set_ptrcnt
1219PerlIOBuf_tell
1220PerlIOBuf_unread
1221PerlIOBuf_write
8c0134a8 1222PerlIO_allocate
568ad336 1223PerlIO_apply_layers
8437356b 1224PerlIO_arg_fetch
568ad336 1225PerlIO_binmode
8437356b 1226PerlIO_define_layer
1227PerlIO_define_layer
1228PerlIO_getpos
568ad336 1229PerlIO_init
a8b77c32 1230PerlIO_modestr
8437356b 1231PerlIO_pending
a8b77c32 1232PerlIO_perlio
8437356b 1233PerlIO_push
568ad336 1234PerlIO_setpos
568ad336 1235PerlIO_sprintf
8437356b 1236PerlIO_sv_dup
1237PerlIO_tmpfile
8437356b 1238PerlIO_vsprintf
1239perlsio_binmode