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