Commit | Line | Data |
---|---|---|
0a753a76 | 1 | #!../miniperl |
2 | ||
22c35a8c | 3 | # Create the export list for perl. Needed by WIN32 for creating perl.dll. |
0a753a76 | 4 | |
22c35a8c | 5 | # reads global.sym, pp.sym, perlvars.h, intrpvar.h, thrdvar.h, config.h |
0a753a76 | 6 | |
910dfcc8 GS |
7 | my $CCTYPE = "MSVC"; # default |
8 | ||
9 | while (@ARGV) | |
d55594ae GS |
10 | { |
11 | my $flag = shift; | |
12 | $define{$1} = 1 if ($flag =~ /^-D(\w+)$/); | |
910dfcc8 | 13 | $CCTYPE = $1 if ($flag =~ /^CCTYPE=(\w+)$/); |
d55594ae GS |
14 | } |
15 | ||
bbc8f9de NIS |
16 | open(CFG,'config.h') || die "Cannot open config.h:$!"; |
17 | while (<CFG>) | |
18 | { | |
19 | $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/; | |
924b3ec4 | 20 | $define{$1} = 1 if /^\s*#\s*define\s+(USE_THREADS)\b/; |
b86a2fa7 | 21 | $define{$1} = 1 if /^\s*#\s*define\s+(MULTIPLICITY)\b/; |
bbc8f9de NIS |
22 | } |
23 | close(CFG); | |
24 | ||
d55594ae GS |
25 | warn join(' ',keys %define)."\n"; |
26 | ||
ac4c12e7 GS |
27 | if ($define{PERL_OBJECT}) { |
28 | print "LIBRARY PerlCore\n"; | |
29 | print "DESCRIPTION 'Perl interpreter'\n"; | |
30 | print "EXPORTS\n"; | |
51371543 | 31 | # output_symbol("perl_alloc"); |
0cb96387 GS |
32 | output_symbol("perl_get_host_info"); |
33 | output_symbol("perl_alloc_using"); | |
51371543 GS |
34 | # output_symbol("perl_construct"); |
35 | # output_symbol("perl_destruct"); | |
36 | # output_symbol("perl_free"); | |
37 | # output_symbol("perl_parse"); | |
38 | # output_symbol("perl_run"); | |
39 | # output_symbol("RunPerl"); | |
51371543 GS |
40 | # exit(0); |
41 | } | |
42 | else { | |
43 | if ($CCTYPE ne 'GCC') { | |
44 | print "LIBRARY Perl\n"; | |
45 | print "DESCRIPTION 'Perl interpreter, export autogenerated'\n"; | |
46 | } | |
47 | else { | |
48 | $define{'PERL_GLOBAL_STRUCT'} = 1; | |
49 | $define{'MULTIPLICITY'} = 1; | |
50 | } | |
51 | print "EXPORTS\n"; | |
ac4c12e7 | 52 | } |
bbc8f9de | 53 | |
22239a37 NIS |
54 | my %skip; |
55 | my %export; | |
56 | ||
51371543 GS |
57 | sub skip_symbols { |
58 | my $list = shift; | |
59 | foreach my $symbol (@$list) { | |
60 | $skip{$symbol} = 1; | |
61 | } | |
22239a37 NIS |
62 | } |
63 | ||
51371543 GS |
64 | sub emit_symbols { |
65 | my $list = shift; | |
66 | foreach my $symbol (@$list) { | |
67 | my $skipsym = $symbol; | |
68 | # XXX hack | |
69 | if ($define{PERL_OBJECT}) { | |
70 | $skipsym =~ s/^Perl_[GIT](\w+)_ptr$/PL_$1/; | |
71 | } | |
72 | emit_symbol($symbol) unless exists $skip{$skipsym}; | |
73 | } | |
22239a37 NIS |
74 | } |
75 | ||
76 | skip_symbols [qw( | |
db15561c GS |
77 | PL_statusvalue_vms |
78 | PL_archpat_auto | |
79 | PL_cryptseen | |
80 | PL_DBcv | |
81 | PL_generation | |
db15561c GS |
82 | PL_lastgotoprobe |
83 | PL_linestart | |
84 | PL_modcount | |
85 | PL_pending_ident | |
86 | PL_sortcxix | |
87 | PL_sublex_info | |
88 | PL_timesbuf | |
4f63d024 GS |
89 | main |
90 | Perl_ErrorNo | |
91 | Perl_GetVars | |
a6c40364 | 92 | Perl_do_exec3 |
0a753a76 | 93 | Perl_do_ipcctl |
94 | Perl_do_ipcget | |
95 | Perl_do_msgrcv | |
96 | Perl_do_msgsnd | |
97 | Perl_do_semop | |
98 | Perl_do_shmio | |
0a753a76 | 99 | Perl_dump_fds |
d55594ae | 100 | Perl_init_thread_intern |
0a753a76 | 101 | Perl_my_bzero |
102 | Perl_my_htonl | |
103 | Perl_my_ntohl | |
104 | Perl_my_swap | |
105 | Perl_my_chsize | |
0a753a76 | 106 | Perl_same_dirent |
68dc0745 | 107 | Perl_setenv_getix |
0a753a76 | 108 | Perl_unlnk |
0a753a76 | 109 | Perl_watch |
0a753a76 | 110 | Perl_safexcalloc |
111 | Perl_safexmalloc | |
112 | Perl_safexfree | |
113 | Perl_safexrealloc | |
68dc0745 | 114 | Perl_my_memcmp |
8b10511d | 115 | Perl_my_memset |
db15561c GS |
116 | PL_cshlen |
117 | PL_cshname | |
118 | PL_opsave | |
22239a37 | 119 | )]; |
0a753a76 | 120 | |
51371543 GS |
121 | if ($define{'PERL_OBJECT'}) { |
122 | skip_symbols [qw( | |
123 | Perl_getenv_len | |
124 | Perl_my_popen | |
125 | Perl_my_pclose | |
126 | )]; | |
127 | } | |
128 | else { | |
129 | skip_symbols [qw( | |
130 | PL_Dir | |
131 | PL_Env | |
132 | PL_LIO | |
133 | PL_Mem | |
134 | PL_Proc | |
135 | PL_Sock | |
136 | PL_StdIO | |
137 | )]; | |
138 | } | |
c69f112c | 139 | |
bbc8f9de NIS |
140 | if ($define{'MYMALLOC'}) |
141 | { | |
22239a37 | 142 | emit_symbols [qw( |
9423c6fc | 143 | Perl_dump_mstats |
22239a37 | 144 | Perl_malloc |
f2517201 | 145 | Perl_mfree |
22239a37 NIS |
146 | Perl_realloc |
147 | Perl_calloc)]; | |
bbc8f9de | 148 | } |
32fcaa0b GS |
149 | else |
150 | { | |
151 | skip_symbols [qw( | |
df31f264 | 152 | Perl_dump_mstats |
4f63d024 GS |
153 | Perl_malloc |
154 | Perl_mfree | |
155 | Perl_realloc | |
156 | Perl_calloc | |
32fcaa0b GS |
157 | Perl_malloced_size)]; |
158 | } | |
bbc8f9de | 159 | |
d55594ae GS |
160 | unless ($define{'USE_THREADS'}) |
161 | { | |
22239a37 | 162 | skip_symbols [qw( |
db15561c GS |
163 | PL_thr_key |
164 | PL_sv_mutex | |
46124e9e | 165 | PL_strtab_mutex |
db15561c GS |
166 | PL_svref_mutex |
167 | PL_malloc_mutex | |
5ff3f7a4 | 168 | PL_cred_mutex |
db15561c GS |
169 | PL_eval_mutex |
170 | PL_eval_cond | |
171 | PL_eval_owner | |
172 | PL_threads_mutex | |
173 | PL_nthreads | |
174 | PL_nthreads_cond | |
175 | PL_threadnum | |
176 | PL_threadsv_names | |
177 | PL_thrsv | |
22c35a8c | 178 | PL_vtbl_mutex |
eb480a0b GS |
179 | Perl_getTHR |
180 | Perl_setTHR | |
d55594ae | 181 | Perl_condpair_magic |
32f822de | 182 | Perl_new_struct_thread |
32f822de | 183 | Perl_per_thread_magicals |
d4cce5f1 NIS |
184 | Perl_thread_create |
185 | Perl_find_threadsv | |
d55594ae | 186 | Perl_unlock_condpair |
d55594ae | 187 | Perl_magic_mutexfree |
95906810 | 188 | )]; |
910dfcc8 | 189 | } |
c5be433b GS |
190 | unless ($define{'USE_THREADS'} or $define{'PERL_IMPLICIT_CONTEXT'} |
191 | or $define{'PERL_OBJECT'}) | |
192 | { | |
4f63d024 GS |
193 | skip_symbols [qw( |
194 | Perl_croak_nocontext | |
195 | Perl_die_nocontext | |
c5be433b | 196 | Perl_deb_nocontext |
4f63d024 GS |
197 | Perl_form_nocontext |
198 | Perl_warn_nocontext | |
c5be433b | 199 | Perl_warner_nocontext |
4f63d024 GS |
200 | Perl_newSVpvf_nocontext |
201 | Perl_sv_catpvf_nocontext | |
202 | Perl_sv_setpvf_nocontext | |
203 | Perl_sv_catpvf_mg_nocontext | |
204 | Perl_sv_setpvf_mg_nocontext | |
205 | )]; | |
206 | } | |
d4cce5f1 | 207 | |
910dfcc8 GS |
208 | unless ($define{'FAKE_THREADS'}) |
209 | { | |
db15561c | 210 | skip_symbols [qw(PL_curthr)]; |
d55594ae GS |
211 | } |
212 | ||
22239a37 NIS |
213 | sub readvar |
214 | { | |
215 | my $file = shift; | |
51371543 | 216 | my $proc = shift || sub { "PL_$_[2]" }; |
22239a37 NIS |
217 | open(VARS,$file) || die "Cannot open $file:$!"; |
218 | my @syms; | |
219 | while (<VARS>) | |
220 | { | |
221 | # All symbols have a Perl_ prefix because that's what embed.h | |
222 | # sticks in front of them. | |
51371543 | 223 | push(@syms, &$proc($1,$2,$3)) if (/\bPERLVAR(A?I?C?)\(([IGT])(\w+)/); |
22239a37 NIS |
224 | } |
225 | close(VARS); | |
226 | return \@syms; | |
227 | } | |
228 | ||
d4cce5f1 | 229 | if ($define{'USE_THREADS'} || $define{'MULTIPLICITY'}) |
d55594ae | 230 | { |
22239a37 NIS |
231 | my $thrd = readvar("../thrdvar.h"); |
232 | skip_symbols $thrd; | |
d55594ae GS |
233 | } |
234 | ||
d4cce5f1 | 235 | if ($define{'MULTIPLICITY'}) |
d55594ae | 236 | { |
22239a37 NIS |
237 | my $interp = readvar("../intrpvar.h"); |
238 | skip_symbols $interp; | |
239 | } | |
240 | ||
241 | if ($define{'PERL_GLOBAL_STRUCT'}) | |
242 | { | |
243 | my $global = readvar("../perlvars.h"); | |
244 | skip_symbols $global; | |
852c2e52 | 245 | emit_symbols [qw(Perl_GetVars)]; |
db15561c | 246 | emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC'; |
d4cce5f1 | 247 | } |
d55594ae | 248 | |
36c15d3f NIS |
249 | unless ($define{'DEBUGGING'}) |
250 | { | |
22239a37 | 251 | skip_symbols [qw( |
fea7140c GS |
252 | Perl_deb |
253 | Perl_deb_growlevel | |
254 | Perl_debop | |
255 | Perl_debprofdump | |
256 | Perl_debstack | |
257 | Perl_debstackptrs | |
22239a37 NIS |
258 | Perl_runops_debug |
259 | Perl_sv_peek | |
3836fe67 | 260 | PL_block_type |
22c35a8c GS |
261 | PL_watchaddr |
262 | PL_watchok)]; | |
36c15d3f NIS |
263 | } |
264 | ||
26618a56 GS |
265 | if ($define{'HAVE_DES_FCRYPT'}) |
266 | { | |
267 | emit_symbols [qw(win32_crypt)]; | |
268 | } | |
269 | ||
22c35a8c GS |
270 | # functions from *.sym files |
271 | ||
272 | for my $syms ('../global.sym','../pp.sym', '../globvar.sym') | |
22239a37 | 273 | { |
22c35a8c GS |
274 | open (GLOBAL, "<$syms") || die "failed to open $syms" . $!; |
275 | while (<GLOBAL>) | |
276 | { | |
277 | next if (!/^[A-Za-z]/); | |
278 | # Functions have a Perl_ prefix | |
279 | # Variables have a PL_ prefix | |
280 | chomp($_); | |
4f63d024 | 281 | my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : ""); |
22c35a8c GS |
282 | $symbol .= $_; |
283 | emit_symbol($symbol) unless exists $skip{$symbol}; | |
284 | } | |
285 | close(GLOBAL); | |
22239a37 | 286 | } |
0a753a76 | 287 | |
22c35a8c | 288 | # variables |
0a753a76 | 289 | |
51371543 GS |
290 | if ($define{'PERL_OBJECT'}) { |
291 | for my $f ("../perlvars.h", "../intrpvar.h", "../thrdvar.h") { | |
292 | my $glob = readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" }); | |
293 | emit_symbols $glob; | |
294 | } | |
295 | } | |
296 | else { | |
297 | unless ($define{'PERL_GLOBAL_STRUCT'}) { | |
298 | my $glob = readvar("../perlvars.h"); | |
299 | emit_symbols $glob; | |
300 | } | |
301 | unless ($define{'MULTIPLICITY'}) { | |
302 | my $glob = readvar("../intrpvar.h"); | |
303 | emit_symbols $glob; | |
304 | } | |
305 | ||
306 | unless ($define{'MULTIPLICITY'} || $define{'USE_THREADS'}) { | |
307 | my $glob = readvar("../thrdvar.h"); | |
308 | emit_symbols $glob; | |
309 | } | |
310 | } | |
0a753a76 | 311 | |
312 | while (<DATA>) { | |
313 | my $symbol; | |
314 | next if (!/^[A-Za-z]/); | |
315 | next if (/^#/); | |
a868473f | 316 | s/\r//g; |
22239a37 | 317 | chomp($_); |
0a753a76 | 318 | $symbol = $_; |
22239a37 | 319 | next if exists $skip{$symbol}; |
3e3baf6d TB |
320 | emit_symbol($symbol); |
321 | } | |
322 | ||
22239a37 NIS |
323 | foreach my $symbol (sort keys %export) |
324 | { | |
ac4c12e7 | 325 | output_symbol($symbol); |
22239a37 NIS |
326 | } |
327 | ||
328 | sub emit_symbol { | |
329 | my $symbol = shift; | |
330 | chomp($symbol); | |
331 | $export{$symbol} = 1; | |
3e3baf6d | 332 | } |
0a753a76 | 333 | |
ac4c12e7 GS |
334 | sub output_symbol { |
335 | my $symbol = shift; | |
a88c3d7c | 336 | $symbol = "_$symbol" if $CCTYPE eq 'BORLAND'; |
51371543 GS |
337 | print "\t$symbol\n"; |
338 | # XXX: binary compatibility between compilers is an exercise | |
339 | # in frustration :-( | |
340 | # if ($CCTYPE eq "BORLAND") { | |
341 | # # workaround Borland quirk by exporting both the straight | |
342 | # # name and a name with leading underscore. Note the | |
343 | # # alias *must* come after the symbol itself, if both | |
344 | # # are to be exported. (Linker bug?) | |
345 | # print "\t_$symbol\n"; | |
346 | # print "\t$symbol = _$symbol\n"; | |
347 | # } | |
348 | # elsif ($CCTYPE eq 'GCC') { | |
349 | # # Symbols have leading _ whole process is $%@"% slow | |
350 | # # so skip aliases for now | |
351 | # print "\t$symbol\n"; | |
352 | # } | |
353 | # else { | |
354 | # # for binary coexistence, export both the symbol and | |
355 | # # alias with leading underscore | |
356 | # print "\t$symbol\n"; | |
357 | # print "\t_$symbol = $symbol\n"; | |
358 | # } | |
ac4c12e7 GS |
359 | } |
360 | ||
0a753a76 | 361 | 1; |
362 | __DATA__ | |
363 | # extra globals not included above. | |
0a753a76 | 364 | perl_alloc |
365 | perl_construct | |
366 | perl_destruct | |
367 | perl_free | |
368 | perl_parse | |
369 | perl_run | |
d28b3ca3 | 370 | boot_DynaLoader |
d55594ae | 371 | Perl_thread_create |
68dc0745 | 372 | win32_errno |
96e4d5b1 | 373 | win32_environ |
68dc0745 | 374 | win32_stdin |
375 | win32_stdout | |
96e4d5b1 | 376 | win32_stderr |
68dc0745 | 377 | win32_ferror |
378 | win32_feof | |
379 | win32_strerror | |
380 | win32_fprintf | |
381 | win32_printf | |
382 | win32_vfprintf | |
96e4d5b1 | 383 | win32_vprintf |
68dc0745 | 384 | win32_fread |
385 | win32_fwrite | |
386 | win32_fopen | |
387 | win32_fdopen | |
388 | win32_freopen | |
389 | win32_fclose | |
390 | win32_fputs | |
391 | win32_fputc | |
392 | win32_ungetc | |
393 | win32_getc | |
394 | win32_fileno | |
395 | win32_clearerr | |
396 | win32_fflush | |
397 | win32_ftell | |
398 | win32_fseek | |
399 | win32_fgetpos | |
400 | win32_fsetpos | |
401 | win32_rewind | |
402 | win32_tmpfile | |
403 | win32_abort | |
404 | win32_fstat | |
96e4d5b1 | 405 | win32_stat |
68dc0745 | 406 | win32_pipe |
407 | win32_popen | |
408 | win32_pclose | |
e24c7c18 | 409 | win32_rename |
68dc0745 | 410 | win32_setmode |
96e4d5b1 | 411 | win32_lseek |
412 | win32_tell | |
68dc0745 | 413 | win32_dup |
414 | win32_dup2 | |
96e4d5b1 | 415 | win32_open |
416 | win32_close | |
417 | win32_eof | |
68dc0745 | 418 | win32_read |
419 | win32_write | |
3e3baf6d | 420 | win32_spawnvp |
5aabfad6 | 421 | win32_mkdir |
422 | win32_rmdir | |
423 | win32_chdir | |
c90c0ff4 | 424 | win32_flock |
eb62e965 | 425 | win32_execv |
6890e559 | 426 | win32_execvp |
54310121 | 427 | win32_htons |
428 | win32_ntohs | |
429 | win32_htonl | |
430 | win32_ntohl | |
431 | win32_inet_addr | |
432 | win32_inet_ntoa | |
433 | win32_socket | |
434 | win32_bind | |
435 | win32_listen | |
436 | win32_accept | |
437 | win32_connect | |
438 | win32_send | |
439 | win32_sendto | |
440 | win32_recv | |
441 | win32_recvfrom | |
442 | win32_shutdown | |
3a25acb4 | 443 | win32_closesocket |
54310121 | 444 | win32_ioctlsocket |
445 | win32_setsockopt | |
446 | win32_getsockopt | |
447 | win32_getpeername | |
448 | win32_getsockname | |
449 | win32_gethostname | |
450 | win32_gethostbyname | |
451 | win32_gethostbyaddr | |
452 | win32_getprotobyname | |
453 | win32_getprotobynumber | |
454 | win32_getservbyname | |
455 | win32_getservbyport | |
456 | win32_select | |
457 | win32_endhostent | |
458 | win32_endnetent | |
459 | win32_endprotoent | |
460 | win32_endservent | |
461 | win32_getnetent | |
462 | win32_getnetbyname | |
463 | win32_getnetbyaddr | |
464 | win32_getprotoent | |
465 | win32_getservent | |
466 | win32_sethostent | |
467 | win32_setnetent | |
468 | win32_setprotoent | |
469 | win32_setservent | |
ad2e33dc | 470 | win32_getenv |
ac5c734f | 471 | win32_putenv |
84902520 TB |
472 | win32_perror |
473 | win32_setbuf | |
474 | win32_setvbuf | |
475 | win32_flushall | |
476 | win32_fcloseall | |
477 | win32_fgets | |
478 | win32_gets | |
479 | win32_fgetc | |
480 | win32_putc | |
481 | win32_puts | |
482 | win32_getchar | |
483 | win32_putchar | |
484 | win32_malloc | |
485 | win32_calloc | |
486 | win32_realloc | |
487 | win32_free | |
f3986ebb GS |
488 | win32_sleep |
489 | win32_times | |
490 | win32_alarm | |
65e48ea9 GS |
491 | win32_open_osfhandle |
492 | win32_get_osfhandle | |
f998180f | 493 | win32_ioctl |
ad0751ec | 494 | win32_utime |
b2af26b1 | 495 | win32_uname |
22fae026 | 496 | win32_wait |
f55ee38a GS |
497 | win32_waitpid |
498 | win32_kill | |
22fae026 | 499 | win32_str_os_error |
ce2e26e5 GS |
500 | win32_opendir |
501 | win32_readdir | |
502 | win32_telldir | |
503 | win32_seekdir | |
504 | win32_rewinddir | |
505 | win32_closedir | |
8ac9c18d | 506 | win32_longpath |
0cb96387 | 507 | win32_os_id |
ad2e33dc | 508 | Perl_win32_init |
f3986ebb | 509 | Perl_init_os_extras |
9811a7d7 | 510 | Perl_getTHR |
0fefa03b | 511 | Perl_setTHR |
84902520 | 512 | RunPerl |
c5be433b GS |
513 | GetPerlInterpreter |
514 | SetPerlInterpreter | |
22239a37 | 515 |