]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Restore support for Microsoft VC6 compiler.
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>
Fri, 13 Jun 2008 00:42:22 +0000 (00:42 +0000)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>
Fri, 13 Jun 2008 00:42:22 +0000 (00:42 +0000)
Some functions in the msvcrt module are skipped,
and socket.ioctl is enabled only when using a more recent Platform SDK.

(and yes, there are still companies that use a 10-years old compiler)

Include/pythonrun.h
Modules/errnomodule.c
Modules/socketmodule.c
Modules/socketmodule.h
PC/VC6/_socket.dsp
PC/VC6/pythoncore.dsp
PC/msvcrtmodule.c
PC/pyconfig.h

index c5635ba01a5205e6d583348ca3e9ee447505d48e..b2b3afdaee17247666e31876aa6c000e492db40d 100644 (file)
@@ -153,7 +153,7 @@ PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
    to a 8k margin. */
 #define PYOS_STACK_MARGIN 2048
 
-#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER)
+#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) && _MSC_VER >= 1300
 /* Enable stack checking under Microsoft C */
 #define USE_STACKCHECK
 #endif
index 696d396b07ad8dcae16a9de979e339eee8963e1e..642d7216781060585a1059027c99df78036d4397 100644 (file)
@@ -5,7 +5,7 @@
 
 /* Windows socket errors (WSA*)  */
 #ifdef MS_WINDOWS
-#include <winsock.h>
+#include <windows.h>
 #endif
 
 /*
index e9568315d4f4b49b181e09f977103ea51762030d..e4c8ac8a3b1f1d66ea88c2746d3b08d48cc000ac 100644 (file)
@@ -2805,7 +2805,7 @@ PyDoc_STRVAR(shutdown_doc,
 Shut down the reading side of the socket (flag == SHUT_RD), the writing side\n\
 of the socket (flag == SHUT_WR), or both ends (flag == SHUT_RDWR).");
 
-#ifdef MS_WINDOWS
+#if defined(MS_WINDOWS) && defined(SIO_RCVALL)
 static PyObject*
 sock_ioctl(PySocketSockObject *s, PyObject *arg)
 {
@@ -2858,7 +2858,7 @@ static PyMethodDef sock_methods[] = {
                          METH_NOARGS, getsockname_doc},
        {"getsockopt",    (PyCFunction)sock_getsockopt, METH_VARARGS,
                          getsockopt_doc},
-#ifdef MS_WINDOWS
+#if defined(MS_WINDOWS) && defined(SIO_RCVALL)
        {"ioctl",         (PyCFunction)sock_ioctl, METH_VARARGS,
                          sock_ioctl_doc},
 #endif
index 285c1fe6e55025a1b61c900fa8a7139ca0fc3ada..44483cb35b5a5cdd4f9aba2b81f426d94c9c9d05 100644 (file)
 # endif
 
 #else /* MS_WINDOWS */
-#if _MSC_VER >= 1300
 # include <winsock2.h>
 # include <ws2tcpip.h>
-# include <MSTcpIP.h> /* for SIO_RCVALL */
-# define HAVE_ADDRINFO
-# define HAVE_SOCKADDR_STORAGE
-# define HAVE_GETADDRINFO
-# define HAVE_GETNAMEINFO
-# define ENABLE_IPV6
-#else
-# include <winsock.h>
-#endif
-#endif
+/* VC6 is shipped with old platform headers, and does not have MSTcpIP.h
+ * Separate SDKs have all the functions we want, but older ones don't have
+ * any version information. I use IPPROTO_IPV6 to detect a decent SDK.
+ */
+# ifdef IPPROTO_IPV6
+#  include <MSTcpIP.h> /* for SIO_RCVALL */
+#  define HAVE_ADDRINFO
+#  define HAVE_SOCKADDR_STORAGE
+#  define HAVE_GETADDRINFO
+#  define HAVE_GETNAMEINFO
+#  define ENABLE_IPV6
+# else
+typedef int socklen_t;
+# endif /* IPPROTO_IPV6 */
+#endif /* MS_WINDOWS */
 
 #ifdef HAVE_SYS_UN_H
 # include <sys/un.h>
index 85d2bf018553a107955069c1eec5e9de3e68ad0b..4e8405566228d9b67ac39b6d8f1d94be923189a2 100644 (file)
@@ -54,7 +54,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386\r
-# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /base:"0x1e1D0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_socket.pyd"\r
+# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /base:"0x1e1D0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_socket.pyd"\r
 # SUBTRACT LINK32 /pdb:none\r
 \r
 !ELSEIF  "$(CFG)" == "_socket - Win32 Debug"\r
