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