source: trunk/essentials/dev-lang/perl/makedef.pl@ 3222

Last change on this file since 3222 was 3203, checked in by bird, 18 years ago

wlink

File size: 32.7 KB
Line 
1#
2# Create the export list for perl.
3#
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.
7#
8# reads global.sym, pp.sym, perlvars.h, intrpvar.h, thrdvar.h, config.h
9# On OS/2 reads miniperl.map and the previous version of perl5.def as well
10
11my $PLATFORM;
12my $CCTYPE;
13
14while (@ARGV) {
15 my $flag = shift;
16 if ($flag =~ s/^CC_FLAGS=/ /) {
17 for my $fflag ($flag =~ /(?:^|\s)-D(\S+)/g) {
18 $fflag .= '=1' unless $fflag =~ /^(\w+)=/;
19 $define{$1} = $2 if $fflag =~ /^(\w+)=(.+)$/;
20 }
21 next;
22 }
23 $define{$1} = 1 if ($flag =~ /^-D(\w+)$/);
24 $define{$1} = $2 if ($flag =~ /^-D(\w+)=(.+)$/);
25 $CCTYPE = $1 if ($flag =~ /^CCTYPE=(\w+)$/);
26 $PLATFORM = $1 if ($flag =~ /^PLATFORM=(\w+)$/);
27 if ($PLATFORM eq 'netware') {
28 $FILETYPE = $1 if ($flag =~ /^FILETYPE=(\w+)$/);
29 }
30}
31
32my @PLATFORM = qw(aix win32 wince os2 MacOS netware);
33my %PLATFORM;
34@PLATFORM{@PLATFORM} = ();
35
36defined $PLATFORM || die "PLATFORM undefined, must be one of: @PLATFORM\n";
37exists $PLATFORM{$PLATFORM} || die "PLATFORM must be one of: @PLATFORM\n";
38
39if ($PLATFORM eq 'win32' or $PLATFORM eq "aix") {
40 # Add the compile-time options that miniperl was built with to %define.
41 # On Win32 these are not the same options as perl itself will be built
42 # with since miniperl is built with a canned config (one of the win32/
43 # config_H.*) and none of the BUILDOPT's that are set in the makefiles,
44 # but they do include some #define's that are hard-coded in various
45 # source files and header files and don't include any BUILDOPT's that
46 # the user might have chosen to disable because the canned configs are
47 # minimal configs that don't include any of those options.
48 my $config = `$^X -Ilib -V`;
49 my($options) = $config =~ /^ Compile-time options: (.*?)\n^ \S/ms;
50 $options =~ s/\s+/ /g;
51 print STDERR "Options: ($options)\n";
52 foreach (split /\s+/, $options) {
53 $define{$_} = 1;
54 }
55}
56
57my %exportperlmalloc =
58 (
59 Perl_malloc => "malloc",
60 Perl_mfree => "free",
61 Perl_realloc => "realloc",
62 Perl_calloc => "calloc",
63 );
64
65my $exportperlmalloc = $PLATFORM eq 'os2';
66
67my $config_sh = "config.sh";
68my $config_h = "config.h";
69my $thrdvar_h = "thrdvar.h";
70my $intrpvar_h = "intrpvar.h";
71my $perlvars_h = "perlvars.h";
72my $global_sym = "global.sym";
73my $pp_sym = "pp.sym";
74my $globvar_sym = "globvar.sym";
75my $perlio_sym = "perlio.sym";
76my $static_ext = "";
77
78if ($PLATFORM eq 'aix') {
79 # Nothing for now.
80}
81elsif ($PLATFORM =~ /^win(?:32|ce)$/ || $PLATFORM eq 'netware') {
82 $CCTYPE = "MSVC" unless defined $CCTYPE;
83 foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym,
84 $pp_sym, $globvar_sym, $perlio_sym) {
85 s!^!..\\!;
86 }
87}
88elsif ($PLATFORM eq 'MacOS') {
89 foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym,
90 $pp_sym, $globvar_sym, $perlio_sym) {
91 s!^!::!;
92 }
93}
94
95unless ($PLATFORM eq 'win32' || $PLATFORM eq 'wince' || $PLATFORM eq 'MacOS' || $PLATFORM eq 'netware') {
96 open(CFG,$config_sh) || die "Cannot open $config_sh: $!\n";
97 while (<CFG>) {
98 if (/^(?:ccflags|optimize)='(.+)'$/) {
99 $_ = $1;
100 $define{$1} = 1 while /-D(\w+)/g;
101 }
102 if ($PLATFORM eq 'os2') {
103 $CONFIG_ARGS = $1 if /^config_args='(.+)'$/;
104 $ARCHNAME = $1 if /^archname='(.+)'$/;
105 $PATCHLEVEL = $1 if /^perl_patchlevel='(.+)'$/;
106 }
107 }
108 close(CFG);
109}
110if ($PLATFORM eq 'win32' || $PLATFORM eq 'wince') {
111 open(CFG,"<..\\$config_sh") || die "Cannot open ..\\$config_sh: $!\n";
112 if ((join '', <CFG>) =~ /^static_ext='(.*)'$/m) {
113 $static_ext = $1;
114 }
115 close(CFG);
116}
117
118open(CFG,$config_h) || die "Cannot open $config_h: $!\n";
119while (<CFG>) {
120 $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/;
121 $define{$1} = 1 if /^\s*#\s*define\s+(MULTIPLICITY)\b/;
122 $define{$1} = 1 if /^\s*#\s*define\s+(PERL_\w+)\b/;
123 $define{$1} = 1 if /^\s*#\s*define\s+(USE_\w+)\b/;
124}
125close(CFG);
126
127# perl.h logic duplication begins
128
129if ($define{PERL_IMPLICIT_SYS}) {
130 $define{PL_OP_SLAB_ALLOC} = 1;
131}
132
133if ($define{USE_ITHREADS}) {
134 if (!$define{MULTIPLICITY}) {
135 $define{MULTIPLICITY} = 1;
136 }
137}
138
139$define{PERL_IMPLICIT_CONTEXT} ||=
140 $define{USE_ITHREADS} ||
141 $define{USE_5005THREADS} ||
142 $define{MULTIPLICITY} ;
143
144if ($define{USE_ITHREADS} && $PLATFORM ne 'win32' && $^O ne 'darwin') {
145 $define{USE_REENTRANT_API} = 1;
146}
147
148# perl.h logic duplication ends
149
150my $sym_ord = 0;
151
152print STDERR "Defines: (" . join(' ', sort keys %define) . ")\n";
153
154if ($PLATFORM =~ /^win(?:32|ce)$/) {
155 ($dll = ($define{PERL_DLL} || "perl58")) =~ s/\.dll$//i;
156 print "LIBRARY $dll\n";
157 print "DESCRIPTION 'Perl interpreter'\n";
158 print "EXPORTS\n";
159 if ($define{PERL_IMPLICIT_SYS}) {
160 output_symbol("perl_get_host_info");
161 output_symbol("perl_alloc_override");
162 }
163 if ($define{USE_ITHREADS} and $define{PERL_IMPLICIT_SYS}) {
164 output_symbol("perl_clone_host");
165 }
166}
167elsif ($PLATFORM eq 'os2') {
168 if (open my $fh, '<', 'perl5.def') {
169 while (<$fh>) {
170 last if /^\s*EXPORTS\b/;
171 }
172 while (<$fh>) {
173 $ordinal{$1} = $2 if /^\s*"(\w+)"\s*(?:=\s*"\w+"\s*)?\@(\d+)\s*$/;
174 # This allows skipping ordinals which were used in older versions
175 $sym_ord = $1 if /^\s*;\s*LAST_ORDINAL\s*=\s*(\d+)\s*$/;
176 }
177 $sym_ord < $_ and $sym_ord = $_ for values %ordinal; # Take the max
178 }
179 ($v = $]) =~ s/(\d\.\d\d\d)(\d\d)$/$1_$2/;
180 $v .= '-thread' if $ARCHNAME =~ /-thread/;
181 ($dll = $define{PERL_DLL}) =~ s/\.dll$//i;
182 $v .= "\@$PATCHLEVEL" if $PATCHLEVEL;
183 $d = "DESCRIPTION '\@#perl5-porters\@perl.org:$v#\@ Perl interpreter, configured as $CONFIG_ARGS'";
184 $d = substr($d, 0, 249) . "...'" if length $d > 253;
185 print <<"---EOP---";
186LIBRARY '$dll' INITINSTANCE TERMINSTANCE
187$d
188STACKSIZE 32768
189CODE LOADONCALL
190DATA LOADONCALL NONSHARED MULTIPLE
191EXPORTS
192---EOP---
193}
194elsif ($PLATFORM eq 'aix') {
195 $OSVER = `uname -v`;
196 chop $OSVER;
197 $OSREL = `uname -r`;
198 chop $OSREL;
199 if ($OSVER > 4 || ($OSVER == 4 && $OSREL >= 3)) {
200 print "#! ..\n";
201 } else {
202 print "#!\n";
203 }
204}
205elsif ($PLATFORM eq 'netware') {
206 if ($FILETYPE eq 'def') {
207 print "LIBRARY perl58\n";
208 print "DESCRIPTION 'Perl interpreter for NetWare'\n";
209 print "EXPORTS\n";
210 }
211 if ($define{PERL_IMPLICIT_SYS}) {
212 output_symbol("perl_get_host_info");
213 output_symbol("perl_alloc_override");
214 output_symbol("perl_clone_host");
215 }
216}
217
218my %skip;
219my %export;
220
221sub skip_symbols {
222 my $list = shift;
223 foreach my $symbol (@$list) {
224 $skip{$symbol} = 1;
225 }
226}
227
228sub emit_symbols {
229 my $list = shift;
230 foreach my $symbol (@$list) {
231 my $skipsym = $symbol;
232 # XXX hack
233 if ($define{MULTIPLICITY}) {
234 $skipsym =~ s/^Perl_[GIT](\w+)_ptr$/PL_$1/;
235 }
236 emit_symbol($symbol) unless exists $skip{$skipsym};
237 }
238}
239
240if ($PLATFORM eq 'win32') {
241 skip_symbols [qw(
242 PL_statusvalue_vms
243 PL_archpat_auto
244 PL_cryptseen
245 PL_DBcv
246 PL_generation
247 PL_lastgotoprobe
248 PL_linestart
249 PL_modcount
250 PL_pending_ident
251 PL_sortcxix
252 PL_sublex_info
253 PL_timesbuf
254 main
255 Perl_ErrorNo
256 Perl_GetVars
257 Perl_do_exec3
258 Perl_do_ipcctl
259 Perl_do_ipcget
260 Perl_do_msgrcv
261 Perl_do_msgsnd
262 Perl_do_semop
263 Perl_do_shmio
264 Perl_dump_fds
265 Perl_init_thread_intern
266 Perl_my_bzero
267 Perl_my_bcopy
268 Perl_my_htonl
269 Perl_my_ntohl
270 Perl_my_swap
271 Perl_my_chsize
272 Perl_same_dirent
273 Perl_setenv_getix
274 Perl_unlnk
275 Perl_watch
276 Perl_safexcalloc
277 Perl_safexmalloc
278 Perl_safexfree
279 Perl_safexrealloc
280 Perl_my_memcmp
281 Perl_my_memset
282 PL_cshlen
283 PL_cshname
284 PL_opsave
285 Perl_do_exec
286 Perl_getenv_len
287 Perl_my_pclose
288 Perl_my_popen
289 Perl_my_sprintf
290 )];
291}
292else {
293 skip_symbols [qw(
294 Perl_do_spawn
295 Perl_do_spawn_nowait
296 Perl_do_aspawn
297 )];
298}
299if ($PLATFORM eq 'wince') {
300 skip_symbols [qw(
301 PL_statusvalue_vms
302 PL_archpat_auto
303 PL_cryptseen
304 PL_DBcv
305 PL_generation
306 PL_lastgotoprobe
307 PL_linestart
308 PL_modcount
309 PL_pending_ident
310 PL_sortcxix
311 PL_sublex_info
312 PL_timesbuf
313 PL_collation_ix
314 PL_collation_name
315 PL_collation_standard
316 PL_collxfrm_base
317 PL_collxfrm_mult
318 PL_numeric_compat1
319 PL_numeric_local
320 PL_numeric_name
321 PL_numeric_radix_sv
322 PL_numeric_standard
323 PL_vtbl_collxfrm
324 Perl_sv_collxfrm
325 setgid
326 setuid
327 win32_free_childdir
328 win32_free_childenv
329 win32_get_childdir
330 win32_get_childenv
331 win32_spawnvp
332 main
333 Perl_ErrorNo
334 Perl_GetVars
335 Perl_do_exec3
336 Perl_do_ipcctl
337 Perl_do_ipcget
338 Perl_do_msgrcv
339 Perl_do_msgsnd
340 Perl_do_semop
341 Perl_do_shmio
342 Perl_dump_fds
343 Perl_init_thread_intern
344 Perl_my_bzero
345 Perl_my_bcopy
346 Perl_my_htonl
347 Perl_my_ntohl
348 Perl_my_swap
349 Perl_my_chsize
350 Perl_same_dirent
351 Perl_setenv_getix
352 Perl_unlnk
353 Perl_watch
354 Perl_safexcalloc
355 Perl_safexmalloc
356 Perl_safexfree
357 Perl_safexrealloc
358 Perl_my_memcmp
359 Perl_my_memset
360 PL_cshlen
361 PL_cshname
362 PL_opsave
363 Perl_do_exec
364 Perl_getenv_len
365 Perl_my_pclose
366 Perl_my_popen
367 Perl_my_sprintf
368 )];
369}
370elsif ($PLATFORM eq 'aix') {
371 skip_symbols([qw(
372 Perl_dump_fds
373 Perl_ErrorNo
374 Perl_GetVars
375 Perl_my_bcopy
376 Perl_my_bzero
377 Perl_my_chsize
378 Perl_my_htonl
379 Perl_my_memcmp
380 Perl_my_memset
381 Perl_my_ntohl
382 Perl_my_swap
383 Perl_safexcalloc
384 Perl_safexfree
385 Perl_safexmalloc
386 Perl_safexrealloc
387 Perl_same_dirent
388 Perl_unlnk
389 Perl_sys_intern_clear
390 Perl_sys_intern_dup
391 Perl_sys_intern_init
392 PL_cryptseen
393 PL_opsave
394 PL_statusvalue_vms
395 PL_sys_intern
396 )]);
397}
398elsif ($PLATFORM eq 'os2') {
399 emit_symbols([qw(
400 ctermid
401 get_sysinfo
402 Perl_OS2_init
403 Perl_OS2_init3
404 Perl_OS2_term
405 OS2_Perl_data
406 dlopen
407 dlsym
408 dlerror
409 dlclose
410 dup2
411 dup
412 my_tmpfile
413 my_tmpnam
414 my_flock
415 my_rmdir
416 my_mkdir
417 my_getpwuid
418 my_getpwnam
419 my_getpwent
420 my_setpwent
421 my_endpwent
422 fork_with_resources
423 croak_with_os2error
424 setgrent
425 endgrent
426 getgrent
427 malloc_mutex
428 threads_mutex
429 nthreads
430 nthreads_cond
431 os2_cond_wait
432 os2_stat
433 os2_execname
434 async_mssleep
435 msCounter
436 InfoTable
437 pthread_join
438 pthread_create
439 pthread_detach
440 XS_Cwd_change_drive
441 XS_Cwd_current_drive
442 XS_Cwd_extLibpath
443 XS_Cwd_extLibpath_set
444 XS_Cwd_sys_abspath
445 XS_Cwd_sys_chdir
446 XS_Cwd_sys_cwd
447 XS_Cwd_sys_is_absolute
448 XS_Cwd_sys_is_relative
449 XS_Cwd_sys_is_rooted
450 XS_DynaLoader_mod2fname
451 XS_File__Copy_syscopy
452 Perl_Register_MQ
453 Perl_Deregister_MQ
454 Perl_Serve_Messages
455 Perl_Process_Messages
456 init_PMWIN_entries
457 PMWIN_entries
458 Perl_hab_GET
459 loadByOrdinal
460 pExtFCN
461 os2error
462 ResetWinError
463 CroakWinError
464 PL_do_undump
465 )]);
466 emit_symbols([qw(os2_cond_wait
467 pthread_join
468 pthread_create
469 pthread_detach
470 )])
471 if $define{'USE_5005THREADS'} or $define{'USE_ITHREADS'};
472}
473elsif ($PLATFORM eq 'MacOS') {
474 skip_symbols [qw(
475 Perl_GetVars
476 PL_cryptseen
477 PL_cshlen
478 PL_cshname
479 PL_statusvalue_vms
480 PL_sys_intern
481 PL_opsave
482 PL_timesbuf
483 Perl_dump_fds
484 Perl_my_bcopy
485 Perl_my_bzero
486 Perl_my_chsize
487 Perl_my_htonl
488 Perl_my_memcmp
489 Perl_my_memset
490 Perl_my_ntohl
491 Perl_my_swap
492 Perl_safexcalloc
493 Perl_safexfree
494 Perl_safexmalloc
495 Perl_safexrealloc
496 Perl_unlnk
497 Perl_sys_intern_clear
498 Perl_sys_intern_init
499 )];
500}
501elsif ($PLATFORM eq 'netware') {
502 skip_symbols [qw(
503 PL_statusvalue_vms
504 PL_archpat_auto
505 PL_cryptseen
506 PL_DBcv
507 PL_generation
508 PL_lastgotoprobe
509 PL_linestart
510 PL_modcount
511 PL_pending_ident
512 PL_sortcxix
513 PL_sublex_info
514 PL_timesbuf
515 main
516 Perl_ErrorNo
517 Perl_GetVars
518 Perl_do_exec3
519 Perl_do_ipcctl
520 Perl_do_ipcget
521 Perl_do_msgrcv
522 Perl_do_msgsnd
523 Perl_do_semop
524 Perl_do_shmio
525 Perl_dump_fds
526 Perl_init_thread_intern
527 Perl_my_bzero
528 Perl_my_htonl
529 Perl_my_ntohl
530 Perl_my_swap
531 Perl_my_chsize
532 Perl_same_dirent
533 Perl_setenv_getix
534 Perl_unlnk
535 Perl_watch
536 Perl_safexcalloc
537 Perl_safexmalloc
538 Perl_safexfree
539 Perl_safexrealloc
540 Perl_my_memcmp
541 Perl_my_memset
542 PL_cshlen
543 PL_cshname
544 PL_opsave
545 Perl_do_exec
546 Perl_getenv_len
547 Perl_my_pclose
548 Perl_my_popen
549 Perl_sys_intern_init
550 Perl_sys_intern_dup
551 Perl_sys_intern_clear
552 Perl_my_bcopy
553 Perl_PerlIO_write
554 Perl_PerlIO_unread
555 Perl_PerlIO_tell
556 Perl_PerlIO_stdout
557 Perl_PerlIO_stdin
558 Perl_PerlIO_stderr
559 Perl_PerlIO_setlinebuf
560 Perl_PerlIO_set_ptrcnt
561 Perl_PerlIO_set_cnt
562 Perl_PerlIO_seek
563 Perl_PerlIO_read
564 Perl_PerlIO_get_ptr
565 Perl_PerlIO_get_cnt
566 Perl_PerlIO_get_bufsiz
567 Perl_PerlIO_get_base
568 Perl_PerlIO_flush
569 Perl_PerlIO_fill
570 Perl_PerlIO_fileno
571 Perl_PerlIO_error
572 Perl_PerlIO_eof
573 Perl_PerlIO_close
574 Perl_PerlIO_clearerr
575 PerlIO_perlio
576 )];
577}
578
579unless ($define{'DEBUGGING'}) {
580 skip_symbols [qw(
581 Perl_deb_growlevel
582 Perl_debop
583 Perl_debprofdump
584 Perl_debstack
585 Perl_debstackptrs
586 Perl_sv_peek
587 PL_block_type
588 PL_watchaddr
589 PL_watchok
590 )];
591}
592
593if ($define{'PERL_IMPLICIT_SYS'}) {
594 skip_symbols [qw(
595 Perl_getenv_len
596 Perl_my_popen
597 Perl_my_pclose
598 )];
599}
600else {
601 skip_symbols [qw(
602 PL_Mem
603 PL_MemShared
604 PL_MemParse
605 PL_Env
606 PL_StdIO
607 PL_LIO
608 PL_Dir
609 PL_Sock
610 PL_Proc
611 )];
612}
613
614unless ($define{'PERL_FLEXIBLE_EXCEPTIONS'}) {
615 skip_symbols [qw(
616 PL_protect
617 Perl_default_protect
618 Perl_vdefault_protect
619 )];
620}
621
622unless ($define{'USE_REENTRANT_API'}) {
623 skip_symbols [qw(
624 PL_reentrant_buffer
625 )];
626}
627
628if ($define{'MYMALLOC'}) {
629 emit_symbols [qw(
630 Perl_dump_mstats
631 Perl_get_mstats
632 Perl_strdup
633 Perl_putenv
634 MallocCfg_ptr
635 MallocCfgP_ptr
636 )];
637 if ($define{'USE_5005THREADS'} || $define{'USE_ITHREADS'}) {
638 emit_symbols [qw(
639 PL_malloc_mutex
640 )];
641 }
642 else {
643 skip_symbols [qw(
644 PL_malloc_mutex
645 )];
646 }
647}
648else {
649 skip_symbols [qw(
650 PL_malloc_mutex
651 Perl_dump_mstats
652 Perl_get_mstats
653 Perl_malloced_size
654 MallocCfg_ptr
655 MallocCfgP_ptr
656 )];
657}
658
659if ($define{'PERL_USE_SAFE_PUTENV'}) {
660 skip_symbols [qw(
661 PL_use_safe_putenv
662 )];
663}
664
665unless ($define{'USE_5005THREADS'} || $define{'USE_ITHREADS'}) {
666 skip_symbols [qw(
667 PL_thr_key
668 )];
669}
670
671unless ($define{'USE_5005THREADS'}) {
672 skip_symbols [qw(
673 PL_sv_mutex
674 PL_strtab_mutex
675 PL_svref_mutex
676 PL_cred_mutex
677 PL_eval_mutex
678 PL_fdpid_mutex
679 PL_sv_lock_mutex
680 PL_eval_cond
681 PL_eval_owner
682 PL_threads_mutex
683 PL_nthreads
684 PL_nthreads_cond
685 PL_threadnum
686 PL_threadsv_names
687 PL_thrsv
688 PL_vtbl_mutex
689 Perl_condpair_magic
690 Perl_new_struct_thread
691 Perl_per_thread_magicals
692 Perl_thread_create
693 Perl_find_threadsv
694 Perl_unlock_condpair
695 Perl_magic_mutexfree
696 Perl_sv_lock
697 )];
698}
699
700unless ($define{'USE_ITHREADS'}) {
701 skip_symbols [qw(
702 PL_ptr_table
703 PL_pte_root
704 PL_pte_arenaroot
705 PL_op_mutex
706 PL_regex_pad
707 PL_regex_padav
708 PL_sharedsv_space
709 PL_sharedsv_space_mutex
710 PL_dollarzero_mutex
711 Perl_dirp_dup
712 Perl_cx_dup
713 Perl_si_dup
714 Perl_any_dup
715 Perl_ss_dup
716 Perl_fp_dup
717 Perl_gp_dup
718 Perl_he_dup
719 Perl_mg_dup
720 Perl_re_dup
721 Perl_sv_dup
722 Perl_rvpv_dup
723 Perl_sys_intern_dup
724 Perl_ptr_table_clear
725 Perl_ptr_table_fetch
726 Perl_ptr_table_free
727 Perl_ptr_table_new
728 Perl_ptr_table_clear
729 Perl_ptr_table_free
730 Perl_ptr_table_split
731 Perl_ptr_table_store
732 perl_clone
733 perl_clone_using
734 Perl_sharedsv_find
735 Perl_sharedsv_init
736 Perl_sharedsv_lock
737 Perl_sharedsv_new
738 Perl_sharedsv_thrcnt_dec
739 Perl_sharedsv_thrcnt_inc
740 Perl_sharedsv_unlock
741 Perl_stashpv_hvname_match
742 )];
743}
744
745unless ($define{'PERL_IMPLICIT_CONTEXT'}) {
746 skip_symbols [qw(
747 Perl_croak_nocontext
748 Perl_die_nocontext
749 Perl_deb_nocontext
750 Perl_form_nocontext
751 Perl_load_module_nocontext
752 Perl_mess_nocontext
753 Perl_warn_nocontext
754 Perl_warner_nocontext
755 Perl_newSVpvf_nocontext
756 Perl_sv_catpvf_nocontext
757 Perl_sv_setpvf_nocontext
758 Perl_sv_catpvf_mg_nocontext
759 Perl_sv_setpvf_mg_nocontext
760 )];
761}
762
763unless ($define{'PERL_IMPLICIT_SYS'}) {
764 skip_symbols [qw(
765 perl_alloc_using
766 perl_clone_using
767 )];
768}
769
770unless ($define{'FAKE_THREADS'}) {
771 skip_symbols [qw(PL_curthr)];
772}
773
774unless ($define{'PL_OP_SLAB_ALLOC'}) {
775 skip_symbols [qw(
776 PL_OpPtr
777 PL_OpSlab
778 PL_OpSpace
779 Perl_Slab_Alloc
780 Perl_Slab_Free
781 )];
782}
783
784unless ($define{'THREADS_HAVE_PIDS'}) {
785 skip_symbols [qw(PL_ppid)];
786}
787
788unless ($define{'DEBUG_LEAKING_SCALARS_FORK_DUMP'}) {
789 skip_symbols [qw(
790 PL_dumper_fd
791 )];
792}
793unless ($define{'PERL_DONT_CREATE_GVSV'}) {
794 skip_symbols [qw(
795 Perl_gv_SVadd
796 )];
797}
798
799sub readvar {
800 my $file = shift;
801 my $proc = shift || sub { "PL_$_[2]" };
802 open(VARS,$file) || die "Cannot open $file: $!\n";
803 my @syms;
804 while (<VARS>) {
805 # All symbols have a Perl_ prefix because that's what embed.h
806 # sticks in front of them.
807 push(@syms, &$proc($1,$2,$3)) if (/\bPERLVAR(A?I?C?)\(([IGT])(\w+)/);
808 }
809 close(VARS);
810 return \@syms;
811}
812
813if ($define{'USE_5005THREADS'}) {
814 my $thrd = readvar($thrdvar_h);
815 skip_symbols $thrd;
816}
817
818if ($define{'PERL_GLOBAL_STRUCT'}) {
819 my $global = readvar($perlvars_h);
820 skip_symbols $global;
821 emit_symbol('Perl_GetVars');
822 emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC';
823}
824
825# functions from *.sym files
826
827my @syms = ($global_sym, $globvar_sym); # $pp_sym is not part of the API
828
829# Symbols that are the public face of the PerlIO layers implementation
830# These are in _addition to_ the public face of the abstraction
831# and need to be exported to allow XS modules to implement layers
832my @layer_syms = qw(
833 PerlIOBase_binmode
834 PerlIOBase_clearerr
835 PerlIOBase_close
836 PerlIOBase_dup
837 PerlIOBase_eof
838 PerlIOBase_error
839 PerlIOBase_fileno
840 PerlIOBase_noop_fail
841 PerlIOBase_noop_ok
842 PerlIOBase_popped
843 PerlIOBase_pushed
844 PerlIOBase_read
845 PerlIOBase_setlinebuf
846 PerlIOBase_unread
847 PerlIOBuf_bufsiz
848 PerlIOBuf_close
849 PerlIOBuf_dup
850 PerlIOBuf_fill
851 PerlIOBuf_flush
852 PerlIOBuf_get_base
853 PerlIOBuf_get_cnt
854 PerlIOBuf_get_ptr
855 PerlIOBuf_open
856 PerlIOBuf_popped
857 PerlIOBuf_pushed
858 PerlIOBuf_read
859 PerlIOBuf_seek
860 PerlIOBuf_set_ptrcnt
861 PerlIOBuf_tell
862 PerlIOBuf_unread
863 PerlIOBuf_write
864 PerlIO_allocate
865 PerlIO_apply_layera
866 PerlIO_apply_layers
867 PerlIO_arg_fetch
868 PerlIO_debug
869 PerlIO_define_layer
870 PerlIO_isutf8
871 PerlIO_layer_fetch
872 PerlIO_list_free
873 PerlIO_modestr
874 PerlIO_parse_layers
875 PerlIO_pending
876 PerlIO_perlio
877 PerlIO_pop
878 PerlIO_push
879 PerlIO_sv_dup
880 Perl_PerlIO_clearerr
881 Perl_PerlIO_close
882 Perl_PerlIO_eof
883 Perl_PerlIO_error
884 Perl_PerlIO_fileno
885 Perl_PerlIO_fill
886 Perl_PerlIO_flush
887 Perl_PerlIO_get_base
888 Perl_PerlIO_get_bufsiz
889 Perl_PerlIO_get_cnt
890 Perl_PerlIO_get_ptr
891 Perl_PerlIO_read
892 Perl_PerlIO_seek
893 Perl_PerlIO_set_cnt
894 Perl_PerlIO_set_ptrcnt
895 Perl_PerlIO_setlinebuf
896 Perl_PerlIO_stderr
897 Perl_PerlIO_stdin
898 Perl_PerlIO_stdout
899 Perl_PerlIO_tell
900 Perl_PerlIO_unread
901 Perl_PerlIO_write
902);
903if ($PLATFORM eq 'netware') {
904 push(@layer_syms,'PL_def_layerlist','PL_known_layers','PL_perlio');
905}
906
907if ($define{'USE_PERLIO'}) {
908 # Export the symols that make up the PerlIO abstraction, regardless
909 # of its implementation - read from a file
910 push @syms, $perlio_sym;
911
912 # This part is then dependent on how the abstraction is implemented
913 if ($define{'USE_SFIO'}) {
914 # Old legacy non-stdio "PerlIO"
915 skip_symbols \@layer_syms;
916 skip_symbols [qw(perlsio_binmode)];
917 # SFIO defines most of the PerlIO routines as macros
918 # So undo most of what $perlio_sym has just done - d'oh !
919 # Perhaps it would be better to list the ones which do exist
920 # And emit them
921 skip_symbols [qw(
922 PerlIO_canset_cnt
923 PerlIO_clearerr
924 PerlIO_close
925 PerlIO_eof
926 PerlIO_error
927 PerlIO_exportFILE
928 PerlIO_fast_gets
929 PerlIO_fdopen
930 PerlIO_fileno
931 PerlIO_findFILE
932 PerlIO_flush
933 PerlIO_get_base
934 PerlIO_get_bufsiz
935 PerlIO_get_cnt
936 PerlIO_get_ptr
937 PerlIO_getc
938 PerlIO_getname
939 PerlIO_has_base
940 PerlIO_has_cntptr
941 PerlIO_importFILE
942 PerlIO_open
943 PerlIO_printf
944 PerlIO_putc
945 PerlIO_puts
946 PerlIO_read
947 PerlIO_releaseFILE
948 PerlIO_reopen
949 PerlIO_rewind
950 PerlIO_seek
951 PerlIO_set_cnt
952 PerlIO_set_ptrcnt
953 PerlIO_setlinebuf
954 PerlIO_sprintf
955 PerlIO_stderr
956 PerlIO_stdin
957 PerlIO_stdout
958 PerlIO_stdoutf
959 PerlIO_tell
960 PerlIO_ungetc
961 PerlIO_vprintf
962 PerlIO_write
963 PerlIO_perlio
964 Perl_PerlIO_clearerr
965 Perl_PerlIO_close
966 Perl_PerlIO_eof
967 Perl_PerlIO_error
968 Perl_PerlIO_fileno
969 Perl_PerlIO_fill
970 Perl_PerlIO_flush
971 Perl_PerlIO_get_base
972 Perl_PerlIO_get_bufsiz
973 Perl_PerlIO_get_cnt
974 Perl_PerlIO_get_ptr
975 Perl_PerlIO_read
976 Perl_PerlIO_seek
977 Perl_PerlIO_set_cnt
978 Perl_PerlIO_set_ptrcnt
979 Perl_PerlIO_setlinebuf
980 Perl_PerlIO_stderr
981 Perl_PerlIO_stdin
982 Perl_PerlIO_stdout
983 Perl_PerlIO_tell
984 Perl_PerlIO_unread
985 Perl_PerlIO_write
986 PL_def_layerlist
987 PL_known_layers
988 PL_perlio
989 )];
990 }
991 else {
992 # PerlIO with layers - export implementation
993 emit_symbols \@layer_syms;
994 emit_symbols [qw(perlsio_binmode)];
995 }
996} else {
997 # -Uuseperlio
998 # Skip the PerlIO layer symbols - although
999 # nothing should have exported them any way
1000 skip_symbols \@layer_syms;
1001 skip_symbols [qw(perlsio_binmode)];
1002 skip_symbols [qw(PL_def_layerlist PL_known_layers PL_perlio)];
1003
1004 # Also do NOT add abstraction symbols from $perlio_sym
1005 # abstraction is done as #define to stdio
1006 # Remaining remnants that _may_ be functions
1007 # are handled in <DATA>
1008}
1009
1010for my $syms (@syms) {
1011 open (GLOBAL, "<$syms") || die "failed to open $syms: $!\n";
1012 while (<GLOBAL>) {
1013 next if (!/^[A-Za-z]/);
1014 # Functions have a Perl_ prefix
1015 # Variables have a PL_ prefix
1016 chomp($_);
1017 my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : "");
1018 $symbol .= $_;
1019 emit_symbol($symbol) unless exists $skip{$symbol};
1020 }
1021 close(GLOBAL);
1022}
1023
1024# variables
1025
1026if ($define{'MULTIPLICITY'}) {
1027 for my $f ($perlvars_h, $intrpvar_h, $thrdvar_h) {
1028 my $glob = readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" });
1029 emit_symbols $glob;
1030 }
1031 # XXX AIX seems to want the perlvars.h symbols, for some reason
1032 if ($PLATFORM eq 'aix' or $PLATFORM eq 'os2') { # OS/2 needs PL_thr_key
1033 my $glob = readvar($perlvars_h);
1034 emit_symbols $glob;
1035 }
1036}
1037else {
1038 unless ($define{'PERL_GLOBAL_STRUCT'}) {
1039 my $glob = readvar($perlvars_h);
1040 emit_symbols $glob;
1041 }
1042 unless ($define{'MULTIPLICITY'}) {
1043 my $glob = readvar($intrpvar_h);
1044 emit_symbols $glob;
1045 }
1046 unless ($define{'MULTIPLICITY'} || $define{'USE_5005THREADS'}) {
1047 my $glob = readvar($thrdvar_h);
1048 emit_symbols $glob;
1049 }
1050}
1051
1052sub try_symbol {
1053 my $symbol = shift;
1054
1055 return if $symbol !~ /^[A-Za-z_]/;
1056 return if $symbol =~ /^\#/;
1057 $symbol =~s/\r//g;
1058 chomp($symbol);
1059 return if exists $skip{$symbol};
1060 emit_symbol($symbol);
1061}
1062
1063while (<DATA>) {
1064 try_symbol($_);
1065}
1066
1067if ($PLATFORM =~ /^win(?:32|ce)$/) {
1068 foreach my $symbol (qw(
1069 setuid
1070 setgid
1071 boot_DynaLoader
1072 Perl_init_os_extras
1073 Perl_thread_create
1074 Perl_win32_init
1075 Perl_win32_term
1076 RunPerl
1077 win32_async_check
1078 win32_errno
1079 win32_environ
1080 win32_abort
1081 win32_fstat
1082 win32_stat
1083 win32_pipe
1084 win32_popen
1085 win32_pclose
1086 win32_rename
1087 win32_setmode
1088 win32_chsize
1089 win32_lseek
1090 win32_tell
1091 win32_dup
1092 win32_dup2
1093 win32_open
1094 win32_close
1095 win32_eof
1096 win32_read
1097 win32_write
1098 win32_spawnvp
1099 win32_mkdir
1100 win32_rmdir
1101 win32_chdir
1102 win32_flock
1103 win32_execv
1104 win32_execvp
1105 win32_htons
1106 win32_ntohs
1107 win32_htonl
1108 win32_ntohl
1109 win32_inet_addr
1110 win32_inet_ntoa
1111 win32_socket
1112 win32_bind
1113 win32_listen
1114 win32_accept
1115 win32_connect
1116 win32_send
1117 win32_sendto
1118 win32_recv
1119 win32_recvfrom
1120 win32_shutdown
1121 win32_closesocket
1122 win32_ioctlsocket
1123 win32_setsockopt
1124 win32_getsockopt
1125 win32_getpeername
1126 win32_getsockname
1127 win32_gethostname
1128 win32_gethostbyname
1129 win32_gethostbyaddr
1130 win32_getprotobyname
1131 win32_getprotobynumber
1132 win32_getservbyname
1133 win32_getservbyport
1134 win32_select
1135 win32_endhostent
1136 win32_endnetent
1137 win32_endprotoent
1138 win32_endservent
1139 win32_getnetent
1140 win32_getnetbyname
1141 win32_getnetbyaddr
1142 win32_getprotoent
1143 win32_getservent
1144 win32_sethostent
1145 win32_setnetent
1146 win32_setprotoent
1147 win32_setservent
1148 win32_getenv
1149 win32_putenv
1150 win32_perror
1151 win32_malloc
1152 win32_calloc
1153 win32_realloc
1154 win32_free
1155 win32_sleep
1156 win32_times
1157 win32_access
1158 win32_alarm
1159 win32_chmod
1160 win32_open_osfhandle
1161 win32_get_osfhandle
1162 win32_ioctl
1163 win32_link
1164 win32_unlink
1165 win32_utime
1166 win32_gettimeofday
1167 win32_uname
1168 win32_wait
1169 win32_waitpid
1170 win32_kill
1171 win32_str_os_error
1172 win32_opendir
1173 win32_readdir
1174 win32_telldir
1175 win32_seekdir
1176 win32_rewinddir
1177 win32_closedir
1178 win32_longpath
1179 win32_os_id
1180 win32_getpid
1181 win32_crypt
1182 win32_dynaload
1183 win32_get_childenv
1184 win32_free_childenv
1185 win32_clearenv
1186 win32_get_childdir
1187 win32_free_childdir
1188 win32_stdin
1189 win32_stdout
1190 win32_stderr
1191 win32_ferror
1192 win32_feof
1193 win32_strerror
1194 win32_fprintf
1195 win32_printf
1196 win32_vfprintf
1197 win32_vprintf
1198 win32_fread
1199 win32_fwrite
1200 win32_fopen
1201 win32_fdopen
1202 win32_freopen
1203 win32_fclose
1204 win32_fputs
1205 win32_fputc
1206 win32_ungetc
1207 win32_getc
1208 win32_fileno
1209 win32_clearerr
1210 win32_fflush
1211 win32_ftell
1212 win32_fseek
1213 win32_fgetpos
1214 win32_fsetpos
1215 win32_rewind
1216 win32_tmpfile
1217 win32_setbuf
1218 win32_setvbuf
1219 win32_flushall
1220 win32_fcloseall
1221 win32_fgets
1222 win32_gets
1223 win32_fgetc
1224 win32_putc
1225 win32_puts
1226 win32_getchar
1227 win32_putchar
1228 ))
1229 {
1230 try_symbol($symbol);
1231 }
1232 if ($CCTYPE eq "BORLAND") {
1233 try_symbol('_matherr');
1234 }
1235}
1236elsif ($PLATFORM eq 'os2') {
1237 open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
1238 /^\s*[\da-f:]+[\s*+]\s*_(\w+)/i and $mapped{$1}++ foreach <MAP>;
1239 close MAP or die 'Cannot close miniperl.map';
1240
1241 @missing = grep { !exists $mapped{$_} }
1242 keys %export;
1243 @missing = grep { !exists $exportperlmalloc{$_} } @missing;
1244 delete $export{$_} foreach @missing;
1245}
1246elsif ($PLATFORM eq 'MacOS') {
1247 open MACSYMS, 'macperl.sym' or die 'Cannot read macperl.sym';
1248
1249 while (<MACSYMS>) {
1250 try_symbol($_);
1251 }
1252
1253 close MACSYMS;
1254}
1255elsif ($PLATFORM eq 'netware') {
1256foreach my $symbol (qw(
1257 boot_DynaLoader
1258 Perl_init_os_extras
1259 Perl_thread_create
1260 Perl_nw5_init
1261 RunPerl
1262 AllocStdPerl
1263 FreeStdPerl
1264 do_spawn2
1265 do_aspawn
1266 nw_uname
1267 nw_stdin
1268 nw_stdout
1269 nw_stderr
1270 nw_feof
1271 nw_ferror
1272 nw_fopen
1273 nw_fclose
1274 nw_clearerr
1275 nw_getc
1276 nw_fgets
1277 nw_fputc
1278 nw_fputs
1279 nw_fflush
1280 nw_ungetc
1281 nw_fileno
1282 nw_fdopen
1283 nw_freopen
1284 nw_fread
1285 nw_fwrite
1286 nw_setbuf
1287 nw_setvbuf
1288 nw_vfprintf
1289 nw_ftell
1290 nw_fseek
1291 nw_rewind
1292 nw_tmpfile
1293 nw_fgetpos
1294 nw_fsetpos
1295 nw_dup
1296 nw_access
1297 nw_chmod
1298 nw_chsize
1299 nw_close
1300 nw_dup2
1301 nw_flock
1302 nw_isatty
1303 nw_link
1304 nw_lseek
1305 nw_stat
1306 nw_mktemp
1307 nw_open
1308 nw_read
1309 nw_rename
1310 nw_setmode
1311 nw_unlink
1312 nw_utime
1313 nw_write
1314 nw_chdir
1315 nw_rmdir
1316 nw_closedir
1317 nw_opendir
1318 nw_readdir
1319 nw_rewinddir
1320 nw_seekdir
1321 nw_telldir
1322 nw_htonl
1323 nw_htons
1324 nw_ntohl
1325 nw_ntohs
1326 nw_accept
1327 nw_bind
1328 nw_connect
1329 nw_endhostent
1330 nw_endnetent
1331 nw_endprotoent
1332 nw_endservent
1333 nw_gethostbyaddr
1334 nw_gethostbyname
1335 nw_gethostent
1336 nw_gethostname
1337 nw_getnetbyaddr
1338 nw_getnetbyname
1339 nw_getnetent
1340 nw_getpeername
1341 nw_getprotobyname
1342 nw_getprotobynumber
1343 nw_getprotoent
1344 nw_getservbyname
1345 nw_getservbyport
1346 nw_getservent
1347 nw_getsockname
1348 nw_getsockopt
1349 nw_inet_addr
1350 nw_listen
1351 nw_socket
1352 nw_recv
1353 nw_recvfrom
1354 nw_select
1355 nw_send
1356 nw_sendto
1357 nw_sethostent
1358 nw_setnetent
1359 nw_setprotoent
1360 nw_setservent
1361 nw_setsockopt
1362 nw_inet_ntoa
1363 nw_shutdown
1364 nw_crypt
1365 nw_execvp
1366 nw_kill
1367 nw_Popen
1368 nw_Pclose
1369 nw_Pipe
1370 nw_times
1371 nw_waitpid
1372 nw_getpid
1373 nw_spawnvp
1374 nw_os_id
1375 nw_open_osfhandle
1376 nw_get_osfhandle
1377 nw_abort
1378 nw_sleep
1379 nw_wait
1380 nw_dynaload
1381 nw_strerror
1382 fnFpSetMode
1383 fnInsertHashListAddrs
1384 fnGetHashListAddrs
1385 Perl_deb
1386 Perl_sv_setsv
1387 Perl_sv_catsv
1388 Perl_sv_catpvn
1389 Perl_sv_2pv
1390 nw_freeenviron
1391 Remove_Thread_Ctx
1392 ))
1393 {
1394 try_symbol($symbol);
1395 }
1396}
1397
1398# records of type boot_module for statically linked modules (except Dynaloader)
1399$static_ext =~ s/\//__/g;
1400$static_ext =~ s/\bDynaLoader\b//;
1401my @stat_mods = map {"boot_$_"} grep {/\S/} split /\s+/, $static_ext;
1402foreach my $symbol (@stat_mods)
1403 {
1404 try_symbol($symbol);
1405 }
1406
1407# Now all symbols should be defined because
1408# next we are going to output them.
1409
1410foreach my $symbol (sort keys %export) {
1411 output_symbol($symbol);
1412}
1413
1414if ($PLATFORM eq 'os2') {
1415 print <<EOP;
1416 _dll_perlmain=_main
1417 _fill_extLibpath
1418 _dir_subst
1419 _Perl_OS2_handler_install
1420
1421; LAST_ORDINAL=$sym_ord
1422EOP
1423}
1424
1425sub emit_symbol {
1426 my $symbol = shift;
1427 chomp($symbol);
1428 $export{$symbol} = 1;
1429}
1430
1431sub output_symbol {
1432 my $symbol = shift;
1433 if ($PLATFORM =~ /^win(?:32|ce)$/) {
1434 $symbol = "_$symbol" if $CCTYPE eq 'BORLAND';
1435 print "\t$symbol\n";
1436# XXX: binary compatibility between compilers is an exercise
1437# in frustration :-(
1438# if ($CCTYPE eq "BORLAND") {
1439# # workaround Borland quirk by exporting both the straight
1440# # name and a name with leading underscore. Note the
1441# # alias *must* come after the symbol itself, if both
1442# # are to be exported. (Linker bug?)
1443# print "\t_$symbol\n";
1444# print "\t$symbol = _$symbol\n";
1445# }
1446# elsif ($CCTYPE eq 'GCC') {
1447# # Symbols have leading _ whole process is $%@"% slow
1448# # so skip aliases for now
1449# nprint "\t$symbol\n";
1450# }
1451# else {
1452# # for binary coexistence, export both the symbol and
1453# # alias with leading underscore
1454# print "\t$symbol\n";
1455# print "\t_$symbol = $symbol\n";
1456# }
1457 }
1458 elsif ($PLATFORM eq 'os2') {
1459 printf qq( %-31s \@%s\n),
1460 qq("_$symbol"), $ordinal{$symbol} || ++$sym_ord;
1461# this doesn't work, fix weakld!?!
1462# printf qq( %-31s \@%s\n),
1463# qq("_$exportperlmalloc{$symbol}" = "_$symbol"),
1464# $ordinal{$exportperlmalloc{$symbol}} || ++$sym_ord
1465# if $exportperlmalloc and exists $exportperlmalloc{$symbol};
1466# printf qq( %-31s \@%s\n),
1467# qq("__std_$exportperlmalloc{$symbol}" = "_$symbol"),
1468# $ordinal{$exportperlmalloc{$symbol}} || ++$sym_ord
1469# if $exportperlmalloc and exists $exportperlmalloc{$symbol};
1470 }
1471 elsif ($PLATFORM eq 'aix' || $PLATFORM eq 'MacOS') {
1472 print "$symbol\n";
1473 }
1474 elsif ($PLATFORM eq 'netware') {
1475 print "\t$symbol,\n";
1476 }
1477}
1478
14791;
1480__DATA__
1481# extra globals not included above.
1482Perl_cxinc
1483perl_alloc
1484perl_alloc_using
1485perl_clone
1486perl_clone_using
1487perl_construct
1488perl_destruct
1489perl_free
1490perl_parse
1491perl_run
1492# Oddities from PerlIO
1493PerlIO_binmode
1494PerlIO_getpos
1495PerlIO_init
1496PerlIO_setpos
1497PerlIO_sprintf
1498PerlIO_sv_dup
1499PerlIO_tmpfile
1500PerlIO_vsprintf
Note: See TracBrowser for help on using the repository browser.