[5.004_71] Patch: let CPAN.pm work with threaded perl
[p5sagit/p5-mst-13.2.git] / win32 / GenCAPI.pl
index 468a9a3..8f597a9 100644 (file)
@@ -50,9 +50,13 @@ debprofdump
 debop
 debstack
 debstackptrs
+dump_fds
+dump_mstats
 fprintf
 find_threadsv
 magic_mutexfree
+my_memcmp
+my_memset
 my_pclose
 my_popen
 my_swap
@@ -67,6 +71,7 @@ safexcalloc
 safexrealloc
 safexfree
 Perl_GetVars
+malloced_size
 )];
 
 
@@ -278,6 +283,24 @@ ENDCODE
                 print OUTFILE "#endif\n" unless ($separateObj == 0);
                next;
            }
+           # handle special case for perl_atexit
+           if ($name eq "perl_atexit") {
+               print OUTFILE <<ENDCODE;
+
+#undef $name
+extern "C" $type $name ($args)
+{
+    pPerl->perl_atexit(fn, ptr);
+}
+ENDCODE
+                print OUTFILE "#endif\n" unless ($separateObj == 0);
+               next;
+           }
+
+
+           if($name eq "byterun" and $args eq "struct bytestream bs") {
+               next;
+           }
 
             # foo(void);
             if ($args eq "void") {
@@ -300,9 +323,8 @@ ENDCODE
 #undef $name
 extern "C" $type $funcName ($args)
 {
-$return pPerl->$funcName
 ENDCODE
-
+           print OUTFILE "$return pPerl->$funcName";
             $doneone = 0;
             foreach $arg (@args) {
                 if ($arg =~ /(\w+)\W*$/) {
@@ -356,7 +378,6 @@ opsave
 eval_mutex
 orslen
 ofmt
-mh
 modcount
 generation
 DBcv
@@ -364,7 +385,7 @@ archpat_auto
 sortcxix
 lastgotoprobe
 regdummy
-regparse
+regcomp_parse
 regxend
 regcode
 regnaughty
@@ -375,7 +396,7 @@ regsize
 regflags
 regseen
 seen_zerolen
-rx
+regcomp_rx
 extralen
 colorset
 colors
@@ -501,6 +522,28 @@ print OUTFILE <<EOCODE;
 
 
 extern "C" {
+
+
+char **        _Perl_op_desc(void)
+{
+    return pPerl->Perl_get_op_descs();
+}
+
+char **        _Perl_op_name(void)
+{
+    return pPerl->Perl_get_op_names();
+}
+
+char * _Perl_no_modify(void)
+{
+    return pPerl->Perl_get_no_modify();
+}
+
+U32 *  _Perl_opargs(void)
+{
+    return pPerl->Perl_get_opargs();
+}
+
 void xs_handler(CV* cv, CPerlObj* p)
 {
     void(*func)(CV*);
@@ -716,6 +759,16 @@ int          _win32_setvbuf(FILE *pf, char *buf, int type, size_t size)
     return pPerl->piStdIO->SetVBuf((PerlIO*)pf, buf, type, size, ErrorNo());
 }
 
+char*          _win32_fgets(char *s, int n, FILE *pf)
+{
+    return pPerl->piStdIO->Gets((PerlIO*)pf, s, n, ErrorNo());
+}
+
+char*          _win32_gets(char *s)
+{
+    return _win32_fgets(s, 80, (FILE*)pPerl->piStdIO->Stdin());
+}
+
 int          _win32_fgetc(FILE *pf)
 {
     return pPerl->piStdIO->Getc((PerlIO*)pf, ErrorNo());
@@ -817,6 +870,11 @@ int          _win32_stat(const char *name,struct stat *sbufptr)
     return pPerl->piLIO->NameStat(name, sbufptr, ErrorNo());
 }
 
+int          _win32_rename(const char *oldname, const char *newname)
+{
+    return pPerl->piLIO->Rename(oldname, newname, ErrorNo());
+}
+
 int          _win32_setmode(int fd, int mode)
 {
     return pPerl->piLIO->Setmode(fd, mode, ErrorNo());
@@ -960,7 +1018,7 @@ int _win32_sendto (SOCKET s, const char * buf, int len, int flags,
 
 int _win32_recv (SOCKET s, char * buf, int len, int flags)
 {
-    return 0;
+    return pPerl->piSock->Recv(s, buf, len, flags, ErrorNo());
 }
 
 int _win32_recvfrom (SOCKET s, char * buf, int len, int flags,
@@ -976,12 +1034,12 @@ int _win32_shutdown (SOCKET s, int how)
 
 int _win32_closesocket (SOCKET s)
 {
-    return 0;
+    return pPerl->piSock->Closesocket(s, ErrorNo());
 }
 
 int _win32_ioctlsocket (SOCKET s, long cmd, u_long *argp)
 {
-    return 0;
+    return pPerl->piSock->Ioctlsocket(s, cmd, argp, ErrorNo());
 }
 
 int _win32_setsockopt (SOCKET s, int level, int optname,
@@ -1115,6 +1173,23 @@ EOCODE
 
 
 print HDRFILE <<EOCODE;
+#undef Perl_op_desc
+char ** _Perl_op_desc ();
+#define Perl_op_desc (_Perl_op_desc())
+
+#undef Perl_op_name
+char ** _Perl_op_name ();
+#define Perl_op_name (_Perl_op_name())
+
+#undef Perl_no_modify
+char * _Perl_no_modify ();
+#define Perl_no_modify (_Perl_no_modify())
+
+#undef Perl_opargs
+U32 * _Perl_opargs ();
+#define Perl_opargs (_Perl_opargs())
+
+
 #undef win32_errno
 #undef win32_stdin
 #undef win32_stdout
@@ -1150,6 +1225,7 @@ print HDRFILE <<EOCODE;
 #undef win32_pipe
 #undef win32_popen
 #undef win32_pclose
+#undef win32_rename
 #undef win32_setmode
 #undef win32_lseek
 #undef win32_tell
@@ -1166,6 +1242,8 @@ print HDRFILE <<EOCODE;
 #undef win32_setbuf
 #undef win32_setvbuf
 #undef win32_fgetc
+#undef win32_fgets
+#undef win32_gets
 #undef win32_putc
 #undef win32_puts
 #undef win32_getchar
@@ -1263,6 +1341,7 @@ print HDRFILE <<EOCODE;
 #define win32_pipe     _win32_pipe
 #define win32_popen    _win32_popen
 #define win32_pclose   _win32_pclose
+#define win32_rename   _win32_rename
 #define win32_setmode  _win32_setmode
 #define win32_lseek    _win32_lseek
 #define win32_tell     _win32_tell
@@ -1279,6 +1358,8 @@ print HDRFILE <<EOCODE;
 #define win32_setbuf   _win32_setbuf
 #define win32_setvbuf  _win32_setvbuf
 #define win32_fgetc    _win32_fgetc
+#define win32_fgets    _win32_fgets
+#define win32_gets     _win32_gets
 #define win32_putc     _win32_putc
 #define win32_puts     _win32_puts
 #define win32_getchar  _win32_getchar
@@ -1379,6 +1460,7 @@ int       _win32_stat(const char *name,struct stat *sbufptr);
 int    _win32_pipe( int *phandles, unsigned int psize, int textmode );
 FILE*  _win32_popen( const char *command, const char *mode );
 int    _win32_pclose( FILE *pf);
+int    _win32_rename( const char *oldname, const char *newname);
 int    _win32_setmode( int fd, int mode);
 long   _win32_lseek( int fd, long offset, int origin);
 long   _win32_tell( int fd);