Missed FREAD in bytecode.h
[p5sagit/p5-mst-13.2.git] / win32 / makedef.pl
CommitLineData
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 17my $CCTYPE = "MSVC"; # default
18
19while (@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 26open(CFG,'config.h') || die "Cannot open config.h:$!";
27while (<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 }
32close(CFG);
33
d55594ae 34warn join(' ',keys %define)."\n";
35
04dc04aa 36if ($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 43else
44 {
45 $define{'PERL_GLOBAL_STRUCT'} = 1;
46 $define{'MULTIPLICITY'} = 1;
47 }
48
bbc8f9de 49print "EXPORTS\n";
50
22239a37 51my %skip;
52my %export;
53
54sub skip_symbols
55{
56 my $list = shift;
57 foreach my $symbol (@$list)
58 {
59 $skip{$symbol} = 1;
60 }
61}
62
63sub emit_symbols
64{
65 my $list = shift;
66 foreach my $symbol (@$list)
67 {
68 emit_symbol($symbol) unless exists $skip{$symbol};
69 }
70}
71
72skip_symbols [qw(
73Perl_statusvalue_vms
0a753a76 74Perl_block_type
0a753a76 75Perl_additem
76Perl_cast_ulong
77Perl_check_uni
78Perl_checkcomma
79Perl_chsize
80Perl_ck_aelem
81Perl_cryptseen
82Perl_cx_dump
0a753a76 83Perl_do_ipcctl
84Perl_do_ipcget
85Perl_do_msgrcv
86Perl_do_msgsnd
87Perl_do_semop
88Perl_do_shmio
89Perl_doeval
90Perl_dofindlabel
91Perl_dopoptoeval
92Perl_dump_eval
93Perl_dump_fds
94Perl_dump_form
95Perl_dump_gv
96Perl_dump_mstats
97Perl_dump_op
98Perl_dump_packsubs
99Perl_dump_pm
100Perl_dump_sub
101Perl_expectterm
102Perl_fetch_gv
103Perl_fetch_io
104Perl_force_ident
105Perl_force_next
106Perl_force_word
107Perl_hv_stashpv
108Perl_intuit_more
d55594ae 109Perl_init_thread_intern
0a753a76 110Perl_know_next
111Perl_modkids
112Perl_mstats
113Perl_my_bzero
114Perl_my_htonl
115Perl_my_ntohl
116Perl_my_swap
117Perl_my_chsize
118Perl_newXSUB
119Perl_no_fh_allowed
120Perl_no_op
121Perl_nointrp
122Perl_nomem
123Perl_pp_cswitch
124Perl_pp_entersubr
125Perl_pp_evalonce
126Perl_pp_interp
127Perl_pp_map
128Perl_pp_nswitch
129Perl_q
d55594ae 130Perl_rcsid
0a753a76 131Perl_reall_srchlen
132Perl_regdump
133Perl_regfold
134Perl_regmyendp
135Perl_regmyp_size
136Perl_regmystartp
137Perl_regnarrate
138Perl_regprop
139Perl_same_dirent
140Perl_saw_return
141Perl_scan_const
142Perl_scan_formline
143Perl_scan_heredoc
144Perl_scan_ident
145Perl_scan_inputsymbol
146Perl_scan_pat
147Perl_scan_prefix
148Perl_scan_str
149Perl_scan_subst
150Perl_scan_trans
151Perl_scan_word
68dc0745 152Perl_setenv_getix
0a753a76 153Perl_skipspace
154Perl_sublex_done
155Perl_sublex_start
0a753a76 156Perl_sv_ref
157Perl_sv_setptrobj
158Perl_timesbuf
159Perl_too_few_arguments
160Perl_too_many_arguments
161Perl_unlnk
0a753a76 162Perl_watch
163Perl_yyname
164Perl_yyrule
165allgvs
166curblock
0a753a76 167curcsv
0a753a76 168lastretstr
169mystack_mark
170perl_init_ext
171perl_requirepv
0a753a76 172stack
ff0cee69 173statusvalue_vms
0a753a76 174Perl_safexcalloc
175Perl_safexmalloc
176Perl_safexfree
177Perl_safexrealloc
68dc0745 178Perl_my_memcmp
8b10511d 179Perl_my_memset
68dc0745 180Perl_cshlen
181Perl_cshname
0da3735a 182Perl_opsave
22239a37 183)];
0a753a76 184
c69f112c 185
bbc8f9de 186if ($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 200unless ($define{'USE_THREADS'})
201 {
22239a37 202 skip_symbols [qw(
d55594ae 203Perl_condpair_magic
204Perl_thr_key
205Perl_sv_mutex
319b3e9e 206Perl_svref_mutex
d55594ae 207Perl_malloc_mutex
208Perl_eval_mutex
209Perl_eval_cond
210Perl_eval_owner
211Perl_threads_mutex
32f822de 212Perl_new_struct_thread
213Perl_nthreads
d55594ae 214Perl_nthreads_cond
32f822de 215Perl_per_thread_magicals
d4cce5f1 216Perl_thread_create
93bce2dc 217Perl_threadnum
d4cce5f1 218Perl_find_threadsv
219Perl_threadsv_names
32f822de 220Perl_thrsv
d55594ae 221Perl_unlock_condpair
222Perl_vtbl_mutex
223Perl_magic_mutexfree
224Perl_sv_iv
225Perl_sv_nv
226Perl_sv_true
227Perl_sv_uv
228Perl_sv_pvn
22239a37 229Perl_newRV_noinc)];
910dfcc8 230 }
d4cce5f1 231
910dfcc8 232unless ($define{'FAKE_THREADS'})
233 {
234 skip_symbols [qw(Perl_curthr)];
d55594ae 235 }
236
22239a37 237sub 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 252if ($define{'USE_THREADS'} || $define{'MULTIPLICITY'})
d55594ae 253 {
22239a37 254 my $thrd = readvar("../thrdvar.h");
255 skip_symbols $thrd;
d55594ae 256 }
257
d4cce5f1 258if ($define{'MULTIPLICITY'})
d55594ae 259 {
22239a37 260 my $interp = readvar("../intrpvar.h");
261 skip_symbols $interp;
262 }
263
264if ($define{'PERL_GLOBAL_STRUCT'})
265 {
266 my $global = readvar("../perlvars.h");
267 skip_symbols $global;
d4cce5f1 268 }
d55594ae 269
36c15d3f 270unless ($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 285if ($define{'HAVE_DES_FCRYPT'})
286 {
287 emit_symbols [qw(win32_crypt)];
288 }
289
0a753a76 290open (GLOBAL, "<../global.sym") || die "failed to open global.sym" . $!;
22239a37 291while (<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 301close(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 308if ($define{'PERL_GLOBAL_STRUCT'})
309 {
310 emit_symbol( ($CCTYPE eq 'GCC') ? 'Perl_GetVars' : 'Perl_VarsPtr')
311 }
312else
313 {
314 my $glob = readvar("../perlvars.h");
315 emit_symbols $glob;
316 }
317
318unless ($define{'MULTIPLICITY'})
319 {
320 my $glob = readvar("../intrpvar.h");
321 emit_symbols $glob;
322 }
0a753a76 323
22239a37 324unless ($define{'MULTIPLICITY'} || $define{'USE_THREADS'})
325 {
326 my $glob = readvar("../thrdvar.h");
327 emit_symbols $glob;
328 }
0a753a76 329
330while (<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 341foreach 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
364sub emit_symbol {
365 my $symbol = shift;
366 chomp($symbol);
367 $export{$symbol} = 1;
3e3baf6d 368}
0a753a76 369
3701;
371__DATA__
372# extra globals not included above.
373perl_init_i18nl10n
374perl_init_ext
375perl_alloc
376perl_construct
377perl_destruct
378perl_free
379perl_parse
380perl_run
381perl_get_sv
382perl_get_av
383perl_get_hv
384perl_get_cv
385perl_call_argv
386perl_call_pv
387perl_call_method
388perl_call_sv
10dd38fc 389perl_require_pv
390perl_eval_pv
391perl_eval_sv
d28b3ca3 392boot_DynaLoader
d55594ae 393Perl_thread_create
68dc0745 394win32_errno
96e4d5b1 395win32_environ
68dc0745 396win32_stdin
397win32_stdout
96e4d5b1 398win32_stderr
68dc0745 399win32_ferror
400win32_feof
401win32_strerror
402win32_fprintf
403win32_printf
404win32_vfprintf
96e4d5b1 405win32_vprintf
68dc0745 406win32_fread
407win32_fwrite
408win32_fopen
409win32_fdopen
410win32_freopen
411win32_fclose
412win32_fputs
413win32_fputc
414win32_ungetc
415win32_getc
416win32_fileno
417win32_clearerr
418win32_fflush
419win32_ftell
420win32_fseek
421win32_fgetpos
422win32_fsetpos
423win32_rewind
424win32_tmpfile
425win32_abort
426win32_fstat
96e4d5b1 427win32_stat
68dc0745 428win32_pipe
429win32_popen
430win32_pclose
431win32_setmode
96e4d5b1 432win32_lseek
433win32_tell
68dc0745 434win32_dup
435win32_dup2
96e4d5b1 436win32_open
437win32_close
438win32_eof
68dc0745 439win32_read
440win32_write
3e3baf6d 441win32_spawnvp
5aabfad6 442win32_mkdir
443win32_rmdir
444win32_chdir
c90c0ff4 445win32_flock
6890e559 446win32_execvp
54310121 447win32_htons
448win32_ntohs
449win32_htonl
450win32_ntohl
451win32_inet_addr
452win32_inet_ntoa
453win32_socket
454win32_bind
455win32_listen
456win32_accept
457win32_connect
458win32_send
459win32_sendto
460win32_recv
461win32_recvfrom
462win32_shutdown
3a25acb4 463win32_closesocket
54310121 464win32_ioctlsocket
465win32_setsockopt
466win32_getsockopt
467win32_getpeername
468win32_getsockname
469win32_gethostname
470win32_gethostbyname
471win32_gethostbyaddr
472win32_getprotobyname
473win32_getprotobynumber
474win32_getservbyname
475win32_getservbyport
476win32_select
477win32_endhostent
478win32_endnetent
479win32_endprotoent
480win32_endservent
481win32_getnetent
482win32_getnetbyname
483win32_getnetbyaddr
484win32_getprotoent
485win32_getservent
486win32_sethostent
487win32_setnetent
488win32_setprotoent
489win32_setservent
ad2e33dc 490win32_getenv
84902520 491win32_perror
492win32_setbuf
493win32_setvbuf
494win32_flushall
495win32_fcloseall
496win32_fgets
497win32_gets
498win32_fgetc
499win32_putc
500win32_puts
501win32_getchar
502win32_putchar
503win32_malloc
504win32_calloc
505win32_realloc
506win32_free
f3986ebb 507win32_sleep
508win32_times
509win32_alarm
65e48ea9 510win32_open_osfhandle
511win32_get_osfhandle
f998180f 512win32_ioctl
ad0751ec 513win32_utime
22fae026 514win32_wait
515win32_str_os_error
ad2e33dc 516Perl_win32_init
f3986ebb 517Perl_init_os_extras
9811a7d7 518Perl_getTHR
0fefa03b 519Perl_setTHR
84902520 520RunPerl
22239a37 521