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
/* Windows socket errors (WSA*) */
#ifdef MS_WINDOWS
#define WIN32_LEAN_AND_MEAN
-#include <winsock.h>
+#include <windows.h>
#endif
/*
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)
{
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
# 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
-# define WIN32_LEAN_AND_MEAN
-# 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>
# 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
# 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
# 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
# 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\_functoolsmodule.c\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
+SOURCE=..\..\Objects\bytearrayobject.c\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=..\..\Objects\bytes_methods.c\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
-SOURCE=..\..\Modules\_collectionsmodule.c\r
-# End Source File\r
-# Begin Source File\r
-\r
SOURCE=..\..\Python\compile.c\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
-SOURCE=..\..\Python\formatter_string.c\r
-# End Source File\r
-# Begin Source File\r
-\r
SOURCE=..\..\Python\formatter_unicode.c\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
-SOURCE=..\..\Python\formatter_unicode.c\r
-# End Source File\r
-# Begin Source File\r
-\r
SOURCE=..\..\Python\frozen.c\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
-SOURCE=..\..\Objects\stringobject.c\r
-# End Source File\r
-# Begin Source File\r
-\r
SOURCE=..\..\Python\structmember.c\r
# End Source File\r
# Begin Source File\r
static int
exists(wchar_t *filename)
{
- struct _stat64 buf;
- return _wstat64(filename, &buf) == 0;
+ return GetFileAttributesW(filename) != 0xFFFFFFFF;
}
/* Assumes 'filename' MAXPATHLEN+1 bytes long -
return PyBytes_FromStringAndSize(s, 1);
}
-#if _MSC_VER >= 1300
+#ifdef _WCONIO_DEFINED
static PyObject *
msvcrt_getwch(PyObject *self, PyObject *args)
{
return PyBytes_FromStringAndSize(s, 1);
}
-#if _MSC_VER >= 1300
+#ifdef _WCONIO_DEFINED
static PyObject *
msvcrt_getwche(PyObject *self, PyObject *args)
{
return Py_None;
}
-
-#if _MSC_VER >= 1300
+#ifdef _WCONIO_DEFINED
static PyObject *
msvcrt_putwch(PyObject *self, PyObject *args)
{
return Py_None;
}
-#if _MSC_VER >= 1300
+#ifdef _WCONIO_DEFINED
static PyObject *
msvcrt_ungetwch(PyObject *self, PyObject *args)
{
{"CrtSetReportMode", msvcrt_setreportmode, METH_VARARGS},
{"set_error_mode", msvcrt_seterrormode, METH_VARARGS},
#endif
-#if _MSC_VER >= 1300
+#ifdef _WCONIO_DEFINED
{"getwch", msvcrt_getwch, METH_VARARGS},
{"getwche", msvcrt_getwche, METH_VARARGS},
{"putwch", msvcrt_putwch, METH_VARARGS},
/* 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