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