diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-03-20 11:59:26 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-03-20 11:59:26 (GMT) |
commit | d0b8e4f72b7ad744867e47ea0f8692bfe8a7380e (patch) | |
tree | 4b361f848f41cccfec18563f8715ea3db04fe6da /generic | |
parent | 26c21e5829f4d4f719de1c6820fef46981a5c97e (diff) | |
parent | 4c9088a0ebb91cda9c88ecf4d02f38c35f1ab962 (diff) | |
download | tcl-d0b8e4f72b7ad744867e47ea0f8692bfe8a7380e.zip tcl-d0b8e4f72b7ad744867e47ea0f8692bfe8a7380e.tar.gz tcl-d0b8e4f72b7ad744867e47ea0f8692bfe8a7380e.tar.bz2 |
[Bug 3508771] load tclreg.dll in cygwin tclsh
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tcl.decls | 4 | ||||
-rw-r--r-- | generic/tclInt.decls | 10 | ||||
-rw-r--r-- | generic/tclIntPlatDecls.h | 105 | ||||
-rw-r--r-- | generic/tclPlatDecls.h | 22 | ||||
-rw-r--r-- | generic/tclStubInit.c | 88 |
5 files changed, 216 insertions, 13 deletions
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 */ |