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