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