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