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