Commit | Line | Data |
---|---|---|
549a6b10 JH |
1 | # |
2 | # Create the export list for perl. | |
3 | # | |
86593e8d JH |
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 |
5c728af0 | 9 | # On OS/2 reads miniperl.map and the previous version of perl5.def as well |
0a753a76 | 10 | |
549a6b10 JH |
11 | my $PLATFORM; |
12 | my $CCTYPE; | |
910dfcc8 | 13 | |
7766f137 GS |
14 | while (@ARGV) { |
15 | my $flag = shift; | |
5c728af0 IZ |
16 | if ($flag =~ s/^CC_FLAGS=/ /) { |
17 | for my $fflag ($flag =~ /(?:^|\s)-D(\S+)/g) { | |
18 | $fflag .= '=1' unless $fflag =~ /^(\w+)=/; | |
19 | $define{$1} = $2 if $fflag =~ /^(\w+)=(.+)$/; | |
20 | } | |
21 | next; | |
22 | } | |
7766f137 GS |
23 | $define{$1} = 1 if ($flag =~ /^-D(\w+)$/); |
24 | $define{$1} = $2 if ($flag =~ /^-D(\w+)=(.+)$/); | |
25 | $CCTYPE = $1 if ($flag =~ /^CCTYPE=(\w+)$/); | |
26 | $PLATFORM = $1 if ($flag =~ /^PLATFORM=(\w+)$/); | |
18f68570 VK |
27 | if ($PLATFORM eq 'netware') { |
28 | $FILETYPE = $1 if ($flag =~ /^FILETYPE=(\w+)$/); | |
29 | } | |
7766f137 | 30 | } |
d55594ae | 31 | |
18f68570 | 32 | my @PLATFORM = qw(aix win32 wince os2 MacOS netware); |
549a6b10 JH |
33 | my %PLATFORM; |
34 | @PLATFORM{@PLATFORM} = (); | |
35 | ||
36 | defined $PLATFORM || die "PLATFORM undefined, must be one of: @PLATFORM\n"; | |
9df9a5cd | 37 | exists $PLATFORM{$PLATFORM} || die "PLATFORM must be one of: @PLATFORM\n"; |
549a6b10 | 38 | |
1829b0dc | 39 | if ($PLATFORM eq 'win32' or $PLATFORM eq 'wince' or $PLATFORM eq "aix") { |
17bdc114 | 40 | # Add the compile-time options that miniperl was built with to %define. |
dcddf0a3 SH |
41 | # On Win32 these are not the same options as perl itself will be built |
42 | # with since miniperl is built with a canned config (one of the win32/ | |
43 | # config_H.*) and none of the BUILDOPT's that are set in the makefiles, | |
44 | # but they do include some #define's that are hard-coded in various | |
45 | # source files and header files and don't include any BUILDOPT's that | |
46 | # the user might have chosen to disable because the canned configs are | |
47 | # minimal configs that don't include any of those options. | |
1829b0dc VK |
48 | my $opts = ($PLATFORM eq 'wince' ? '-MCross' : ''); |
49 | my $config = `$^X $opts -Ilib -V`; | |
dcddf0a3 SH |
50 | my($options) = $config =~ /^ Compile-time options: (.*?)\n^ \S/ms; |
51 | $options =~ s/\s+/ /g; | |
40dfc4d2 | 52 | print STDERR "Options: ($options)\n"; |
17bdc114 SH |
53 | foreach (split /\s+/, $options) { |
54 | $define{$_} = 1; | |
55 | } | |
56 | } | |
57 | ||
c6261f3b JH |
58 | my %exportperlmalloc = |
59 | ( | |
60 | Perl_malloc => "malloc", | |
61 | Perl_mfree => "free", | |
62 | Perl_realloc => "realloc", | |
63 | Perl_calloc => "calloc", | |
64 | ); | |
65 | ||
66 | my $exportperlmalloc = $PLATFORM eq 'os2'; | |
67 | ||
549a6b10 JH |
68 | my $config_sh = "config.sh"; |
69 | my $config_h = "config.h"; | |
70 | my $thrdvar_h = "thrdvar.h"; | |
71 | my $intrpvar_h = "intrpvar.h"; | |
72 | my $perlvars_h = "perlvars.h"; | |
73 | my $global_sym = "global.sym"; | |
74 | my $pp_sym = "pp.sym"; | |
75 | my $globvar_sym = "globvar.sym"; | |
76 | my $perlio_sym = "perlio.sym"; | |
d2b25974 | 77 | my $static_ext = ""; |
549a6b10 | 78 | |
9df9a5cd | 79 | if ($PLATFORM eq 'aix') { |
549a6b10 | 80 | # Nothing for now. |
7766f137 | 81 | } |
18f68570 | 82 | elsif ($PLATFORM =~ /^win(?:32|ce)$/ || $PLATFORM eq 'netware') { |
549a6b10 | 83 | $CCTYPE = "MSVC" unless defined $CCTYPE; |
00b02797 | 84 | foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym, |
aadb217d | 85 | $pp_sym, $globvar_sym, $perlio_sym) { |
549a6b10 JH |
86 | s!^!..\\!; |
87 | } | |
88 | } | |
084592ab CN |
89 | elsif ($PLATFORM eq 'MacOS') { |
90 | foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym, | |
aadb217d | 91 | $pp_sym, $globvar_sym, $perlio_sym) { |
084592ab CN |
92 | s!^!::!; |
93 | } | |
94 | } | |
549a6b10 | 95 | |
18f68570 | 96 | unless ($PLATFORM eq 'win32' || $PLATFORM eq 'wince' || $PLATFORM eq 'MacOS' || $PLATFORM eq 'netware') { |
549a6b10 | 97 | open(CFG,$config_sh) || die "Cannot open $config_sh: $!\n"; |
7766f137 | 98 | while (<CFG>) { |
549a6b10 JH |
99 | if (/^(?:ccflags|optimize)='(.+)'$/) { |
100 | $_ = $1; | |
101 | $define{$1} = 1 while /-D(\w+)/g; | |
102 | } | |
aadb217d JH |
103 | if (/^(d_(?:mmap|sigaction))='(.+)'$/) { |
104 | $define{$1} = $2; | |
105 | } | |
3cfae81b | 106 | if ($PLATFORM eq 'os2') { |
52e4c282 IZ |
107 | $CONFIG_ARGS = $1 if /^config_args='(.+)'$/; |
108 | $ARCHNAME = $1 if /^archname='(.+)'$/; | |
109 | $PATCHLEVEL = $1 if /^perl_patchlevel='(.+)'$/; | |
3cfae81b | 110 | } |
549a6b10 JH |
111 | } |
112 | close(CFG); | |
113 | } | |
d2b25974 VK |
114 | if ($PLATFORM eq 'win32' || $PLATFORM eq 'wince') { |
115 | open(CFG,"<..\\$config_sh") || die "Cannot open ..\\$config_sh: $!\n"; | |
116 | if ((join '', <CFG>) =~ /^static_ext='(.*)'$/m) { | |
117 | $static_ext = $1; | |
118 | } | |
119 | close(CFG); | |
120 | } | |
549a6b10 JH |
121 | |
122 | open(CFG,$config_h) || die "Cannot open $config_h: $!\n"; | |
7766f137 GS |
123 | while (<CFG>) { |
124 | $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/; | |
7766f137 | 125 | $define{$1} = 1 if /^\s*#\s*define\s+(MULTIPLICITY)\b/; |
0e32cd81 JH |
126 | $define{$1} = 1 if /^\s*#\s*define\s+(PERL_\w+)\b/; |
127 | $define{$1} = 1 if /^\s*#\s*define\s+(USE_\w+)\b/; | |
7766f137 | 128 | } |
bbc8f9de NIS |
129 | close(CFG); |
130 | ||
18c4b137 JH |
131 | # perl.h logic duplication begins |
132 | ||
894ccb8c JH |
133 | if ($define{PERL_IMPLICIT_SYS}) { |
134 | $define{PL_OP_SLAB_ALLOC} = 1; | |
135 | } | |
ac6bedea | 136 | |
18c4b137 | 137 | if ($define{USE_ITHREADS}) { |
acfe0abc | 138 | if (!$define{MULTIPLICITY}) { |
18c4b137 JH |
139 | $define{MULTIPLICITY} = 1; |
140 | } | |
141 | } | |
142 | ||
143 | $define{PERL_IMPLICIT_CONTEXT} ||= | |
144 | $define{USE_ITHREADS} || | |
18c4b137 JH |
145 | $define{MULTIPLICITY} ; |
146 | ||
10bc17b6 JH |
147 | if ($define{USE_ITHREADS} && $PLATFORM ne 'win32' && $^O ne 'darwin') { |
148 | $define{USE_REENTRANT_API} = 1; | |
149 | } | |
150 | ||
18c4b137 JH |
151 | # perl.h logic duplication ends |
152 | ||
ac6bedea JH |
153 | my $sym_ord = 0; |
154 | ||
dcddf0a3 SH |
155 | print STDERR "Defines: (" . join(' ', sort keys %define) . ")\n"; |
156 | ||
18f68570 | 157 | if ($PLATFORM =~ /^win(?:32|ce)$/) { |
78a7c709 | 158 | ($dll = ($define{PERL_DLL} || "perl59")) =~ s/\.dll$//i; |
18f68570 | 159 | print "LIBRARY $dll\n"; |
dfdd1393 GS |
160 | print "DESCRIPTION 'Perl interpreter'\n"; |
161 | print "EXPORTS\n"; | |
162 | if ($define{PERL_IMPLICIT_SYS}) { | |
549a6b10 | 163 | output_symbol("perl_get_host_info"); |
7766f137 | 164 | output_symbol("perl_alloc_override"); |
0295eab8 | 165 | } |
b54a2e1e | 166 | if ($define{USE_ITHREADS} and $define{PERL_IMPLICIT_SYS}) { |
ac6bedea | 167 | output_symbol("perl_clone_host"); |
51371543 | 168 | } |
7766f137 GS |
169 | } |
170 | elsif ($PLATFORM eq 'os2') { | |
52e4c282 IZ |
171 | if (open my $fh, '<', 'perl5.def') { |
172 | while (<$fh>) { | |
173 | last if /^\s*EXPORTS\b/; | |
174 | } | |
175 | while (<$fh>) { | |
78232bc0 | 176 | $ordinal{$1} = $2 if /^\s*"(\w+)"\s*(?:=\s*"\w+"\s*)?\@(\d+)\s*$/; |
52e4c282 IZ |
177 | # This allows skipping ordinals which were used in older versions |
178 | $sym_ord = $1 if /^\s*;\s*LAST_ORDINAL\s*=\s*(\d+)\s*$/; | |
179 | } | |
180 | $sym_ord < $_ and $sym_ord = $_ for values %ordinal; # Take the max | |
181 | } | |
3cfae81b IZ |
182 | ($v = $]) =~ s/(\d\.\d\d\d)(\d\d)$/$1_$2/; |
183 | $v .= '-thread' if $ARCHNAME =~ /-thread/; | |
3cfae81b | 184 | ($dll = $define{PERL_DLL}) =~ s/\.dll$//i; |
52e4c282 | 185 | $v .= "\@$PATCHLEVEL" if $PATCHLEVEL; |
1102eebe IZ |
186 | $d = "DESCRIPTION '\@#perl5-porters\@perl.org:$v#\@ Perl interpreter, configured as $CONFIG_ARGS'"; |
187 | $d = substr($d, 0, 249) . "...'" if length $d > 253; | |
3cfae81b IZ |
188 | print <<"---EOP---"; |
189 | LIBRARY '$dll' INITINSTANCE TERMINSTANCE | |
1102eebe | 190 | $d |
3cfae81b IZ |
191 | STACKSIZE 32768 |
192 | CODE LOADONCALL | |
193 | DATA LOADONCALL NONSHARED MULTIPLE | |
194 | EXPORTS | |
195 | ---EOP--- | |
7766f137 GS |
196 | } |
197 | elsif ($PLATFORM eq 'aix') { | |
61d42ce4 JH |
198 | $OSVER = `uname -v`; |
199 | chop $OSVER; | |
200 | $OSREL = `uname -r`; | |
201 | chop $OSREL; | |
202 | if ($OSVER > 4 || ($OSVER == 4 && $OSREL >= 3)) { | |
203 | print "#! ..\n"; | |
204 | } else { | |
205 | print "#!\n"; | |
206 | } | |
ac4c12e7 | 207 | } |
2986a63f JH |
208 | elsif ($PLATFORM eq 'netware') { |
209 | if ($FILETYPE eq 'def') { | |
78a7c709 | 210 | print "LIBRARY perl59\n"; |
2986a63f JH |
211 | print "DESCRIPTION 'Perl interpreter for NetWare'\n"; |
212 | print "EXPORTS\n"; | |
213 | } | |
214 | if ($define{PERL_IMPLICIT_SYS}) { | |
ac6bedea JH |
215 | output_symbol("perl_get_host_info"); |
216 | output_symbol("perl_alloc_override"); | |
217 | output_symbol("perl_clone_host"); | |
2986a63f JH |
218 | } |
219 | } | |
bbc8f9de | 220 | |
22239a37 NIS |
221 | my %skip; |
222 | my %export; | |
223 | ||
51371543 GS |
224 | sub skip_symbols { |
225 | my $list = shift; | |
226 | foreach my $symbol (@$list) { | |
227 | $skip{$symbol} = 1; | |
228 | } | |
22239a37 NIS |
229 | } |
230 | ||
51371543 GS |
231 | sub emit_symbols { |
232 | my $list = shift; | |
233 | foreach my $symbol (@$list) { | |
234 | my $skipsym = $symbol; | |
235 | # XXX hack | |
acfe0abc | 236 | if ($define{MULTIPLICITY}) { |
51371543 GS |
237 | $skipsym =~ s/^Perl_[GIT](\w+)_ptr$/PL_$1/; |
238 | } | |
239 | emit_symbol($symbol) unless exists $skip{$skipsym}; | |
240 | } | |
22239a37 NIS |
241 | } |
242 | ||
549a6b10 | 243 | if ($PLATFORM eq 'win32') { |
7766f137 GS |
244 | skip_symbols [qw( |
245 | PL_statusvalue_vms | |
246 | PL_archpat_auto | |
247 | PL_cryptseen | |
248 | PL_DBcv | |
249 | PL_generation | |
250 | PL_lastgotoprobe | |
251 | PL_linestart | |
252 | PL_modcount | |
253 | PL_pending_ident | |
7766f137 GS |
254 | PL_sublex_info |
255 | PL_timesbuf | |
256 | main | |
257 | Perl_ErrorNo | |
aadb217d | 258 | Perl_GetVars |
7766f137 GS |
259 | Perl_do_exec3 |
260 | Perl_do_ipcctl | |
261 | Perl_do_ipcget | |
262 | Perl_do_msgrcv | |
263 | Perl_do_msgsnd | |
264 | Perl_do_semop | |
265 | Perl_do_shmio | |
266 | Perl_dump_fds | |
267 | Perl_init_thread_intern | |
268 | Perl_my_bzero | |
9d50d399 | 269 | Perl_my_bcopy |
7766f137 GS |
270 | Perl_my_htonl |
271 | Perl_my_ntohl | |
272 | Perl_my_swap | |
273 | Perl_my_chsize | |
274 | Perl_same_dirent | |
275 | Perl_setenv_getix | |
276 | Perl_unlnk | |
277 | Perl_watch | |
278 | Perl_safexcalloc | |
279 | Perl_safexmalloc | |
280 | Perl_safexfree | |
281 | Perl_safexrealloc | |
282 | Perl_my_memcmp | |
283 | Perl_my_memset | |
284 | PL_cshlen | |
285 | PL_cshname | |
286 | PL_opsave | |
287 | Perl_do_exec | |
288 | Perl_getenv_len | |
289 | Perl_my_pclose | |
290 | Perl_my_popen | |
291 | )]; | |
292 | } | |
54725af6 GS |
293 | else { |
294 | skip_symbols [qw( | |
295 | Perl_do_spawn | |
296 | Perl_do_spawn_nowait | |
297 | Perl_do_aspawn | |
298 | )]; | |
299 | } | |
300 | if ($PLATFORM eq 'wince') { | |
18f68570 VK |
301 | skip_symbols [qw( |
302 | PL_statusvalue_vms | |
303 | PL_archpat_auto | |
304 | PL_cryptseen | |
305 | PL_DBcv | |
306 | PL_generation | |
307 | PL_lastgotoprobe | |
308 | PL_linestart | |
309 | PL_modcount | |
310 | PL_pending_ident | |
18f68570 VK |
311 | PL_sublex_info |
312 | PL_timesbuf | |
313 | PL_collation_ix | |
314 | PL_collation_name | |
315 | PL_collation_standard | |
316 | PL_collxfrm_base | |
317 | PL_collxfrm_mult | |
318 | PL_numeric_compat1 | |
319 | PL_numeric_local | |
320 | PL_numeric_name | |
321 | PL_numeric_radix_sv | |
322 | PL_numeric_standard | |
323 | PL_vtbl_collxfrm | |
324 | Perl_sv_collxfrm | |
325 | setgid | |
326 | setuid | |
18f68570 VK |
327 | win32_free_childdir |
328 | win32_free_childenv | |
329 | win32_get_childdir | |
330 | win32_get_childenv | |
331 | win32_spawnvp | |
332 | main | |
333 | Perl_ErrorNo | |
aadb217d | 334 | Perl_GetVars |
18f68570 VK |
335 | Perl_do_exec3 |
336 | Perl_do_ipcctl | |
337 | Perl_do_ipcget | |
338 | Perl_do_msgrcv | |
339 | Perl_do_msgsnd | |
340 | Perl_do_semop | |
341 | Perl_do_shmio | |
342 | Perl_dump_fds | |
343 | Perl_init_thread_intern | |
344 | Perl_my_bzero | |
345 | Perl_my_bcopy | |
346 | Perl_my_htonl | |
347 | Perl_my_ntohl | |
348 | Perl_my_swap | |
349 | Perl_my_chsize | |
350 | Perl_same_dirent | |
351 | Perl_setenv_getix | |
352 | Perl_unlnk | |
353 | Perl_watch | |
354 | Perl_safexcalloc | |
355 | Perl_safexmalloc | |
356 | Perl_safexfree | |
357 | Perl_safexrealloc | |
358 | Perl_my_memcmp | |
359 | Perl_my_memset | |
360 | PL_cshlen | |
361 | PL_cshname | |
362 | PL_opsave | |
363 | Perl_do_exec | |
364 | Perl_getenv_len | |
365 | Perl_my_pclose | |
366 | Perl_my_popen | |
367 | )]; | |
368 | } | |
7766f137 | 369 | elsif ($PLATFORM eq 'aix') { |
549a6b10 | 370 | skip_symbols([qw( |
7766f137 GS |
371 | Perl_dump_fds |
372 | Perl_ErrorNo | |
aadb217d | 373 | Perl_GetVars |
7766f137 GS |
374 | Perl_my_bcopy |
375 | Perl_my_bzero | |
376 | Perl_my_chsize | |
377 | Perl_my_htonl | |
378 | Perl_my_memcmp | |
379 | Perl_my_memset | |
380 | Perl_my_ntohl | |
381 | Perl_my_swap | |
382 | Perl_safexcalloc | |
383 | Perl_safexfree | |
384 | Perl_safexmalloc | |
385 | Perl_safexrealloc | |
386 | Perl_same_dirent | |
387 | Perl_unlnk | |
6c644e78 | 388 | Perl_sys_intern_clear |
95151ede | 389 | Perl_sys_intern_dup |
52853b95 | 390 | Perl_sys_intern_init |
7766f137 GS |
391 | PL_cryptseen |
392 | PL_opsave | |
393 | PL_statusvalue_vms | |
394 | PL_sys_intern | |
395 | )]); | |
396 | } | |
397 | elsif ($PLATFORM eq 'os2') { | |
3cfae81b | 398 | emit_symbols([qw( |
7766f137 GS |
399 | ctermid |
400 | get_sysinfo | |
401 | Perl_OS2_init | |
764df951 IZ |
402 | Perl_OS2_init3 |
403 | Perl_OS2_term | |
7766f137 GS |
404 | OS2_Perl_data |
405 | dlopen | |
406 | dlsym | |
407 | dlerror | |
403d6f8e | 408 | dlclose |
59ad941d IZ |
409 | dup2 |
410 | dup | |
7766f137 GS |
411 | my_tmpfile |
412 | my_tmpnam | |
413 | my_flock | |
9c130f5b NIS |
414 | my_rmdir |
415 | my_mkdir | |
f72c975a IZ |
416 | my_getpwuid |
417 | my_getpwnam | |
418 | my_getpwent | |
419 | my_setpwent | |
420 | my_endpwent | |
622913ab IZ |
421 | fork_with_resources |
422 | croak_with_os2error | |
f72c975a IZ |
423 | setgrent |
424 | endgrent | |
425 | getgrent | |
7766f137 GS |
426 | malloc_mutex |
427 | threads_mutex | |
428 | nthreads | |
429 | nthreads_cond | |
430 | os2_cond_wait | |
431 | os2_stat | |
1933e12c IZ |
432 | os2_execname |
433 | async_mssleep | |
434 | msCounter | |
435 | InfoTable | |
7766f137 GS |
436 | pthread_join |
437 | pthread_create | |
438 | pthread_detach | |
439 | XS_Cwd_change_drive | |
440 | XS_Cwd_current_drive | |
441 | XS_Cwd_extLibpath | |
442 | XS_Cwd_extLibpath_set | |
443 | XS_Cwd_sys_abspath | |
444 | XS_Cwd_sys_chdir | |
445 | XS_Cwd_sys_cwd | |
446 | XS_Cwd_sys_is_absolute | |
447 | XS_Cwd_sys_is_relative | |
448 | XS_Cwd_sys_is_rooted | |
449 | XS_DynaLoader_mod2fname | |
450 | XS_File__Copy_syscopy | |
451 | Perl_Register_MQ | |
452 | Perl_Deregister_MQ | |
453 | Perl_Serve_Messages | |
454 | Perl_Process_Messages | |
455 | init_PMWIN_entries | |
456 | PMWIN_entries | |
457 | Perl_hab_GET | |
35bc1fdc IZ |
458 | loadByOrdinal |
459 | pExtFCN | |
30500b05 IZ |
460 | os2error |
461 | ResetWinError | |
462 | CroakWinError | |
5c728af0 | 463 | PL_do_undump |
7766f137 | 464 | )]); |
5c728af0 IZ |
465 | emit_symbols([qw(os2_cond_wait |
466 | pthread_join | |
467 | pthread_create | |
468 | pthread_detach | |
469 | )]) | |
470 | if $define{'USE_5005THREADS'} or $define{'USE_ITHREADS'}; | |
3cfae81b | 471 | } |
084592ab CN |
472 | elsif ($PLATFORM eq 'MacOS') { |
473 | skip_symbols [qw( | |
aadb217d | 474 | Perl_GetVars |
084592ab CN |
475 | PL_cryptseen |
476 | PL_cshlen | |
477 | PL_cshname | |
478 | PL_statusvalue_vms | |
479 | PL_sys_intern | |
480 | PL_opsave | |
481 | PL_timesbuf | |
482 | Perl_dump_fds | |
483 | Perl_my_bcopy | |
484 | Perl_my_bzero | |
485 | Perl_my_chsize | |
486 | Perl_my_htonl | |
487 | Perl_my_memcmp | |
488 | Perl_my_memset | |
489 | Perl_my_ntohl | |
490 | Perl_my_swap | |
491 | Perl_safexcalloc | |
492 | Perl_safexfree | |
493 | Perl_safexmalloc | |
494 | Perl_safexrealloc | |
495 | Perl_unlnk | |
fe05f414 JH |
496 | Perl_sys_intern_clear |
497 | Perl_sys_intern_init | |
084592ab CN |
498 | )]; |
499 | } | |
2986a63f JH |
500 | elsif ($PLATFORM eq 'netware') { |
501 | skip_symbols [qw( | |
502 | PL_statusvalue_vms | |
503 | PL_archpat_auto | |
504 | PL_cryptseen | |
505 | PL_DBcv | |
506 | PL_generation | |
507 | PL_lastgotoprobe | |
508 | PL_linestart | |
509 | PL_modcount | |
510 | PL_pending_ident | |
2986a63f JH |
511 | PL_sublex_info |
512 | PL_timesbuf | |
513 | main | |
514 | Perl_ErrorNo | |
aadb217d | 515 | Perl_GetVars |
2986a63f JH |
516 | Perl_do_exec3 |
517 | Perl_do_ipcctl | |
518 | Perl_do_ipcget | |
519 | Perl_do_msgrcv | |
520 | Perl_do_msgsnd | |
521 | Perl_do_semop | |
522 | Perl_do_shmio | |
523 | Perl_dump_fds | |
524 | Perl_init_thread_intern | |
525 | Perl_my_bzero | |
526 | Perl_my_htonl | |
527 | Perl_my_ntohl | |
528 | Perl_my_swap | |
529 | Perl_my_chsize | |
530 | Perl_same_dirent | |
531 | Perl_setenv_getix | |
532 | Perl_unlnk | |
533 | Perl_watch | |
534 | Perl_safexcalloc | |
535 | Perl_safexmalloc | |
536 | Perl_safexfree | |
537 | Perl_safexrealloc | |
538 | Perl_my_memcmp | |
539 | Perl_my_memset | |
540 | PL_cshlen | |
541 | PL_cshname | |
542 | PL_opsave | |
543 | Perl_do_exec | |
544 | Perl_getenv_len | |
545 | Perl_my_pclose | |
546 | Perl_my_popen | |
011f1a1a JH |
547 | Perl_sys_intern_init |
548 | Perl_sys_intern_dup | |
549 | Perl_sys_intern_clear | |
550 | Perl_my_bcopy | |
551 | Perl_PerlIO_write | |
552 | Perl_PerlIO_unread | |
553 | Perl_PerlIO_tell | |
554 | Perl_PerlIO_stdout | |
555 | Perl_PerlIO_stdin | |
556 | Perl_PerlIO_stderr | |
557 | Perl_PerlIO_setlinebuf | |
558 | Perl_PerlIO_set_ptrcnt | |
559 | Perl_PerlIO_set_cnt | |
560 | Perl_PerlIO_seek | |
561 | Perl_PerlIO_read | |
562 | Perl_PerlIO_get_ptr | |
563 | Perl_PerlIO_get_cnt | |
564 | Perl_PerlIO_get_bufsiz | |
565 | Perl_PerlIO_get_base | |
566 | Perl_PerlIO_flush | |
567 | Perl_PerlIO_fill | |
568 | Perl_PerlIO_fileno | |
569 | Perl_PerlIO_error | |
570 | Perl_PerlIO_eof | |
571 | Perl_PerlIO_close | |
572 | Perl_PerlIO_clearerr | |
573 | PerlIO_perlio | |
2986a63f JH |
574 | )]; |
575 | } | |
3cfae81b | 576 | |
7766f137 GS |
577 | unless ($define{'DEBUGGING'}) { |
578 | skip_symbols [qw( | |
7766f137 GS |
579 | Perl_deb_growlevel |
580 | Perl_debop | |
581 | Perl_debprofdump | |
582 | Perl_debstack | |
583 | Perl_debstackptrs | |
7766f137 GS |
584 | Perl_sv_peek |
585 | PL_block_type | |
586 | PL_watchaddr | |
587 | PL_watchok | |
e0cde265 | 588 | PL_watch_pvx |
7766f137 GS |
589 | )]; |
590 | } | |
591 | ||
605881df SH |
592 | if ($define{'PERL_IMPLICIT_CONTEXT'}) { |
593 | skip_symbols [qw( | |
594 | PL_sig_sv | |
595 | )]; | |
596 | } | |
597 | ||
7766f137 GS |
598 | if ($define{'PERL_IMPLICIT_SYS'}) { |
599 | skip_symbols [qw( | |
600 | Perl_getenv_len | |
601 | Perl_my_popen | |
602 | Perl_my_pclose | |
603 | )]; | |
604 | } | |
605 | else { | |
606 | skip_symbols [qw( | |
607 | PL_Mem | |
608 | PL_MemShared | |
609 | PL_MemParse | |
610 | PL_Env | |
611 | PL_StdIO | |
612 | PL_LIO | |
613 | PL_Dir | |
614 | PL_Sock | |
615 | PL_Proc | |
616 | )]; | |
617 | } | |
618 | ||
f8c7b90f | 619 | unless ($define{'PERL_OLD_COPY_ON_WRITE'}) { |
0190f6ec AT |
620 | skip_symbols [qw( |
621 | Perl_sv_setsv_cow | |
2aa6a103 | 622 | Perl_sv_release_IVX |
0190f6ec AT |
623 | )]; |
624 | } | |
625 | ||
5bcb3f6c NIS |
626 | unless ($define{'USE_REENTRANT_API'}) { |
627 | skip_symbols [qw( | |
628 | PL_reentrant_buffer | |
629 | )]; | |
630 | } | |
631 | ||
7766f137 GS |
632 | if ($define{'MYMALLOC'}) { |
633 | emit_symbols [qw( | |
634 | Perl_dump_mstats | |
827e134a | 635 | Perl_get_mstats |
9c130f5b NIS |
636 | Perl_strdup |
637 | Perl_putenv | |
6af660ee IZ |
638 | MallocCfg_ptr |
639 | MallocCfgP_ptr | |
7766f137 | 640 | )]; |
3db8f154 | 641 | if ($define{'USE_ITHREADS'}) { |
1feb2720 GS |
642 | emit_symbols [qw( |
643 | PL_malloc_mutex | |
644 | )]; | |
645 | } | |
80fc1a6e GS |
646 | else { |
647 | skip_symbols [qw( | |
648 | PL_malloc_mutex | |
649 | )]; | |
650 | } | |
51371543 GS |
651 | } |
652 | else { | |
7766f137 GS |
653 | skip_symbols [qw( |
654 | PL_malloc_mutex | |
655 | Perl_dump_mstats | |
6ecd3fcb | 656 | Perl_get_mstats |
7766f137 | 657 | Perl_malloced_size |
6af660ee IZ |
658 | MallocCfg_ptr |
659 | MallocCfgP_ptr | |
7766f137 GS |
660 | )]; |
661 | } | |
662 | ||
aadb217d | 663 | unless ($define{'PERL_MALLOC_WRAP'}) { |
e0cde265 | 664 | skip_symbols [qw( |
aadb217d | 665 | PL_memory_wrap |
e0cde265 SH |
666 | )]; |
667 | } | |
668 | ||
8852afe9 MB |
669 | if ($define{'PERL_USE_SAFE_PUTENV'}) { |
670 | skip_symbols [qw( | |
671 | PL_use_safe_putenv | |
672 | )]; | |
673 | } | |
674 | ||
3db8f154 | 675 | unless ($define{'USE_ITHREADS'}) { |
7766f137 GS |
676 | skip_symbols [qw( |
677 | PL_thr_key | |
f433d095 GS |
678 | )]; |
679 | } | |
680 | ||
3db8f154 | 681 | # USE_5005THREADS symbols. Kept as reference for easier removal |
f433d095 | 682 | skip_symbols [qw( |
7766f137 GS |
683 | PL_sv_mutex |
684 | PL_strtab_mutex | |
685 | PL_svref_mutex | |
7766f137 GS |
686 | PL_cred_mutex |
687 | PL_eval_mutex | |
6940069f GS |
688 | PL_fdpid_mutex |
689 | PL_sv_lock_mutex | |
7766f137 GS |
690 | PL_eval_cond |
691 | PL_eval_owner | |
692 | PL_threads_mutex | |
693 | PL_nthreads | |
694 | PL_nthreads_cond | |
695 | PL_threadnum | |
696 | PL_threadsv_names | |
697 | PL_thrsv | |
698 | PL_vtbl_mutex | |
7766f137 GS |
699 | Perl_condpair_magic |
700 | Perl_new_struct_thread | |
701 | Perl_per_thread_magicals | |
702 | Perl_thread_create | |
703 | Perl_find_threadsv | |
704 | Perl_unlock_condpair | |
705 | Perl_magic_mutexfree | |
4755096e | 706 | Perl_sv_lock |
7766f137 | 707 | )]; |
7766f137 GS |
708 | |
709 | unless ($define{'USE_ITHREADS'}) { | |
710 | skip_symbols [qw( | |
711 | PL_ptr_table | |
6e72d904 NC |
712 | PL_pte_root |
713 | PL_pte_arenaroot | |
534825c4 | 714 | PL_op_mutex |
7e95b20d JH |
715 | PL_regex_pad |
716 | PL_regex_padav | |
f2f7cecd MB |
717 | PL_sharedsv_space |
718 | PL_sharedsv_space_mutex | |
e2975953 | 719 | PL_dollarzero_mutex |
7766f137 GS |
720 | Perl_dirp_dup |
721 | Perl_cx_dup | |
722 | Perl_si_dup | |
723 | Perl_any_dup | |
724 | Perl_ss_dup | |
725 | Perl_fp_dup | |
726 | Perl_gp_dup | |
727 | Perl_he_dup | |
728 | Perl_mg_dup | |
729 | Perl_re_dup | |
730 | Perl_sv_dup | |
aeef2723 | 731 | Perl_rvpv_dup |
88daff13 | 732 | Perl_hek_dup |
7766f137 | 733 | Perl_sys_intern_dup |
86593e8d | 734 | Perl_ptr_table_clear |
7766f137 | 735 | Perl_ptr_table_fetch |
86593e8d | 736 | Perl_ptr_table_free |
7766f137 | 737 | Perl_ptr_table_new |
4ac9195f MS |
738 | Perl_ptr_table_clear |
739 | Perl_ptr_table_free | |
7766f137 GS |
740 | Perl_ptr_table_split |
741 | Perl_ptr_table_store | |
742 | perl_clone | |
743 | perl_clone_using | |
038f0558 JH |
744 | Perl_sharedsv_find |
745 | Perl_sharedsv_init | |
746 | Perl_sharedsv_lock | |
747 | Perl_sharedsv_new | |
748 | Perl_sharedsv_thrcnt_dec | |
749 | Perl_sharedsv_thrcnt_inc | |
750 | Perl_sharedsv_unlock | |
dc1061dc | 751 | Perl_stashpv_hvname_match |
7766f137 GS |
752 | )]; |
753 | } | |
754 | ||
755 | unless ($define{'PERL_IMPLICIT_CONTEXT'}) { | |
756 | skip_symbols [qw( | |
757 | Perl_croak_nocontext | |
758 | Perl_die_nocontext | |
759 | Perl_deb_nocontext | |
760 | Perl_form_nocontext | |
e0f4245d | 761 | Perl_load_module_nocontext |
7766f137 GS |
762 | Perl_mess_nocontext |
763 | Perl_warn_nocontext | |
764 | Perl_warner_nocontext | |
765 | Perl_newSVpvf_nocontext | |
766 | Perl_sv_catpvf_nocontext | |
767 | Perl_sv_setpvf_nocontext | |
768 | Perl_sv_catpvf_mg_nocontext | |
769 | Perl_sv_setpvf_mg_nocontext | |
770 | )]; | |
771 | } | |
772 | ||
773 | unless ($define{'PERL_IMPLICIT_SYS'}) { | |
774 | skip_symbols [qw( | |
775 | perl_alloc_using | |
014822e4 | 776 | perl_clone_using |
7766f137 GS |
777 | )]; |
778 | } | |
779 | ||
780 | unless ($define{'FAKE_THREADS'}) { | |
781 | skip_symbols [qw(PL_curthr)]; | |
782 | } | |
783 | ||
aadb217d | 784 | unless ($define{'PL_OP_SLAB_ALLOC'}) { |
e0cde265 | 785 | skip_symbols [qw( |
aadb217d JH |
786 | PL_OpPtr |
787 | PL_OpSlab | |
788 | PL_OpSpace | |
789 | Perl_Slab_Alloc | |
790 | Perl_Slab_Free | |
791 | )]; | |
792 | } | |
793 | ||
794 | unless ($define{'THREADS_HAVE_PIDS'}) { | |
795 | skip_symbols [qw(PL_ppid)]; | |
e0cde265 SH |
796 | } |
797 | ||
aadb217d | 798 | unless ($define{'PERL_NEED_APPCTX'}) { |
e0cde265 | 799 | skip_symbols [qw( |
aadb217d | 800 | PL_appctx |
e0cde265 SH |
801 | )]; |
802 | } | |
803 | ||
aadb217d | 804 | unless ($define{'PERL_NEED_TIMESBASE'}) { |
e0cde265 | 805 | skip_symbols [qw( |
aadb217d | 806 | PL_timesbase |
e0cde265 SH |
807 | )]; |
808 | } | |
809 | ||
808e2276 NC |
810 | unless ($define{'DEBUG_LEAKING_SCALARS_FORK_DUMP'}) { |
811 | skip_symbols [qw( | |
812 | PL_dumper_fd | |
813 | )]; | |
814 | } | |
c69033f2 NC |
815 | unless ($define{'PERL_DONT_CREATE_GVSV'}) { |
816 | skip_symbols [qw( | |
817 | Perl_gv_SVadd | |
818 | )]; | |
819 | } | |
ce582cee NC |
820 | if ($define{'SPRINTF_RETURNS_STRLEN'}) { |
821 | skip_symbols [qw( | |
822 | Perl_my_sprintf | |
823 | )]; | |
824 | } | |
ca0c25f6 NC |
825 | unless ($define{'PERL_USES_PL_PIDSTATUS'}) { |
826 | skip_symbols [qw( | |
827 | Perl_pidgone | |
828 | PL_pidstatus | |
829 | )]; | |
830 | } | |
808e2276 | 831 | |
aadb217d | 832 | unless ($define{'d_mmap'}) { |
ac6bedea | 833 | skip_symbols [qw( |
aadb217d JH |
834 | PL_mmap_page_size |
835 | )]; | |
ac6bedea JH |
836 | } |
837 | ||
aadb217d JH |
838 | if ($define{'d_sigaction'}) { |
839 | skip_symbols [qw( | |
840 | PL_sig_trapped | |
841 | )]; | |
d97afc04 AT |
842 | } |
843 | ||
aadb217d JH |
844 | if ($^O ne 'vms') { |
845 | # VMS does its own thing for these symbols. | |
846 | skip_symbols [qw(PL_sig_handlers_initted | |
847 | PL_sig_ignoring | |
848 | PL_sig_defaulting)]; | |
849 | } | |
850 | ||
7766f137 GS |
851 | sub readvar { |
852 | my $file = shift; | |
853 | my $proc = shift || sub { "PL_$_[2]" }; | |
854 | open(VARS,$file) || die "Cannot open $file: $!\n"; | |
855 | my @syms; | |
856 | while (<VARS>) { | |
857 | # All symbols have a Perl_ prefix because that's what embed.h | |
aadb217d JH |
858 | # sticks in front of them. The A?I?S?C? is strictly speaking |
859 | # wrong. | |
313fe300 | 860 | push(@syms, &$proc($1,$2,$3)) if (/\bPERLVAR(A?I?S?C?)\(([IGT])(\w+)/); |
9df9a5cd NIS |
861 | } |
862 | close(VARS); | |
7766f137 GS |
863 | return \@syms; |
864 | } | |
865 | ||
7766f137 GS |
866 | if ($define{'PERL_GLOBAL_STRUCT'}) { |
867 | my $global = readvar($perlvars_h); | |
868 | skip_symbols $global; | |
869 | emit_symbol('Perl_GetVars'); | |
870 | emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC'; | |
aadb217d JH |
871 | } else { |
872 | skip_symbols [qw(Perl_init_global_struct Perl_free_global_struct)]; | |
7766f137 | 873 | } |
36c15d3f | 874 | |
22c35a8c GS |
875 | # functions from *.sym files |
876 | ||
954c1994 | 877 | my @syms = ($global_sym, $globvar_sym); # $pp_sym is not part of the API |
549a6b10 | 878 | |
d892637e NIS |
879 | # Symbols that are the public face of the PerlIO layers implementation |
880 | # These are in _addition to_ the public face of the abstraction | |
881 | # and need to be exported to allow XS modules to implement layers | |
9df9a5cd | 882 | my @layer_syms = qw( |
db76e01e JH |
883 | PerlIOBase_binmode |
884 | PerlIOBase_clearerr | |
885 | PerlIOBase_close | |
886 | PerlIOBase_dup | |
887 | PerlIOBase_eof | |
888 | PerlIOBase_error | |
889 | PerlIOBase_fileno | |
890 | PerlIOBase_noop_fail | |
891 | PerlIOBase_noop_ok | |
892 | PerlIOBase_popped | |
7e700b9a | 893 | PerlIOBase_pushed |
db76e01e JH |
894 | PerlIOBase_read |
895 | PerlIOBase_setlinebuf | |
896 | PerlIOBase_unread | |
897 | PerlIOBuf_bufsiz | |
898 | PerlIOBuf_close | |
899 | PerlIOBuf_dup | |
900 | PerlIOBuf_fill | |
901 | PerlIOBuf_flush | |
902 | PerlIOBuf_get_base | |
903 | PerlIOBuf_get_cnt | |
904 | PerlIOBuf_get_ptr | |
905 | PerlIOBuf_open | |
906 | PerlIOBuf_popped | |
907 | PerlIOBuf_pushed | |
908 | PerlIOBuf_read | |
909 | PerlIOBuf_seek | |
910 | PerlIOBuf_set_ptrcnt | |
911 | PerlIOBuf_tell | |
912 | PerlIOBuf_unread | |
913 | PerlIOBuf_write | |
914 | PerlIO_allocate | |
8ffeedc3 | 915 | PerlIO_apply_layera |
db76e01e JH |
916 | PerlIO_apply_layers |
917 | PerlIO_arg_fetch | |
918 | PerlIO_debug | |
919 | PerlIO_define_layer | |
51d05609 | 920 | PerlIO_isutf8 |
db76e01e JH |
921 | PerlIO_layer_fetch |
922 | PerlIO_list_free | |
923 | PerlIO_modestr | |
924 | PerlIO_parse_layers | |
925 | PerlIO_pending | |
926 | PerlIO_perlio | |
927 | PerlIO_pop | |
928 | PerlIO_push | |
929 | PerlIO_sv_dup | |
930 | Perl_PerlIO_clearerr | |
931 | Perl_PerlIO_close | |
932 | Perl_PerlIO_eof | |
933 | Perl_PerlIO_error | |
934 | Perl_PerlIO_fileno | |
935 | Perl_PerlIO_fill | |
936 | Perl_PerlIO_flush | |
937 | Perl_PerlIO_get_base | |
938 | Perl_PerlIO_get_bufsiz | |
939 | Perl_PerlIO_get_cnt | |
940 | Perl_PerlIO_get_ptr | |
941 | Perl_PerlIO_read | |
942 | Perl_PerlIO_seek | |
943 | Perl_PerlIO_set_cnt | |
944 | Perl_PerlIO_set_ptrcnt | |
945 | Perl_PerlIO_setlinebuf | |
946 | Perl_PerlIO_stderr | |
947 | Perl_PerlIO_stdin | |
948 | Perl_PerlIO_stdout | |
949 | Perl_PerlIO_tell | |
950 | Perl_PerlIO_unread | |
951 | Perl_PerlIO_write | |
9df9a5cd | 952 | ); |
a5564b91 JH |
953 | if ($PLATFORM eq 'netware') { |
954 | push(@layer_syms,'PL_def_layerlist','PL_known_layers','PL_perlio'); | |
955 | } | |
d892637e | 956 | |
7766f137 | 957 | if ($define{'USE_PERLIO'}) { |
d892637e NIS |
958 | # Export the symols that make up the PerlIO abstraction, regardless |
959 | # of its implementation - read from a file | |
084592ab | 960 | push @syms, $perlio_sym; |
d892637e NIS |
961 | |
962 | # This part is then dependent on how the abstraction is implemented | |
084592ab | 963 | if ($define{'USE_SFIO'}) { |
d892637e | 964 | # Old legacy non-stdio "PerlIO" |
9df9a5cd | 965 | skip_symbols \@layer_syms; |
954fb84e | 966 | skip_symbols [qw(perlsio_binmode)]; |
084592ab | 967 | # SFIO defines most of the PerlIO routines as macros |
d892637e NIS |
968 | # So undo most of what $perlio_sym has just done - d'oh ! |
969 | # Perhaps it would be better to list the ones which do exist | |
970 | # And emit them | |
084592ab CN |
971 | skip_symbols [qw( |
972 | PerlIO_canset_cnt | |
973 | PerlIO_clearerr | |
974 | PerlIO_close | |
975 | PerlIO_eof | |
976 | PerlIO_error | |
977 | PerlIO_exportFILE | |
978 | PerlIO_fast_gets | |
979 | PerlIO_fdopen | |
980 | PerlIO_fileno | |
981 | PerlIO_findFILE | |
982 | PerlIO_flush | |
983 | PerlIO_get_base | |
984 | PerlIO_get_bufsiz | |
985 | PerlIO_get_cnt | |
986 | PerlIO_get_ptr | |
987 | PerlIO_getc | |
988 | PerlIO_getname | |
989 | PerlIO_has_base | |
990 | PerlIO_has_cntptr | |
991 | PerlIO_importFILE | |
992 | PerlIO_open | |
993 | PerlIO_printf | |
994 | PerlIO_putc | |
995 | PerlIO_puts | |
996 | PerlIO_read | |
997 | PerlIO_releaseFILE | |
998 | PerlIO_reopen | |
999 | PerlIO_rewind | |
1000 | PerlIO_seek | |
1001 | PerlIO_set_cnt | |
1002 | PerlIO_set_ptrcnt | |
1003 | PerlIO_setlinebuf | |
1004 | PerlIO_sprintf | |
1005 | PerlIO_stderr | |
1006 | PerlIO_stdin | |
1007 | PerlIO_stdout | |
1008 | PerlIO_stdoutf | |
1009 | PerlIO_tell | |
1010 | PerlIO_ungetc | |
1011 | PerlIO_vprintf | |
1012 | PerlIO_write | |
bcdb689b JH |
1013 | PerlIO_perlio |
1014 | Perl_PerlIO_clearerr | |
1015 | Perl_PerlIO_close | |
1016 | Perl_PerlIO_eof | |
1017 | Perl_PerlIO_error | |
1018 | Perl_PerlIO_fileno | |
1019 | Perl_PerlIO_fill | |
1020 | Perl_PerlIO_flush | |
1021 | Perl_PerlIO_get_base | |
1022 | Perl_PerlIO_get_bufsiz | |
1023 | Perl_PerlIO_get_cnt | |
1024 | Perl_PerlIO_get_ptr | |
1025 | Perl_PerlIO_read | |
1026 | Perl_PerlIO_seek | |
1027 | Perl_PerlIO_set_cnt | |
1028 | Perl_PerlIO_set_ptrcnt | |
1029 | Perl_PerlIO_setlinebuf | |
1030 | Perl_PerlIO_stderr | |
1031 | Perl_PerlIO_stdin | |
1032 | Perl_PerlIO_stdout | |
1033 | Perl_PerlIO_tell | |
1034 | Perl_PerlIO_unread | |
1035 | Perl_PerlIO_write | |
ffcf5686 JH |
1036 | PL_def_layerlist |
1037 | PL_known_layers | |
1038 | PL_perlio | |
084592ab CN |
1039 | )]; |
1040 | } | |
d892637e NIS |
1041 | else { |
1042 | # PerlIO with layers - export implementation | |
1043 | emit_symbols \@layer_syms; | |
954fb84e | 1044 | emit_symbols [qw(perlsio_binmode)]; |
d892637e | 1045 | } |
5138f914 | 1046 | } else { |
d892637e NIS |
1047 | # -Uuseperlio |
1048 | # Skip the PerlIO layer symbols - although | |
aadb217d | 1049 | # nothing should have exported them anyway. |
9df9a5cd | 1050 | skip_symbols \@layer_syms; |
954fb84e | 1051 | skip_symbols [qw(perlsio_binmode)]; |
1e8a8f59 NIS |
1052 | skip_symbols [qw(PL_def_layerlist PL_known_layers PL_perlio)]; |
1053 | ||
d892637e NIS |
1054 | # Also do NOT add abstraction symbols from $perlio_sym |
1055 | # abstraction is done as #define to stdio | |
1056 | # Remaining remnants that _may_ be functions | |
1057 | # are handled in <DATA> | |
9df9a5cd | 1058 | } |
7766f137 GS |
1059 | |
1060 | for my $syms (@syms) { | |
1061 | open (GLOBAL, "<$syms") || die "failed to open $syms: $!\n"; | |
1062 | while (<GLOBAL>) { | |
1063 | next if (!/^[A-Za-z]/); | |
1064 | # Functions have a Perl_ prefix | |
1065 | # Variables have a PL_ prefix | |
1066 | chomp($_); | |
1067 | my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : ""); | |
1068 | $symbol .= $_; | |
1069 | emit_symbol($symbol) unless exists $skip{$symbol}; | |
1070 | } | |
1071 | close(GLOBAL); | |
1072 | } | |
0a753a76 | 1073 | |
22c35a8c | 1074 | # variables |
0a753a76 | 1075 | |
acfe0abc | 1076 | if ($define{'MULTIPLICITY'}) { |
1acb48c9 | 1077 | for my $f ($perlvars_h, $intrpvar_h, $thrdvar_h) { |
18c4b137 JH |
1078 | my $glob = readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" }); |
1079 | emit_symbols $glob; | |
18c4b137 | 1080 | } |
1acb48c9 | 1081 | # XXX AIX seems to want the perlvars.h symbols, for some reason |
5c728af0 | 1082 | if ($PLATFORM eq 'aix' or $PLATFORM eq 'os2') { # OS/2 needs PL_thr_key |
1acb48c9 | 1083 | my $glob = readvar($perlvars_h); |
51371543 GS |
1084 | emit_symbols $glob; |
1085 | } | |
1086 | } | |
1087 | else { | |
1088 | unless ($define{'PERL_GLOBAL_STRUCT'}) { | |
549a6b10 | 1089 | my $glob = readvar($perlvars_h); |
51371543 | 1090 | emit_symbols $glob; |
9df9a5cd | 1091 | } |
51371543 | 1092 | unless ($define{'MULTIPLICITY'}) { |
549a6b10 | 1093 | my $glob = readvar($intrpvar_h); |
51371543 | 1094 | emit_symbols $glob; |
9df9a5cd | 1095 | } |
3db8f154 | 1096 | unless ($define{'MULTIPLICITY'}) { |
549a6b10 | 1097 | my $glob = readvar($thrdvar_h); |
51371543 | 1098 | emit_symbols $glob; |
9df9a5cd | 1099 | } |
51371543 | 1100 | } |
0a753a76 | 1101 | |
549a6b10 JH |
1102 | sub try_symbol { |
1103 | my $symbol = shift; | |
22239a37 | 1104 | |
4d6b4052 | 1105 | return if $symbol !~ /^[A-Za-z_]/; |
549a6b10 JH |
1106 | return if $symbol =~ /^\#/; |
1107 | $symbol =~s/\r//g; | |
1108 | chomp($symbol); | |
43cd9f80 | 1109 | return if exists $skip{$symbol}; |
549a6b10 | 1110 | emit_symbol($symbol); |
3e3baf6d | 1111 | } |
0a753a76 | 1112 | |
549a6b10 JH |
1113 | while (<DATA>) { |
1114 | try_symbol($_); | |
ac4c12e7 GS |
1115 | } |
1116 | ||
18f68570 | 1117 | if ($PLATFORM =~ /^win(?:32|ce)$/) { |
549a6b10 | 1118 | foreach my $symbol (qw( |
00b02797 JH |
1119 | setuid |
1120 | setgid | |
7766f137 | 1121 | boot_DynaLoader |
7766f137 | 1122 | Perl_init_os_extras |
c44d3fdb | 1123 | Perl_thread_create |
7766f137 | 1124 | Perl_win32_init |
23f519f0 | 1125 | Perl_win32_term |
7766f137 | 1126 | RunPerl |
5290524f | 1127 | win32_async_check |
7766f137 GS |
1128 | win32_errno |
1129 | win32_environ | |
7766f137 GS |
1130 | win32_abort |
1131 | win32_fstat | |
1132 | win32_stat | |
1133 | win32_pipe | |
1134 | win32_popen | |
1135 | win32_pclose | |
1136 | win32_rename | |
1137 | win32_setmode | |
11bb82ff | 1138 | win32_chsize |
7766f137 GS |
1139 | win32_lseek |
1140 | win32_tell | |
1141 | win32_dup | |
1142 | win32_dup2 | |
1143 | win32_open | |
1144 | win32_close | |
1145 | win32_eof | |
1146 | win32_read | |
1147 | win32_write | |
1148 | win32_spawnvp | |
1149 | win32_mkdir | |
1150 | win32_rmdir | |
1151 | win32_chdir | |
1152 | win32_flock | |
1153 | win32_execv | |
1154 | win32_execvp | |
1155 | win32_htons | |
1156 | win32_ntohs | |
1157 | win32_htonl | |
1158 | win32_ntohl | |
1159 | win32_inet_addr | |
1160 | win32_inet_ntoa | |
1161 | win32_socket | |
1162 | win32_bind | |
1163 | win32_listen | |
1164 | win32_accept | |
1165 | win32_connect | |
1166 | win32_send | |
1167 | win32_sendto | |
1168 | win32_recv | |
1169 | win32_recvfrom | |
1170 | win32_shutdown | |
1171 | win32_closesocket | |
1172 | win32_ioctlsocket | |
1173 | win32_setsockopt | |
1174 | win32_getsockopt | |
1175 | win32_getpeername | |
1176 | win32_getsockname | |
1177 | win32_gethostname | |
1178 | win32_gethostbyname | |
1179 | win32_gethostbyaddr | |
1180 | win32_getprotobyname | |
1181 | win32_getprotobynumber | |
1182 | win32_getservbyname | |
1183 | win32_getservbyport | |
1184 | win32_select | |
1185 | win32_endhostent | |
1186 | win32_endnetent | |
1187 | win32_endprotoent | |
1188 | win32_endservent | |
1189 | win32_getnetent | |
1190 | win32_getnetbyname | |
1191 | win32_getnetbyaddr | |
1192 | win32_getprotoent | |
1193 | win32_getservent | |
1194 | win32_sethostent | |
1195 | win32_setnetent | |
1196 | win32_setprotoent | |
1197 | win32_setservent | |
1198 | win32_getenv | |
1199 | win32_putenv | |
1200 | win32_perror | |
7766f137 GS |
1201 | win32_malloc |
1202 | win32_calloc | |
1203 | win32_realloc | |
1204 | win32_free | |
1205 | win32_sleep | |
1206 | win32_times | |
1207 | win32_access | |
1208 | win32_alarm | |
1209 | win32_chmod | |
1210 | win32_open_osfhandle | |
1211 | win32_get_osfhandle | |
1212 | win32_ioctl | |
1213 | win32_link | |
1214 | win32_unlink | |
1215 | win32_utime | |
57ab3dfe | 1216 | win32_gettimeofday |
7766f137 GS |
1217 | win32_uname |
1218 | win32_wait | |
1219 | win32_waitpid | |
1220 | win32_kill | |
1221 | win32_str_os_error | |
1222 | win32_opendir | |
1223 | win32_readdir | |
1224 | win32_telldir | |
1225 | win32_seekdir | |
1226 | win32_rewinddir | |
1227 | win32_closedir | |
1228 | win32_longpath | |
1229 | win32_os_id | |
1230 | win32_getpid | |
1231 | win32_crypt | |
1232 | win32_dynaload | |
df3728a2 JH |
1233 | win32_get_childenv |
1234 | win32_free_childenv | |
1235 | win32_clearenv | |
1236 | win32_get_childdir | |
1237 | win32_free_childdir | |
00b02797 JH |
1238 | win32_stdin |
1239 | win32_stdout | |
1240 | win32_stderr | |
1241 | win32_ferror | |
1242 | win32_feof | |
1243 | win32_strerror | |
1244 | win32_fprintf | |
1245 | win32_printf | |
1246 | win32_vfprintf | |
1247 | win32_vprintf | |
1248 | win32_fread | |
1249 | win32_fwrite | |
1250 | win32_fopen | |
1251 | win32_fdopen | |
1252 | win32_freopen | |
1253 | win32_fclose | |
1254 | win32_fputs | |
1255 | win32_fputc | |
1256 | win32_ungetc | |
1257 | win32_getc | |
1258 | win32_fileno | |
1259 | win32_clearerr | |
1260 | win32_fflush | |
1261 | win32_ftell | |
1262 | win32_fseek | |
1263 | win32_fgetpos | |
1264 | win32_fsetpos | |
1265 | win32_rewind | |
1266 | win32_tmpfile | |
1267 | win32_setbuf | |
1268 | win32_setvbuf | |
1269 | win32_flushall | |
1270 | win32_fcloseall | |
1271 | win32_fgets | |
1272 | win32_gets | |
1273 | win32_fgetc | |
1274 | win32_putc | |
1275 | win32_puts | |
1276 | win32_getchar | |
1277 | win32_putchar | |
7766f137 GS |
1278 | )) |
1279 | { | |
549a6b10 JH |
1280 | try_symbol($symbol); |
1281 | } | |
3a00b83e SH |
1282 | if ($CCTYPE eq "BORLAND") { |
1283 | try_symbol('_matherr'); | |
1284 | } | |
549a6b10 | 1285 | } |
3cfae81b | 1286 | elsif ($PLATFORM eq 'os2') { |
7766f137 GS |
1287 | open MAP, 'miniperl.map' or die 'Cannot read miniperl.map'; |
1288 | /^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>; | |
1289 | close MAP or die 'Cannot close miniperl.map'; | |
1290 | ||
ad6971c8 | 1291 | @missing = grep { !exists $mapped{$_} } |
7766f137 | 1292 | keys %export; |
c6261f3b | 1293 | @missing = grep { !exists $exportperlmalloc{$_} } @missing; |
7766f137 | 1294 | delete $export{$_} foreach @missing; |
3cfae81b | 1295 | } |
084592ab CN |
1296 | elsif ($PLATFORM eq 'MacOS') { |
1297 | open MACSYMS, 'macperl.sym' or die 'Cannot read macperl.sym'; | |
1298 | ||
1299 | while (<MACSYMS>) { | |
1300 | try_symbol($_); | |
1301 | } | |
1302 | ||
1303 | close MACSYMS; | |
1304 | } | |
2986a63f JH |
1305 | elsif ($PLATFORM eq 'netware') { |
1306 | foreach my $symbol (qw( | |
1307 | boot_DynaLoader | |
1308 | Perl_init_os_extras | |
1309 | Perl_thread_create | |
1310 | Perl_nw5_init | |
1311 | RunPerl | |
1312 | AllocStdPerl | |
1313 | FreeStdPerl | |
1314 | do_spawn2 | |
1315 | do_aspawn | |
1316 | nw_uname | |
1317 | nw_stdin | |
1318 | nw_stdout | |
1319 | nw_stderr | |
1320 | nw_feof | |
1321 | nw_ferror | |
1322 | nw_fopen | |
1323 | nw_fclose | |
1324 | nw_clearerr | |
1325 | nw_getc | |
1326 | nw_fgets | |
1327 | nw_fputc | |
1328 | nw_fputs | |
1329 | nw_fflush | |
1330 | nw_ungetc | |
1331 | nw_fileno | |
1332 | nw_fdopen | |
1333 | nw_freopen | |
1334 | nw_fread | |
1335 | nw_fwrite | |
1336 | nw_setbuf | |
1337 | nw_setvbuf | |
1338 | nw_vfprintf | |
1339 | nw_ftell | |
1340 | nw_fseek | |
1341 | nw_rewind | |
1342 | nw_tmpfile | |
1343 | nw_fgetpos | |
1344 | nw_fsetpos | |
1345 | nw_dup | |
1346 | nw_access | |
1347 | nw_chmod | |
1348 | nw_chsize | |
1349 | nw_close | |
1350 | nw_dup2 | |
1351 | nw_flock | |
1352 | nw_isatty | |
1353 | nw_link | |
1354 | nw_lseek | |
1355 | nw_stat | |
1356 | nw_mktemp | |
1357 | nw_open | |
1358 | nw_read | |
1359 | nw_rename | |
1360 | nw_setmode | |
1361 | nw_unlink | |
1362 | nw_utime | |
1363 | nw_write | |
1364 | nw_chdir | |
1365 | nw_rmdir | |
1366 | nw_closedir | |
1367 | nw_opendir | |
1368 | nw_readdir | |
1369 | nw_rewinddir | |
1370 | nw_seekdir | |
1371 | nw_telldir | |
1372 | nw_htonl | |
1373 | nw_htons | |
1374 | nw_ntohl | |
1375 | nw_ntohs | |
1376 | nw_accept | |
1377 | nw_bind | |
1378 | nw_connect | |
1379 | nw_endhostent | |
1380 | nw_endnetent | |
1381 | nw_endprotoent | |
1382 | nw_endservent | |
1383 | nw_gethostbyaddr | |
1384 | nw_gethostbyname | |
1385 | nw_gethostent | |
1386 | nw_gethostname | |
1387 | nw_getnetbyaddr | |
1388 | nw_getnetbyname | |
1389 | nw_getnetent | |
1390 | nw_getpeername | |
1391 | nw_getprotobyname | |
1392 | nw_getprotobynumber | |
1393 | nw_getprotoent | |
1394 | nw_getservbyname | |
1395 | nw_getservbyport | |
1396 | nw_getservent | |
1397 | nw_getsockname | |
1398 | nw_getsockopt | |
1399 | nw_inet_addr | |
1400 | nw_listen | |
1401 | nw_socket | |
1402 | nw_recv | |
1403 | nw_recvfrom | |
1404 | nw_select | |
1405 | nw_send | |
1406 | nw_sendto | |
1407 | nw_sethostent | |
1408 | nw_setnetent | |
1409 | nw_setprotoent | |
1410 | nw_setservent | |
3a0827a6 | 1411 | nw_setsockopt |
4d76e4b4 | 1412 | nw_inet_ntoa |
2986a63f JH |
1413 | nw_shutdown |
1414 | nw_crypt | |
1415 | nw_execvp | |
1416 | nw_kill | |
1417 | nw_Popen | |
1418 | nw_Pclose | |
1419 | nw_Pipe | |
1420 | nw_times | |
1421 | nw_waitpid | |
1422 | nw_getpid | |
1423 | nw_spawnvp | |
1424 | nw_os_id | |
1425 | nw_open_osfhandle | |
1426 | nw_get_osfhandle | |
1427 | nw_abort | |
1428 | nw_sleep | |
1429 | nw_wait | |
1430 | nw_dynaload | |
1431 | nw_strerror | |
1432 | fnFpSetMode | |
1433 | fnInsertHashListAddrs | |
1434 | fnGetHashListAddrs | |
1435 | Perl_deb | |
011f1a1a JH |
1436 | Perl_sv_setsv |
1437 | Perl_sv_catsv | |
1438 | Perl_sv_catpvn | |
1439 | Perl_sv_2pv | |
f355267c JH |
1440 | nw_freeenviron |
1441 | Remove_Thread_Ctx | |
2986a63f JH |
1442 | )) |
1443 | { | |
1444 | try_symbol($symbol); | |
1445 | } | |
1446 | } | |
22239a37 | 1447 | |
d2b25974 VK |
1448 | # records of type boot_module for statically linked modules (except Dynaloader) |
1449 | $static_ext =~ s/\//__/g; | |
1450 | $static_ext =~ s/\bDynaLoader\b//; | |
1451 | my @stat_mods = map {"boot_$_"} grep {/\S/} split /\s+/, $static_ext; | |
1452 | foreach my $symbol (@stat_mods) | |
1453 | { | |
1454 | try_symbol($symbol); | |
1455 | } | |
1456 | ||
549a6b10 JH |
1457 | # Now all symbols should be defined because |
1458 | # next we are going to output them. | |
1459 | ||
7766f137 GS |
1460 | foreach my $symbol (sort keys %export) { |
1461 | output_symbol($symbol); | |
1462 | } | |
549a6b10 | 1463 | |
011f1a1a | 1464 | if ($PLATFORM eq 'os2') { |
59ad941d IZ |
1465 | print <<EOP; |
1466 | dll_perlmain=main | |
1933e12c IZ |
1467 | fill_extLibpath |
1468 | dir_subst | |
1469 | Perl_OS2_handler_install | |
1470 | ||
59ad941d IZ |
1471 | ; LAST_ORDINAL=$sym_ord |
1472 | EOP | |
2986a63f JH |
1473 | } |
1474 | ||
549a6b10 | 1475 | sub emit_symbol { |
7766f137 | 1476 | my $symbol = shift; |
9df9a5cd | 1477 | chomp($symbol); |
7766f137 | 1478 | $export{$symbol} = 1; |
549a6b10 JH |
1479 | } |
1480 | ||
1481 | sub output_symbol { | |
1482 | my $symbol = shift; | |
18f68570 | 1483 | if ($PLATFORM =~ /^win(?:32|ce)$/) { |
549a6b10 | 1484 | $symbol = "_$symbol" if $CCTYPE eq 'BORLAND'; |
520c758a | 1485 | print "\t$symbol\n"; |
549a6b10 JH |
1486 | # XXX: binary compatibility between compilers is an exercise |
1487 | # in frustration :-( | |
1488 | # if ($CCTYPE eq "BORLAND") { | |
1489 | # # workaround Borland quirk by exporting both the straight | |
1490 | # # name and a name with leading underscore. Note the | |
1491 | # # alias *must* come after the symbol itself, if both | |
1492 | # # are to be exported. (Linker bug?) | |
1493 | # print "\t_$symbol\n"; | |
1494 | # print "\t$symbol = _$symbol\n"; | |
1495 | # } | |
1496 | # elsif ($CCTYPE eq 'GCC') { | |
1497 | # # Symbols have leading _ whole process is $%@"% slow | |
1498 | # # so skip aliases for now | |
1499 | # nprint "\t$symbol\n"; | |
1500 | # } | |
1501 | # else { | |
1502 | # # for binary coexistence, export both the symbol and | |
1503 | # # alias with leading underscore | |
1504 | # print "\t$symbol\n"; | |
1505 | # print "\t_$symbol = $symbol\n"; | |
1506 | # } | |
7766f137 GS |
1507 | } |
1508 | elsif ($PLATFORM eq 'os2') { | |
52e4c282 IZ |
1509 | printf qq( %-31s \@%s\n), |
1510 | qq("$symbol"), $ordinal{$symbol} || ++$sym_ord; | |
78232bc0 JH |
1511 | printf qq( %-31s \@%s\n), |
1512 | qq("$exportperlmalloc{$symbol}" = "$symbol"), | |
1513 | $ordinal{$exportperlmalloc{$symbol}} || ++$sym_ord | |
1514 | if $exportperlmalloc and exists $exportperlmalloc{$symbol}; | |
7766f137 | 1515 | } |
084592ab | 1516 | elsif ($PLATFORM eq 'aix' || $PLATFORM eq 'MacOS') { |
549a6b10 JH |
1517 | print "$symbol\n"; |
1518 | } | |
2986a63f JH |
1519 | elsif ($PLATFORM eq 'netware') { |
1520 | print "\t$symbol,\n"; | |
1521 | } | |
549a6b10 JH |
1522 | } |
1523 | ||
1524 | 1; | |
1525 | __DATA__ | |
1526 | # extra globals not included above. | |
8437356b | 1527 | Perl_cxinc |
549a6b10 | 1528 | perl_alloc |
7766f137 | 1529 | perl_alloc_using |
014822e4 GS |
1530 | perl_clone |
1531 | perl_clone_using | |
549a6b10 JH |
1532 | perl_construct |
1533 | perl_destruct | |
1534 | perl_free | |
1535 | perl_parse | |
1536 | perl_run | |
44798d05 | 1537 | # Oddities from PerlIO |
568ad336 | 1538 | PerlIO_binmode |
8437356b | 1539 | PerlIO_getpos |
568ad336 | 1540 | PerlIO_init |
568ad336 | 1541 | PerlIO_setpos |
568ad336 | 1542 | PerlIO_sprintf |
8437356b MB |
1543 | PerlIO_sv_dup |
1544 | PerlIO_tmpfile | |
8437356b | 1545 | PerlIO_vsprintf |