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