@@ -82,7 +82,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept\r
-# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /base:"0x1e1D0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_socket_d.pyd" /pdbtype:sept\r
+# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /base:"0x1e1D0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_socket_d.pyd" /pdbtype:sept\r
 # SUBTRACT LINK32 /pdb:none\r
 \r
 !ENDIF \r
index 992f816a47dc228e03344579f0c2b7403d422b38..1fc2a38792727685cfc7247bcd38c1be192b7960 100644 (file)
@@ -97,6 +97,10 @@ SOURCE=..\..\Modules\_bisectmodule.c
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\Modules\_bytesio.c\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\Modules\cjkcodecs\_codecs_cn.c\r
 # End Source File\r
 # Begin Source File\r
index e110ed8b091c4a13dcb93b7b1c49c272e8b1fcd9..95e369b42499f78bb30308992ea2fa5a3a4000f4 100755 (executable)
@@ -143,6 +143,7 @@ msvcrt_getch(PyObject *self, PyObject *args)
        return PyString_FromStringAndSize(s, 1);
 }
 
+#ifdef _WCONIO_DEFINED
 static PyObject *
 msvcrt_getwch(PyObject *self, PyObject *args)
 {
@@ -158,6 +159,7 @@ msvcrt_getwch(PyObject *self, PyObject *args)
        u[0] = ch;
        return PyUnicode_FromUnicode(u, 1);
 }
+#endif
 
 static PyObject *
 msvcrt_getche(PyObject *self, PyObject *args)
@@ -175,6 +177,7 @@ msvcrt_getche(PyObject *self, PyObject *args)
        return PyString_FromStringAndSize(s, 1);
 }
 
+#ifdef _WCONIO_DEFINED
 static PyObject *
 msvcrt_getwche(PyObject *self, PyObject *args)
 {
@@ -190,6 +193,7 @@ msvcrt_getwche(PyObject *self, PyObject *args)
        s[0] = ch;
        return PyUnicode_FromUnicode(s, 1);
 }
+#endif
 
 static PyObject *
 msvcrt_putch(PyObject *self, PyObject *args)
@@ -204,7 +208,7 @@ msvcrt_putch(PyObject *self, PyObject *args)
        return Py_None;
 }
 
-
+#ifdef _WCONIO_DEFINED
 static PyObject *
 msvcrt_putwch(PyObject *self, PyObject *args)
 {
@@ -223,6 +227,7 @@ msvcrt_putwch(PyObject *self, PyObject *args)
        Py_RETURN_NONE;
 
 }
+#endif
 
 static PyObject *
 msvcrt_ungetch(PyObject *self, PyObject *args)
@@ -238,6 +243,7 @@ msvcrt_ungetch(PyObject *self, PyObject *args)
        return Py_None;
 }
 
+#ifdef _WCONIO_DEFINED
 static PyObject *
 msvcrt_ungetwch(PyObject *self, PyObject *args)
 {
@@ -251,6 +257,7 @@ msvcrt_ungetwch(PyObject *self, PyObject *args)
        Py_INCREF(Py_None);
        return Py_None;
 }
+#endif
 
 static void
 insertint(PyObject *d, char *name, int value)
@@ -279,11 +286,12 @@ static struct PyMethodDef msvcrt_functions[] = {
        {"getche",              msvcrt_getche, METH_VARARGS},
        {"putch",               msvcrt_putch, METH_VARARGS},
        {"ungetch",             msvcrt_ungetch, METH_VARARGS},
+#ifdef _WCONIO_DEFINED
        {"getwch",              msvcrt_getwch, METH_VARARGS},
        {"getwche",             msvcrt_getwche, METH_VARARGS},
        {"putwch",              msvcrt_putwch, METH_VARARGS},
        {"ungetwch",            msvcrt_ungetwch, METH_VARARGS},
-
+#endif
        {NULL,                  NULL}
 };
 
index 98d79ad52bb1bee13952df5efc3ccfcc029e7168..93dbc0983bf934a50142ab15218ca6dd95d89a3a 100644 (file)
@@ -467,13 +467,6 @@ Py_NO_ENABLE_SHARED to find out.  Also support MS_NO_COREDLL for b/w compat */
 /* Define to `unsigned' if <sys/types.h> doesn't define.  */
 /* #undef size_t */
 
-/* Define to `int' if <sys/types.h> doesn't define.  */
-#if _MSC_VER + 0 >= 1300
-/* VC.NET typedefs socklen_t in ws2tcpip.h. */
-#else
-#define socklen_t int
-#endif
-
 /* Define if you have the ANSI C header files.  */
 #define STDC_HEADERS 1