Commit | Line | Data |
549a6b10 |
1 | # |
2 | # Create the export list for perl. |
3 | # |
3cfae81b |
4 | # Needed by WIN32 and OS/2 for creating perl.dll |
5 | # and by AIX for creating libperl.a when -Dusershrplib is in effect. |
549a6b10 |
6 | # |
22c35a8c |
7 | # reads global.sym, pp.sym, perlvars.h, intrpvar.h, thrdvar.h, config.h |
3cfae81b |
8 | # On OS/2 reads miniperl.map as well |
0a753a76 |
9 | |
549a6b10 |
10 | my $PLATFORM; |
11 | my $CCTYPE; |
910dfcc8 |
12 | |
4cb71bb6 |
13 | my %bincompat5005 = |
732aff91 |
14 | ( |
15 | Perl_call_atexit => "perl_atexit", |
16 | Perl_eval_sv => "perl_eval_sv", |
17 | Perl_eval_pv => "perl_eval_pv", |
18 | Perl_call_argv => "perl_call_argv", |
4cb71bb6 |
19 | Perl_call_method => "perl_call_method", |
20 | Perl_call_pv => "perl_call_pv", |
21 | Perl_call_sv => "perl_call_sv", |
22 | Perl_get_av => "perl_get_av", |
23 | Perl_get_cv => "perl_get_cv", |
24 | Perl_get_hv => "perl_get_hv", |
25 | Perl_get_sv => "perl_get_sv", |
26 | Perl_init_i18nl10n => "perl_init_i18nl10n", |
27 | Perl_init_i18nl14n => "perl_init_i18nl14n", |
28 | Perl_new_collate => "perl_new_collate", |
29 | Perl_new_ctype => "perl_new_ctype", |
30 | Perl_new_numeric => "perl_new_numeric", |
31 | Perl_require_pv => "perl_require_pv", |
32 | Perl_safesyscalloc => "Perl_safecalloc", |
33 | Perl_safesysfree => "Perl_safefree", |
34 | Perl_safesysmalloc => "Perl_safemalloc", |
35 | Perl_safesysrealloc => "Perl_saferealloc", |
36 | Perl_set_numeric_local => "perl_set_numeric_local", |
62457c2b |
37 | Perl_set_numeric_standard => "perl_set_numeric_standard", |
38 | Perl_malloc => "malloc", |
39 | Perl_mfree => "free", |
40 | Perl_realloc => "realloc", |
732aff91 |
41 | Perl_calloc => "calloc", |
42 | ); |
4cb71bb6 |
43 | |
44 | my $bincompat5005 = join("|", keys %bincompat5005); |
45 | |
7766f137 |
46 | while (@ARGV) { |
47 | my $flag = shift; |
48 | $define{$1} = 1 if ($flag =~ /^-D(\w+)$/); |
49 | $define{$1} = $2 if ($flag =~ /^-D(\w+)=(.+)$/); |
50 | $CCTYPE = $1 if ($flag =~ /^CCTYPE=(\w+)$/); |
51 | $PLATFORM = $1 if ($flag =~ /^PLATFORM=(\w+)$/); |
52 | } |
d55594ae |
53 | |
084592ab |
54 | my @PLATFORM = qw(aix win32 os2 MacOS); |
549a6b10 |
55 | my %PLATFORM; |
56 | @PLATFORM{@PLATFORM} = (); |
57 | |
58 | defined $PLATFORM || die "PLATFORM undefined, must be one of: @PLATFORM\n"; |
59 | exists $PLATFORM{$PLATFORM} || die "PLATFORM must be one of: @PLATFORM\n"; |
60 | |
61 | my $config_sh = "config.sh"; |
62 | my $config_h = "config.h"; |
63 | my $thrdvar_h = "thrdvar.h"; |
64 | my $intrpvar_h = "intrpvar.h"; |
65 | my $perlvars_h = "perlvars.h"; |
66 | my $global_sym = "global.sym"; |
67 | my $pp_sym = "pp.sym"; |
68 | my $globvar_sym = "globvar.sym"; |
69 | my $perlio_sym = "perlio.sym"; |
70 | |
71 | if ($PLATFORM eq 'aix') { |
72 | # Nothing for now. |
7766f137 |
73 | } |
74 | elsif ($PLATFORM eq 'win32') { |
549a6b10 |
75 | $CCTYPE = "MSVC" unless defined $CCTYPE; |
00b02797 |
76 | foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym, |
77 | $pp_sym, $globvar_sym, $perlio_sym) { |
549a6b10 |
78 | s!^!..\\!; |
79 | } |
80 | } |
084592ab |
81 | elsif ($PLATFORM eq 'MacOS') { |
82 | foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym, |
83 | $pp_sym, $globvar_sym, $perlio_sym) { |
84 | s!^!::!; |
85 | } |
86 | } |
549a6b10 |
87 | |
084592ab |
88 | unless ($PLATFORM eq 'win32' || $PLATFORM eq 'MacOS') { |
549a6b10 |
89 | open(CFG,$config_sh) || die "Cannot open $config_sh: $!\n"; |
7766f137 |
90 | while (<CFG>) { |
549a6b10 |
91 | if (/^(?:ccflags|optimize)='(.+)'$/) { |
92 | $_ = $1; |
93 | $define{$1} = 1 while /-D(\w+)/g; |
94 | } |
3cfae81b |
95 | if ($PLATFORM eq 'os2') { |
96 | $CONFIG_ARGS = $1 if /^(?:config_args)='(.+)'$/; |
0e32cd81 |
97 | $ARCHNAME = $1 if /^(?:archname)='(.+)'$/; |
3cfae81b |
98 | } |
549a6b10 |
99 | } |
100 | close(CFG); |
101 | } |
102 | |
103 | open(CFG,$config_h) || die "Cannot open $config_h: $!\n"; |
7766f137 |
104 | while (<CFG>) { |
105 | $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/; |
7766f137 |
106 | $define{$1} = 1 if /^\s*#\s*define\s+(MULTIPLICITY)\b/; |
0e32cd81 |
107 | $define{$1} = 1 if /^\s*#\s*define\s+(PERL_\w+)\b/; |
108 | $define{$1} = 1 if /^\s*#\s*define\s+(USE_\w+)\b/; |
7766f137 |
109 | } |
bbc8f9de |
110 | close(CFG); |
111 | |
18c4b137 |
112 | # perl.h logic duplication begins |
113 | |
114 | if ($define{USE_ITHREADS}) { |
341bd822 |
115 | if (!$define{MULTIPLICITY} && !$define{PERL_OBJECT}) { |
18c4b137 |
116 | $define{MULTIPLICITY} = 1; |
117 | } |
118 | } |
119 | |
120 | $define{PERL_IMPLICIT_CONTEXT} ||= |
121 | $define{USE_ITHREADS} || |
66cf6f75 |
122 | $define{USE_5005THREADS} || |
18c4b137 |
123 | $define{MULTIPLICITY} ; |
124 | |
125 | if ($define{PERL_CAPI}) { |
126 | delete $define{PERL_OBJECT}; |
127 | $define{MULTIPLICITY} = 1; |
128 | $define{PERL_IMPLICIT_CONTEXT} = 1; |
129 | $define{PERL_IMPLICIT_SYS} = 1; |
130 | } |
131 | |
132 | if ($define{PERL_OBJECT}) { |
133 | $define{PERL_IMPLICIT_CONTEXT} = 1; |
134 | $define{PERL_IMPLICIT_SYS} = 1; |
135 | } |
136 | |
137 | # perl.h logic duplication ends |
138 | |
549a6b10 |
139 | if ($PLATFORM eq 'win32') { |
140 | warn join(' ',keys %define)."\n"; |
7d4dff66 |
141 | print "LIBRARY Perl57\n"; |
dfdd1393 |
142 | print "DESCRIPTION 'Perl interpreter'\n"; |
143 | print "EXPORTS\n"; |
144 | if ($define{PERL_IMPLICIT_SYS}) { |
549a6b10 |
145 | output_symbol("perl_get_host_info"); |
7766f137 |
146 | output_symbol("perl_alloc_override"); |
51371543 |
147 | } |
7766f137 |
148 | } |
149 | elsif ($PLATFORM eq 'os2') { |
3cfae81b |
150 | ($v = $]) =~ s/(\d\.\d\d\d)(\d\d)$/$1_$2/; |
151 | $v .= '-thread' if $ARCHNAME =~ /-thread/; |
3cfae81b |
152 | ($dll = $define{PERL_DLL}) =~ s/\.dll$//i; |
3cfae81b |
153 | print <<"---EOP---"; |
154 | LIBRARY '$dll' INITINSTANCE TERMINSTANCE |
23da6c43 |
155 | DESCRIPTION '\@#perl5-porters\@perl.org:$v#\@ Perl interpreter' |
3cfae81b |
156 | STACKSIZE 32768 |
157 | CODE LOADONCALL |
158 | DATA LOADONCALL NONSHARED MULTIPLE |
159 | EXPORTS |
160 | ---EOP--- |
7766f137 |
161 | } |
162 | elsif ($PLATFORM eq 'aix') { |
549a6b10 |
163 | print "#!\n"; |
ac4c12e7 |
164 | } |
bbc8f9de |
165 | |
22239a37 |
166 | my %skip; |
167 | my %export; |
168 | |
51371543 |
169 | sub skip_symbols { |
170 | my $list = shift; |
171 | foreach my $symbol (@$list) { |
172 | $skip{$symbol} = 1; |
173 | } |
22239a37 |
174 | } |
175 | |
51371543 |
176 | sub emit_symbols { |
177 | my $list = shift; |
178 | foreach my $symbol (@$list) { |
179 | my $skipsym = $symbol; |
180 | # XXX hack |
6f4183fe |
181 | if ($define{PERL_OBJECT} || $define{MULTIPLICITY}) { |
51371543 |
182 | $skipsym =~ s/^Perl_[GIT](\w+)_ptr$/PL_$1/; |
183 | } |
184 | emit_symbol($symbol) unless exists $skip{$skipsym}; |
185 | } |
22239a37 |
186 | } |
187 | |
549a6b10 |
188 | if ($PLATFORM eq 'win32') { |
7766f137 |
189 | skip_symbols [qw( |
190 | PL_statusvalue_vms |
191 | PL_archpat_auto |
192 | PL_cryptseen |
193 | PL_DBcv |
194 | PL_generation |
195 | PL_lastgotoprobe |
196 | PL_linestart |
197 | PL_modcount |
198 | PL_pending_ident |
199 | PL_sortcxix |
200 | PL_sublex_info |
201 | PL_timesbuf |
202 | main |
203 | Perl_ErrorNo |
204 | Perl_GetVars |
205 | Perl_do_exec3 |
206 | Perl_do_ipcctl |
207 | Perl_do_ipcget |
208 | Perl_do_msgrcv |
209 | Perl_do_msgsnd |
210 | Perl_do_semop |
211 | Perl_do_shmio |
212 | Perl_dump_fds |
213 | Perl_init_thread_intern |
214 | Perl_my_bzero |
215 | Perl_my_htonl |
216 | Perl_my_ntohl |
217 | Perl_my_swap |
218 | Perl_my_chsize |
219 | Perl_same_dirent |
220 | Perl_setenv_getix |
221 | Perl_unlnk |
222 | Perl_watch |
223 | Perl_safexcalloc |
224 | Perl_safexmalloc |
225 | Perl_safexfree |
226 | Perl_safexrealloc |
227 | Perl_my_memcmp |
228 | Perl_my_memset |
229 | PL_cshlen |
230 | PL_cshname |
231 | PL_opsave |
232 | Perl_do_exec |
233 | Perl_getenv_len |
234 | Perl_my_pclose |
235 | Perl_my_popen |
236 | )]; |
237 | } |
238 | elsif ($PLATFORM eq 'aix') { |
549a6b10 |
239 | skip_symbols([qw( |
7766f137 |
240 | Perl_dump_fds |
241 | Perl_ErrorNo |
242 | Perl_GetVars |
243 | Perl_my_bcopy |
244 | Perl_my_bzero |
245 | Perl_my_chsize |
246 | Perl_my_htonl |
247 | Perl_my_memcmp |
248 | Perl_my_memset |
249 | Perl_my_ntohl |
250 | Perl_my_swap |
251 | Perl_safexcalloc |
252 | Perl_safexfree |
253 | Perl_safexmalloc |
254 | Perl_safexrealloc |
255 | Perl_same_dirent |
256 | Perl_unlnk |
6c644e78 |
257 | Perl_sys_intern_clear |
95151ede |
258 | Perl_sys_intern_dup |
52853b95 |
259 | Perl_sys_intern_init |
7766f137 |
260 | PL_cryptseen |
261 | PL_opsave |
262 | PL_statusvalue_vms |
263 | PL_sys_intern |
264 | )]); |
265 | } |
266 | elsif ($PLATFORM eq 'os2') { |
3cfae81b |
267 | emit_symbols([qw( |
7766f137 |
268 | ctermid |
269 | get_sysinfo |
270 | Perl_OS2_init |
271 | OS2_Perl_data |
272 | dlopen |
273 | dlsym |
274 | dlerror |
403d6f8e |
275 | dlclose |
7766f137 |
276 | my_tmpfile |
277 | my_tmpnam |
278 | my_flock |
279 | malloc_mutex |
280 | threads_mutex |
281 | nthreads |
282 | nthreads_cond |
283 | os2_cond_wait |
284 | os2_stat |
285 | pthread_join |
286 | pthread_create |
287 | pthread_detach |
288 | XS_Cwd_change_drive |
289 | XS_Cwd_current_drive |
290 | XS_Cwd_extLibpath |
291 | XS_Cwd_extLibpath_set |
292 | XS_Cwd_sys_abspath |
293 | XS_Cwd_sys_chdir |
294 | XS_Cwd_sys_cwd |
295 | XS_Cwd_sys_is_absolute |
296 | XS_Cwd_sys_is_relative |
297 | XS_Cwd_sys_is_rooted |
298 | XS_DynaLoader_mod2fname |
299 | XS_File__Copy_syscopy |
300 | Perl_Register_MQ |
301 | Perl_Deregister_MQ |
302 | Perl_Serve_Messages |
303 | Perl_Process_Messages |
304 | init_PMWIN_entries |
305 | PMWIN_entries |
306 | Perl_hab_GET |
307 | )]); |
3cfae81b |
308 | } |
084592ab |
309 | elsif ($PLATFORM eq 'MacOS') { |
310 | skip_symbols [qw( |
311 | Perl_GetVars |
312 | PL_cryptseen |
313 | PL_cshlen |
314 | PL_cshname |
315 | PL_statusvalue_vms |
316 | PL_sys_intern |
317 | PL_opsave |
318 | PL_timesbuf |
319 | Perl_dump_fds |
320 | Perl_my_bcopy |
321 | Perl_my_bzero |
322 | Perl_my_chsize |
323 | Perl_my_htonl |
324 | Perl_my_memcmp |
325 | Perl_my_memset |
326 | Perl_my_ntohl |
327 | Perl_my_swap |
328 | Perl_safexcalloc |
329 | Perl_safexfree |
330 | Perl_safexmalloc |
331 | Perl_safexrealloc |
332 | Perl_unlnk |
333 | )]; |
334 | } |
335 | |
3cfae81b |
336 | |
7766f137 |
337 | unless ($define{'DEBUGGING'}) { |
338 | skip_symbols [qw( |
7766f137 |
339 | Perl_deb_growlevel |
340 | Perl_debop |
341 | Perl_debprofdump |
342 | Perl_debstack |
343 | Perl_debstackptrs |
344 | Perl_runops_debug |
345 | Perl_sv_peek |
346 | PL_block_type |
347 | PL_watchaddr |
348 | PL_watchok |
349 | )]; |
350 | } |
351 | |
352 | if ($define{'PERL_IMPLICIT_SYS'}) { |
353 | skip_symbols [qw( |
354 | Perl_getenv_len |
355 | Perl_my_popen |
356 | Perl_my_pclose |
357 | )]; |
358 | } |
359 | else { |
360 | skip_symbols [qw( |
361 | PL_Mem |
362 | PL_MemShared |
363 | PL_MemParse |
364 | PL_Env |
365 | PL_StdIO |
366 | PL_LIO |
367 | PL_Dir |
368 | PL_Sock |
369 | PL_Proc |
370 | )]; |
371 | } |
372 | |
7c128300 |
373 | unless ($define{'PERL_FLEXIBLE_EXCEPTIONS'}) { |
374 | skip_symbols [qw( |
375 | PL_protect |
376 | Perl_default_protect |
377 | Perl_vdefault_protect |
378 | )]; |
379 | } |
380 | |
7766f137 |
381 | if ($define{'MYMALLOC'}) { |
382 | emit_symbols [qw( |
383 | Perl_dump_mstats |
827e134a |
384 | Perl_get_mstats |
7766f137 |
385 | Perl_malloc |
386 | Perl_mfree |
387 | Perl_realloc |
388 | Perl_calloc |
389 | )]; |
bbda9c9d |
390 | if ($define{'USE_5005THREADS'} || $define{'USE_ITHREADS'}) { |
1feb2720 |
391 | emit_symbols [qw( |
392 | PL_malloc_mutex |
393 | )]; |
394 | } |
80fc1a6e |
395 | else { |
396 | skip_symbols [qw( |
397 | PL_malloc_mutex |
398 | )]; |
399 | } |
51371543 |
400 | } |
401 | else { |
7766f137 |
402 | skip_symbols [qw( |
403 | PL_malloc_mutex |
404 | Perl_dump_mstats |
6ecd3fcb |
405 | Perl_get_mstats |
7766f137 |
406 | Perl_malloc |
407 | Perl_mfree |
408 | Perl_realloc |
409 | Perl_calloc |
410 | Perl_malloced_size |
411 | )]; |
412 | } |
413 | |
f433d095 |
414 | unless ($define{'USE_5005THREADS'} || $define{'USE_ITHREADS'}) { |
7766f137 |
415 | skip_symbols [qw( |
416 | PL_thr_key |
f433d095 |
417 | )]; |
418 | } |
419 | |
420 | unless ($define{'USE_5005THREADS'}) { |
421 | skip_symbols [qw( |
7766f137 |
422 | PL_sv_mutex |
423 | PL_strtab_mutex |
424 | PL_svref_mutex |
7766f137 |
425 | PL_cred_mutex |
426 | PL_eval_mutex |
6940069f |
427 | PL_fdpid_mutex |
428 | PL_sv_lock_mutex |
7766f137 |
429 | PL_eval_cond |
430 | PL_eval_owner |
431 | PL_threads_mutex |
432 | PL_nthreads |
433 | PL_nthreads_cond |
434 | PL_threadnum |
435 | PL_threadsv_names |
436 | PL_thrsv |
437 | PL_vtbl_mutex |
7766f137 |
438 | Perl_condpair_magic |
439 | Perl_new_struct_thread |
440 | Perl_per_thread_magicals |
441 | Perl_thread_create |
442 | Perl_find_threadsv |
443 | Perl_unlock_condpair |
444 | Perl_magic_mutexfree |
4755096e |
445 | Perl_sv_lock |
7766f137 |
446 | )]; |
447 | } |
448 | |
449 | unless ($define{'USE_ITHREADS'}) { |
450 | skip_symbols [qw( |
451 | PL_ptr_table |
534825c4 |
452 | PL_op_mutex |
7766f137 |
453 | Perl_dirp_dup |
454 | Perl_cx_dup |
455 | Perl_si_dup |
456 | Perl_any_dup |
457 | Perl_ss_dup |
458 | Perl_fp_dup |
459 | Perl_gp_dup |
460 | Perl_he_dup |
461 | Perl_mg_dup |
462 | Perl_re_dup |
463 | Perl_sv_dup |
464 | Perl_sys_intern_dup |
465 | Perl_ptr_table_fetch |
466 | Perl_ptr_table_new |
467 | Perl_ptr_table_split |
468 | Perl_ptr_table_store |
469 | perl_clone |
470 | perl_clone_using |
471 | )]; |
472 | } |
473 | |
474 | unless ($define{'PERL_IMPLICIT_CONTEXT'}) { |
475 | skip_symbols [qw( |
476 | Perl_croak_nocontext |
477 | Perl_die_nocontext |
478 | Perl_deb_nocontext |
479 | Perl_form_nocontext |
e0f4245d |
480 | Perl_load_module_nocontext |
7766f137 |
481 | Perl_mess_nocontext |
482 | Perl_warn_nocontext |
483 | Perl_warner_nocontext |
484 | Perl_newSVpvf_nocontext |
485 | Perl_sv_catpvf_nocontext |
486 | Perl_sv_setpvf_nocontext |
487 | Perl_sv_catpvf_mg_nocontext |
488 | Perl_sv_setpvf_mg_nocontext |
489 | )]; |
490 | } |
491 | |
492 | unless ($define{'PERL_IMPLICIT_SYS'}) { |
493 | skip_symbols [qw( |
494 | perl_alloc_using |
014822e4 |
495 | perl_clone_using |
7766f137 |
496 | )]; |
497 | } |
498 | |
499 | unless ($define{'FAKE_THREADS'}) { |
500 | skip_symbols [qw(PL_curthr)]; |
501 | } |
502 | |
503 | sub readvar { |
504 | my $file = shift; |
505 | my $proc = shift || sub { "PL_$_[2]" }; |
506 | open(VARS,$file) || die "Cannot open $file: $!\n"; |
507 | my @syms; |
508 | while (<VARS>) { |
509 | # All symbols have a Perl_ prefix because that's what embed.h |
510 | # sticks in front of them. |
511 | push(@syms, &$proc($1,$2,$3)) if (/\bPERLVAR(A?I?C?)\(([IGT])(\w+)/); |
512 | } |
513 | close(VARS); |
514 | return \@syms; |
515 | } |
516 | |
6f4183fe |
517 | if ($define{'USE_5005THREADS'}) { |
7766f137 |
518 | my $thrd = readvar($thrdvar_h); |
519 | skip_symbols $thrd; |
520 | } |
521 | |
7766f137 |
522 | if ($define{'PERL_GLOBAL_STRUCT'}) { |
523 | my $global = readvar($perlvars_h); |
524 | skip_symbols $global; |
525 | emit_symbol('Perl_GetVars'); |
526 | emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC'; |
527 | } |
36c15d3f |
528 | |
22c35a8c |
529 | # functions from *.sym files |
530 | |
954c1994 |
531 | my @syms = ($global_sym, $globvar_sym); # $pp_sym is not part of the API |
549a6b10 |
532 | |
7766f137 |
533 | if ($define{'USE_PERLIO'}) { |
084592ab |
534 | push @syms, $perlio_sym; |
535 | if ($define{'USE_SFIO'}) { |
536 | # SFIO defines most of the PerlIO routines as macros |
537 | skip_symbols [qw( |
538 | PerlIO_canset_cnt |
539 | PerlIO_clearerr |
540 | PerlIO_close |
541 | PerlIO_eof |
542 | PerlIO_error |
543 | PerlIO_exportFILE |
544 | PerlIO_fast_gets |
545 | PerlIO_fdopen |
546 | PerlIO_fileno |
547 | PerlIO_findFILE |
548 | PerlIO_flush |
549 | PerlIO_get_base |
550 | PerlIO_get_bufsiz |
551 | PerlIO_get_cnt |
552 | PerlIO_get_ptr |
553 | PerlIO_getc |
554 | PerlIO_getname |
555 | PerlIO_has_base |
556 | PerlIO_has_cntptr |
557 | PerlIO_importFILE |
558 | PerlIO_open |
559 | PerlIO_printf |
560 | PerlIO_putc |
561 | PerlIO_puts |
562 | PerlIO_read |
563 | PerlIO_releaseFILE |
564 | PerlIO_reopen |
565 | PerlIO_rewind |
566 | PerlIO_seek |
567 | PerlIO_set_cnt |
568 | PerlIO_set_ptrcnt |
569 | PerlIO_setlinebuf |
570 | PerlIO_sprintf |
571 | PerlIO_stderr |
572 | PerlIO_stdin |
573 | PerlIO_stdout |
574 | PerlIO_stdoutf |
575 | PerlIO_tell |
576 | PerlIO_ungetc |
577 | PerlIO_vprintf |
578 | PerlIO_write |
579 | )]; |
580 | } |
7766f137 |
581 | } |
582 | |
583 | for my $syms (@syms) { |
584 | open (GLOBAL, "<$syms") || die "failed to open $syms: $!\n"; |
585 | while (<GLOBAL>) { |
586 | next if (!/^[A-Za-z]/); |
587 | # Functions have a Perl_ prefix |
588 | # Variables have a PL_ prefix |
589 | chomp($_); |
590 | my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : ""); |
591 | $symbol .= $_; |
592 | emit_symbol($symbol) unless exists $skip{$symbol}; |
593 | } |
594 | close(GLOBAL); |
595 | } |
0a753a76 |
596 | |
22c35a8c |
597 | # variables |
0a753a76 |
598 | |
6f4183fe |
599 | if ($define{'PERL_OBJECT'} || $define{'MULTIPLICITY'}) { |
1acb48c9 |
600 | for my $f ($perlvars_h, $intrpvar_h, $thrdvar_h) { |
18c4b137 |
601 | my $glob = readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" }); |
602 | emit_symbols $glob; |
18c4b137 |
603 | } |
1acb48c9 |
604 | # XXX AIX seems to want the perlvars.h symbols, for some reason |
605 | if ($PLATFORM eq 'aix') { |
606 | my $glob = readvar($perlvars_h); |
51371543 |
607 | emit_symbols $glob; |
608 | } |
609 | } |
610 | else { |
611 | unless ($define{'PERL_GLOBAL_STRUCT'}) { |
549a6b10 |
612 | my $glob = readvar($perlvars_h); |
51371543 |
613 | emit_symbols $glob; |
614 | } |
615 | unless ($define{'MULTIPLICITY'}) { |
549a6b10 |
616 | my $glob = readvar($intrpvar_h); |
51371543 |
617 | emit_symbols $glob; |
618 | } |
bbda9c9d |
619 | unless ($define{'MULTIPLICITY'} || $define{'USE_5005THREADS'}) { |
549a6b10 |
620 | my $glob = readvar($thrdvar_h); |
51371543 |
621 | emit_symbols $glob; |
622 | } |
623 | } |
0a753a76 |
624 | |
549a6b10 |
625 | sub try_symbol { |
626 | my $symbol = shift; |
22239a37 |
627 | |
549a6b10 |
628 | return if $symbol !~ /^[A-Za-z]/; |
629 | return if $symbol =~ /^\#/; |
630 | $symbol =~s/\r//g; |
631 | chomp($symbol); |
43cd9f80 |
632 | return if exists $skip{$symbol}; |
549a6b10 |
633 | emit_symbol($symbol); |
3e3baf6d |
634 | } |
0a753a76 |
635 | |
549a6b10 |
636 | while (<DATA>) { |
637 | try_symbol($_); |
ac4c12e7 |
638 | } |
639 | |
549a6b10 |
640 | if ($PLATFORM eq 'win32') { |
641 | foreach my $symbol (qw( |
00b02797 |
642 | setuid |
643 | setgid |
7766f137 |
644 | boot_DynaLoader |
7766f137 |
645 | Perl_init_os_extras |
c44d3fdb |
646 | Perl_thread_create |
7766f137 |
647 | Perl_win32_init |
648 | RunPerl |
7766f137 |
649 | win32_errno |
650 | win32_environ |
7766f137 |
651 | win32_abort |
652 | win32_fstat |
653 | win32_stat |
654 | win32_pipe |
655 | win32_popen |
656 | win32_pclose |
657 | win32_rename |
658 | win32_setmode |
659 | win32_lseek |
660 | win32_tell |
661 | win32_dup |
662 | win32_dup2 |
663 | win32_open |
664 | win32_close |
665 | win32_eof |
666 | win32_read |
667 | win32_write |
668 | win32_spawnvp |
669 | win32_mkdir |
670 | win32_rmdir |
671 | win32_chdir |
672 | win32_flock |
673 | win32_execv |
674 | win32_execvp |
675 | win32_htons |
676 | win32_ntohs |
677 | win32_htonl |
678 | win32_ntohl |
679 | win32_inet_addr |
680 | win32_inet_ntoa |
681 | win32_socket |
682 | win32_bind |
683 | win32_listen |
684 | win32_accept |
685 | win32_connect |
686 | win32_send |
687 | win32_sendto |
688 | win32_recv |
689 | win32_recvfrom |
690 | win32_shutdown |
691 | win32_closesocket |
692 | win32_ioctlsocket |
693 | win32_setsockopt |
694 | win32_getsockopt |
695 | win32_getpeername |
696 | win32_getsockname |
697 | win32_gethostname |
698 | win32_gethostbyname |
699 | win32_gethostbyaddr |
700 | win32_getprotobyname |
701 | win32_getprotobynumber |
702 | win32_getservbyname |
703 | win32_getservbyport |
704 | win32_select |
705 | win32_endhostent |
706 | win32_endnetent |
707 | win32_endprotoent |
708 | win32_endservent |
709 | win32_getnetent |
710 | win32_getnetbyname |
711 | win32_getnetbyaddr |
712 | win32_getprotoent |
713 | win32_getservent |
714 | win32_sethostent |
715 | win32_setnetent |
716 | win32_setprotoent |
717 | win32_setservent |
718 | win32_getenv |
719 | win32_putenv |
720 | win32_perror |
7766f137 |
721 | win32_malloc |
722 | win32_calloc |
723 | win32_realloc |
724 | win32_free |
725 | win32_sleep |
726 | win32_times |
727 | win32_access |
728 | win32_alarm |
729 | win32_chmod |
730 | win32_open_osfhandle |
731 | win32_get_osfhandle |
732 | win32_ioctl |
733 | win32_link |
734 | win32_unlink |
735 | win32_utime |
736 | win32_uname |
737 | win32_wait |
738 | win32_waitpid |
739 | win32_kill |
740 | win32_str_os_error |
741 | win32_opendir |
742 | win32_readdir |
743 | win32_telldir |
744 | win32_seekdir |
745 | win32_rewinddir |
746 | win32_closedir |
747 | win32_longpath |
748 | win32_os_id |
749 | win32_getpid |
750 | win32_crypt |
751 | win32_dynaload |
00b02797 |
752 | |
753 | win32_stdin |
754 | win32_stdout |
755 | win32_stderr |
756 | win32_ferror |
757 | win32_feof |
758 | win32_strerror |
759 | win32_fprintf |
760 | win32_printf |
761 | win32_vfprintf |
762 | win32_vprintf |
763 | win32_fread |
764 | win32_fwrite |
765 | win32_fopen |
766 | win32_fdopen |
767 | win32_freopen |
768 | win32_fclose |
769 | win32_fputs |
770 | win32_fputc |
771 | win32_ungetc |
772 | win32_getc |
773 | win32_fileno |
774 | win32_clearerr |
775 | win32_fflush |
776 | win32_ftell |
777 | win32_fseek |
778 | win32_fgetpos |
779 | win32_fsetpos |
780 | win32_rewind |
781 | win32_tmpfile |
782 | win32_setbuf |
783 | win32_setvbuf |
784 | win32_flushall |
785 | win32_fcloseall |
786 | win32_fgets |
787 | win32_gets |
788 | win32_fgetc |
789 | win32_putc |
790 | win32_puts |
791 | win32_getchar |
792 | win32_putchar |
7766f137 |
793 | )) |
794 | { |
549a6b10 |
795 | try_symbol($symbol); |
796 | } |
797 | } |
3cfae81b |
798 | elsif ($PLATFORM eq 'os2') { |
7766f137 |
799 | open MAP, 'miniperl.map' or die 'Cannot read miniperl.map'; |
800 | /^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>; |
801 | close MAP or die 'Cannot close miniperl.map'; |
802 | |
803 | @missing = grep { !exists $mapped{$_} and !exists $bincompat5005{$_} } |
804 | keys %export; |
805 | delete $export{$_} foreach @missing; |
3cfae81b |
806 | } |
084592ab |
807 | elsif ($PLATFORM eq 'MacOS') { |
808 | open MACSYMS, 'macperl.sym' or die 'Cannot read macperl.sym'; |
809 | |
810 | while (<MACSYMS>) { |
811 | try_symbol($_); |
812 | } |
813 | |
814 | close MACSYMS; |
815 | } |
22239a37 |
816 | |
549a6b10 |
817 | # Now all symbols should be defined because |
818 | # next we are going to output them. |
819 | |
7766f137 |
820 | foreach my $symbol (sort keys %export) { |
821 | output_symbol($symbol); |
822 | } |
549a6b10 |
823 | |
824 | sub emit_symbol { |
7766f137 |
825 | my $symbol = shift; |
826 | chomp($symbol); |
827 | $export{$symbol} = 1; |
549a6b10 |
828 | } |
829 | |
830 | sub output_symbol { |
831 | my $symbol = shift; |
4cb71bb6 |
832 | $symbol = $bincompat5005{$symbol} |
833 | if $define{PERL_BINCOMPAT_5005} and $symbol =~ /^($bincompat5005)$/; |
549a6b10 |
834 | if ($PLATFORM eq 'win32') { |
549a6b10 |
835 | $symbol = "_$symbol" if $CCTYPE eq 'BORLAND'; |
520c758a |
836 | print "\t$symbol\n"; |
549a6b10 |
837 | # XXX: binary compatibility between compilers is an exercise |
838 | # in frustration :-( |
839 | # if ($CCTYPE eq "BORLAND") { |
840 | # # workaround Borland quirk by exporting both the straight |
841 | # # name and a name with leading underscore. Note the |
842 | # # alias *must* come after the symbol itself, if both |
843 | # # are to be exported. (Linker bug?) |
844 | # print "\t_$symbol\n"; |
845 | # print "\t$symbol = _$symbol\n"; |
846 | # } |
847 | # elsif ($CCTYPE eq 'GCC') { |
848 | # # Symbols have leading _ whole process is $%@"% slow |
849 | # # so skip aliases for now |
850 | # nprint "\t$symbol\n"; |
851 | # } |
852 | # else { |
853 | # # for binary coexistence, export both the symbol and |
854 | # # alias with leading underscore |
855 | # print "\t$symbol\n"; |
856 | # print "\t_$symbol = $symbol\n"; |
857 | # } |
7766f137 |
858 | } |
859 | elsif ($PLATFORM eq 'os2') { |
3cfae81b |
860 | print qq( "$symbol"\n); |
7766f137 |
861 | } |
084592ab |
862 | elsif ($PLATFORM eq 'aix' || $PLATFORM eq 'MacOS') { |
549a6b10 |
863 | print "$symbol\n"; |
864 | } |
865 | } |
866 | |
867 | 1; |
868 | __DATA__ |
869 | # extra globals not included above. |
870 | perl_alloc |
7766f137 |
871 | perl_alloc_using |
014822e4 |
872 | perl_clone |
873 | perl_clone_using |
549a6b10 |
874 | perl_construct |
875 | perl_destruct |
876 | perl_free |
877 | perl_parse |
878 | perl_run |
18b7339f |
879 | PerlIO_define_layer |
880 | PerlIOBuf_set_ptrcnt |
881 | PerlIOBuf_get_cnt |
882 | PerlIOBuf_get_ptr |
883 | PerlIOBuf_bufsiz |
884 | PerlIOBuf_setlinebuf |
885 | PerlIOBase_clearerr |
886 | PerlIOBase_error |
887 | PerlIOBase_eof |
888 | PerlIOBuf_tell |
889 | PerlIOBuf_seek |
890 | PerlIOBuf_write |
891 | PerlIOBuf_unread |
892 | PerlIOBuf_read |
893 | PerlIOBuf_reopen |
894 | PerlIOBuf_open |
895 | PerlIOBuf_fdopen |
896 | PerlIOBase_fileno |
897 | PerlIOBuf_pushed |
898 | PerlIOBuf_fill |
899 | PerlIOBuf_flush |
900 | PerlIOBase_close |
901 | PerlIO_define_layer |
902 | PerlIO_pending |
903 | PerlIO_unread |
568ad336 |
904 | PerlIO_push |
905 | PerlIO_apply_layers |
906 | perlsio_binmode |
907 | PerlIO_binmode |
908 | PerlIO_init |
909 | PerlIO_tmpfile |
910 | PerlIO_setpos |
911 | PerlIO_getpos |
912 | PerlIO_vsprintf |
913 | PerlIO_sprintf |