summaryrefslogtreecommitdiffstats
path: root/generic/tkStubLib.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tkStubLib.c')
-rw-r--r--generic/tkStubLib.c61
1 files changed, 30 insertions, 31 deletions
diff --git a/generic/tkStubLib.c b/generic/tkStubLib.c
index 3841bcf..66fdb11 100644
--- a/generic/tkStubLib.c
+++ b/generic/tkStubLib.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkStubLib.c,v 1.20.2.1 2008/04/02 04:05:13 dgp Exp $
+ * RCS: @(#) $Id: tkStubLib.c,v 1.26 2010/02/05 22:45:03 nijtmans Exp $
*/
/*
@@ -20,15 +20,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"
@@ -48,17 +43,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');
}
@@ -81,33 +84,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)) {
@@ -117,7 +116,6 @@ Tk_InitStubs(
/* Construct error message */
Tcl_PkgRequireEx(interp, "Tk", version, 1, NULL);
return NULL;
-
}
} else {
actualVersion = Tcl_PkgRequireEx(interp, "Tk", version, 1, NULL);
@@ -127,17 +125,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;
}