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