summaryrefslogtreecommitdiffstats
path: root/generic/tclStubInit.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-03-28 14:27:56 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-03-28 14:27:56 (GMT)
commitd9dc3c7c3c720547bce9b9260cb6200ebaed735a (patch)
treed2659e334f577bdec8f61c362091ad0205b8c021 /generic/tclStubInit.c
parent5c3fdea6d8c78852aab5bfa588ec6109c1af4b8e (diff)
parent1251bcbcc6272da5c31c077c03ce238cfde19844 (diff)
downloadtcl-d9dc3c7c3c720547bce9b9260cb6200ebaed735a.zip
tcl-d9dc3c7c3c720547bce9b9260cb6200ebaed735a.tar.gz
tcl-d9dc3c7c3c720547bce9b9260cb6200ebaed735a.tar.bz2
merge trunk
Diffstat (limited to 'generic/tclStubInit.c')
-rw-r--r--generic/tclStubInit.c199
1 files changed, 185 insertions, 14 deletions
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 5b47e95..32e9557 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -39,8 +39,146 @@
#undef Tcl_CreateHashEntry
#undef Tcl_Panic
#undef Tcl_FindExecutable
-#define TclpLocaltime_unix TclpLocaltime
-#define TclpGmtime_unix TclpGmtime
+
+#ifdef __CYGWIN__
+
+#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 TclWinFlushDirtyChannels doNothing
+#define TclWinResetInterfaces doNothing
+
+static Tcl_Encoding winTCharEncoding;
+
+static 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 */;
+}
+
+static int TclWinGetTclInstance()
+{
+ Tcl_Panic("TclWinGetTclInstance not yet implemented for CYGWIN");
+ return 0;
+}
+
+static unsigned short
+TclWinNToHS(unsigned short ns)
+{
+ Tcl_Panic("TclWinNToHS not yet implemented for CYGWIN");
+ return (unsigned short) -1;
+}
+static int
+TclWinSetSockOpt(int 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;
+}
+
+static char *
+TclWinNoBackslash(char *path)
+{
+ char *p;
+
+ for (p = path; *p != '\0'; p++) {
+ if (*p == '\\') {
+ *p = '/';
+ }
+ }
+ return path;
+}
+
+static void
+doNothing(void)
+{
+ /* dummy implementation, no need to do anything */
+}
+
+static char *
+Tcl_WinUtfToTChar(string, len, dsPtr)
+ CONST char *string;
+ int len;
+ Tcl_DString *dsPtr;
+{
+ if (!winTCharEncoding) {
+ winTCharEncoding = Tcl_GetEncoding(0, "unicode");
+ }
+ return Tcl_UtfToExternalDString(winTCharEncoding,
+ string, len, dsPtr);
+}
+
+static 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);
+}
+
+#define Tcl_MacOSXOpenBundleResources (int (*) _ANSI_ARGS_(( \
+ Tcl_Interp *, CONST char *, int, int, char *))) Tcl_WinUtfToTChar
+#define Tcl_MacOSXOpenVersionedBundleResources (int (*) _ANSI_ARGS_(( \
+ Tcl_Interp *, CONST char *, CONST char *, int, int, char *))) Tcl_WinTCharToUtf
+#define TclMacOSXGetFileAttribute (int (*) _ANSI_ARGS_((Tcl_Interp *, \
+ int, Tcl_Obj *, Tcl_Obj **))) TclpCreateProcess
+#define TclMacOSXMatchType (int (*) _ANSI_ARGS_((Tcl_Interp *, CONST char *, \
+ CONST char *, Tcl_StatBuf *, Tcl_GlobTypeData *))) TclpMakeFile
+#define TclMacOSXNotifierAddRunLoopMode (void (*) _ANSI_ARGS_((CONST void *))) TclpOpenFile
+#define TclpLocaltime_unix (struct tm *(*) _ANSI_ARGS_((CONST time_t *))) TclGetAndDetachPids
+#define TclpGmtime_unix (struct tm *(*) _ANSI_ARGS_((CONST time_t *))) TclpCloseFile
+
+#elif !defined(__WIN32__) /* UNIX and MAC */
+# define TclWinConvertError (void (*) _ANSI_ARGS_((unsigned int))) TclGetAndDetachPids
+# define TclWinConvertWSAError (void (*) _ANSI_ARGS_((unsigned int))) TclpCloseFile
+# define TclWinGetPlatformId (int (*)()) TclpCreateTempFile
+# define TclWinGetTclInstance (int (*)()) TclpCreateProcess
+# define TclWinNToHS (unsigned short (*) _ANSI_ARGS_((unsigned short ns))) TclpMakeFile
+# define TclWinSetSockOpt (int (*) _ANSI_ARGS_((int, int, int, const char *, int))) TclpOpenFile
+# define TclWinAddProcess 0
+# define TclpGetTZName 0
+# define TclWinNoBackslash 0
+# define TclWinSetInterfaces 0
+# define TclWinFlushDirtyChannels 0
+# define TclWinResetInterfaces 0
+# define TclMacOSXGetFileAttribute 0 /* Only implemented in Tcl >= 8.5 */
+# define TclMacOSXMatchType 0 /* Only implemented in Tcl >= 8.5 */
+# define TclMacOSXNotifierAddRunLoopMode 0 /* Only implemented in Tcl >= 8.5 */
+# ifndef MAC_OSX_TCL
+# define Tcl_MacOSXOpenBundleResources 0
+# define Tcl_MacOSXOpenVersionedBundleResources 0
+# endif
+# define TclpLocaltime_unix TclpLocaltime
+# define TclpGmtime_unix TclpGmtime
+#endif
/*
* WARNING: The contents of this file is automatically generated by the
@@ -313,21 +451,38 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TCL_STUB_MAGIC,
0,
#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
- TclGetAndDetachPids, /* 0 */
- TclpCloseFile, /* 1 */
+ TclWinConvertError, /* 0 */
+ TclWinConvertWSAError, /* 1 */
TclpCreateCommandChannel, /* 2 */
TclpCreatePipe, /* 3 */
- TclpCreateProcess, /* 4 */
+ TclWinGetTclInstance, /* 4 */
0, /* 5 */
- TclpMakeFile, /* 6 */
- TclpOpenFile, /* 7 */
+ TclWinNToHS, /* 6 */
+ TclWinSetSockOpt, /* 7 */
TclUnixWaitForFile, /* 8 */
- TclpCreateTempFile, /* 9 */
+ TclWinGetPlatformId, /* 9 */
TclpReaddir, /* 10 */
TclpLocaltime_unix, /* 11 */
TclpGmtime_unix, /* 12 */
TclpInetNtoa, /* 13 */
TclUnixCopyFile, /* 14 */
+ TclMacOSXGetFileAttribute, /* 15 */
+ 0, /* 16 */
+ 0, /* 17 */
+ TclMacOSXMatchType, /* 18 */
+ TclMacOSXNotifierAddRunLoopMode, /* 19 */
+ TclWinAddProcess, /* 20 */
+ 0, /* 21 */
+ TclpCreateTempFile, /* 22 */
+ TclpGetTZName, /* 23 */
+ TclWinNoBackslash, /* 24 */
+ 0, /* 25 */
+ TclWinSetInterfaces, /* 26 */
+ TclWinFlushDirtyChannels, /* 27 */
+ TclWinResetInterfaces, /* 28 */
+ TclWinCPUID, /* 29 */
+ TclGetAndDetachPids, /* 30 */
+ TclpCloseFile, /* 31 */
#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
TclWinConvertError, /* 0 */
@@ -362,16 +517,16 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclWinCPUID, /* 29 */
#endif /* WIN */
#ifdef MAC_OSX_TCL /* MACOSX */
- TclGetAndDetachPids, /* 0 */
- TclpCloseFile, /* 1 */
+ TclWinConvertError, /* 0 */
+ TclWinConvertWSAError, /* 1 */
TclpCreateCommandChannel, /* 2 */
TclpCreatePipe, /* 3 */
- TclpCreateProcess, /* 4 */
+ TclWinGetTclInstance, /* 4 */
0, /* 5 */
- TclpMakeFile, /* 6 */
- TclpOpenFile, /* 7 */
+ TclWinNToHS, /* 6 */
+ TclWinSetSockOpt, /* 7 */
TclUnixWaitForFile, /* 8 */
- TclpCreateTempFile, /* 9 */
+ TclWinGetPlatformId, /* 9 */
TclpReaddir, /* 10 */
TclpLocaltime_unix, /* 11 */
TclpGmtime_unix, /* 12 */
@@ -382,12 +537,28 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclMacOSXCopyFileAttributes, /* 17 */
TclMacOSXMatchType, /* 18 */
TclMacOSXNotifierAddRunLoopMode, /* 19 */
+ TclWinAddProcess, /* 20 */
+ 0, /* 21 */
+ TclpCreateTempFile, /* 22 */
+ TclpGetTZName, /* 23 */
+ TclWinNoBackslash, /* 24 */
+ 0, /* 25 */
+ TclWinSetInterfaces, /* 26 */
+ TclWinFlushDirtyChannels, /* 27 */
+ TclWinResetInterfaces, /* 28 */
+ TclWinCPUID, /* 29 */
+ TclGetAndDetachPids, /* 30 */
+ TclpCloseFile, /* 31 */
#endif /* MACOSX */
};
static const TclPlatStubs tclPlatStubs = {
TCL_STUB_MAGIC,
0,
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
+ Tcl_MacOSXOpenBundleResources, /* 0 */
+ Tcl_MacOSXOpenVersionedBundleResources, /* 1 */
+#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
Tcl_WinUtfToTChar, /* 0 */
Tcl_WinTCharToUtf, /* 1 */