summaryrefslogtreecommitdiffstats
path: root/generic/tclStubLib.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2013-01-25 10:04:58 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2013-01-25 10:04:58 (GMT)
commita8c158be4b6bd3dc3a0fc23faf26992246c8bcc4 (patch)
tree231d897e2ebe2880bb9a06d76226aa9808b7036b /generic/tclStubLib.c
parent6859fb45c25a8eb401e7d0decab9b77b24014627 (diff)
parentf09de888df51736f6e35a190ee1eef87b39048cf (diff)
downloadtcl-novem_unversioned_stub.zip
tcl-novem_unversioned_stub.tar.gz
tcl-novem_unversioned_stub.tar.bz2
merge novem. Some more fixes.novem_unversioned_stub
Diffstat (limited to 'generic/tclStubLib.c')
-rw-r--r--generic/tclStubLib.c92
1 files changed, 49 insertions, 43 deletions
diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c
index 42b4911..6c89562 100644
--- a/generic/tclStubLib.c
+++ b/generic/tclStubLib.c
@@ -82,62 +82,68 @@ Tcl_InitStubs(
return NULL;
}
- actualVersion = stubsPtr->tcl_PkgRequireEx(interp, "Tcl", version, 0, &pkgData);
- if (actualVersion == NULL) {
- return NULL;
- }
- if (exact&1) {
- const char *p = version;
- int count = 0;
-
- while (*p) {
- count += !ISDIGIT(*p++);
+ if(iPtr->errorLine == TCL_STUB_MAGIC) {
+ actualVersion = (const char *)iPtr->objResultPtr;
+ tclStubsPtr = stubsPtr;
+ } else {
+ actualVersion = stubsPtr->tcl_PkgRequireEx(interp, "Tcl", version, 0, &pkgData);
+ if (actualVersion == NULL) {
+ return NULL;
}
- if (count == 1) {
- const char *q = actualVersion;
+ if (exact&1) {
+ const char *p = version;
+ int count = 0;
- p = version;
- while (*p && (*p == *q)) {
- p++; q++;
+ while (*p) {
+ count += !ISDIGIT(*p++);
}
- if (*p || ISDIGIT(*q)) {
- /* Construct error message */
- stubsPtr->tcl_PkgRequireEx(interp, "Tcl", version, 1, NULL);
- return NULL;
- }
- } else {
- actualVersion = stubsPtr->tcl_PkgRequireEx(interp, "Tcl", version, 1, NULL);
- if (actualVersion == NULL) {
- return NULL;
+ if (count == 1) {
+ const char *q = actualVersion;
+
+ p = version;
+ while (*p && (*p == *q)) {
+ p++; q++;
+ }
+ if (*p || ISDIGIT(*q)) {
+ /* Construct error message */
+ stubsPtr->tcl_PkgRequireEx(interp, "Tcl", version, 1, NULL);
+ return NULL;
+ }
+ } else {
+ actualVersion = stubsPtr->tcl_PkgRequireEx(interp, "Tcl", version, 1, NULL);
+ if (actualVersion == NULL) {
+ return NULL;
+ }
}
}
- }
#define MASK (4+8+16) /* possible values of sizeof(size_t) */
- /* reserved77 is the location of Tcl_Backslash, which was removed
- * in Tcl 9.0. If this value is NULL, we know that we have Tcl > 8
- */
- if ((exact & MASK) != (int)
- ((stubsPtr->reserved77)?sizeof(int):sizeof(size_t))) {
- char msg[32], *p = msg;
-
if (stubsPtr->reserved77) {
- /* Take "version", but strip off everything after '-' */
- while (*version && *version != '-') {
- *p++ = *version++;
+ /* We are running Tcl 8. */
+ if ((exact & MASK) != (int)sizeof(int)) {
+ char msg[32], *p = msg;
+
+ /* Take "version", but strip off everything after '-' */
+ while (*version && *version != '-') {
+ *p++ = *version++;
+ }
+ *p = '\0';
+ stubsPtr->tcl_AppendResult(interp, "incompatible stub library: have ",
+ tclversion, ", need ", msg, NULL);
+ return NULL;
}
- *p = '\0';
-
+ tclStubsPtr = (TclStubs *)pkgData;
} else {
- msg[0] = '9';
- msg[1] = '\0';
+ /* We are running Tcl 9. */
+ if ((exact & MASK) != (int)sizeof(size_t)) {
+ stubsPtr->tcl_AppendResult(interp, "incompatible stub library: have ",
+ tclversion, ", need 9", NULL);
+ return NULL;
+ }
+ tclStubsPtr = stubsPtr;
}
- stubsPtr->tcl_AppendResult(interp, "incompatible stub library: have ",
- tclversion, ", need ", msg);
- return NULL;
}
- tclStubsPtr = (TclStubs *)pkgData;
if (tclStubsPtr->hooks) {
tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs;