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