summaryrefslogtreecommitdiffstats
path: root/win/tclWinPort.h
diff options
context:
space:
mode:
Diffstat (limited to 'win/tclWinPort.h')
-rw-r--r--win/tclWinPort.h248
1 files changed, 141 insertions, 107 deletions
diff --git a/win/tclWinPort.h b/win/tclWinPort.h
index c1317be..9c9831c 100644
--- a/win/tclWinPort.h
+++ b/win/tclWinPort.h
@@ -14,6 +14,19 @@
#ifndef _TCLWINPORT
#define _TCLWINPORT
+/*
+ * We must specify the lower version we intend to support.
+ *
+ * WINVER = 0x0500 means Windows 2000 and above
+ */
+
+#ifndef WINVER
+# define WINVER 0x0501
+#endif
+#ifndef _WIN32_WINNT
+# define _WIN32_WINNT 0x0501
+#endif
+
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
@@ -23,6 +36,10 @@
*/
#define INCL_WINSOCK_API_TYPEDEFS 1
#include <winsock2.h>
+#include <ws2tcpip.h>
+#ifdef HAVE_WSPIAPI_H
+# include <wspiapi.h>
+#endif
#ifdef CHECK_UNICODE_CALLS
# define _UNICODE
@@ -34,27 +51,34 @@
#endif /* CHECK_UNICODE_CALLS */
/*
+ * Pull in the typedef of TCHAR for windows.
+ */
+#include <tchar.h>
+#ifndef _TCHAR_DEFINED
+ /* Borland seems to forget to set this. */
+ typedef _TCHAR TCHAR;
+# define _TCHAR_DEFINED
+#endif
+#if defined(_MSC_VER) && defined(__STDC__)
+ /* VS2005 SP1 misses this. See [Bug #3110161] */
+ typedef _TCHAR TCHAR;
+#endif
+
+/*
*---------------------------------------------------------------------------
* The following sets of #includes and #ifdefs are required to get Tcl to
* compile under the windows compilers.
*---------------------------------------------------------------------------
*/
-#ifdef __CYGWIN__
-# include <unistd.h>
-# include <wchar.h>
-#else
-# include <io.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
+#include <wchar.h>
+#include <io.h>
#include <errno.h>
#include <fcntl.h>
#include <float.h>
#include <malloc.h>
#include <process.h>
#include <signal.h>
-#include <string.h>
#include <limits.h>
#ifdef __CYGWIN__
@@ -89,22 +113,6 @@
#include <time.h>
/*
- * Define EINPROGRESS in terms of WSAEINPROGRESS.
- */
-
-#ifndef EINPROGRESS
-# define EINPROGRESS WSAEINPROGRESS
-#endif
-
-/*
- * If ENOTSUP is not defined, define it to a value that will never occur.
- */
-
-#ifndef ENOTSUP
-# define ENOTSUP -1030507
-#endif
-
-/*
* Not all mingw32 versions have this struct.
*/
#if !defined(__BORLANDC__) && !defined(_MSC_VER) && !defined(_WIN64) && !defined(HAVE_STRUCT_STAT32I64)
@@ -128,122 +136,154 @@
* BSD errors so Tcl_PosixError can do the right thing.
*/
-#ifndef EWOULDBLOCK
-# define EWOULDBLOCK EAGAIN
+#ifndef ENOTEMPTY
+# define ENOTEMPTY 41 /* Directory not empty */
+#endif
+#ifndef EREMOTE
+# define EREMOTE 66 /* The object is remote */
+#endif
+#ifndef EPFNOSUPPORT
+# define EPFNOSUPPORT 96 /* Protocol family not supported */
+#endif
+#ifndef EADDRINUSE
+# define EADDRINUSE 100 /* Address already in use */
+#endif
+#ifndef EADDRNOTAVAIL
+# define EADDRNOTAVAIL 101 /* Can't assign requested address */
+#endif
+#ifndef EAFNOSUPPORT
+# define EAFNOSUPPORT 102 /* Address family not supported */
#endif
#ifndef EALREADY
-# define EALREADY 149 /* operation already in progress */
+# define EALREADY 103 /* Operation already in progress */
#endif
-#ifndef ENOTSOCK
-# define ENOTSOCK 95 /* Socket operation on non-socket */
+#ifndef EBADMSG
+# define EBADMSG 104 /* Not a data message */
#endif
-#ifndef EDESTADDRREQ
-# define EDESTADDRREQ 96 /* Destination address required */
+#ifndef ECANCELED
+# define ECANCELED 105 /* Canceled */
#endif
-#ifndef EMSGSIZE
-# define EMSGSIZE 97 /* Message too long */
+#ifndef ECONNABORTED
+# define ECONNABORTED 106 /* Software caused connection abort */
#endif
-#ifndef EPROTOTYPE
-# define EPROTOTYPE 98 /* Protocol wrong type for socket */
+#ifndef ECONNREFUSED
+# define ECONNREFUSED 107 /* Connection refused */
#endif
-#ifndef ENOPROTOOPT
-# define ENOPROTOOPT 99 /* Protocol not available */
+#ifndef ECONNRESET
+# define ECONNRESET 108 /* Connection reset by peer */
#endif
-#ifndef EPROTONOSUPPORT
-# define EPROTONOSUPPORT 120 /* Protocol not supported */
+#ifndef EDESTADDRREQ
+# define EDESTADDRREQ 109 /* Destination address required */
#endif
-#ifndef ESOCKTNOSUPPORT
-# define ESOCKTNOSUPPORT 121 /* Socket type not supported */
+#ifndef EHOSTUNREACH
+# define EHOSTUNREACH 110 /* No route to host */
#endif
-#ifndef EOPNOTSUPP
-# define EOPNOTSUPP 122 /* Operation not supported on socket */
+#ifndef EIDRM
+# define EIDRM 111 /* Identifier removed */
#endif
-#ifndef EPFNOSUPPORT
-# define EPFNOSUPPORT 123 /* Protocol family not supported */
+#ifndef EINPROGRESS
+# define EINPROGRESS 112 /* Operation now in progress */
#endif
-#ifndef EAFNOSUPPORT
-# define EAFNOSUPPORT 124 /* Address family not supported */
+#ifndef EISCONN
+# define EISCONN 113 /* Socket is already connected */
#endif
-#ifndef EADDRINUSE
-# define EADDRINUSE 125 /* Address already in use */
+#ifndef ELOOP
+# define ELOOP 114 /* Symbolic link loop */
#endif
-#ifndef EADDRNOTAVAIL
-# define EADDRNOTAVAIL 126 /* Can't assign requested address */
+#ifndef EMSGSIZE
+# define EMSGSIZE 115 /* Message too long */
#endif
#ifndef ENETDOWN
-# define ENETDOWN 127 /* Network is down */
+# define ENETDOWN 116 /* Network is down */
+#endif
+#ifndef ENETRESET
+# define ENETRESET 117 /* Network dropped connection on reset */
#endif
#ifndef ENETUNREACH
-# define ENETUNREACH 128 /* Network is unreachable */
+# define ENETUNREACH 118 /* Network is unreachable */
#endif
-#ifndef ENETRESET
-# define ENETRESET 129 /* Network dropped connection on reset */
+#ifndef ENOBUFS
+# define ENOBUFS 119 /* No buffer space available */
#endif
-#ifndef ECONNABORTED
-# define ECONNABORTED 130 /* Software caused connection abort */
+#ifndef ENODATA
+# define ENODATA 120 /* No data available */
#endif
-#ifndef ECONNRESET
-# define ECONNRESET 131 /* Connection reset by peer */
+#ifndef ENOLINK
+# define ENOLINK 121 /* Link has be severed */
#endif
-#ifndef ENOBUFS
-# define ENOBUFS 132 /* No buffer space available */
+#ifndef ENOMSG
+# define ENOMSG 122 /* No message of desired type */
#endif
-#ifndef EISCONN
-# define EISCONN 133 /* Socket is already connected */
+#ifndef ENOPROTOOPT
+# define ENOPROTOOPT 123 /* Protocol not available */
+#endif
+#ifndef ENOSR
+# define ENOSR 124 /* Out of stream resources */
+#endif
+#ifndef ENOSTR
+# define ENOSTR 125 /* Not a stream device */
#endif
#ifndef ENOTCONN
-# define ENOTCONN 134 /* Socket is not connected */
+# define ENOTCONN 126 /* Socket is not connected */
#endif
-#ifndef ESHUTDOWN
-# define ESHUTDOWN 143 /* Can't send after socket shutdown */
+#ifndef ENOTRECOVERABLE
+# define ENOTRECOVERABLE 127 /* Not recoverable */
#endif
-#ifndef ETOOMANYREFS
-# define ETOOMANYREFS 144 /* Too many references: can't splice */
+#ifndef ENOTSOCK
+# define ENOTSOCK 128 /* Socket operation on non-socket */
#endif
-#ifndef ETIMEDOUT
-# define ETIMEDOUT 145 /* Connection timed out */
+#ifndef ENOTSUP
+# define ENOTSUP 129 /* Operation not supported */
#endif
-#ifndef ECONNREFUSED
-# define ECONNREFUSED 146 /* Connection refused */
+#ifndef EOPNOTSUPP
+# define EOPNOTSUPP 130 /* Operation not supported on socket */
#endif
-#ifndef ELOOP
-# define ELOOP 90 /* Symbolic link loop */
+#ifndef EOTHER
+# define EOTHER 131 /* Other error */
#endif
-#ifndef EHOSTDOWN
-# define EHOSTDOWN 147 /* Host is down */
+#ifndef EOVERFLOW
+# define EOVERFLOW 132 /* File too big */
#endif
-#ifndef EHOSTUNREACH
-# define EHOSTUNREACH 148 /* No route to host */
+#ifndef EOWNERDEAD
+# define EOWNERDEAD 133 /* File too big */
#endif
-#ifndef ENOTEMPTY
-# define ENOTEMPTY 93 /* directory not empty */
+#ifndef EPROTO
+# define EPROTO 134 /* Protocol error */
#endif
-#ifndef EUSERS
-# define EUSERS 94 /* Too many users (for UFS) */
+#ifndef EPROTONOSUPPORT
+# define EPROTONOSUPPORT 135 /* Protocol not supported */
#endif
-#ifndef EDQUOT
-# define EDQUOT 69 /* Disc quota exceeded */
+#ifndef EPROTOTYPE
+# define EPROTOTYPE 136 /* Protocol wrong type for socket */
#endif
-#ifndef ESTALE
-# define ESTALE 151 /* Stale NFS file handle */
+#ifndef ETIME
+# define ETIME 137 /* Timer expired */
#endif
-#ifndef EREMOTE
-# define EREMOTE 66 /* The object is remote */
+#ifndef ETIMEDOUT
+# define ETIMEDOUT 138 /* Connection timed out */
+#endif
+#ifndef ETXTBSY
+# define ETXTBSY 139 /* Text file or pseudo-device busy */
+#endif
+#ifndef EWOULDBLOCK
+# define EWOULDBLOCK 140 /* Operation would block */
#endif
-/*
- * It is very hard to determine how Windows reacts to attempting to
- * set a file pointer outside the input datatype's representable
- * region. So we fake the error code ourselves.
- */
-#ifndef EOVERFLOW
-# ifdef EFBIG
-# define EOVERFLOW EFBIG /* The object couldn't fit in the datatype */
-# else /* !EFBIG */
-# define EOVERFLOW EINVAL /* Better than nothing! */
-# endif /* EFBIG */
-#endif /* !EOVERFLOW */
+#undef ESOCKTNOSUPPORT
+#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT /* Socket type not supported */
+#undef ESHUTDOWN
+#define ESHUTDOWN WSAESHUTDOWN /* Can't send after socket shutdown */
+#undef ETOOMANYREFS
+#define ETOOMANYREFS WSAETOOMANYREFS /* Too many references: can't splice */
+#undef EHOSTDOWN
+#define EHOSTDOWN WSAEHOSTDOWN /* Host is down */
+#undef EUSERS
+#define EUSERS WSAEUSERS /* Too many users (for UFS) */
+#undef EDQUOT
+#define EDQUOT WSAEDQUOT /* Disc quota exceeded */
+#undef ESTALE
+#define ESTALE WSAESTALE /* Stale NFS file handle */
/*
* Signals not known to the standard ANSI signal.h. These are used
@@ -445,12 +485,6 @@
/*
- * There is no platform-specific panic routine for Windows in the Tcl internals.
- */
-
-#define TclpPanic ((Tcl_PanicProc *) NULL)
-
-/*
*---------------------------------------------------------------------------
* The following macros and declarations represent the interface between
* generic and windows-specific parts of Tcl. Some of the macros may