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