DJGPP updates from Laszlo Molnar.
[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
7766f137 14while (@ARGV) {
15 my $flag = shift;
16 $define{$1} = 1 if ($flag =~ /^-D(\w+)$/);
17 $define{$1} = $2 if ($flag =~ /^-D(\w+)=(.+)$/);
18 $CCTYPE = $1 if ($flag =~ /^CCTYPE=(\w+)$/);
19 $PLATFORM = $1 if ($flag =~ /^PLATFORM=(\w+)$/);
2986a63f 20 if ($PLATFORM eq 'netware') {
21 $FILETYPE = $1 if ($flag =~ /^FILETYPE=(\w+)$/);
22 }
7766f137 23}
d55594ae 24
2986a63f 25my @PLATFORM = qw(aix win32 os2 MacOS netware);
549a6b10 26my %PLATFORM;
27@PLATFORM{@PLATFORM} = ();
28
29defined $PLATFORM || die "PLATFORM undefined, must be one of: @PLATFORM\n";
9df9a5cd 30exists $PLATFORM{$PLATFORM} || die "PLATFORM must be one of: @PLATFORM\n";
549a6b10 31
32my $config_sh = "config.sh";
33my $config_h = "config.h";
34my $thrdvar_h = "thrdvar.h";
35my $intrpvar_h = "intrpvar.h";
36my $perlvars_h = "perlvars.h";
37my $global_sym = "global.sym";
38my $pp_sym = "pp.sym";
39my $globvar_sym = "globvar.sym";
40my $perlio_sym = "perlio.sym";
41
9df9a5cd 42if ($PLATFORM eq 'aix') {
549a6b10 43 # Nothing for now.
7766f137 44}
2986a63f 45elsif ($PLATFORM eq 'win32' || $PLATFORM eq 'netware') {
549a6b10 46 $CCTYPE = "MSVC" unless defined $CCTYPE;
00b02797 47 foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym,
48 $pp_sym, $globvar_sym, $perlio_sym) {
549a6b10 49 s!^!..\\!;
50 }
51}
084592ab 52elsif ($PLATFORM eq 'MacOS') {
53 foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym,
54 $pp_sym, $globvar_sym, $perlio_sym) {
55 s!^!::!;
56 }
57}
549a6b10 58
2986a63f 59unless ($PLATFORM eq 'win32' || $PLATFORM eq 'MacOS' || $PLATFORM eq 'netware') {
549a6b10 60 open(CFG,$config_sh) || die "Cannot open $config_sh: $!\n";
7766f137 61 while (<CFG>) {
549a6b10 62 if (/^(?:ccflags|optimize)='(.+)'$/) {
63 $_ = $1;
64 $define{$1} = 1 while /-D(\w+)/g;
65 }
3cfae81b 66 if ($PLATFORM eq 'os2') {
52e4c282 67 $CONFIG_ARGS = $1 if /^config_args='(.+)'$/;
68 $ARCHNAME = $1 if /^archname='(.+)'$/;
69 $PATCHLEVEL = $1 if /^perl_patchlevel='(.+)'$/;
3cfae81b 70 }
549a6b10 71 }
72 close(CFG);
73}
74
75open(CFG,$config_h) || die "Cannot open $config_h: $!\n";
7766f137 76while (<CFG>) {
77 $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/;
7766f137 78 $define{$1} = 1 if /^\s*#\s*define\s+(MULTIPLICITY)\b/;
0e32cd81 79 $define{$1} = 1 if /^\s*#\s*define\s+(PERL_\w+)\b/;
80 $define{$1} = 1 if /^\s*#\s*define\s+(USE_\w+)\b/;
7766f137 81}
bbc8f9de 82close(CFG);
83
18c4b137 84# perl.h logic duplication begins
85
ac6bedea 86if ($define{PERL_IMPLICIT_SYS}) {
87 $define{PL_OP_SLAB_ALLOC} = 1;
88}
89
18c4b137 90if ($define{USE_ITHREADS}) {
acfe0abc 91 if (!$define{MULTIPLICITY}) {
18c4b137 92 $define{MULTIPLICITY} = 1;
93 }
94}
95
96$define{PERL_IMPLICIT_CONTEXT} ||=
97 $define{USE_ITHREADS} ||
66cf6f75 98 $define{USE_5005THREADS} ||
18c4b137 99 $define{MULTIPLICITY} ;
100
10bc17b6 101if ($define{USE_ITHREADS} && $PLATFORM ne 'win32' && $^O ne 'darwin') {
102 $define{USE_REENTRANT_API} = 1;
103}
104
18c4b137 105# perl.h logic duplication ends
106
ac6bedea 107my $sym_ord = 0;
108
549a6b10 109if ($PLATFORM eq 'win32') {
110 warn join(' ',keys %define)."\n";
9c25e1f8 111 print "LIBRARY perl58\n";
dfdd1393 112 print "DESCRIPTION 'Perl interpreter'\n";
113 print "EXPORTS\n";
114 if ($define{PERL_IMPLICIT_SYS}) {
549a6b10 115 output_symbol("perl_get_host_info");
7766f137 116 output_symbol("perl_alloc_override");
0295eab8 117 }
118 if ($define{USE_ITHREADS}) {
ac6bedea 119 output_symbol("perl_clone_host");
51371543 120 }
7766f137 121}
122elsif ($PLATFORM eq 'os2') {
52e4c282 123 if (open my $fh, '<', 'perl5.def') {
124 while (<$fh>) {
125 last if /^\s*EXPORTS\b/;
126 }
127 while (<$fh>) {
128 $ordinal{$1} = $2 if /^\s*"(\w+)"\s*\@(\d+)\s*$/;
129 # This allows skipping ordinals which were used in older versions
130 $sym_ord = $1 if /^\s*;\s*LAST_ORDINAL\s*=\s*(\d+)\s*$/;
131 }
132 $sym_ord < $_ and $sym_ord = $_ for values %ordinal; # Take the max
133 }
3cfae81b 134 ($v = $]) =~ s/(\d\.\d\d\d)(\d\d)$/$1_$2/;
135 $v .= '-thread' if $ARCHNAME =~ /-thread/;
3cfae81b 136 ($dll = $define{PERL_DLL}) =~ s/\.dll$//i;
52e4c282 137 $v .= "\@$PATCHLEVEL" if $PATCHLEVEL;
1102eebe 138 $d = "DESCRIPTION '\@#perl5-porters\@perl.org:$v#\@ Perl interpreter, configured as $CONFIG_ARGS'";
139 $d = substr($d, 0, 249) . "...'" if length $d > 253;
3cfae81b 140 print <<"---EOP---";
141LIBRARY '$dll' INITINSTANCE TERMINSTANCE
1102eebe 142$d
3cfae81b 143STACKSIZE 32768
144CODE LOADONCALL
145DATA LOADONCALL NONSHARED MULTIPLE
146EXPORTS
147---EOP---
7766f137 148}
149elsif ($PLATFORM eq 'aix') {
61d42ce4 150 $OSVER = `uname -v`;
151 chop $OSVER;
152 $OSREL = `uname -r`;
153 chop $OSREL;
154 if ($OSVER > 4 || ($OSVER == 4 && $OSREL >= 3)) {
155 print "#! ..\n";
156 } else {
157 print "#!\n";
158 }
ac4c12e7 159}
2986a63f 160elsif ($PLATFORM eq 'netware') {
161 if ($FILETYPE eq 'def') {
9c25e1f8 162 print "LIBRARY perl58\n";
2986a63f 163 print "DESCRIPTION 'Perl interpreter for NetWare'\n";
164 print "EXPORTS\n";
165 }
166 if ($define{PERL_IMPLICIT_SYS}) {
ac6bedea 167 output_symbol("perl_get_host_info");
168 output_symbol("perl_alloc_override");
169 output_symbol("perl_clone_host");
2986a63f 170 }
171}
bbc8f9de 172
22239a37 173my %skip;
174my %export;
175
51371543 176sub skip_symbols {
177 my $list = shift;
178 foreach my $symbol (@$list) {
179 $skip{$symbol} = 1;
180 }
22239a37 181}
182
51371543 183sub emit_symbols {
184 my $list = shift;
185 foreach my $symbol (@$list) {
186 my $skipsym = $symbol;
187 # XXX hack
acfe0abc 188 if ($define{MULTIPLICITY}) {
51371543 189 $skipsym =~ s/^Perl_[GIT](\w+)_ptr$/PL_$1/;
190 }
191 emit_symbol($symbol) unless exists $skip{$skipsym};
192 }
22239a37 193}
194
549a6b10 195if ($PLATFORM eq 'win32') {
7766f137 196 skip_symbols [qw(
197 PL_statusvalue_vms
198 PL_archpat_auto
199 PL_cryptseen
200 PL_DBcv
201 PL_generation
202 PL_lastgotoprobe
203 PL_linestart
204 PL_modcount
205 PL_pending_ident
206 PL_sortcxix
207 PL_sublex_info
208 PL_timesbuf
209 main
210 Perl_ErrorNo
211 Perl_GetVars
212 Perl_do_exec3
213 Perl_do_ipcctl
214 Perl_do_ipcget
215 Perl_do_msgrcv
216 Perl_do_msgsnd
217 Perl_do_semop
218 Perl_do_shmio
219 Perl_dump_fds
220 Perl_init_thread_intern
221 Perl_my_bzero
9d50d399 222 Perl_my_bcopy
7766f137 223 Perl_my_htonl
224 Perl_my_ntohl
225 Perl_my_swap
226 Perl_my_chsize
227 Perl_same_dirent
228 Perl_setenv_getix
229 Perl_unlnk
230 Perl_watch
231 Perl_safexcalloc
232 Perl_safexmalloc
233 Perl_safexfree
234 Perl_safexrealloc
235 Perl_my_memcmp
236 Perl_my_memset
237 PL_cshlen
238 PL_cshname
239 PL_opsave
240 Perl_do_exec
241 Perl_getenv_len
242 Perl_my_pclose
243 Perl_my_popen
244 )];
245}
246elsif ($PLATFORM eq 'aix') {
549a6b10 247 skip_symbols([qw(
7766f137 248 Perl_dump_fds
249 Perl_ErrorNo
250 Perl_GetVars
251 Perl_my_bcopy
252 Perl_my_bzero
253 Perl_my_chsize
254 Perl_my_htonl
255 Perl_my_memcmp
256 Perl_my_memset
257 Perl_my_ntohl
258 Perl_my_swap
259 Perl_safexcalloc
260 Perl_safexfree
261 Perl_safexmalloc
262 Perl_safexrealloc
263 Perl_same_dirent
264 Perl_unlnk
6c644e78 265 Perl_sys_intern_clear
95151ede 266 Perl_sys_intern_dup
52853b95 267 Perl_sys_intern_init
7766f137 268 PL_cryptseen
269 PL_opsave
270 PL_statusvalue_vms
271 PL_sys_intern
272 )]);
273}
274elsif ($PLATFORM eq 'os2') {
3cfae81b 275 emit_symbols([qw(
7766f137 276 ctermid
277 get_sysinfo
278 Perl_OS2_init
764df951 279 Perl_OS2_init3
280 Perl_OS2_term
7766f137 281 OS2_Perl_data
282 dlopen
283 dlsym
284 dlerror
403d6f8e 285 dlclose
7766f137 286 my_tmpfile
287 my_tmpnam
288 my_flock
9c130f5b 289 my_rmdir
290 my_mkdir
f72c975a 291 my_getpwuid
292 my_getpwnam
293 my_getpwent
294 my_setpwent
295 my_endpwent
296 setgrent
297 endgrent
298 getgrent
7766f137 299 malloc_mutex
300 threads_mutex
301 nthreads
302 nthreads_cond
303 os2_cond_wait
304 os2_stat
305 pthread_join
306 pthread_create
307 pthread_detach
308 XS_Cwd_change_drive
309 XS_Cwd_current_drive
310 XS_Cwd_extLibpath
311 XS_Cwd_extLibpath_set
312 XS_Cwd_sys_abspath
313 XS_Cwd_sys_chdir
314 XS_Cwd_sys_cwd
315 XS_Cwd_sys_is_absolute
316 XS_Cwd_sys_is_relative
317 XS_Cwd_sys_is_rooted
318 XS_DynaLoader_mod2fname
319 XS_File__Copy_syscopy
320 Perl_Register_MQ
321 Perl_Deregister_MQ
322 Perl_Serve_Messages
323 Perl_Process_Messages
324 init_PMWIN_entries
325 PMWIN_entries
326 Perl_hab_GET
35bc1fdc 327 loadByOrdinal
328 pExtFCN
30500b05 329 os2error
330 ResetWinError
331 CroakWinError
7766f137 332 )]);
3cfae81b 333}
084592ab 334elsif ($PLATFORM eq 'MacOS') {
335 skip_symbols [qw(
336 Perl_GetVars
337 PL_cryptseen
338 PL_cshlen
339 PL_cshname
340 PL_statusvalue_vms
341 PL_sys_intern
342 PL_opsave
343 PL_timesbuf
344 Perl_dump_fds
345 Perl_my_bcopy
346 Perl_my_bzero
347 Perl_my_chsize
348 Perl_my_htonl
349 Perl_my_memcmp
350 Perl_my_memset
351 Perl_my_ntohl
352 Perl_my_swap
353 Perl_safexcalloc
354 Perl_safexfree
355 Perl_safexmalloc
356 Perl_safexrealloc
357 Perl_unlnk
fe05f414 358 Perl_sys_intern_clear
359 Perl_sys_intern_init
084592ab 360 )];
361}
2986a63f 362elsif ($PLATFORM eq 'netware') {
363 skip_symbols [qw(
364 PL_statusvalue_vms
365 PL_archpat_auto
366 PL_cryptseen
367 PL_DBcv
368 PL_generation
369 PL_lastgotoprobe
370 PL_linestart
371 PL_modcount
372 PL_pending_ident
373 PL_sortcxix
374 PL_sublex_info
375 PL_timesbuf
376 main
377 Perl_ErrorNo
378 Perl_GetVars
379 Perl_do_exec3
380 Perl_do_ipcctl
381 Perl_do_ipcget
382 Perl_do_msgrcv
383 Perl_do_msgsnd
384 Perl_do_semop
385 Perl_do_shmio
386 Perl_dump_fds
387 Perl_init_thread_intern
388 Perl_my_bzero
389 Perl_my_htonl
390 Perl_my_ntohl
391 Perl_my_swap
392 Perl_my_chsize
393 Perl_same_dirent
394 Perl_setenv_getix
395 Perl_unlnk
396 Perl_watch
397 Perl_safexcalloc
398 Perl_safexmalloc
399 Perl_safexfree
400 Perl_safexrealloc
401 Perl_my_memcmp
402 Perl_my_memset
403 PL_cshlen
404 PL_cshname
405 PL_opsave
406 Perl_do_exec
407 Perl_getenv_len
408 Perl_my_pclose
409 Perl_my_popen
011f1a1a 410 Perl_sys_intern_init
411 Perl_sys_intern_dup
412 Perl_sys_intern_clear
413 Perl_my_bcopy
414 Perl_PerlIO_write
415 Perl_PerlIO_unread
416 Perl_PerlIO_tell
417 Perl_PerlIO_stdout
418 Perl_PerlIO_stdin
419 Perl_PerlIO_stderr
420 Perl_PerlIO_setlinebuf
421 Perl_PerlIO_set_ptrcnt
422 Perl_PerlIO_set_cnt
423 Perl_PerlIO_seek
424 Perl_PerlIO_read
425 Perl_PerlIO_get_ptr
426 Perl_PerlIO_get_cnt
427 Perl_PerlIO_get_bufsiz
428 Perl_PerlIO_get_base
429 Perl_PerlIO_flush
430 Perl_PerlIO_fill
431 Perl_PerlIO_fileno
432 Perl_PerlIO_error
433 Perl_PerlIO_eof
434 Perl_PerlIO_close
435 Perl_PerlIO_clearerr
436 PerlIO_perlio
2986a63f 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
d892637e 658# Symbols that are the public face of the PerlIO layers implementation
659# These are in _addition to_ the public face of the abstraction
660# and need to be exported to allow XS modules to implement layers
9df9a5cd 661my @layer_syms = qw(
662 PerlIOBase_clearerr
663 PerlIOBase_close
8437356b 664 PerlIOBase_dup
9df9a5cd 665 PerlIOBase_eof
666 PerlIOBase_error
667 PerlIOBase_fileno
8c0134a8 668 PerlIOBase_pushed
669 PerlIOBase_read
55ac2d47 670 PerlIOBase_setlinebuf
d892637e 671 PerlIOBase_unread
9df9a5cd 672 PerlIOBuf_bufsiz
9df9a5cd 673 PerlIOBuf_fill
674 PerlIOBuf_flush
675 PerlIOBuf_get_cnt
676 PerlIOBuf_get_ptr
677 PerlIOBuf_open
678 PerlIOBuf_pushed
679 PerlIOBuf_read
9df9a5cd 680 PerlIOBuf_seek
681 PerlIOBuf_set_ptrcnt
9df9a5cd 682 PerlIOBuf_tell
683 PerlIOBuf_unread
684 PerlIOBuf_write
d892637e 685 PerlIO_debug
55ac2d47 686 PerlIO_allocate
d892637e 687 PerlIO_apply_layera
688 PerlIO_apply_layers
8c0134a8 689 PerlIO_arg_fetch
55ac2d47 690 PerlIO_define_layer
d9dac8cd 691 PerlIO_modestr
692 PerlIO_parse_layers
693 PerlIO_layer_fetch
694 PerlIO_list_free
695 PerlIO_apply_layera
9df9a5cd 696 PerlIO_pending
697 PerlIO_push
8437356b 698 PerlIO_sv_dup
ad6971c8 699 PerlIO_perlio
1e8a8f59 700
701Perl_PerlIO_clearerr
702Perl_PerlIO_close
703Perl_PerlIO_eof
704Perl_PerlIO_error
705Perl_PerlIO_fileno
706Perl_PerlIO_fill
707Perl_PerlIO_flush
708Perl_PerlIO_get_base
709Perl_PerlIO_get_bufsiz
710Perl_PerlIO_get_cnt
711Perl_PerlIO_get_ptr
712Perl_PerlIO_read
713Perl_PerlIO_seek
714Perl_PerlIO_set_cnt
715Perl_PerlIO_set_ptrcnt
716Perl_PerlIO_setlinebuf
717Perl_PerlIO_stderr
718Perl_PerlIO_stdin
719Perl_PerlIO_stdout
720Perl_PerlIO_tell
721Perl_PerlIO_unread
722Perl_PerlIO_write
723
9df9a5cd 724);
725
d892637e 726
7766f137 727if ($define{'USE_PERLIO'}) {
d892637e 728 # Export the symols that make up the PerlIO abstraction, regardless
729 # of its implementation - read from a file
084592ab 730 push @syms, $perlio_sym;
d892637e 731
732 # This part is then dependent on how the abstraction is implemented
084592ab 733 if ($define{'USE_SFIO'}) {
d892637e 734 # Old legacy non-stdio "PerlIO"
9df9a5cd 735 skip_symbols \@layer_syms;
084592ab 736 # SFIO defines most of the PerlIO routines as macros
d892637e 737 # So undo most of what $perlio_sym has just done - d'oh !
738 # Perhaps it would be better to list the ones which do exist
739 # And emit them
084592ab 740 skip_symbols [qw(
741 PerlIO_canset_cnt
742 PerlIO_clearerr
743 PerlIO_close
744 PerlIO_eof
745 PerlIO_error
746 PerlIO_exportFILE
747 PerlIO_fast_gets
748 PerlIO_fdopen
749 PerlIO_fileno
750 PerlIO_findFILE
751 PerlIO_flush
752 PerlIO_get_base
753 PerlIO_get_bufsiz
754 PerlIO_get_cnt
755 PerlIO_get_ptr
756 PerlIO_getc
757 PerlIO_getname
758 PerlIO_has_base
759 PerlIO_has_cntptr
760 PerlIO_importFILE
761 PerlIO_open
762 PerlIO_printf
763 PerlIO_putc
764 PerlIO_puts
765 PerlIO_read
766 PerlIO_releaseFILE
767 PerlIO_reopen
768 PerlIO_rewind
769 PerlIO_seek
770 PerlIO_set_cnt
771 PerlIO_set_ptrcnt
772 PerlIO_setlinebuf
773 PerlIO_sprintf
774 PerlIO_stderr
775 PerlIO_stdin
776 PerlIO_stdout
777 PerlIO_stdoutf
778 PerlIO_tell
779 PerlIO_ungetc
780 PerlIO_vprintf
781 PerlIO_write
bcdb689b 782 PerlIO_perlio
783 Perl_PerlIO_clearerr
784 Perl_PerlIO_close
785 Perl_PerlIO_eof
786 Perl_PerlIO_error
787 Perl_PerlIO_fileno
788 Perl_PerlIO_fill
789 Perl_PerlIO_flush
790 Perl_PerlIO_get_base
791 Perl_PerlIO_get_bufsiz
792 Perl_PerlIO_get_cnt
793 Perl_PerlIO_get_ptr
794 Perl_PerlIO_read
795 Perl_PerlIO_seek
796 Perl_PerlIO_set_cnt
797 Perl_PerlIO_set_ptrcnt
798 Perl_PerlIO_setlinebuf
799 Perl_PerlIO_stderr
800 Perl_PerlIO_stdin
801 Perl_PerlIO_stdout
802 Perl_PerlIO_tell
803 Perl_PerlIO_unread
804 Perl_PerlIO_write
084592ab 805 )];
806 }
d892637e 807 else {
808 # PerlIO with layers - export implementation
809 emit_symbols \@layer_syms;
810 }
5138f914 811} else {
d892637e 812 # -Uuseperlio
813 # Skip the PerlIO layer symbols - although
814 # nothing should have exported them any way
9df9a5cd 815 skip_symbols \@layer_syms;
1e8a8f59 816 skip_symbols [qw(PL_def_layerlist PL_known_layers PL_perlio)];
817
d892637e 818 # Also do NOT add abstraction symbols from $perlio_sym
819 # abstraction is done as #define to stdio
820 # Remaining remnants that _may_ be functions
821 # are handled in <DATA>
9df9a5cd 822}
7766f137 823
824for my $syms (@syms) {
825 open (GLOBAL, "<$syms") || die "failed to open $syms: $!\n";
826 while (<GLOBAL>) {
827 next if (!/^[A-Za-z]/);
828 # Functions have a Perl_ prefix
829 # Variables have a PL_ prefix
830 chomp($_);
831 my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : "");
832 $symbol .= $_;
833 emit_symbol($symbol) unless exists $skip{$symbol};
834 }
835 close(GLOBAL);
836}
0a753a76 837
22c35a8c 838# variables
0a753a76 839
acfe0abc 840if ($define{'MULTIPLICITY'}) {
1acb48c9 841 for my $f ($perlvars_h, $intrpvar_h, $thrdvar_h) {
18c4b137 842 my $glob = readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" });
843 emit_symbols $glob;
18c4b137 844 }
1acb48c9 845 # XXX AIX seems to want the perlvars.h symbols, for some reason
846 if ($PLATFORM eq 'aix') {
847 my $glob = readvar($perlvars_h);
51371543 848 emit_symbols $glob;
849 }
850}
851else {
852 unless ($define{'PERL_GLOBAL_STRUCT'}) {
549a6b10 853 my $glob = readvar($perlvars_h);
51371543 854 emit_symbols $glob;
9df9a5cd 855 }
51371543 856 unless ($define{'MULTIPLICITY'}) {
549a6b10 857 my $glob = readvar($intrpvar_h);
51371543 858 emit_symbols $glob;
9df9a5cd 859 }
bbda9c9d 860 unless ($define{'MULTIPLICITY'} || $define{'USE_5005THREADS'}) {
549a6b10 861 my $glob = readvar($thrdvar_h);
51371543 862 emit_symbols $glob;
9df9a5cd 863 }
51371543 864}
0a753a76 865
549a6b10 866sub try_symbol {
867 my $symbol = shift;
22239a37 868
4d6b4052 869 return if $symbol !~ /^[A-Za-z_]/;
549a6b10 870 return if $symbol =~ /^\#/;
871 $symbol =~s/\r//g;
872 chomp($symbol);
43cd9f80 873 return if exists $skip{$symbol};
549a6b10 874 emit_symbol($symbol);
3e3baf6d 875}
0a753a76 876
549a6b10 877while (<DATA>) {
878 try_symbol($_);
ac4c12e7 879}
880
549a6b10 881if ($PLATFORM eq 'win32') {
882 foreach my $symbol (qw(
00b02797 883 setuid
884 setgid
7766f137 885 boot_DynaLoader
7766f137 886 Perl_init_os_extras
c44d3fdb 887 Perl_thread_create
7766f137 888 Perl_win32_init
889 RunPerl
5290524f 890 win32_async_check
7766f137 891 win32_errno
892 win32_environ
7766f137 893 win32_abort
894 win32_fstat
895 win32_stat
896 win32_pipe
897 win32_popen
898 win32_pclose
899 win32_rename
900 win32_setmode
901 win32_lseek
902 win32_tell
903 win32_dup
904 win32_dup2
905 win32_open
906 win32_close
907 win32_eof
908 win32_read
909 win32_write
910 win32_spawnvp
911 win32_mkdir
912 win32_rmdir
913 win32_chdir
914 win32_flock
915 win32_execv
916 win32_execvp
917 win32_htons
918 win32_ntohs
919 win32_htonl
920 win32_ntohl
921 win32_inet_addr
922 win32_inet_ntoa
923 win32_socket
924 win32_bind
925 win32_listen
926 win32_accept
927 win32_connect
928 win32_send
929 win32_sendto
930 win32_recv
931 win32_recvfrom
932 win32_shutdown
933 win32_closesocket
934 win32_ioctlsocket
935 win32_setsockopt
936 win32_getsockopt
937 win32_getpeername
938 win32_getsockname
939 win32_gethostname
940 win32_gethostbyname
941 win32_gethostbyaddr
942 win32_getprotobyname
943 win32_getprotobynumber
944 win32_getservbyname
945 win32_getservbyport
946 win32_select
947 win32_endhostent
948 win32_endnetent
949 win32_endprotoent
950 win32_endservent
951 win32_getnetent
952 win32_getnetbyname
953 win32_getnetbyaddr
954 win32_getprotoent
955 win32_getservent
956 win32_sethostent
957 win32_setnetent
958 win32_setprotoent
959 win32_setservent
960 win32_getenv
961 win32_putenv
962 win32_perror
7766f137 963 win32_malloc
964 win32_calloc
965 win32_realloc
966 win32_free
967 win32_sleep
968 win32_times
969 win32_access
970 win32_alarm
971 win32_chmod
972 win32_open_osfhandle
973 win32_get_osfhandle
974 win32_ioctl
975 win32_link
976 win32_unlink
977 win32_utime
978 win32_uname
979 win32_wait
980 win32_waitpid
981 win32_kill
982 win32_str_os_error
983 win32_opendir
984 win32_readdir
985 win32_telldir
986 win32_seekdir
987 win32_rewinddir
988 win32_closedir
989 win32_longpath
990 win32_os_id
991 win32_getpid
992 win32_crypt
993 win32_dynaload
df3728a2 994 win32_get_childenv
995 win32_free_childenv
996 win32_clearenv
997 win32_get_childdir
998 win32_free_childdir
00b02797 999 win32_stdin
1000 win32_stdout
1001 win32_stderr
1002 win32_ferror
1003 win32_feof
1004 win32_strerror
1005 win32_fprintf
1006 win32_printf
1007 win32_vfprintf
1008 win32_vprintf
1009 win32_fread
1010 win32_fwrite
1011 win32_fopen
1012 win32_fdopen
1013 win32_freopen
1014 win32_fclose
1015 win32_fputs
1016 win32_fputc
1017 win32_ungetc
1018 win32_getc
1019 win32_fileno
1020 win32_clearerr
1021 win32_fflush
1022 win32_ftell
1023 win32_fseek
1024 win32_fgetpos
1025 win32_fsetpos
1026 win32_rewind
1027 win32_tmpfile
1028 win32_setbuf
1029 win32_setvbuf
1030 win32_flushall
1031 win32_fcloseall
1032 win32_fgets
1033 win32_gets
1034 win32_fgetc
1035 win32_putc
1036 win32_puts
1037 win32_getchar
1038 win32_putchar
7766f137 1039 ))
1040 {
549a6b10 1041 try_symbol($symbol);
1042 }
1043}
3cfae81b 1044elsif ($PLATFORM eq 'os2') {
7766f137 1045 open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
1046 /^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>;
1047 close MAP or die 'Cannot close miniperl.map';
1048
ad6971c8 1049 @missing = grep { !exists $mapped{$_} }
7766f137 1050 keys %export;
1051 delete $export{$_} foreach @missing;
3cfae81b 1052}
084592ab 1053elsif ($PLATFORM eq 'MacOS') {
1054 open MACSYMS, 'macperl.sym' or die 'Cannot read macperl.sym';
1055
1056 while (<MACSYMS>) {
1057 try_symbol($_);
1058 }
1059
1060 close MACSYMS;
1061}
2986a63f 1062elsif ($PLATFORM eq 'netware') {
1063foreach my $symbol (qw(
1064 boot_DynaLoader
1065 Perl_init_os_extras
1066 Perl_thread_create
1067 Perl_nw5_init
1068 RunPerl
1069 AllocStdPerl
1070 FreeStdPerl
1071 do_spawn2
1072 do_aspawn
1073 nw_uname
1074 nw_stdin
1075 nw_stdout
1076 nw_stderr
1077 nw_feof
1078 nw_ferror
1079 nw_fopen
1080 nw_fclose
1081 nw_clearerr
1082 nw_getc
1083 nw_fgets
1084 nw_fputc
1085 nw_fputs
1086 nw_fflush
1087 nw_ungetc
1088 nw_fileno
1089 nw_fdopen
1090 nw_freopen
1091 nw_fread
1092 nw_fwrite
1093 nw_setbuf
1094 nw_setvbuf
1095 nw_vfprintf
1096 nw_ftell
1097 nw_fseek
1098 nw_rewind
1099 nw_tmpfile
1100 nw_fgetpos
1101 nw_fsetpos
1102 nw_dup
1103 nw_access
1104 nw_chmod
1105 nw_chsize
1106 nw_close
1107 nw_dup2
1108 nw_flock
1109 nw_isatty
1110 nw_link
1111 nw_lseek
1112 nw_stat
1113 nw_mktemp
1114 nw_open
1115 nw_read
1116 nw_rename
1117 nw_setmode
1118 nw_unlink
1119 nw_utime
1120 nw_write
1121 nw_chdir
1122 nw_rmdir
1123 nw_closedir
1124 nw_opendir
1125 nw_readdir
1126 nw_rewinddir
1127 nw_seekdir
1128 nw_telldir
1129 nw_htonl
1130 nw_htons
1131 nw_ntohl
1132 nw_ntohs
1133 nw_accept
1134 nw_bind
1135 nw_connect
1136 nw_endhostent
1137 nw_endnetent
1138 nw_endprotoent
1139 nw_endservent
1140 nw_gethostbyaddr
1141 nw_gethostbyname
1142 nw_gethostent
1143 nw_gethostname
1144 nw_getnetbyaddr
1145 nw_getnetbyname
1146 nw_getnetent
1147 nw_getpeername
1148 nw_getprotobyname
1149 nw_getprotobynumber
1150 nw_getprotoent
1151 nw_getservbyname
1152 nw_getservbyport
1153 nw_getservent
1154 nw_getsockname
1155 nw_getsockopt
1156 nw_inet_addr
1157 nw_listen
1158 nw_socket
1159 nw_recv
1160 nw_recvfrom
1161 nw_select
1162 nw_send
1163 nw_sendto
1164 nw_sethostent
1165 nw_setnetent
1166 nw_setprotoent
1167 nw_setservent
3a0827a6 1168 nw_setsockopt
4d76e4b4 1169 nw_inet_ntoa
2986a63f 1170 nw_shutdown
1171 nw_crypt
1172 nw_execvp
1173 nw_kill
1174 nw_Popen
1175 nw_Pclose
1176 nw_Pipe
1177 nw_times
1178 nw_waitpid
1179 nw_getpid
1180 nw_spawnvp
1181 nw_os_id
1182 nw_open_osfhandle
1183 nw_get_osfhandle
1184 nw_abort
1185 nw_sleep
1186 nw_wait
1187 nw_dynaload
1188 nw_strerror
1189 fnFpSetMode
1190 fnInsertHashListAddrs
1191 fnGetHashListAddrs
1192 Perl_deb
011f1a1a 1193 Perl_sv_setsv
1194 Perl_sv_catsv
1195 Perl_sv_catpvn
1196 Perl_sv_2pv
2986a63f 1197 ))
1198 {
1199 try_symbol($symbol);
1200 }
1201}
22239a37 1202
549a6b10 1203# Now all symbols should be defined because
1204# next we are going to output them.
1205
7766f137 1206foreach my $symbol (sort keys %export) {
1207 output_symbol($symbol);
1208}
549a6b10 1209
011f1a1a 1210if ($PLATFORM eq 'os2') {
52e4c282 1211 print "; LAST_ORDINAL=$sym_ord\n";
2986a63f 1212}
1213
549a6b10 1214sub emit_symbol {
7766f137 1215 my $symbol = shift;
9df9a5cd 1216 chomp($symbol);
7766f137 1217 $export{$symbol} = 1;
549a6b10 1218}
1219
1220sub output_symbol {
1221 my $symbol = shift;
1222 if ($PLATFORM eq 'win32') {
549a6b10 1223 $symbol = "_$symbol" if $CCTYPE eq 'BORLAND';
520c758a 1224 print "\t$symbol\n";
549a6b10 1225# XXX: binary compatibility between compilers is an exercise
1226# in frustration :-(
1227# if ($CCTYPE eq "BORLAND") {
1228# # workaround Borland quirk by exporting both the straight
1229# # name and a name with leading underscore. Note the
1230# # alias *must* come after the symbol itself, if both
1231# # are to be exported. (Linker bug?)
1232# print "\t_$symbol\n";
1233# print "\t$symbol = _$symbol\n";
1234# }
1235# elsif ($CCTYPE eq 'GCC') {
1236# # Symbols have leading _ whole process is $%@"% slow
1237# # so skip aliases for now
1238# nprint "\t$symbol\n";
1239# }
1240# else {
1241# # for binary coexistence, export both the symbol and
1242# # alias with leading underscore
1243# print "\t$symbol\n";
1244# print "\t_$symbol = $symbol\n";
1245# }
7766f137 1246 }
1247 elsif ($PLATFORM eq 'os2') {
52e4c282 1248 printf qq( %-31s \@%s\n),
1249 qq("$symbol"), $ordinal{$symbol} || ++$sym_ord;
7766f137 1250 }
084592ab 1251 elsif ($PLATFORM eq 'aix' || $PLATFORM eq 'MacOS') {
549a6b10 1252 print "$symbol\n";
1253 }
2986a63f 1254 elsif ($PLATFORM eq 'netware') {
1255 print "\t$symbol,\n";
1256 }
549a6b10 1257}
1258
12591;
1260__DATA__
1261# extra globals not included above.
8437356b 1262Perl_cxinc
549a6b10 1263perl_alloc
7766f137 1264perl_alloc_using
014822e4 1265perl_clone
1266perl_clone_using
549a6b10 1267perl_construct
1268perl_destruct
1269perl_free
1270perl_parse
1271perl_run
b6d604f4 1272# Oddities from PerlIO
568ad336 1273PerlIO_binmode
8437356b 1274PerlIO_getpos
568ad336 1275PerlIO_init
568ad336 1276PerlIO_setpos
568ad336 1277PerlIO_sprintf
8437356b 1278PerlIO_sv_dup
1279PerlIO_tmpfile
8437356b 1280PerlIO_vsprintf
1281perlsio_binmode