summaryrefslogtreecommitdiffstats
path: root/generic/tclStubInit.c
diff options
context:
space:
mode:
authormig <mig>2012-11-26 15:31:39 (GMT)
committermig <mig>2012-11-26 15:31:39 (GMT)
commitdc53ade348e2e48b0e8a031930a36b23dc985d32 (patch)
tree92e3c75cbe7d34f4c2cf7f628dde51cebb58ecf6 /generic/tclStubInit.c
parent401a9d0876241c716e89cc2b8c7cea0d4bfab806 (diff)
parenta6f5874dd6a97c06fc39c4d5fd429042d4facce8 (diff)
downloadtcl-dc53ade348e2e48b0e8a031930a36b23dc985d32.zip
tcl-dc53ade348e2e48b0e8a031930a36b23dc985d32.tar.gz
tcl-dc53ade348e2e48b0e8a031930a36b23dc985d32.tar.bz2
merge trunk
Diffstat (limited to 'generic/tclStubInit.c')
-rw-r--r--generic/tclStubInit.c192
1 files changed, 175 insertions, 17 deletions
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 12ab744..569d0f1 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -39,8 +39,140 @@
#undef Tcl_CreateHashEntry
#undef Tcl_Panic
#undef Tcl_FindExecutable
-#define TclpLocaltime_unix TclpLocaltime
-#define TclpGmtime_unix TclpGmtime
+#undef TclpGetPid
+#undef TclSockMinimumBuffers
+
+/* See bug 510001: TclSockMinimumBuffers needs plat imp */
+#ifdef _WIN64
+# define TclSockMinimumBuffersOld 0
+#else
+#define TclSockMinimumBuffersOld sockMinimumBuffersOld
+static int TclSockMinimumBuffersOld(int sock, int size)
+{
+ return TclSockMinimumBuffers(INT2PTR(sock), size);
+}
+#endif
+
+
+#if defined(_WIN32) || defined(__CYGWIN__)
+#undef TclWinNToHS
+#define TclWinNToHS winNToHS
+static unsigned short TclWinNToHS(unsigned short ns) {
+ return ntohs(ns);
+}
+#endif
+
+#ifdef __WIN32__
+# define TclUnixWaitForFile 0
+# define TclUnixCopyFile 0
+# define TclpReaddir 0
+# define TclpIsAtty 0
+#elif defined(__CYGWIN__)
+# define TclpIsAtty TclPlatIsAtty
+# define TclWinSetInterfaces (void (*) (int)) doNothing
+# define TclWinAddProcess (void (*) (void *, unsigned int)) doNothing
+# define TclWinFlushDirtyChannels doNothing
+# define TclWinResetInterfaces doNothing
+
+static Tcl_Encoding winTCharEncoding;
+
+static int
+TclpIsAtty(int fd)
+{
+ return isatty(fd);
+}
+
+int
+TclWinGetPlatformId()
+{
+ /* Don't bother to determine the real platform on cygwin,
+ * because VER_PLATFORM_WIN32_NT is the only supported platform */
+ return 2; /* VER_PLATFORM_WIN32_NT */;
+}
+
+void *TclWinGetTclInstance()
+{
+ void *hInstance = NULL;
+ GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
+ (const char *)&winTCharEncoding, &hInstance);
+ return hInstance;
+}
+
+int
+TclWinSetSockOpt(SOCKET s, int level, int optname,
+ const char *optval, int optlen)
+{
+ return setsockopt((int) s, level, optname, optval, optlen);
+}
+
+int
+TclWinGetSockOpt(SOCKET s, int level, int optname,
+ char *optval, int *optlen)
+{
+ return getsockopt((int) s, level, optname, optval, optlen);
+}
+
+struct servent *
+TclWinGetServByName(const char *name, const char *proto)
+{
+ return getservbyname(name, proto);
+}
+
+char *
+TclWinNoBackslash(char *path)
+{
+ char *p;
+
+ for (p = path; *p != '\0'; p++) {
+ if (*p == '\\') {
+ *p = '/';
+ }
+ }
+ return path;
+}
+
+int
+TclpGetPid(Tcl_Pid pid)
+{
+ return (int) (size_t) pid;
+}
+
+static void
+doNothing(void)
+{
+ /* dummy implementation, no need to do anything */
+}
+
+char *
+Tcl_WinUtfToTChar(
+ const char *string,
+ int len,
+ Tcl_DString *dsPtr)
+{
+ if (!winTCharEncoding) {
+ winTCharEncoding = Tcl_GetEncoding(0, "unicode");
+ }
+ return Tcl_UtfToExternalDString(winTCharEncoding,
+ string, len, dsPtr);
+}
+
+char *
+Tcl_WinTCharToUtf(
+ const char *string,
+ int len,
+ Tcl_DString *dsPtr)
+{
+ if (!winTCharEncoding) {
+ winTCharEncoding = Tcl_GetEncoding(0, "unicode");
+ }
+ return Tcl_ExternalToUtfDString(winTCharEncoding,
+ string, len, dsPtr);
+}
+
+#else /* UNIX and MAC */
+# define TclpLocaltime_unix TclpLocaltime
+# define TclpGmtime_unix TclpGmtime
+#endif
/*
* WARNING: The contents of this file is automatically generated by the
@@ -134,7 +266,7 @@ static const TclIntStubs tclIntStubs = {
TclpGetClicks, /* 75 */
TclpGetSeconds, /* 76 */
TclpGetTime, /* 77 */
- TclpGetTimeZone, /* 78 */
+ 0, /* 78 */
0, /* 79 */
0, /* 80 */
0, /* 81 */
@@ -160,13 +292,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 */
@@ -312,7 +444,7 @@ static const TclIntStubs tclIntStubs = {
static const TclIntPlatStubs tclIntPlatStubs = {
TCL_STUB_MAGIC,
0,
-#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
+#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */
TclGetAndDetachPids, /* 0 */
TclpCloseFile, /* 1 */
TclpCreateCommandChannel, /* 2 */
@@ -328,32 +460,47 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclpGmtime_unix, /* 12 */
TclpInetNtoa, /* 13 */
TclUnixCopyFile, /* 14 */
+ 0, /* 15 */
+ 0, /* 16 */
+ 0, /* 17 */
+ 0, /* 18 */
+ 0, /* 19 */
+ TclUnixOpenTemporaryFile, /* 20 */
+ 0, /* 21 */
+ 0, /* 22 */
+ 0, /* 23 */
+ 0, /* 24 */
+ 0, /* 25 */
+ 0, /* 26 */
+ 0, /* 27 */
+ 0, /* 28 */
+ TclWinCPUID, /* 29 */
#endif /* UNIX */
-#ifdef __WIN32__ /* WIN */
+#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */
TclWinConvertError, /* 0 */
TclWinConvertWSAError, /* 1 */
TclWinGetServByName, /* 2 */
TclWinGetSockOpt, /* 3 */
TclWinGetTclInstance, /* 4 */
- 0, /* 5 */
+ TclUnixWaitForFile, /* 5 */
TclWinNToHS, /* 6 */
TclWinSetSockOpt, /* 7 */
TclpGetPid, /* 8 */
TclWinGetPlatformId, /* 9 */
- 0, /* 10 */
+ TclpReaddir, /* 10 */
TclGetAndDetachPids, /* 11 */
TclpCloseFile, /* 12 */
TclpCreateCommandChannel, /* 13 */
TclpCreatePipe, /* 14 */
TclpCreateProcess, /* 15 */
- 0, /* 16 */
- 0, /* 17 */
+ TclpIsAtty, /* 16 */
+ TclUnixCopyFile, /* 17 */
TclpMakeFile, /* 18 */
TclpOpenFile, /* 19 */
TclWinAddProcess, /* 20 */
- 0, /* 21 */
+ TclpInetNtoa, /* 21 */
TclpCreateTempFile, /* 22 */
- TclpGetTZName, /* 23 */
+ 0, /* 23 */
TclWinNoBackslash, /* 24 */
0, /* 25 */
TclWinSetInterfaces, /* 26 */
@@ -382,13 +529,23 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclMacOSXCopyFileAttributes, /* 17 */
TclMacOSXMatchType, /* 18 */
TclMacOSXNotifierAddRunLoopMode, /* 19 */
+ TclUnixOpenTemporaryFile, /* 20 */
+ 0, /* 21 */
+ 0, /* 22 */
+ 0, /* 23 */
+ 0, /* 24 */
+ 0, /* 25 */
+ 0, /* 26 */
+ 0, /* 27 */
+ 0, /* 28 */
+ TclWinCPUID, /* 29 */
#endif /* MACOSX */
};
static const TclPlatStubs tclPlatStubs = {
TCL_STUB_MAGIC,
0,
-#ifdef __WIN32__ /* WIN */
+#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */
Tcl_WinUtfToTChar, /* 0 */
Tcl_WinTCharToUtf, /* 1 */
#endif /* WIN */
@@ -488,7 +645,7 @@ const TclStubs tclStubs = {
#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
Tcl_CreateFileHandler, /* 9 */
#endif /* UNIX */
-#ifdef __WIN32__ /* WIN */
+#if defined(__WIN32__) /* WIN */
0, /* 9 */
#endif /* WIN */
#ifdef MAC_OSX_TCL /* MACOSX */
@@ -497,7 +654,7 @@ const TclStubs tclStubs = {
#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
Tcl_DeleteFileHandler, /* 10 */
#endif /* UNIX */
-#ifdef __WIN32__ /* WIN */
+#if defined(__WIN32__) /* WIN */
0, /* 10 */
#endif /* WIN */
#ifdef MAC_OSX_TCL /* MACOSX */
@@ -662,7 +819,7 @@ const TclStubs tclStubs = {
#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
Tcl_GetOpenFile, /* 167 */
#endif /* UNIX */
-#ifdef __WIN32__ /* WIN */
+#if defined(__WIN32__) /* WIN */
0, /* 167 */
#endif /* WIN */
#ifdef MAC_OSX_TCL /* MACOSX */
@@ -1130,6 +1287,7 @@ const TclStubs tclStubs = {
Tcl_LoadFile, /* 627 */
Tcl_FindSymbol, /* 628 */
Tcl_FSUnloadFile, /* 629 */
+ Tcl_ZlibStreamSetCompressionDictionary, /* 630 */
};
/* !END!: Do not edit above this line. */