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