summaryrefslogtreecommitdiffstats
path: root/generic/tclStubInit.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-05-31 08:31:58 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-05-31 08:31:58 (GMT)
commitc69794cc05d5ab01537ede052537fa25613c01c4 (patch)
tree2662cac0c4b4f7458c792fdfc1e8916f23f4d202 /generic/tclStubInit.c
parent3186e522afae18a8fe8e1513d4a9e27500486613 (diff)
parent161a43e685132ef00e715c16fe1cf9c6a33e0a6d (diff)
downloadtcl-c69794cc05d5ab01537ede052537fa25613c01c4.zip
tcl-c69794cc05d5ab01537ede052537fa25613c01c4.tar.gz
tcl-c69794cc05d5ab01537ede052537fa25613c01c4.tar.bz2
merge trunk
Diffstat (limited to 'generic/tclStubInit.c')
-rw-r--r--generic/tclStubInit.c191
1 files changed, 75 insertions, 116 deletions
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 9e5868a..1b671d4 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -53,26 +53,26 @@ static int TclSockMinimumBuffersOld(int sock, int size)
}
#endif
-#ifdef __CYGWIN__
-#define TclWinGetPlatformId winGetPlatformId
-#define Tcl_WinUtfToTChar winUtfToTChar
-#define Tcl_WinTCharToUtf winTCharToUtf
-#define TclWinGetTclInstance winGetTclInstance
-#define TclWinNToHS winNToHS
-#define TclWinSetSockOpt winSetSockOpt
-#define TclWinGetSockOpt winGetSockOpt
-#define TclWinGetServByName winGetServByName
-#define TclWinNoBackslash winNoBackslash
-#define TclWinSetInterfaces (void (*) (int)) doNothing
-#define TclWinAddProcess (void (*) (void *, unsigned int)) doNothing
-#define TclIntPlatReserved13 (void (*) ()) TclpCreateCommandChannel
-#define TclWinFlushDirtyChannels doNothing
-#define TclWinResetInterfaces doNothing
-#define TclpGetPid getPid
+#ifdef __WIN32__
+# define TclUnixWaitForFile 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,
@@ -80,7 +80,7 @@ TclWinGetPlatformId()
return 2; /* VER_PLATFORM_WIN32_NT */;
}
-static void *TclWinGetTclInstance()
+void *TclWinGetTclInstance()
{
void *hInstance = NULL;
GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
@@ -88,21 +88,21 @@ static void *TclWinGetTclInstance()
return hInstance;
}
-static unsigned short
+unsigned short
TclWinNToHS(unsigned short ns)
{
return ntohs(ns);
}
-static int
-TclWinSetSockOpt(void *s, int level, int optname,
+int
+TclWinSetSockOpt(SOCKET s, int level, int optname,
const char *optval, int optlen)
{
return setsockopt((int) s, level, optname, optval, optlen);
}
-static int
-TclWinGetSockOpt(void *s, int level, int optname,
+int
+TclWinGetSockOpt(SOCKET s, int level, int optname,
char *optval, int *optlen)
{
return getsockopt((int) s, level, optname, optval, optlen);
@@ -114,7 +114,7 @@ TclWinGetServByName(const char *name, const char *proto)
return getservbyname(name, proto);
}
-static char *
+char *
TclWinNoBackslash(char *path)
{
char *p;
@@ -127,7 +127,7 @@ TclWinNoBackslash(char *path)
return path;
}
-static int
+int
TclpGetPid(Tcl_Pid pid)
{
return (int) (size_t) pid;
@@ -139,11 +139,11 @@ doNothing(void)
/* dummy implementation, no need to do anything */
}
-static char *
-Tcl_WinUtfToTChar(string, len, dsPtr)
- const char *string;
- int len;
- Tcl_DString *dsPtr;
+char *
+Tcl_WinUtfToTChar(
+ const char *string,
+ int len,
+ Tcl_DString *dsPtr)
{
if (!winTCharEncoding) {
winTCharEncoding = Tcl_GetEncoding(0, "unicode");
@@ -152,7 +152,7 @@ Tcl_WinUtfToTChar(string, len, dsPtr)
string, len, dsPtr);
}
-static char *
+char *
Tcl_WinTCharToUtf(
const char *string,
int len,
@@ -173,30 +173,7 @@ Tcl_WinTCharToUtf(
#define TclpLocaltime_unix (struct tm *(*) (const time_t *)) TclGetAndDetachPids
#define TclpGmtime_unix (struct tm *(*) (const time_t *)) TclpCloseFile
-#elif !defined(__WIN32__) /* UNIX and MAC */
-# define TclWinConvertError (void (*) (unsigned int)) TclGetAndDetachPids
-# undef TclWinConvertWSAError
-# define TclWinConvertWSAError (void (*) (unsigned int)) TclpCloseFile
-# define TclWinGetPlatformId (int (*)()) TclpCreateTempFile
-# define TclWinGetTclInstance (void *(*)()) TclpCreateProcess
-# define TclWinNToHS (unsigned short (*) _ANSI_ARGS_((unsigned short ns))) TclpMakeFile
-# define TclWinSetSockOpt (int (*) (void *, int, int, const char *, int)) TclpOpenFile
-# define TclWinGetSockOpt (int (*) (void *, int, int, char *, int *)) TclpCreatePipe
-# define TclWinGetServByName (struct servent *(*) (const char *nm, const char *proto)) TclpCreateCommandChannel
-# define TclIntPlatReserved13 (void (*) ()) TclpInetNtoa
-# define TclWinAddProcess 0
-# define TclWinNoBackslash 0
-# define TclWinSetInterfaces 0
-# define TclWinFlushDirtyChannels 0
-# define TclWinResetInterfaces 0
-# define TclpGetPid 0
-# ifndef MAC_OSX_TCL
-# define TclMacOSXMatchType 0
-# define TclMacOSXNotifierAddRunLoopMode 0
-# define TclMacOSXGetFileAttribute 0
-# define Tcl_MacOSXOpenBundleResources 0
-# define Tcl_MacOSXOpenVersionedBundleResources 0
-# endif
+#else /* UNIX and MAC */
# define TclpLocaltime_unix TclpLocaltime
# define TclpGmtime_unix TclpGmtime
#endif
@@ -471,70 +448,61 @@ static const TclIntStubs tclIntStubs = {
static const TclIntPlatStubs tclIntPlatStubs = {
TCL_STUB_MAGIC,
0,
-#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
- TclWinConvertError, /* 0 */
- TclWinConvertWSAError, /* 1 */
- TclWinGetServByName, /* 2 */
- TclWinGetSockOpt, /* 3 */
- TclWinGetTclInstance, /* 4 */
+#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */
+ TclGetAndDetachPids, /* 0 */
+ TclpCloseFile, /* 1 */
+ TclpCreateCommandChannel, /* 2 */
+ TclpCreatePipe, /* 3 */
+ TclpCreateProcess, /* 4 */
0, /* 5 */
- TclWinNToHS, /* 6 */
- TclWinSetSockOpt, /* 7 */
- TclpGetPid, /* 8 */
- TclWinGetPlatformId, /* 9 */
+ TclpMakeFile, /* 6 */
+ TclpOpenFile, /* 7 */
+ TclUnixWaitForFile, /* 8 */
+ TclpCreateTempFile, /* 9 */
TclpReaddir, /* 10 */
TclpLocaltime_unix, /* 11 */
TclpGmtime_unix, /* 12 */
- TclIntPlatReserved13, /* 13 */
+ TclpInetNtoa, /* 13 */
TclUnixCopyFile, /* 14 */
- TclMacOSXGetFileAttribute, /* 15 */
+ 0, /* 15 */
0, /* 16 */
0, /* 17 */
- TclMacOSXMatchType, /* 18 */
- TclMacOSXNotifierAddRunLoopMode, /* 19 */
- TclWinAddProcess, /* 20 */
+ 0, /* 18 */
+ 0, /* 19 */
+ 0, /* 20 */
0, /* 21 */
- TclpCreateTempFile, /* 22 */
+ 0, /* 22 */
0, /* 23 */
- TclWinNoBackslash, /* 24 */
+ 0, /* 24 */
0, /* 25 */
- TclWinSetInterfaces, /* 26 */
- TclWinFlushDirtyChannels, /* 27 */
- TclWinResetInterfaces, /* 28 */
+ 0, /* 26 */
+ 0, /* 27 */
+ 0, /* 28 */
TclWinCPUID, /* 29 */
- TclGetAndDetachPids, /* 30 */
- TclpCloseFile, /* 31 */
- TclpCreateCommandChannel, /* 32 */
- TclpCreatePipe, /* 33 */
- TclpCreateProcess, /* 34 */
- TclpInetNtoa, /* 35 */
- TclpMakeFile, /* 36 */
- TclpOpenFile, /* 37 */
- TclUnixWaitForFile, /* 38 */
#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 */
+ TclpIsAtty, /* 16 */
0, /* 17 */
TclpMakeFile, /* 18 */
TclpOpenFile, /* 19 */
TclWinAddProcess, /* 20 */
- 0, /* 21 */
+ TclpInetNtoa, /* 21 */
TclpCreateTempFile, /* 22 */
0, /* 23 */
TclWinNoBackslash, /* 24 */
@@ -545,45 +513,36 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclWinCPUID, /* 29 */
#endif /* WIN */
#ifdef MAC_OSX_TCL /* MACOSX */
- TclWinConvertError, /* 0 */
- TclWinConvertWSAError, /* 1 */
- TclWinGetServByName, /* 2 */
- TclWinGetSockOpt, /* 3 */
- TclWinGetTclInstance, /* 4 */
+ TclGetAndDetachPids, /* 0 */
+ TclpCloseFile, /* 1 */
+ TclpCreateCommandChannel, /* 2 */
+ TclpCreatePipe, /* 3 */
+ TclpCreateProcess, /* 4 */
0, /* 5 */
- TclWinNToHS, /* 6 */
- TclWinSetSockOpt, /* 7 */
- TclpGetPid, /* 8 */
- TclWinGetPlatformId, /* 9 */
+ TclpMakeFile, /* 6 */
+ TclpOpenFile, /* 7 */
+ TclUnixWaitForFile, /* 8 */
+ TclpCreateTempFile, /* 9 */
TclpReaddir, /* 10 */
TclpLocaltime_unix, /* 11 */
TclpGmtime_unix, /* 12 */
- TclIntPlatReserved13, /* 13 */
+ TclpInetNtoa, /* 13 */
TclUnixCopyFile, /* 14 */
TclMacOSXGetFileAttribute, /* 15 */
TclMacOSXSetFileAttribute, /* 16 */
TclMacOSXCopyFileAttributes, /* 17 */
TclMacOSXMatchType, /* 18 */
TclMacOSXNotifierAddRunLoopMode, /* 19 */
- TclWinAddProcess, /* 20 */
+ 0, /* 20 */
0, /* 21 */
- TclpCreateTempFile, /* 22 */
+ 0, /* 22 */
0, /* 23 */
- TclWinNoBackslash, /* 24 */
+ 0, /* 24 */
0, /* 25 */
- TclWinSetInterfaces, /* 26 */
- TclWinFlushDirtyChannels, /* 27 */
- TclWinResetInterfaces, /* 28 */
+ 0, /* 26 */
+ 0, /* 27 */
+ 0, /* 28 */
TclWinCPUID, /* 29 */
- TclGetAndDetachPids, /* 30 */
- TclpCloseFile, /* 31 */
- TclpCreateCommandChannel, /* 32 */
- TclpCreatePipe, /* 33 */
- TclpCreateProcess, /* 34 */
- TclpInetNtoa, /* 35 */
- TclpMakeFile, /* 36 */
- TclpOpenFile, /* 37 */
- TclUnixWaitForFile, /* 38 */
#endif /* MACOSX */
};
@@ -690,7 +649,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 */
@@ -699,7 +658,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 */
@@ -864,7 +823,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 */