summaryrefslogtreecommitdiffstats
path: root/generic/tclTestObj.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2002-02-15 14:28:47 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2002-02-15 14:28:47 (GMT)
commit66a15c6f8be47c3acbdddffadc67f50dec8a56e6 (patch)
treeedaf81ee6d40edeacc9f3e2093ddcb2ba302c620 /generic/tclTestObj.c
parent2827a2692798a7a0ec46e684a4ccc83afb39859e (diff)
downloadtcl-66a15c6f8be47c3acbdddffadc67f50dec8a56e6.zip
tcl-66a15c6f8be47c3acbdddffadc67f50dec8a56e6.tar.gz
tcl-66a15c6f8be47c3acbdddffadc67f50dec8a56e6.tar.bz2
TIP#72 implementation. See ChangeLog for details.
This version builds clean on Solaris/SPARC, with GCC and CC, both with and without threads and both in 32-bit and 64-bit mode.
Diffstat (limited to 'generic/tclTestObj.c')
-rw-r--r--generic/tclTestObj.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c
index ca9b088..5d36cc0 100644
--- a/generic/tclTestObj.c
+++ b/generic/tclTestObj.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclTestObj.c,v 1.9 2002/01/17 04:37:33 dgp Exp $
+ * RCS: @(#) $Id: tclTestObj.c,v 1.10 2002/02/15 14:28:49 dkf Exp $
*/
#include "tclInt.h"
@@ -406,6 +406,15 @@ TestindexobjCmd(clientData, interp, objc, objv)
int allowAbbrev, index, index2, setError, i, result;
CONST char **argv;
static CONST char *tablePtr[] = {"a", "b", "check", (char *) NULL};
+ /*
+ * Keep this structure declaration in sync with tclIndexObj.c
+ */
+ struct IndexRep {
+ VOID *tablePtr; /* Pointer to the table of strings */
+ int offset; /* Offset between table entries */
+ int index; /* Selected index into table. */
+ };
+ struct IndexRep *indexRep;
if ((objc == 3) && (strcmp(Tcl_GetString(objv[1]),
"check") == 0)) {
@@ -415,13 +424,14 @@ TestindexobjCmd(clientData, interp, objc, objv)
* returned on subsequent lookups.
*/
- Tcl_GetIndexFromObj((Tcl_Interp *) NULL, objv[1], tablePtr,
- "token", 0, &index);
if (Tcl_GetIntFromObj(interp, objv[2], &index2) != TCL_OK) {
return TCL_ERROR;
}
- objv[1]->internalRep.twoPtrValue.ptr2 =
- (VOID *) (index2 * sizeof(char *));
+
+ Tcl_GetIndexFromObj((Tcl_Interp *) NULL, objv[1], tablePtr,
+ "token", 0, &index);
+ indexRep = (struct IndexRep *) objv[1]->internalRep.otherValuePtr;
+ indexRep->index = index2;
result = Tcl_GetIndexFromObj((Tcl_Interp *) NULL, objv[1],
tablePtr, "token", 0, &index);
if (result == TCL_OK) {
@@ -455,9 +465,12 @@ TestindexobjCmd(clientData, interp, objc, objv)
* the index object, clear out the object's cached state.
*/
- if ((objv[3]->typePtr == Tcl_GetObjType("index"))
- && (objv[3]->internalRep.twoPtrValue.ptr1 == (VOID *) argv)) {
- objv[3]->typePtr = NULL;
+ if (objv[3]->typePtr == &tclIndexType) {
+ indexRep = (struct IndexRep *) objv[3]->internalRep.otherValuePtr;
+ if (indexRep->tablePtr == (VOID *) argv) {
+ objv[3]->typePtr->freeIntRepProc(objv[3]);
+ objv[3]->typePtr = NULL;
+ }
}
result = Tcl_GetIndexFromObj((setError? interp : NULL), objv[3],