diff options
-rw-r--r-- | generic/tcl.decls | 4 | ||||
-rw-r--r-- | generic/tclInt.decls | 3 | ||||
-rw-r--r-- | generic/tclIntPlatDecls.h | 32 | ||||
-rw-r--r-- | generic/tclPlatDecls.h | 54 | ||||
-rw-r--r-- | generic/tclStubInit.c | 61 |
5 files changed, 120 insertions, 34 deletions
diff --git a/generic/tcl.decls b/generic/tcl.decls index 4ebaea5..a2fb082 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -1862,14 +1862,14 @@ declare 8 mac { # Mac OS X declarations # -declare 0 macosx { +declare 0 unix { int Tcl_MacOSXOpenBundleResources(Tcl_Interp *interp, CONST char *bundleName, int hasResourceFile, int maxPathLen, char *libraryPath) } -declare 1 macosx { +declare 1 unix { int Tcl_MacOSXOpenVersionedBundleResources(Tcl_Interp *interp, CONST char *bundleName, CONST char *bundleVersion, diff --git a/generic/tclInt.decls b/generic/tclInt.decls index e3d3a08..269cd81 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -1011,4 +1011,7 @@ declare 13 unix { declare 22 unix { TclFile TclpCreateTempFile(CONST char *contents) } +declare 29 unix { + int TclWinCPUID(unsigned int index, unsigned int *regs) +} diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index a3898ab..ec474d4 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -76,6 +76,15 @@ EXTERN char * TclpInetNtoa _ANSI_ARGS_((struct in_addr addr)); /* 22 */ EXTERN TclFile TclpCreateTempFile _ANSI_ARGS_(( 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 _ANSI_ARGS_((unsigned int index, + unsigned int * regs)); #endif /* UNIX */ #ifdef __WIN32__ /* 0 */ @@ -253,6 +262,13 @@ typedef struct TclIntPlatStubs { void *reserved20; void *reserved21; TclFile (*tclpCreateTempFile) _ANSI_ARGS_((CONST char * contents)); /* 22 */ + void *reserved23; + void *reserved24; + void *reserved25; + void *reserved26; + void *reserved27; + void *reserved28; + int (*tclWinCPUID) _ANSI_ARGS_((unsigned int index, unsigned int * regs)); /* 29 */ #endif /* UNIX */ #ifdef __WIN32__ void (*tclWinConvertError) _ANSI_ARGS_((DWORD errCode)); /* 0 */ @@ -397,6 +413,16 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclpCreateTempFile \ (tclIntPlatStubsPtr->tclpCreateTempFile) /* 22 */ #endif +/* Slot 23 is reserved */ +/* Slot 24 is reserved */ +/* Slot 25 is reserved */ +/* Slot 26 is reserved */ +/* Slot 27 is reserved */ +/* Slot 28 is reserved */ +#ifndef TclWinCPUID +#define TclWinCPUID \ + (tclIntPlatStubsPtr->tclWinCPUID) /* 29 */ +#endif #endif /* UNIX */ #ifdef __WIN32__ #ifndef TclWinConvertError @@ -623,4 +649,10 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #undef TclpLocaltime_unix #undef TclpGmtime_unix +#if !defined(__WIN32__) && !defined(MAC_TCL) && !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 c6fad72..0760250 100644 --- a/generic/tclPlatDecls.h +++ b/generic/tclPlatDecls.h @@ -34,6 +34,19 @@ * Exported function declarations: */ +#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ +/* 0 */ +EXTERN int Tcl_MacOSXOpenBundleResources _ANSI_ARGS_(( + Tcl_Interp * interp, CONST char * bundleName, + int hasResourceFile, int maxPathLen, + char * libraryPath)); +/* 1 */ +EXTERN int Tcl_MacOSXOpenVersionedBundleResources _ANSI_ARGS_(( + Tcl_Interp * interp, CONST char * bundleName, + CONST char * bundleVersion, + int hasResourceFile, int maxPathLen, + char * libraryPath)); +#endif /* UNIX */ #ifdef __WIN32__ /* 0 */ EXTERN TCHAR * Tcl_WinUtfToTChar _ANSI_ARGS_((CONST char * str, @@ -74,24 +87,15 @@ EXTERN int strncasecmp _ANSI_ARGS_((CONST char * s1, EXTERN int strcasecmp _ANSI_ARGS_((CONST char * s1, CONST char * s2)); #endif /* MAC_TCL */ -#ifdef MAC_OSX_TCL -/* 0 */ -EXTERN int Tcl_MacOSXOpenBundleResources _ANSI_ARGS_(( - Tcl_Interp * interp, CONST char * bundleName, - int hasResourceFile, int maxPathLen, - char * libraryPath)); -/* 1 */ -EXTERN int Tcl_MacOSXOpenVersionedBundleResources _ANSI_ARGS_(( - Tcl_Interp * interp, CONST char * bundleName, - CONST char * bundleVersion, - int hasResourceFile, int maxPathLen, - char * libraryPath)); -#endif /* MAC_OSX_TCL */ typedef struct TclPlatStubs { int magic; struct TclPlatStubHooks *hooks; +#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ + int (*tcl_MacOSXOpenBundleResources) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * bundleName, int hasResourceFile, int maxPathLen, char * libraryPath)); /* 0 */ + int (*tcl_MacOSXOpenVersionedBundleResources) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * bundleName, CONST char * bundleVersion, int hasResourceFile, int maxPathLen, char * libraryPath)); /* 1 */ +#endif /* UNIX */ #ifdef __WIN32__ TCHAR * (*tcl_WinUtfToTChar) _ANSI_ARGS_((CONST char * str, int len, Tcl_DString * dsPtr)); /* 0 */ char * (*tcl_WinTCharToUtf) _ANSI_ARGS_((CONST TCHAR * str, int len, Tcl_DString * dsPtr)); /* 1 */ @@ -107,10 +111,6 @@ typedef struct TclPlatStubs { int (*strncasecmp) _ANSI_ARGS_((CONST char * s1, CONST char * s2, size_t n)); /* 7 */ int (*strcasecmp) _ANSI_ARGS_((CONST char * s1, CONST char * s2)); /* 8 */ #endif /* MAC_TCL */ -#ifdef MAC_OSX_TCL - int (*tcl_MacOSXOpenBundleResources) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * bundleName, int hasResourceFile, int maxPathLen, char * libraryPath)); /* 0 */ - int (*tcl_MacOSXOpenVersionedBundleResources) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * bundleName, CONST char * bundleVersion, int hasResourceFile, int maxPathLen, char * libraryPath)); /* 1 */ -#endif /* MAC_OSX_TCL */ } TclPlatStubs; #ifdef __cplusplus @@ -127,6 +127,16 @@ extern TclPlatStubs *tclPlatStubsPtr; * Inline function declarations: */ +#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ +#ifndef Tcl_MacOSXOpenBundleResources +#define Tcl_MacOSXOpenBundleResources \ + (tclPlatStubsPtr->tcl_MacOSXOpenBundleResources) /* 0 */ +#endif +#ifndef Tcl_MacOSXOpenVersionedBundleResources +#define Tcl_MacOSXOpenVersionedBundleResources \ + (tclPlatStubsPtr->tcl_MacOSXOpenVersionedBundleResources) /* 1 */ +#endif +#endif /* UNIX */ #ifdef __WIN32__ #ifndef Tcl_WinUtfToTChar #define Tcl_WinUtfToTChar \ @@ -175,16 +185,6 @@ extern TclPlatStubs *tclPlatStubsPtr; (tclPlatStubsPtr->strcasecmp) /* 8 */ #endif #endif /* MAC_TCL */ -#ifdef MAC_OSX_TCL -#ifndef Tcl_MacOSXOpenBundleResources -#define Tcl_MacOSXOpenBundleResources \ - (tclPlatStubsPtr->tcl_MacOSXOpenBundleResources) /* 0 */ -#endif -#ifndef Tcl_MacOSXOpenVersionedBundleResources -#define Tcl_MacOSXOpenVersionedBundleResources \ - (tclPlatStubsPtr->tcl_MacOSXOpenVersionedBundleResources) /* 1 */ -#endif -#endif /* MAC_OSX_TCL */ #endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 91f176c..fab94a3 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -58,7 +58,13 @@ Tcl_NotifierProcs tclOriginalNotifier = { }; #ifdef __CYGWIN__ + #define TclWinGetPlatformId winGetPlatformId +#define Tcl_WinUtfToTChar winUtfToTChar +#define Tcl_WinTCharToUtf winTCharToUtf + +static Tcl_Encoding winTCharEncoding; + static int TclWinGetPlatformId() { @@ -66,8 +72,46 @@ TclWinGetPlatformId() * 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); +} + +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 TclWinCPUID 0 /* TODO: to be implemented for cygwin */ +#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_TCL) /* UNIX */ -#define TclWinGetPlatformId (int (*)()) TclpCreateTempFile +# define TclWinGetPlatformId (int (*)()) TclpCreateTempFile +# define TclWinCPUID 0 +# ifndef MAC_OSX_TCL +# define Tcl_MacOSXOpenBundleResources 0 +# define Tcl_MacOSXOpenVersionedBundleResources 0 +# endif #endif /* @@ -334,6 +378,13 @@ TclIntPlatStubs tclIntPlatStubs = { NULL, /* 20 */ NULL, /* 21 */ TclpCreateTempFile, /* 22 */ + NULL, /* 23 */ + NULL, /* 24 */ + NULL, /* 25 */ + NULL, /* 26 */ + NULL, /* 27 */ + NULL, /* 28 */ + TclWinCPUID, /* 29 */ #endif /* UNIX */ #ifdef __WIN32__ TclWinConvertError, /* 0 */ @@ -401,6 +452,10 @@ TclIntPlatStubs tclIntPlatStubs = { TclPlatStubs tclPlatStubs = { TCL_STUB_MAGIC, NULL, +#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ + Tcl_MacOSXOpenBundleResources, /* 0 */ + Tcl_MacOSXOpenVersionedBundleResources, /* 1 */ +#endif /* UNIX */ #ifdef __WIN32__ Tcl_WinUtfToTChar, /* 0 */ Tcl_WinTCharToUtf, /* 1 */ @@ -416,10 +471,6 @@ TclPlatStubs tclPlatStubs = { strncasecmp, /* 7 */ strcasecmp, /* 8 */ #endif /* MAC_TCL */ -#ifdef MAC_OSX_TCL - Tcl_MacOSXOpenBundleResources, /* 0 */ - Tcl_MacOSXOpenVersionedBundleResources, /* 1 */ -#endif /* MAC_OSX_TCL */ }; static TclStubHooks tclStubHooks = { |