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