summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-03-20 11:59:26 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-03-20 11:59:26 (GMT)
commitcc0dacf5bd3ad288d41dd1d53e2e31c651c4ad53 (patch)
tree4b361f848f41cccfec18563f8715ea3db04fe6da
parent3a328819334df817532b410dffcf00fab3840851 (diff)
parentbe655860e9e94d14a354128098bfd22c7f9d7412 (diff)
downloadtcl-cc0dacf5bd3ad288d41dd1d53e2e31c651c4ad53.zip
tcl-cc0dacf5bd3ad288d41dd1d53e2e31c651c4ad53.tar.gz
tcl-cc0dacf5bd3ad288d41dd1d53e2e31c651c4ad53.tar.bz2
[Bug 3508771] load tclreg.dll in cygwin tclsh
-rw-r--r--ChangeLog9
-rw-r--r--generic/tcl.decls4
-rw-r--r--generic/tclInt.decls10
-rw-r--r--generic/tclIntPlatDecls.h105
-rw-r--r--generic/tclPlatDecls.h22
-rw-r--r--generic/tclStubInit.c88
-rw-r--r--unix/tclUnixCompat.c37
7 files changed, 262 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 2b7ea56..fb79e57 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-03-20 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tcl.decls: [Bug 3508771] load tclreg.dll in cygwin tclsh
+ * generic/tclInt.decls: Implement TclWinGetPlatformId, Tcl_WinUtfToTChar,
+ * generic/tclIntPlatDecls.h: Tcl_WinTCharToUtf (and a dummy TclWinCPUID) for
+ * generic/tclPlatDecls.h: Cygwin, so win32 extensions using those can be
+ * generic/tclStubInit.c: loaded in the cygwin version of tclsh.
+ * unix/tclUnixCompat.c:
+
2012-03-19 Venkat Iyer <venkat@comit.com>
* library/tzdata/America/Atikokan: Update to tzdata2012b.
diff --git a/generic/tcl.decls b/generic/tcl.decls
index 30a2aca..7e5bbbb 100644
--- a/generic/tcl.decls
+++ b/generic/tcl.decls
@@ -2346,12 +2346,12 @@ declare 1 win {
################################
# Mac OS X specific functions
-declare 0 macosx {
+declare 0 {unix macosx} {
int Tcl_MacOSXOpenBundleResources(Tcl_Interp *interp,
const char *bundleName, int hasResourceFile,
int maxPathLen, char *libraryPath)
}
-declare 1 macosx {
+declare 1 {unix macosx} {
int Tcl_MacOSXOpenVersionedBundleResources(Tcl_Interp *interp,
const char *bundleName, const char *bundleVersion,
int hasResourceFile, int maxPathLen, char *libraryPath)
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index df60dae..cf88fd3 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -1168,8 +1168,9 @@ declare 8 unix {
# Added in 8.1:
+# On non-cygwin, this is actually a reference to TclpCreateTempFile
declare 9 unix {
- TclFile TclpCreateTempFile(const char *contents)
+ int TclWinGetPlatformId(void)
}
# Added in 8.4:
@@ -1196,6 +1197,13 @@ declare 14 unix {
const Tcl_StatBuf *statBufPtr, int dontCopyAtts)
}
+declare 22 unix {
+ TclFile TclpCreateTempFile(const char *contents)
+}
+declare 29 unix {
+ int TclWinCPUID(unsigned int index, unsigned int *regs)
+}
+
################################
# Mac OS X specific functions
diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h
index 0f1c0d1..8350781 100644
--- a/generic/tclIntPlatDecls.h
+++ b/generic/tclIntPlatDecls.h
@@ -61,7 +61,7 @@ EXTERN TclFile TclpOpenFile(const char *fname, int mode);
/* 8 */
EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout);
/* 9 */
-EXTERN TclFile TclpCreateTempFile(const char *contents);
+EXTERN int TclWinGetPlatformId(void);
/* 10 */
EXTERN Tcl_DirEntry * TclpReaddir(DIR *dir);
/* 11 */
@@ -74,6 +74,23 @@ EXTERN char * TclpInetNtoa(struct in_addr addr);
EXTERN int TclUnixCopyFile(const char *src, const char *dst,
const Tcl_StatBuf *statBufPtr,
int dontCopyAtts);
+/* Slot 15 is reserved */
+/* Slot 16 is reserved */
+/* Slot 17 is reserved */
+/* Slot 18 is reserved */
+/* Slot 19 is reserved */
+/* Slot 20 is reserved */
+/* Slot 21 is reserved */
+/* 22 */
+EXTERN TclFile TclpCreateTempFile(const char *contents);
+/* Slot 23 is reserved */
+/* Slot 24 is reserved */
+/* Slot 25 is reserved */
+/* Slot 26 is reserved */
+/* Slot 27 is reserved */
+/* Slot 28 is reserved */
+/* 29 */
+EXTERN int TclWinCPUID(unsigned int index, unsigned int *regs);
#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
/* 0 */
@@ -165,7 +182,7 @@ EXTERN TclFile TclpOpenFile(const char *fname, int mode);
/* 8 */
EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout);
/* 9 */
-EXTERN TclFile TclpCreateTempFile(const char *contents);
+EXTERN int TclWinGetPlatformId(void);
/* 10 */
EXTERN Tcl_DirEntry * TclpReaddir(DIR *dir);
/* 11 */
@@ -198,6 +215,18 @@ EXTERN int TclMacOSXMatchType(Tcl_Interp *interp,
/* 19 */
EXTERN void TclMacOSXNotifierAddRunLoopMode(
const void *runLoopMode);
+/* Slot 20 is reserved */
+/* Slot 21 is reserved */
+/* 22 */
+EXTERN TclFile TclpCreateTempFile(const char *contents);
+/* Slot 23 is reserved */
+/* Slot 24 is reserved */
+/* Slot 25 is reserved */
+/* Slot 26 is reserved */
+/* Slot 27 is reserved */
+/* Slot 28 is reserved */
+/* 29 */
+EXTERN int TclWinCPUID(unsigned int index, unsigned int *regs);
#endif /* MACOSX */
typedef struct TclIntPlatStubs {
@@ -214,12 +243,27 @@ typedef struct TclIntPlatStubs {
TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 6 */
TclFile (*tclpOpenFile) (const char *fname, int mode); /* 7 */
int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */
- TclFile (*tclpCreateTempFile) (const char *contents); /* 9 */
+ int (*tclWinGetPlatformId) (void); /* 9 */
Tcl_DirEntry * (*tclpReaddir) (DIR *dir); /* 10 */
struct tm * (*tclpLocaltime_unix) (const time_t *clock); /* 11 */
struct tm * (*tclpGmtime_unix) (const time_t *clock); /* 12 */
char * (*tclpInetNtoa) (struct in_addr addr); /* 13 */
int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 14 */
+ void (*reserved15)(void);
+ void (*reserved16)(void);
+ void (*reserved17)(void);
+ void (*reserved18)(void);
+ void (*reserved19)(void);
+ void (*reserved20)(void);
+ void (*reserved21)(void);
+ TclFile (*tclpCreateTempFile) (const char *contents); /* 22 */
+ void (*reserved23)(void);
+ void (*reserved24)(void);
+ void (*reserved25)(void);
+ void (*reserved26)(void);
+ void (*reserved27)(void);
+ void (*reserved28)(void);
+ int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */
#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
void (*tclWinConvertError) (unsigned long errCode); /* 0 */
@@ -263,7 +307,7 @@ typedef struct TclIntPlatStubs {
TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 6 */
TclFile (*tclpOpenFile) (const char *fname, int mode); /* 7 */
int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */
- TclFile (*tclpCreateTempFile) (const char *contents); /* 9 */
+ int (*tclWinGetPlatformId) (void); /* 9 */
Tcl_DirEntry * (*tclpReaddir) (DIR *dir); /* 10 */
struct tm * (*tclpLocaltime_unix) (const time_t *clock); /* 11 */
struct tm * (*tclpGmtime_unix) (const time_t *clock); /* 12 */
@@ -274,6 +318,16 @@ typedef struct TclIntPlatStubs {
int (*tclMacOSXCopyFileAttributes) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr); /* 17 */
int (*tclMacOSXMatchType) (Tcl_Interp *interp, const char *pathName, const char *fileName, Tcl_StatBuf *statBufPtr, Tcl_GlobTypeData *types); /* 18 */
void (*tclMacOSXNotifierAddRunLoopMode) (const void *runLoopMode); /* 19 */
+ void (*reserved20)(void);
+ void (*reserved21)(void);
+ TclFile (*tclpCreateTempFile) (const char *contents); /* 22 */
+ void (*reserved23)(void);
+ void (*reserved24)(void);
+ void (*reserved25)(void);
+ void (*reserved26)(void);
+ void (*reserved27)(void);
+ void (*reserved28)(void);
+ int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */
#endif /* MACOSX */
} TclIntPlatStubs;
@@ -309,8 +363,8 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclpOpenFile) /* 7 */
#define TclUnixWaitForFile \
(tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */
-#define TclpCreateTempFile \
- (tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */
+#define TclWinGetPlatformId \
+ (tclIntPlatStubsPtr->tclWinGetPlatformId) /* 9 */
#define TclpReaddir \
(tclIntPlatStubsPtr->tclpReaddir) /* 10 */
#define TclpLocaltime_unix \
@@ -321,6 +375,23 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */
#define TclUnixCopyFile \
(tclIntPlatStubsPtr->tclUnixCopyFile) /* 14 */
+/* Slot 15 is reserved */
+/* Slot 16 is reserved */
+/* Slot 17 is reserved */
+/* Slot 18 is reserved */
+/* Slot 19 is reserved */
+/* Slot 20 is reserved */
+/* Slot 21 is reserved */
+#define TclpCreateTempFile \
+ (tclIntPlatStubsPtr->tclpCreateTempFile) /* 22 */
+/* Slot 23 is reserved */
+/* Slot 24 is reserved */
+/* Slot 25 is reserved */
+/* Slot 26 is reserved */
+/* Slot 27 is reserved */
+/* Slot 28 is reserved */
+#define TclWinCPUID \
+ (tclIntPlatStubsPtr->tclWinCPUID) /* 29 */
#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
#define TclWinConvertError \
@@ -396,8 +467,8 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclpOpenFile) /* 7 */
#define TclUnixWaitForFile \
(tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */
-#define TclpCreateTempFile \
- (tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */
+#define TclWinGetPlatformId \
+ (tclIntPlatStubsPtr->tclWinGetPlatformId) /* 9 */
#define TclpReaddir \
(tclIntPlatStubsPtr->tclpReaddir) /* 10 */
#define TclpLocaltime_unix \
@@ -418,6 +489,18 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclMacOSXMatchType) /* 18 */
#define TclMacOSXNotifierAddRunLoopMode \
(tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) /* 19 */
+/* Slot 20 is reserved */
+/* Slot 21 is reserved */
+#define TclpCreateTempFile \
+ (tclIntPlatStubsPtr->tclpCreateTempFile) /* 22 */
+/* Slot 23 is reserved */
+/* Slot 24 is reserved */
+/* Slot 25 is reserved */
+/* Slot 26 is reserved */
+/* Slot 27 is reserved */
+/* Slot 28 is reserved */
+#define TclWinCPUID \
+ (tclIntPlatStubsPtr->tclWinCPUID) /* 29 */
#endif /* MACOSX */
#endif /* defined(USE_TCL_STUBS) */
@@ -429,4 +512,10 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
#undef TclpLocaltime_unix
#undef TclpGmtime_unix
+#if !defined(__WIN32__) && !defined(__CYGWIN__) && defined(USE_TCL_STUBS)
+#undef TclpCreateTempFile
+#define TclpCreateTempFile \
+ ((TclFile (*)_ANSI_ARGS_((CONST char *))) tclIntPlatStubsPtr->tclWinGetPlatformId)
+#endif
+
#endif /* _TCLINTPLATDECLS */
diff --git a/generic/tclPlatDecls.h b/generic/tclPlatDecls.h
index 77678be..37f5479 100644
--- a/generic/tclPlatDecls.h
+++ b/generic/tclPlatDecls.h
@@ -46,6 +46,18 @@
* Exported function declarations:
*/
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
+/* 0 */
+EXTERN int Tcl_MacOSXOpenBundleResources(Tcl_Interp *interp,
+ const char *bundleName, int hasResourceFile,
+ int maxPathLen, char *libraryPath);
+/* 1 */
+EXTERN int Tcl_MacOSXOpenVersionedBundleResources(
+ Tcl_Interp *interp, const char *bundleName,
+ const char *bundleVersion,
+ int hasResourceFile, int maxPathLen,
+ char *libraryPath);
+#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
/* 0 */
EXTERN TCHAR * Tcl_WinUtfToTChar(const char *str, int len,
@@ -71,6 +83,10 @@ typedef struct TclPlatStubs {
int magic;
const struct TclPlatStubHooks *hooks;
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
+ int (*tcl_MacOSXOpenBundleResources) (Tcl_Interp *interp, const char *bundleName, int hasResourceFile, int maxPathLen, char *libraryPath); /* 0 */
+ int (*tcl_MacOSXOpenVersionedBundleResources) (Tcl_Interp *interp, const char *bundleName, const char *bundleVersion, int hasResourceFile, int maxPathLen, char *libraryPath); /* 1 */
+#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
TCHAR * (*tcl_WinUtfToTChar) (const char *str, int len, Tcl_DString *dsPtr); /* 0 */
char * (*tcl_WinTCharToUtf) (const TCHAR *str, int len, Tcl_DString *dsPtr); /* 1 */
@@ -95,6 +111,12 @@ extern const TclPlatStubs *tclPlatStubsPtr;
* Inline function declarations:
*/
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
+#define Tcl_MacOSXOpenBundleResources \
+ (tclPlatStubsPtr->tcl_MacOSXOpenBundleResources) /* 0 */
+#define Tcl_MacOSXOpenVersionedBundleResources \
+ (tclPlatStubsPtr->tcl_MacOSXOpenVersionedBundleResources) /* 1 */
+#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
#define Tcl_WinUtfToTChar \
(tclPlatStubsPtr->tcl_WinUtfToTChar) /* 0 */
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 5b47e95..eab51a8 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -42,6 +42,61 @@
#define TclpLocaltime_unix TclpLocaltime
#define TclpGmtime_unix TclpGmtime
+#ifdef __CYGWIN__
+
+#define TclWinGetPlatformId winGetPlatformId
+#define Tcl_WinUtfToTChar winUtfToTChar
+#define Tcl_WinTCharToUtf winTCharToUtf
+
+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 char *
+Tcl_WinUtfToTChar(string, len, dsPtr)
+ CONST char *string;
+ int len;
+ Tcl_DString *dsPtr;
+{
+ if (!winTCharEncoding) {
+ winTCharEncoding = Tcl_GetEncoding(NULL, "unicode");
+ }
+ return Tcl_UtfToExternalDString(winTCharEncoding,
+ string, len, dsPtr);
+}
+
+static char *
+Tcl_WinTCharToUtf(string, len, dsPtr)
+ CONST char *string;
+ int len;
+ Tcl_DString *dsPtr;
+{
+ if (!winTCharEncoding) {
+ winTCharEncoding = Tcl_GetEncoding(NULL, "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
+
+#elif !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
+# define TclWinGetPlatformId (int (*)()) TclpCreateTempFile
+# ifndef MAC_OSX_TCL
+# define Tcl_MacOSXOpenBundleResources 0
+# define Tcl_MacOSXOpenVersionedBundleResources 0
+# endif
+#endif
+
/*
* WARNING: The contents of this file is automatically generated by the
* tools/genStubs.tcl script. Any modifications to the function declarations
@@ -322,12 +377,27 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclpMakeFile, /* 6 */
TclpOpenFile, /* 7 */
TclUnixWaitForFile, /* 8 */
- TclpCreateTempFile, /* 9 */
+ TclWinGetPlatformId, /* 9 */
TclpReaddir, /* 10 */
TclpLocaltime_unix, /* 11 */
TclpGmtime_unix, /* 12 */
TclpInetNtoa, /* 13 */
TclUnixCopyFile, /* 14 */
+ 0, /* 15 */
+ 0, /* 16 */
+ 0, /* 17 */
+ 0, /* 18 */
+ 0, /* 19 */
+ 0, /* 20 */
+ 0, /* 21 */
+ TclpCreateTempFile, /* 22 */
+ 0, /* 23 */
+ 0, /* 24 */
+ 0, /* 25 */
+ 0, /* 26 */
+ 0, /* 27 */
+ 0, /* 28 */
+ TclWinCPUID, /* 29 */
#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
TclWinConvertError, /* 0 */
@@ -371,7 +441,7 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclpMakeFile, /* 6 */
TclpOpenFile, /* 7 */
TclUnixWaitForFile, /* 8 */
- TclpCreateTempFile, /* 9 */
+ TclWinGetPlatformId, /* 9 */
TclpReaddir, /* 10 */
TclpLocaltime_unix, /* 11 */
TclpGmtime_unix, /* 12 */
@@ -382,12 +452,26 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclMacOSXCopyFileAttributes, /* 17 */
TclMacOSXMatchType, /* 18 */
TclMacOSXNotifierAddRunLoopMode, /* 19 */
+ 0, /* 20 */
+ 0, /* 21 */
+ TclpCreateTempFile, /* 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,
+#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 */
diff --git a/unix/tclUnixCompat.c b/unix/tclUnixCompat.c
index 456a552..48ba4d3 100644
--- a/unix/tclUnixCompat.c
+++ b/unix/tclUnixCompat.c
@@ -964,3 +964,40 @@ CopyString(
* fill-column: 78
* End:
*/
+
+/*
+ *------------------------------------------------------------------------
+ *
+ * TclWinCPUID --
+ *
+ * Get CPU ID information on an Intel box under UNIX (either Linux or Cygwin)
+ *
+ * Results:
+ * Returns TCL_OK if successful, TCL_ERROR if CPUID is not supported or
+ * fails.
+ *
+ * Side effects:
+ * If successful, stores EAX, EBX, ECX and EDX registers after the CPUID
+ * instruction in the four integers designated by 'regsPtr'
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TclWinCPUID(
+ unsigned int index, /* Which CPUID value to retrieve. */
+ unsigned int *regsPtr) /* Registers after the CPUID. */
+{
+ int status = TCL_ERROR;
+
+ /* There is no reason this couldn't be implemented on UNIX as well */
+ return status;
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */