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