This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
AIX patch (including Configure support for {sched,pthread}_yield,
[perl5.git] / win32 / makedef.pl
index f868203..abc89d8 100644 (file)
 
 # There is some symbol defined in global.sym and interp.sym
 # that does not present in the WIN32 port but there is no easy
-# way to find them so I just put a exeception list here
+# way to find them so I just put a exception list here
+
+while (@ARGV && $ARGV[0] =~ /^-/)
+ {
+  my $flag = shift;
+  $define{$1} = 1 if ($flag =~ /^-D(\w+)$/);
+ } 
+
+warn join(' ',keys %define)."\n";
+
+my $CCTYPE = shift || "MSVC";
 
 $skip_sym=<<'!END!OF!SKIP!';
-Perl_SvIV
-Perl_SvNV
-Perl_SvTRUE
-Perl_SvUV
 Perl_block_type
-Perl_sv_pvn
 Perl_additem
 Perl_cast_ulong
 Perl_check_uni
@@ -61,6 +66,7 @@ Perl_force_next
 Perl_force_word
 Perl_hv_stashpv
 Perl_intuit_more
+Perl_init_thread_intern
 Perl_know_next
 Perl_modkids
 Perl_mstats
@@ -81,6 +87,7 @@ Perl_pp_interp
 Perl_pp_map
 Perl_pp_nswitch
 Perl_q
+Perl_rcsid
 Perl_reall_srchlen
 Perl_regdump
 Perl_regfold
@@ -106,7 +113,6 @@ Perl_setenv_getix
 Perl_skipspace
 Perl_sublex_done
 Perl_sublex_start
-Perl_sv_peek
 Perl_sv_ref
 Perl_sv_setptrobj
 Perl_timesbuf
@@ -119,18 +125,13 @@ Perl_yyname
 Perl_yyrule
 allgvs
 curblock
-curcop
-curcopdb
 curcsv
-envgv
 lastretstr
 mystack_mark
 perl_init_ext
 perl_requirepv
-siggv
 stack
 statusvalue_vms
-tainting
 Perl_safexcalloc
 Perl_safexmalloc
 Perl_safexfree
@@ -139,7 +140,54 @@ Perl_my_memcmp
 Perl_my_memset
 Perl_cshlen
 Perl_cshname
+Perl_opsave
+!END!OF!SKIP!
+
+unless ($define{'USE_THREADS'})
+ {
+  $skip_sym .= <<'!END!OF!SKIP!';
+Perl_condpair_magic
+Perl_thr_key
+Perl_sv_mutex
+Perl_malloc_mutex
+Perl_eval_mutex
+Perl_eval_cond
+Perl_eval_owner
+Perl_threads_mutex
+Perl_new_struct_thread
+Perl_nthreads
+Perl_nthreads_cond
+Perl_per_thread_magicals
+Perl_thrsv
+Perl_unlock_condpair
+Perl_vtbl_mutex
+Perl_magic_mutexfree
+Perl_sv_iv
+Perl_sv_nv
+Perl_sv_true
+Perl_sv_uv
+Perl_sv_pvn
+Perl_newRV_noinc
 !END!OF!SKIP!
+ }
+
+if ($define{'USE_THISPTR'} || $define{'USE_THREADS'})
+ {
+  open(THREAD,"<../thread.sym") || die "Cannot open thread.sym:$!";
+  while (<THREAD>)
+   {
+    next if (!/^[A-Za-z]/);
+    next if (/_amg[ \t]*$/);
+    $skip_sym .= "Perl_".$_;
+   } 
+  close(THREAD); 
+  $skip_sym .= "Perl_op\n";
+ } 
+
+unless ($define{'USE_THREADS'})
+ {
+  $skip_sym .= "Perl_thread_create\n";
+ }
 
 # All symbols have a Perl_ prefix because that's what embed.h
 # sticks in front of them.
@@ -158,8 +206,8 @@ while (<GLOBAL>) {
        next if (/_amg[ \t]*$/);
        $symbol = "Perl_$_";
        next if ($skip_sym =~ m/$symbol/m);
-       print "\t$symbol";
-       };
+       emit_symbol($symbol);
+}
 close(GLOBAL);
 
 # also add symbols from interp.sym
@@ -175,8 +223,8 @@ while (<INTERP>) {
        $symbol = $_;
        next if ($skip_sym =~ m/$symbol/m);
        #print "\t$symbol";
-       print "\tPerl_$symbol";
-       };
+       emit_symbol("Perl_" . $symbol);
+}
 
 #close(INTERP);
 
@@ -186,8 +234,29 @@ while (<DATA>) {
        next if (/^#/);
        $symbol = $_;
        next if ($skip_sym =~ m/^$symbol/m);
-       print "\t$symbol";
-       };
+        $symbol = "Perl_".$symbol if ($define{'USE_THISPTR'} 
+                                      && $symbol =~ /^perl/);
+       emit_symbol($symbol);
+}
+
+sub emit_symbol {
+       my $symbol = shift;
+       chomp $symbol;
+       if ($CCTYPE eq "BORLAND") {
+               # workaround Borland quirk by exporting both the straight
+               # name and a name with leading underscore.  Note the
+               # alias *must* come after the symbol itself, if both
+               # are to be exported. (Linker bug?)
+               print "\t_$symbol\n";
+               print "\t$symbol = _$symbol\n";
+       }
+       else {
+               # for binary coexistence, export both the symbol and
+               # alias with leading underscore
+               print "\t$symbol\n";
+               print "\t_$symbol = $symbol\n";
+       }
+}
 
 1;
 __DATA__
@@ -212,6 +281,7 @@ perl_require_pv
 perl_eval_pv
 perl_eval_sv
 boot_DynaLoader
+Perl_thread_create
 win32_errno
 win32_environ
 win32_stdin
@@ -259,12 +329,12 @@ win32_close
 win32_eof
 win32_read
 win32_write
-win32_spawnvpe
-win32_spawnle
+win32_spawnvp
 win32_mkdir
 win32_rmdir
 win32_chdir
 win32_flock
+win32_execvp
 win32_htons
 win32_ntohs
 win32_htonl
@@ -281,6 +351,7 @@ win32_sendto
 win32_recv
 win32_recvfrom
 win32_shutdown
+win32_closesocket
 win32_ioctlsocket
 win32_setsockopt
 win32_getsockopt
@@ -307,3 +378,28 @@ win32_sethostent
 win32_setnetent
 win32_setprotoent
 win32_setservent
+win32_getenv
+win32_perror
+win32_setbuf
+win32_setvbuf
+win32_flushall
+win32_fcloseall
+win32_fgets
+win32_gets
+win32_fgetc
+win32_putc
+win32_puts
+win32_getchar
+win32_putchar
+win32_malloc
+win32_calloc
+win32_realloc
+win32_free
+win32_sleep
+win32_times
+win32_alarm
+win32_open_osfhandle
+win32_get_osfhandle
+Perl_win32_init
+Perl_init_os_extras
+RunPerl