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