summaryrefslogtreecommitdiffstats
path: root/generic/tclStubInit.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclStubInit.c')
-rw-r--r--generic/tclStubInit.c69
1 files changed, 37 insertions, 32 deletions
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index eec540c..3f2f929 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -39,19 +39,37 @@
#undef Tcl_CreateHashEntry
#undef Tcl_Panic
#undef Tcl_FindExecutable
+#undef TclSockMinimumBuffers
+
+/* See bug 510001: TclSockMinimumBuffers needs plat imp */
+#ifdef _WIN64
+# define TclSockMinimumBuffersOld 0
+#else
+#define TclSockMinimumBuffersOld sockMinimumBuffersOld
+static int TclSockMinimumBuffersOld(sock, size)
+ int sock;
+ int size;
+{
+ return TclSockMinimumBuffers(INT2PTR(sock), size);
+}
+#endif
#ifdef __CYGWIN__
+/* Trick, so we don't have to include <windows.h> here, which
+ * - b.t.w. - lacks this function anyway */
+#define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004
+int __stdcall GetModuleHandleExW(unsigned int, const char *, void *);
+
#define TclWinGetPlatformId winGetPlatformId
#define Tcl_WinUtfToTChar winUtfToTChar
#define Tcl_WinTCharToUtf winTCharToUtf
#define TclWinGetTclInstance winGetTclInstance
#define TclWinNToHS winNToHS
#define TclWinSetSockOpt winSetSockOpt
-#define TclWinAddProcess winAddProcess
-#define TclpGetTZName pGetTZName
#define TclWinNoBackslash winNoBackslash
-#define TclWinSetInterfaces (void (*) _ANSI_ARGS_((int))) doNothing
+#define TclWinSetInterfaces (void (*) (int)) doNothing
+#define TclWinAddProcess (void (*) (void *, unsigned int)) doNothing
#define TclWinFlushDirtyChannels doNothing
#define TclWinResetInterfaces doNothing
@@ -65,38 +83,25 @@ TclWinGetPlatformId()
return 2; /* VER_PLATFORM_WIN32_NT */;
}
-static int TclWinGetTclInstance()
+static void *TclWinGetTclInstance()
{
- Tcl_Panic("TclWinGetTclInstance not yet implemented for CYGWIN");
- return 0;
+ void *hInstance = NULL;
+ GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
+ (const char *)&winTCharEncoding, &hInstance);
+ return hInstance;
}
static unsigned short
TclWinNToHS(unsigned short ns)
{
- Tcl_Panic("TclWinNToHS not yet implemented for CYGWIN");
- return (unsigned short) -1;
+ return ntohs(ns);
}
+
static int
-TclWinSetSockOpt(int s, int level, int optname,
+TclWinSetSockOpt(void *s, int level, int optname,
const char *optval, int optlen)
{
- Tcl_Panic("TclWinSetSockOpt not yet implemented for CYGWIN");
- return -1;
-}
-
-static void
-TclWinAddProcess(void *hProcess, unsigned long id)
-{
- Tcl_Panic("TclWinAddProcess not yet implemented for CYGWIN");
-}
-
-static char *
-TclpGetTZName(int isdst)
-{
- /* TODO: implementation */
- Tcl_Panic("TclpGetTZName not yet implemented for CYGWIN");
- return 0;
+ return setsockopt((int) s, level, optname, optval, optlen);
}
static char *
@@ -158,13 +163,13 @@ Tcl_WinTCharToUtf(
#elif !defined(__WIN32__) /* UNIX and MAC */
# define TclWinConvertError (void (*) _ANSI_ARGS_((unsigned int))) TclGetAndDetachPids
+# undef TclWinConvertWSAError
# define TclWinConvertWSAError (void (*) _ANSI_ARGS_((unsigned int))) TclpCloseFile
# define TclWinGetPlatformId (int (*)()) TclpCreateTempFile
-# define TclWinGetTclInstance (int (*)()) TclpCreateProcess
+# define TclWinGetTclInstance (void *(*)()) TclpCreateProcess
# define TclWinNToHS (unsigned short (*) _ANSI_ARGS_((unsigned short ns))) TclpMakeFile
-# define TclWinSetSockOpt (int (*) _ANSI_ARGS_((int, int, int, const char *, int))) TclpOpenFile
+# define TclWinSetSockOpt (int (*) _ANSI_ARGS_((void *, int, int, const char *, int))) TclpOpenFile
# define TclWinAddProcess 0
-# define TclpGetTZName 0
# define TclWinNoBackslash 0
# define TclWinSetInterfaces 0
# define TclWinFlushDirtyChannels 0
@@ -298,13 +303,13 @@ static const TclIntStubs tclIntStubs = {
TclSetPreInitScript, /* 101 */
TclSetupEnv, /* 102 */
TclSockGetPort, /* 103 */
- TclSockMinimumBuffers, /* 104 */
+ TclSockMinimumBuffersOld, /* 104 */
0, /* 105 */
0, /* 106 */
0, /* 107 */
TclTeardownNamespace, /* 108 */
TclUpdateReturnInfo, /* 109 */
- 0, /* 110 */
+ TclSockMinimumBuffers, /* 110 */
Tcl_AddInterpResolvers, /* 111 */
Tcl_AppendExportList, /* 112 */
Tcl_CreateNamespace, /* 113 */
@@ -474,7 +479,7 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclWinAddProcess, /* 20 */
0, /* 21 */
TclpCreateTempFile, /* 22 */
- TclpGetTZName, /* 23 */
+ 0, /* 23 */
TclWinNoBackslash, /* 24 */
0, /* 25 */
TclWinSetInterfaces, /* 26 */
@@ -540,7 +545,7 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclWinAddProcess, /* 20 */
0, /* 21 */
TclpCreateTempFile, /* 22 */
- TclpGetTZName, /* 23 */
+ 0, /* 23 */
TclWinNoBackslash, /* 24 */
0, /* 25 */
TclWinSetInterfaces, /* 26 */