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