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