diff options
Diffstat (limited to 'generic/tkStubLib.c')
-rw-r--r-- | generic/tkStubLib.c | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/generic/tkStubLib.c b/generic/tkStubLib.c index 5349a0b..53f177d 100644 --- a/generic/tkStubLib.c +++ b/generic/tkStubLib.c @@ -18,15 +18,10 @@ * including the rest of the stub functions. */ -#ifndef USE_TCL_STUBS +#undef USE_TCL_STUBS #define USE_TCL_STUBS -#endif -#undef USE_TCL_STUB_PROCS -#ifndef USE_TK_STUBS #define USE_TK_STUBS -#endif -#undef USE_TK_STUB_PROCS #include "tkInt.h" @@ -46,17 +41,25 @@ #include "tkPlatDecls.h" #include "tkIntXlibDecls.h" -TkStubs *tkStubsPtr = NULL; -TkPlatStubs *tkPlatStubsPtr = NULL; -TkIntStubs *tkIntStubsPtr = NULL; -TkIntPlatStubs *tkIntPlatStubsPtr = NULL; -TkIntXlibStubs *tkIntXlibStubsPtr = NULL; +MODULE_SCOPE const TkStubs *tkStubsPtr; +MODULE_SCOPE const TkPlatStubs *tkPlatStubsPtr; +MODULE_SCOPE const TkIntStubs *tkIntStubsPtr; +MODULE_SCOPE const TkIntPlatStubs *tkIntPlatStubsPtr; +MODULE_SCOPE const TkIntXlibStubs *tkIntXlibStubsPtr; + +const TkStubs *tkStubsPtr = NULL; +const TkPlatStubs *tkPlatStubsPtr = NULL; +const TkIntStubs *tkIntStubsPtr = NULL; +const TkIntPlatStubs *tkIntPlatStubsPtr = NULL; +const TkIntXlibStubs *tkIntXlibStubsPtr = NULL; /* * Use our own isdigit to avoid linking to libc on windows */ -static int isDigit(const int c) +static int +isDigit( + const int c) { return (c >= '0' && c <= '9'); } @@ -79,33 +82,29 @@ static int isDigit(const int c) *---------------------------------------------------------------------- */ -#ifdef Tk_InitStubs -#undef Tk_InitStubs -#endif - -CONST char * +MODULE_SCOPE const char * Tk_InitStubs( Tcl_Interp *interp, - CONST char *version, + const char *version, int exact) { - CONST char *actualVersion; - TkStubs **stubsPtrPtr = &tkStubsPtr; /* squelch warning */ + ClientData pkgClientData = NULL; + const char *actualVersion = Tcl_PkgRequireEx(interp, "Tk", version, 0, + &pkgClientData); + const TkStubs *stubsPtr = pkgClientData; - actualVersion = Tcl_PkgRequireEx(interp, "Tk", version, 0, - (ClientData *) stubsPtrPtr); if (!actualVersion) { return NULL; } if (exact) { - CONST char *p = version; + const char *p = version; int count = 0; while (*p) { count += !isDigit(*p++); } if (count == 1) { - CONST char *q = actualVersion; + const char *q = actualVersion; p = version; while (*p && (*p == *q)) { @@ -115,7 +114,6 @@ Tk_InitStubs( /* Construct error message */ Tcl_PkgRequireEx(interp, "Tk", version, 1, NULL); return NULL; - } } else { actualVersion = Tcl_PkgRequireEx(interp, "Tk", version, 1, NULL); @@ -125,17 +123,18 @@ Tk_InitStubs( } } - if (!tkStubsPtr) { + if (!stubsPtr) { Tcl_SetResult(interp, "This implementation of Tk does not support stubs", TCL_STATIC); return NULL; } - tkPlatStubsPtr = tkStubsPtr->hooks->tkPlatStubs; - tkIntStubsPtr = tkStubsPtr->hooks->tkIntStubs; - tkIntPlatStubsPtr = tkStubsPtr->hooks->tkIntPlatStubs; - tkIntXlibStubsPtr = tkStubsPtr->hooks->tkIntXlibStubs; + tkPlatStubsPtr = stubsPtr->hooks->tkPlatStubs; + tkIntStubsPtr = stubsPtr->hooks->tkIntStubs; + tkIntPlatStubsPtr = stubsPtr->hooks->tkIntPlatStubs; + tkIntXlibStubsPtr = stubsPtr->hooks->tkIntXlibStubs; + tkStubsPtr = stubsPtr; return actualVersion; } |