Index: ChangeLog
===================================================================
RCS file: /cvsroot/tcl/tcl/ChangeLog,v
retrieving revision 1.3762
diff -u -r1.3762 ChangeLog
--- ChangeLog	11 Nov 2007 10:21:41 -0000	1.3762
+++ ChangeLog	11 Nov 2007 19:28:30 -0000
@@ -1,3 +1,36 @@
+2007-11-10  Miguel Sofer  <msofer@users.sf.net>
+
+	* generic/tclBasic.c:       Increased usage of macros to detect
+	* generic/tclBinary.c:      and take advantage of objTypes. Added 
+	* generic/tclClock.c:       macros TclGet(Int|Long)FromObj,
+	* generic/tclCmdAH.c:       TclGetIntForIndexM and TclListObjLength, 
+	* generic/tclCmdIL.c:       modified TclListObjGetElements.
+	* generic/tclCmdMZ.c:
+	* generic/tclCompCmds.c:    The TclGetInt* macros are only a shortcut
+	* generic/tclCompExpr.c:    on platforms where 'long' is 'int'; it may
+	* generic/tclCompile.c:     be worthwhile to extend their functionality
+	* generic/tclDictObj.c:     also to other cases.
+	* generic/tclExecute.c:
+	* generic/tclGet.c:         As this patch touches many files it has
+	* generic/tclIO.c:          been recorded as [Patch 1830038] in order to
+	* generic/tclIOCmd.c:       facilitate reviewing.
+	* generic/tclIOGT.c:
+	* generic/tclIndexObj.c:
+	* generic/tclInt.h:
+	* generic/tclInterp.c:
+	* generic/tclListObj.c:
+	* generic/tclLiteral.c:
+	* generic/tclNamesp.c:
+	* generic/tclObj.c:
+	* generic/tclParse.c:
+	* generic/tclProc.c:
+	* generic/tclRegexp.c:
+	* generic/tclResult.c:
+	* generic/tclScan.c:
+	* generic/tclStringObj.c:
+	* generic/tclUtil.c:
+	* generic/tclVar.c:
+
 2007-11-11  Daniel Steffen  <das@users.sourceforge.net>
 
 	* unix/tclUnixTime.c (TclpWideClicksToNanoseconds): Fix issues with
Index: generic/tclBasic.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclBasic.c,v
retrieving revision 1.278
diff -u -r1.278 tclBasic.c
--- generic/tclBasic.c	11 Nov 2007 06:32:29 -0000	1.278
+++ generic/tclBasic.c	11 Nov 2007 19:28:32 -0000
@@ -3594,7 +3594,7 @@
 	 */
 
 	commandPtr = GetCommandSource(iPtr, command, length, objc, objv);
-	command = Tcl_GetStringFromObj(commandPtr, &length);
+	command = TclGetStringFromObj(commandPtr, &length);
 	
 	/*
 	 * Execute any command or execution traces. Note that we bump up the
@@ -4217,7 +4217,7 @@
 		if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) {
 		    int numElements;
 
-		    code = Tcl_ListObjLength(interp, objv[objectsUsed],
+		    code = TclListObjLength(interp, objv[objectsUsed],
 			    &numElements);
 		    if (code == TCL_ERROR) {
 			/*
@@ -4648,7 +4648,7 @@
 		line = 1;
 		for (i=0; i < eoFramePtr->nline; i++) {
 		    eoFramePtr->line[i] = line;
-		    w = Tcl_GetString(elements[i]);
+		    w = TclGetString(elements[i]);
 		    TclAdvanceLines(&line, w, w + strlen(w));
 		}
 
@@ -5005,7 +5005,7 @@
     case TCL_NUMBER_LONG:
     case TCL_NUMBER_WIDE:
     case TCL_NUMBER_BIG:
-	result = Tcl_GetLongFromObj(interp, resultPtr, ptr);
+	result = TclGetLongFromObj(interp, resultPtr, ptr);
 	break;
 
     case TCL_NUMBER_NAN:
@@ -5174,7 +5174,7 @@
 	return TCL_ERROR;
     }
 
-    cmdName = Tcl_GetString(objv[0]);
+    cmdName = TclGetString(objv[0]);
     hTblPtr = iPtr->hiddenCmdTablePtr;
     if (hTblPtr != NULL) {
 	hPtr = Tcl_FindHashEntry(hTblPtr, cmdName);
@@ -5294,7 +5294,7 @@
     Tcl_Obj *objPtr)		/* Message to record. */
 {
     int length;
-    const char *message = Tcl_GetStringFromObj(objPtr, &length);
+    const char *message = TclGetStringFromObj(objPtr, &length);
 
     Tcl_AddObjErrorInfo(interp, message, length);
     Tcl_DecrRefCount(objPtr);
@@ -6152,7 +6152,7 @@
 	return TCL_ERROR;
     }
     objPtr = Tcl_GetObjResult(interp);
-    if (Tcl_GetLongFromObj(NULL, objPtr, &iResult) != TCL_OK) {
+    if (TclGetLongFromObj(NULL, objPtr, &iResult) != TCL_OK) {
 	/*
 	 * Truncate the bignum; keep only bits in long range.
 	 */
@@ -6163,7 +6163,7 @@
 	mp_mod_2d(&big, (int) CHAR_BIT * sizeof(long), &big);
 	objPtr = Tcl_NewBignumObj(&big);
 	Tcl_IncrRefCount(objPtr);
-	Tcl_GetLongFromObj(NULL, objPtr, &iResult);
+	TclGetLongFromObj(NULL, objPtr, &iResult);
 	Tcl_DecrRefCount(objPtr);
     }
     Tcl_SetObjResult(interp, Tcl_NewLongObj(iResult));
@@ -6390,7 +6390,7 @@
 	return TCL_ERROR;
     }
 
-    if (Tcl_GetLongFromObj(NULL, objv[1], &i) != TCL_OK) {
+    if (TclGetLongFromObj(NULL, objv[1], &i) != TCL_OK) {
 	Tcl_Obj *objPtr;
 	mp_int big;
 
@@ -6402,7 +6402,7 @@
 	mp_mod_2d(&big, (int) CHAR_BIT * sizeof(long), &big);
 	objPtr = Tcl_NewBignumObj(&big);
 	Tcl_IncrRefCount(objPtr);
-	Tcl_GetLongFromObj(NULL, objPtr, &i);
+	TclGetLongFromObj(NULL, objPtr, &i);
 	Tcl_DecrRefCount(objPtr);
     }
 
@@ -6550,7 +6550,7 @@
 	for (i = 0; i < 2; i++) {
 	    Tcl_DictObjGet(NULL, info, *k++, &val);
 	    if (val) {
-		Tcl_GetIntFromObj(NULL, val, &(argsi[i]));
+		TclGetIntFromObj(NULL, val, &(argsi[i]));
 	    } else {
 		argsi[i] = 0;
 	    }
Index: generic/tclBinary.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclBinary.c,v
retrieving revision 1.37
diff -u -r1.37 tclBinary.c
--- generic/tclBinary.c	9 Nov 2007 18:50:54 -0000	1.37
+++ generic/tclBinary.c	11 Nov 2007 19:28:33 -0000
@@ -397,7 +397,7 @@
     Tcl_UniChar ch;
 
     if (objPtr->typePtr != &tclByteArrayType) {
-	src = Tcl_GetStringFromObj(objPtr, &length);
+	src = TclGetStringFromObj(objPtr, &length);
 	srcEnd = src + length;
 
 	byteArrayPtr = (ByteArray *) ckalloc(BYTEARRAY_SIZE(length));
@@ -609,7 +609,7 @@
 	 * places the formatted data into the buffer.
 	 */
 
-	format = Tcl_GetString(objv[2]);
+	format = TclGetString(objv[2]);
 	arg = 3;
 	offset = 0;
 	length = 0;
@@ -695,10 +695,13 @@
 		    int listc;
 		    Tcl_Obj **listv;
 
-		    if (Tcl_ListObjGetElements(interp, objv[arg++], &listc,
+		    /* The macro evals its args more than once: avoid arg++ */		    
+		    if (TclListObjGetElements(interp, objv[arg], &listc,
 			    &listv) != TCL_OK) {
 			return TCL_ERROR;
 		    }
+		    arg++;
+		    
 		    if (count == BINARY_ALL) {
 			count = listc;
 		    } else if (count > listc) {
@@ -774,7 +777,7 @@
 	 */
 
 	arg = 3;
-	format = Tcl_GetString(objv[2]);
+	format = TclGetString(objv[2]);
 	cursor = buffer;
 	maxPos = cursor;
 	while (*format != 0) {
@@ -812,7 +815,8 @@
 	    case 'B': {
 		unsigned char *last;
 
-		str = Tcl_GetStringFromObj(objv[arg++], &length);
+		str = TclGetStringFromObj(objv[arg], &length);
+		arg++;
 		if (count == BINARY_ALL) {
 		    count = length;
 		} else if (count == BINARY_NOCOUNT) {
@@ -873,7 +877,8 @@
 		unsigned char *last;
 		int c;
 
-		str = Tcl_GetStringFromObj(objv[arg++], &length);
+		str = TclGetStringFromObj(objv[arg], &length);
+		arg++;
 		if (count == BINARY_ALL) {
 		    count = length;
 		} else if (count == BINARY_NOCOUNT) {
@@ -973,7 +978,7 @@
 		    listc = 1;
 		    count = 1;
 		} else {
-		    Tcl_ListObjGetElements(interp, objv[arg], &listc, &listv);
+		    TclListObjGetElements(interp, objv[arg], &listc, &listv);
 		    if (count == BINARY_ALL) {
 			count = listc;
 		    }
@@ -1035,7 +1040,7 @@
 	numberCachePtr = &numberCacheHash;
 	Tcl_InitHashTable(numberCachePtr, TCL_ONE_WORD_KEYS);
 	buffer = Tcl_GetByteArrayFromObj(objv[2], &length);
-	format = Tcl_GetString(objv[3]);
+	format = TclGetString(objv[3]);
 	cursor = buffer;
 	arg = 4;
 	offset = 0;
@@ -1126,7 +1131,7 @@
 		src = buffer + offset;
 		valuePtr = Tcl_NewObj();
 		Tcl_SetObjLength(valuePtr, count);
-		dest = Tcl_GetString(valuePtr);
+		dest = TclGetString(valuePtr);
 
 		if (cmd == 'b') {
 		    for (i = 0; i < count; i++) {
@@ -1182,7 +1187,7 @@
 		src = buffer + offset;
 		valuePtr = Tcl_NewObj();
 		Tcl_SetObjLength(valuePtr, count);
-		dest = Tcl_GetString(valuePtr);
+		dest = TclGetString(valuePtr);
 
 		if (cmd == 'h') {
 		    for (i = 0; i < count; i++) {
@@ -1726,7 +1731,7 @@
     case 'i':
     case 'I':
     case 'n':
-	if (Tcl_GetLongFromObj(interp, src, &value) != TCL_OK) {
+	if (TclGetLongFromObj(interp, src, &value) != TCL_OK) {
 	    return TCL_ERROR;
 	}
 	if (NeedReversing(type)) {
@@ -1748,7 +1753,7 @@
     case 's':
     case 'S':
     case 't':
-	if (Tcl_GetLongFromObj(interp, src, &value) != TCL_OK) {
+	if (TclGetLongFromObj(interp, src, &value) != TCL_OK) {
 	    return TCL_ERROR;
 	}
 	if (NeedReversing(type)) {
@@ -1764,7 +1769,7 @@
 	 * 8-bit integer values.
 	 */
     case 'c':
-	if (Tcl_GetLongFromObj(interp, src, &value) != TCL_OK) {
+	if (TclGetLongFromObj(interp, src, &value) != TCL_OK) {
 	    return TCL_ERROR;
 	}
 	*(*cursorPtr)++ = (unsigned char) value;
Index: generic/tclClock.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclClock.c,v
retrieving revision 1.61
diff -u -r1.61 tclClock.c
--- generic/tclClock.c	20 Apr 2007 05:51:09 -0000	1.61
+++ generic/tclClock.c	11 Nov 2007 19:28:33 -0000
@@ -323,7 +323,7 @@
 		&secondsObj) != TCL_OK)
 	    || (Tcl_GetWideIntFromObj(interp, secondsObj,
 		&(fields.localSeconds)) != TCL_OK)
-	    || (Tcl_GetIntFromObj(interp, objv[3], &changeover) != TCL_OK)
+	    || (TclGetIntFromObj(interp, objv[3], &changeover) != TCL_OK)
 	    || ConvertLocalToUTC(interp, &fields, objv[2], changeover)) {
 	return TCL_ERROR;
     }
@@ -401,7 +401,7 @@
 	return TCL_ERROR;
     }
     if (Tcl_GetWideIntFromObj(interp, objv[1], &(fields.seconds)) != TCL_OK
-	    || Tcl_GetIntFromObj(interp, objv[3], &changeover) != TCL_OK) {
+	    || TclGetIntFromObj(interp, objv[3], &changeover) != TCL_OK) {
 	return TCL_ERROR;
     }
 
@@ -514,15 +514,15 @@
 		&era) != TCL_OK
 	    || Tcl_DictObjGet(interp, dict, literals[LIT_YEAR],
 		&fieldPtr) != TCL_OK
-	    || Tcl_GetIntFromObj(interp, fieldPtr, &(fields.year)) != TCL_OK
+	    || TclGetIntFromObj(interp, fieldPtr, &(fields.year)) != TCL_OK
 	    || Tcl_DictObjGet(interp, dict, literals[LIT_MONTH],
 		&fieldPtr) != TCL_OK
-	    || Tcl_GetIntFromObj(interp, fieldPtr, &(fields.month)) != TCL_OK
+	    || TclGetIntFromObj(interp, fieldPtr, &(fields.month)) != TCL_OK
 	    || Tcl_DictObjGet(interp, dict, literals[LIT_DAYOFMONTH],
 		&fieldPtr) != TCL_OK
-	    || Tcl_GetIntFromObj(interp, fieldPtr,
+	    || TclGetIntFromObj(interp, fieldPtr,
 		&(fields.dayOfMonth)) != TCL_OK
-	    || Tcl_GetIntFromObj(interp, objv[2], &changeover) != TCL_OK) {
+	    || TclGetIntFromObj(interp, objv[2], &changeover) != TCL_OK) {
 	return TCL_ERROR;
     }
     fields.era = era;
@@ -605,17 +605,17 @@
 		&era) != TCL_OK
 	    || Tcl_DictObjGet(interp, dict, literals[LIT_ISO8601YEAR],
 		&fieldPtr) != TCL_OK
-	    || Tcl_GetIntFromObj(interp, fieldPtr,
+	    || TclGetIntFromObj(interp, fieldPtr,
 		&(fields.iso8601Year)) != TCL_OK
 	    || Tcl_DictObjGet(interp, dict, literals[LIT_ISO8601WEEK],
 		&fieldPtr) != TCL_OK
-	    || Tcl_GetIntFromObj(interp, fieldPtr,
+	    || TclGetIntFromObj(interp, fieldPtr,
 		&(fields.iso8601Week)) != TCL_OK
 	    || Tcl_DictObjGet(interp, dict, literals[LIT_DAYOFWEEK],
 		&fieldPtr) != TCL_OK
-	    || Tcl_GetIntFromObj(interp, fieldPtr,
+	    || TclGetIntFromObj(interp, fieldPtr,
 		&(fields.dayOfWeek)) != TCL_OK
-	    || Tcl_GetIntFromObj(interp, objv[2], &changeover) != TCL_OK) {
+	    || TclGetIntFromObj(interp, objv[2], &changeover) != TCL_OK) {
 	return TCL_ERROR;
     }
     fields.era = era;
@@ -678,7 +678,7 @@
      * Unpack the tz data.
      */
 
-    if (Tcl_ListObjGetElements(interp, tzdata, &rowc, &rowv) != TCL_OK) {
+    if (TclListObjGetElements(interp, tzdata, &rowc, &rowv) != TCL_OK) {
 	return TCL_ERROR;
     }
 
@@ -743,9 +743,9 @@
     while (!found) {
 	row = LookupLastTransition(interp, fields->seconds, rowc, rowv);
 	if ((row == NULL)
-		|| Tcl_ListObjGetElements(interp, row, &cellc,
+		|| TclListObjGetElements(interp, row, &cellc,
 		    &cellv) != TCL_OK
-		|| Tcl_GetIntFromObj(interp, cellv[1],
+		|| TclGetIntFromObj(interp, cellv[1],
 		    &(fields->tzOffset)) != TCL_OK) {
 	    return TCL_ERROR;
 	}
@@ -882,7 +882,7 @@
      * Unpack the tz data.
      */
 
-    if (Tcl_ListObjGetElements(interp, tzdata, &rowc, &rowv) != TCL_OK) {
+    if (TclListObjGetElements(interp, tzdata, &rowc, &rowv) != TCL_OK) {
 	return TCL_ERROR;
     }
 
@@ -934,8 +934,8 @@
 
     row = LookupLastTransition(interp, fields->seconds, rowc, rowv);
     if (row == NULL ||
-	    Tcl_ListObjGetElements(interp, row, &cellc, &cellv) != TCL_OK ||
-	    Tcl_GetIntFromObj(interp,cellv[1],&(fields->tzOffset)) != TCL_OK) {
+	    TclListObjGetElements(interp, row, &cellc, &cellv) != TCL_OK ||
+	    TclGetIntFromObj(interp,cellv[1],&(fields->tzOffset)) != TCL_OK) {
 	return TCL_ERROR;
     }
 
@@ -1577,7 +1577,7 @@
 	Tcl_WrongNumArgs(interp, 1, objv, "name");
 	return TCL_ERROR;
     }
-    varName = Tcl_GetStringFromObj(objv[1], NULL);
+    varName = TclGetString(objv[1]);
     varValue = getenv(varName);
     if (varValue == NULL) {
 	varValue = "";
Index: generic/tclCmdAH.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCmdAH.c,v
retrieving revision 1.89
diff -u -r1.89 tclCmdAH.c
--- generic/tclCmdAH.c	20 Jun 2007 18:46:07 -0000	1.89
+++ generic/tclCmdAH.c	11 Nov 2007 19:28:33 -0000
@@ -125,7 +125,7 @@
     if (caseObjc == 1) {
 	Tcl_Obj **newObjv;
 
-	Tcl_ListObjGetElements(interp, caseObjv[0], &caseObjc, &newObjv);
+	TclListObjGetElements(interp, caseObjv[0], &caseObjc, &newObjv);
 	caseObjv = newObjv;
     }
 
@@ -494,7 +494,7 @@
 	     * Store the result as binary data.
 	     */
 
-	    stringPtr = Tcl_GetStringFromObj(data, &length);
+	    stringPtr = TclGetStringFromObj(data, &length);
 	    Tcl_UtfToExternalDString(encoding, stringPtr, length, &ds);
 	    Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(
 		    (unsigned char *) Tcl_DStringValue(&ds),
@@ -869,7 +869,7 @@
 
 	    long newTime;
 
-	    if (Tcl_GetLongFromObj(interp, objv[3], &newTime) != TCL_OK) {
+	    if (TclGetLongFromObj(interp, objv[3], &newTime) != TCL_OK) {
 		return TCL_ERROR;
 	    }
 
@@ -1752,7 +1752,7 @@
 	    result = TCL_ERROR;
 	    goto done;
 	}
-	Tcl_ListObjGetElements(NULL, vCopyList[i], &varcList[i], &varvList[i]);
+	TclListObjGetElements(NULL, vCopyList[i], &varcList[i], &varvList[i]);
 	if (varcList[i] < 1) {
 	    Tcl_AppendResult(interp, "foreach varlist is empty", NULL);
 	    result = TCL_ERROR;
@@ -1764,7 +1764,7 @@
 	    result = TCL_ERROR;
 	    goto done;
 	}
-	Tcl_ListObjGetElements(NULL, aCopyList[i], &argcList[i], &argvList[i]);
+	TclListObjGetElements(NULL, aCopyList[i], &argcList[i], &argvList[i]);
 
 	j = argcList[i] / varcList[i];
 	if ((argcList[i] % varcList[i]) != 0) {
Index: generic/tclCmdIL.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCmdIL.c,v
retrieving revision 1.123
diff -u -r1.123 tclCmdIL.c
--- generic/tclCmdIL.c	13 Sep 2007 15:25:50 -0000	1.123
+++ generic/tclCmdIL.c	11 Nov 2007 19:28:34 -0000
@@ -540,7 +540,7 @@
 	 * run before. [Bug #545644]
 	 */
 
-	(void) Tcl_GetString(bodyPtr);
+	(void) TclGetString(bodyPtr);
     }
     resultPtr = Tcl_NewStringObj(bodyPtr->bytes, bodyPtr->length);
 
@@ -1082,7 +1082,7 @@
      * We've got "info frame level" and must parse the level first.
      */
 
-    if (Tcl_GetIntFromObj(interp, objv[1], &level) != TCL_OK) {
+    if (TclGetIntFromObj(interp, objv[1], &level) != TCL_OK) {
 	return TCL_ERROR;
     }
     if (level <= 0) {
@@ -1456,7 +1456,7 @@
 	int level;
 	CallFrame *framePtr, *rootFramePtr = iPtr->rootFramePtr;
 
-	if (Tcl_GetIntFromObj(interp, objv[1], &level) != TCL_OK) {
+	if (TclGetIntFromObj(interp, objv[1], &level) != TCL_OK) {
 	    return TCL_ERROR;
 	}
 	if (level <= 0) {
@@ -2015,7 +2015,7 @@
      * pointer to its array of element pointers.
      */
 
-    if (Tcl_ListObjGetElements(interp, objv[1], &listLen,
+    if (TclListObjGetElements(interp, objv[1], &listLen,
 	    &elemPtrs) != TCL_OK) {
 	return TCL_ERROR;
     }
@@ -2074,7 +2074,7 @@
 	return TCL_ERROR;
     }
 
-    Tcl_ListObjGetElements(NULL, listCopyPtr, &listObjc, &listObjv);
+    TclListObjGetElements(NULL, listCopyPtr, &listObjc, &listObjv);
 
     objc -= 2;
     objv += 2;
@@ -2198,7 +2198,7 @@
 	return TCL_ERROR;
     }
 
-    result = Tcl_ListObjLength(interp, objv[1], &len);
+    result = TclListObjLength(interp, objv[1], &len);
     if (result != TCL_OK) {
 	return result;
     }
@@ -2209,7 +2209,7 @@
      * appended to the list.
      */
 
-    result = TclGetIntForIndex(interp, objv[2], /*end*/ len, &index);
+    result = TclGetIntForIndexM(interp, objv[2], /*end*/ len, &index);
     if (result != TCL_OK) {
 	return result;
     }
@@ -2313,7 +2313,7 @@
 	return TCL_ERROR;
     }
 
-    result = Tcl_ListObjLength(interp, objv[1], &listLen);
+    result = TclListObjLength(interp, objv[1], &listLen);
     if (result != TCL_OK) {
 	return result;
     }
@@ -2369,9 +2369,9 @@
     if (listPtr == NULL) {
 	return TCL_ERROR;
     }
-    Tcl_ListObjGetElements(NULL, listPtr, &listLen, &elemPtrs);
+    TclListObjGetElements(NULL, listPtr, &listLen, &elemPtrs);
 
-    result = TclGetIntForIndex(interp, objv[2], /*endValue*/ listLen - 1,
+    result = TclGetIntForIndexM(interp, objv[2], /*endValue*/ listLen - 1,
 	    &first);
     if (result == TCL_OK) {
 	int last;
@@ -2380,7 +2380,7 @@
 	    first = 0;
 	}
 
-	result = TclGetIntForIndex(interp, objv[3], /*endValue*/ listLen - 1,
+	result = TclGetIntForIndexM(interp, objv[3], /*endValue*/ listLen - 1,
 		&last);
 	if (result == TCL_OK) {
 	    if (last >= listLen) {
@@ -2438,7 +2438,7 @@
 	Tcl_WrongNumArgs(interp, 1, objv, "positiveCount value ?value ...?");
 	return TCL_ERROR;
     }
-    result = Tcl_GetIntFromObj(interp, objv[1], &elementCount);
+    result = TclGetIntFromObj(interp, objv[1], &elementCount);
     if (result == TCL_ERROR) {
 	return TCL_ERROR;
     }
@@ -2527,7 +2527,7 @@
 	return TCL_ERROR;
     }
 
-    result = Tcl_ListObjLength(interp, objv[1], &listLen);
+    result = TclListObjLength(interp, objv[1], &listLen);
     if (result != TCL_OK) {
 	return result;
     }
@@ -2538,12 +2538,12 @@
      * included for deletion.
      */
 
-    result = TclGetIntForIndex(interp, objv[2], /*end*/ listLen-1, &first);
+    result = TclGetIntForIndexM(interp, objv[2], /*end*/ listLen-1, &first);
     if (result != TCL_OK) {
 	return result;
     }
 
-    result = TclGetIntForIndex(interp, objv[3], /*end*/ listLen-1, &last);
+    result = TclGetIntForIndexM(interp, objv[3], /*end*/ listLen-1, &last);
     if (result != TCL_OK) {
 	return result;
     }
@@ -2632,7 +2632,7 @@
 	Tcl_WrongNumArgs(interp, 1, objv, "list");
 	return TCL_ERROR;
     }
-    if (Tcl_ListObjGetElements(interp, objv[1], &elemc, &elemv) != TCL_OK) {
+    if (TclListObjGetElements(interp, objv[1], &elemc, &elemv) != TCL_OK) {
 	return TCL_ERROR;
     }
 
@@ -2871,7 +2871,7 @@
 	     */
 
 	    i++;
-	    if (Tcl_ListObjGetElements(interp, objv[i],
+	    if (TclListObjGetElements(interp, objv[i],
 		    &sortInfo.indexc, &indices) != TCL_OK) {
 		if (startPtr != NULL) {
 		    Tcl_DecrRefCount(startPtr);
@@ -2897,7 +2897,7 @@
 	     */
 
 	    for (j=0 ; j<sortInfo.indexc ; j++) {
-		if (TclGetIntForIndex(interp, indices[j], SORTIDX_END,
+		if (TclGetIntForIndexM(interp, indices[j], SORTIDX_END,
 			&sortInfo.indexv[j]) != TCL_OK) {
 		    if (sortInfo.indexc > 1) {
 			ckfree((char *) sortInfo.indexv);
@@ -2963,7 +2963,7 @@
      * pointer to its array of element pointers.
      */
 
-    result = Tcl_ListObjGetElements(interp, objv[objc - 2], &listc, &listv);
+    result = TclListObjGetElements(interp, objv[objc - 2], &listc, &listv);
     if (result != TCL_OK) {
 	if (startPtr != NULL) {
 	    Tcl_DecrRefCount(startPtr);
@@ -2979,7 +2979,7 @@
      */
 
     if (startPtr) {
-	result = TclGetIntForIndex(interp, startPtr, listc-1, &offset);
+	result = TclGetIntForIndexM(interp, startPtr, listc-1, &offset);
 	Tcl_DecrRefCount(startPtr);
 	if (result != TCL_OK) {
 	    if (sortInfo.indexc > 1) {
@@ -3015,10 +3015,10 @@
 	switch ((enum datatypes) dataType) {
 	case ASCII:
 	case DICTIONARY:
-	    patternBytes = Tcl_GetStringFromObj(patObj, &length);
+	    patternBytes = TclGetStringFromObj(patObj, &length);
 	    break;
 	case INTEGER:
-	    result = Tcl_GetIntFromObj(interp, patObj, &patInt);
+	    result = TclGetIntFromObj(interp, patObj, &patInt);
 	    if (result != TCL_OK) {
 		if (sortInfo.indexc > 1) {
 		    ckfree((char *) sortInfo.indexv);
@@ -3037,7 +3037,7 @@
 	    break;
 	}
     } else {
-	patternBytes = Tcl_GetStringFromObj(patObj, &length);
+	patternBytes = TclGetStringFromObj(patObj, &length);
     }
 
     /*
@@ -3077,7 +3077,7 @@
 		match = DictionaryCompare(patternBytes, bytes);
 		break;
 	    case INTEGER:
-		result = Tcl_GetIntFromObj(interp, itemPtr, &objInt);
+		result = TclGetIntFromObj(interp, itemPtr, &objInt);
 		if (result != TCL_OK) {
 		    if (sortInfo.indexc > 1) {
 			ckfree((char *) sortInfo.indexv);
@@ -3169,7 +3169,7 @@
 	    case EXACT:
 		switch ((enum datatypes) dataType) {
 		case ASCII:
-		    bytes = Tcl_GetStringFromObj(itemPtr, &elemLen);
+		    bytes = TclGetStringFromObj(itemPtr, &elemLen);
 		    if (length == elemLen) {
 			/*
 			 * This split allows for more optimal compilation of
@@ -3191,7 +3191,7 @@
 		    break;
 
 		case INTEGER:
-		    result = Tcl_GetIntFromObj(interp, itemPtr, &objInt);
+		    result = TclGetIntFromObj(interp, itemPtr, &objInt);
 		    if (result != TCL_OK) {
 			if (listPtr != NULL) {
 			    Tcl_DecrRefCount(listPtr);
@@ -3511,7 +3511,7 @@
 	     * Take copy to prevent shimmering problems.
 	     */
 
-	    if (Tcl_ListObjGetElements(interp, objv[i+1], &sortInfo.indexc,
+	    if (TclListObjGetElements(interp, objv[i+1], &sortInfo.indexc,
 		    &indices) != TCL_OK) {
 		return TCL_ERROR;
 	    }
@@ -3534,7 +3534,7 @@
 	     */
 
 	    for (j=0 ; j<sortInfo.indexc ; j++) {
-		if (TclGetIntForIndex(interp, indices[j], SORTIDX_END,
+		if (TclGetIntForIndexM(interp, indices[j], SORTIDX_END,
 			&sortInfo.indexv[j]) != TCL_OK) {
 		    if (sortInfo.indexc > 1) {
 			ckfree((char *) sortInfo.indexv);
@@ -3607,7 +3607,7 @@
 	sortInfo.compareCmdPtr = newCommandPtr;
     }
 
-    sortInfo.resultCode = Tcl_ListObjGetElements(interp, listObj,
+    sortInfo.resultCode = TclListObjGetElements(interp, listObj,
 	    &length, &listObjPtrs);
     if (sortInfo.resultCode != TCL_OK || length <= 0) {
 	goto done;
@@ -3847,8 +3847,8 @@
     } else if (infoPtr->sortMode == SORTMODE_INTEGER) {
 	long a, b;
 
-	if ((Tcl_GetLongFromObj(infoPtr->interp, objPtr1, &a) != TCL_OK)
-		|| (Tcl_GetLongFromObj(infoPtr->interp, objPtr2, &b)
+	if ((TclGetLongFromObj(infoPtr->interp, objPtr1, &a) != TCL_OK)
+		|| (TclGetLongFromObj(infoPtr->interp, objPtr2, &b)
 		!= TCL_OK)) {
 	    infoPtr->resultCode = TCL_ERROR;
 	    return order;
@@ -3883,10 +3883,10 @@
 	 * Replace them and evaluate the result.
 	 */
 
-	Tcl_ListObjLength(infoPtr->interp, infoPtr->compareCmdPtr, &objc);
+	TclListObjLength(infoPtr->interp, infoPtr->compareCmdPtr, &objc);
 	Tcl_ListObjReplace(infoPtr->interp, infoPtr->compareCmdPtr, objc - 2,
 		2, 2, paramObjv);
-	Tcl_ListObjGetElements(infoPtr->interp, infoPtr->compareCmdPtr,
+	TclListObjGetElements(infoPtr->interp, infoPtr->compareCmdPtr,
 		&objc, &objv);
 
 	infoPtr->resultCode = Tcl_EvalObjv(infoPtr->interp, objc, objv, 0);
@@ -3901,7 +3901,7 @@
 	 * Parse the result of the command.
 	 */
 
-	if (Tcl_GetIntFromObj(infoPtr->interp,
+	if (TclGetIntFromObj(infoPtr->interp,
 		Tcl_GetObjResult(infoPtr->interp), &order) != TCL_OK) {
 	    Tcl_ResetResult(infoPtr->interp);
 	    Tcl_AppendResult(infoPtr->interp,
@@ -4096,7 +4096,7 @@
 	int listLen, index;
 	Tcl_Obj *currentObj;
 
-	if (Tcl_ListObjLength(infoPtr->interp, objPtr, &listLen) != TCL_OK) {
+	if (TclListObjLength(infoPtr->interp, objPtr, &listLen) != TCL_OK) {
 	    infoPtr->resultCode = TCL_ERROR;
 	    return NULL;
 	}
Index: generic/tclCmdMZ.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCmdMZ.c,v
retrieving revision 1.156
diff -u -r1.156 tclCmdMZ.c
--- generic/tclCmdMZ.c	1 Nov 2007 11:11:44 -0000	1.156
+++ generic/tclCmdMZ.c	11 Nov 2007 19:28:35 -0000
@@ -156,7 +156,7 @@
 	    if (++i >= objc) {
 		goto endOfForLoop;
 	    }
-	    if (TclGetIntForIndex(interp, objv[i], 0, &temp) != TCL_OK) {
+	    if (TclGetIntForIndexM(interp, objv[i], 0, &temp) != TCL_OK) {
 		goto optionError;
 	    }
 	    if (startIndex) {
@@ -218,7 +218,7 @@
     stringLength = Tcl_GetCharLength(objPtr);
 
     if (startIndex) {
-	TclGetIntForIndex(NULL, startIndex, stringLength, &offset);
+	TclGetIntForIndexM(NULL, startIndex, stringLength, &offset);
 	Tcl_DecrRefCount(startIndex);
 	if (offset < 0) {
 	    offset = 0;
@@ -496,7 +496,7 @@
 	    if (++idx >= objc) {
 		goto endOfForLoop;
 	    }
-	    if (TclGetIntForIndex(interp, objv[idx], 0, &temp) != TCL_OK) {
+	    if (TclGetIntForIndexM(interp, objv[idx], 0, &temp) != TCL_OK) {
 		goto optionError;
 	    }
 	    if (startIndex) {
@@ -529,7 +529,7 @@
     if (startIndex) {
 	int stringLength = Tcl_GetCharLength(objv[1]);
 
-	TclGetIntForIndex(NULL, startIndex, stringLength, &offset);
+	TclGetIntForIndexM(NULL, startIndex, stringLength, &offset);
 	Tcl_DecrRefCount(startIndex);
 	if (offset < 0) {
 	    offset = 0;
@@ -989,13 +989,13 @@
 	splitChars = " \n\t\r";
 	splitCharLen = 4;
     } else if (objc == 3) {
-	splitChars = Tcl_GetStringFromObj(objv[2], &splitCharLen);
+	splitChars = TclGetStringFromObj(objv[2], &splitCharLen);
     } else {
 	Tcl_WrongNumArgs(interp, 1, objv, "string ?splitChars?");
 	return TCL_ERROR;
     }
 
-    stringPtr = Tcl_GetStringFromObj(objv[1], &stringLen);
+    stringPtr = TclGetStringFromObj(objv[1], &stringLen);
     end = stringPtr + stringLen;
     listPtr = Tcl_NewObj();
 
@@ -1172,7 +1172,7 @@
 	}
 
 	for (i = 2; i < objc-2; i++) {
-	    string2 = Tcl_GetStringFromObj(objv[i], &length2);
+	    string2 = TclGetStringFromObj(objv[i], &length2);
 	    if ((length2 > 1)
 		    && strncmp(string2, "-nocase", (size_t)length2) == 0) {
 		nocase = 1;
@@ -1181,7 +1181,8 @@
 		if (i+1 >= objc-2) {
 		    goto str_cmp_args;
 		}
-		if (Tcl_GetIntFromObj(interp, objv[++i],
+		++i;
+		if (TclGetIntFromObj(interp, objv[i],
 			&reqlength) != TCL_OK) {
 		    return TCL_ERROR;
 		}
@@ -1241,8 +1242,8 @@
 	     * we are case-sensitive and no specific length was requested.
 	     */
 
-	    string1 = (char *) Tcl_GetStringFromObj(objv[0], &length1);
-	    string2 = (char *) Tcl_GetStringFromObj(objv[1], &length2);
+	    string1 = (char *) TclGetStringFromObj(objv[0], &length1);
+	    string2 = (char *) TclGetStringFromObj(objv[1], &length2);
 	    if ((reqlength < 0) && !nocase) {
 		strCmpFn = (strCmpFn_t) TclpUtfNcmp2;
 	    } else {
@@ -1310,7 +1311,7 @@
 	     * that point in the string before we think about a match.
 	     */
 
-	    if (TclGetIntForIndex(interp, objv[4], length2 - 1,
+	    if (TclGetIntForIndexM(interp, objv[4], length2 - 1,
 		    &start) != TCL_OK) {
 		return TCL_ERROR;
 	    }
@@ -1372,7 +1373,7 @@
 	if (objv[2]->typePtr == &tclByteArrayType) {
 	    string1 = (char *) Tcl_GetByteArrayFromObj(objv[2], &length1);
 
-	    if (TclGetIntForIndex(interp, objv[3], length1 - 1,
+	    if (TclGetIntForIndexM(interp, objv[3], length1 - 1,
 		    &index) != TCL_OK) {
 		return TCL_ERROR;
 	    }
@@ -1387,7 +1388,7 @@
 
 	    length1 = Tcl_GetCharLength(objv[2]);
 
-	    if (TclGetIntForIndex(interp, objv[3], length1 - 1,
+	    if (TclGetIntForIndexM(interp, objv[3], length1 - 1,
 		    &index) != TCL_OK) {
 		return TCL_ERROR;
 	    }
@@ -1442,7 +1443,7 @@
 	}
 	if (objc != 4) {
 	    for (i = 3; i < objc-1; i++) {
-		string2 = Tcl_GetStringFromObj(objv[i], &length2);
+		string2 = TclGetStringFromObj(objv[i], &length2);
 		if ((length2 > 1) &&
 			strncmp(string2, "-strict", (size_t) length2) == 0) {
 		    strict = 1;
@@ -1470,7 +1471,7 @@
 	 */
 
 	objPtr = objv[objc-1];
-	string1 = Tcl_GetStringFromObj(objPtr, &length1);
+	string1 = TclGetStringFromObj(objPtr, &length1);
 	if (length1 == 0 && index != STR_IS_LIST) {
 	    if (strict) {
 		result = 0;
@@ -1541,7 +1542,7 @@
 	case STR_IS_INT:
 	case STR_IS_WIDE:
 	    if ((((enum isOptions) index) == STR_IS_INT)
-		    && (TCL_OK == Tcl_GetIntFromObj(NULL, objPtr, &i))) {
+		    && (TCL_OK == TclGetIntFromObj(NULL, objPtr, &i))) {
 		break;
 	    }
 	    if ((((enum isOptions) index) == STR_IS_WIDE)
@@ -1591,7 +1592,7 @@
 	     * well-formed lists.
 	     */
 
-	    if (TCL_OK == Tcl_ListObjLength(NULL, objPtr, &length2)) {
+	    if (TCL_OK == TclListObjLength(NULL, objPtr, &length2)) {
 		break;
 	    }
 
@@ -1719,7 +1720,7 @@
 	     * string range to that char index in the string
 	     */
 
-	    if (TclGetIntForIndex(interp, objv[4], length2 - 1,
+	    if (TclGetIntForIndexM(interp, objv[4], length2 - 1,
 		    &start) != TCL_OK) {
 		return TCL_ERROR;
 	    }
@@ -1760,7 +1761,7 @@
 	}
 
 	if ((enum options) index == STR_BYTELENGTH) {
-	    (void) Tcl_GetStringFromObj(objv[2], &length1);
+	    (void) TclGetStringFromObj(objv[2], &length1);
 	} else {
 	    /*
 	     * If we have a ByteArray object, avoid recomputing the string
@@ -1788,7 +1789,7 @@
 	}
 
 	if (objc == 5) {
-	    string2 = Tcl_GetStringFromObj(objv[2], &length2);
+	    string2 = TclGetStringFromObj(objv[2], &length2);
 	    if ((length2 > 1) &&
 		    strncmp(string2, "-nocase", (size_t) length2) == 0) {
 		nocase = 1;
@@ -1842,7 +1843,7 @@
 	    }
 	    Tcl_DictObjDone(&search);
 	} else {
-	    if (Tcl_ListObjGetElements(interp, objv[objc-2],
+	    if (TclListObjGetElements(interp, objv[objc-2],
 		    &mapElemc, &mapElemv) != TCL_OK) {
 		return TCL_ERROR;
 	    }
@@ -2037,7 +2038,7 @@
 	}
 
 	if (objc == 5) {
-	    string2 = Tcl_GetStringFromObj(objv[2], &length2);
+	    string2 = TclGetStringFromObj(objv[2], &length2);
 	    if ((length2 > 1) &&
 		strncmp(string2, "-nocase", (size_t) length2) == 0) {
 		nocase = 1;
@@ -2079,8 +2080,8 @@
 	    length1 = Tcl_GetCharLength(objv[2]) - 1;
 	}
 
-	if (TclGetIntForIndex(interp, objv[3], length1, &first) != TCL_OK ||
-		TclGetIntForIndex(interp, objv[4], length1, &last) != TCL_OK) {
+	if (TclGetIntForIndexM(interp, objv[3], length1, &first) != TCL_OK ||
+		TclGetIntForIndexM(interp, objv[4], length1, &last) != TCL_OK) {
 	    return TCL_ERROR;
 	}
 
@@ -2110,14 +2111,14 @@
 	    return TCL_ERROR;
 	}
 
-	if (Tcl_GetIntFromObj(interp, objv[3], &count) != TCL_OK) {
+	if (TclGetIntFromObj(interp, objv[3], &count) != TCL_OK) {
 	    return TCL_ERROR;
 	}
 
 	if (count == 1) {
 	    Tcl_SetObjResult(interp, objv[2]);
 	} else if (count > 1) {
-	    string1 = Tcl_GetStringFromObj(objv[2], &length1);
+	    string1 = TclGetStringFromObj(objv[2], &length1);
 	    if (length1 > 0) {
 		/*
 		 * Only build up a string that has data. Instead of building
@@ -2173,8 +2174,8 @@
 	ustring1 = Tcl_GetUnicodeFromObj(objv[2], &length1);
 	length1--;
 
-	if (TclGetIntForIndex(interp, objv[3], length1, &first) != TCL_OK ||
-		TclGetIntForIndex(interp, objv[4], length1, &last) != TCL_OK){
+	if (TclGetIntForIndexM(interp, objv[3], length1, &first) != TCL_OK ||
+		TclGetIntForIndexM(interp, objv[4], length1, &last) != TCL_OK){
 	    return TCL_ERROR;
 	}
 
@@ -2215,7 +2216,7 @@
 	    return TCL_ERROR;
 	}
 
-	string1 = Tcl_GetStringFromObj(objv[2], &length1);
+	string1 = TclGetStringFromObj(objv[2], &length1);
 
 	if (objc == 3) {
 	    Tcl_Obj *resultPtr = Tcl_NewStringObj(string1, length1);
@@ -2234,7 +2235,7 @@
 	    Tcl_Obj *resultPtr;
 
 	    length1 = Tcl_NumUtfChars(string1, length1) - 1;
-	    if (TclGetIntForIndex(interp,objv[3],length1, &first) != TCL_OK) {
+	    if (TclGetIntForIndexM(interp,objv[3],length1, &first) != TCL_OK) {
 		return TCL_ERROR;
 	    }
 	    if (first < 0) {
@@ -2242,7 +2243,7 @@
 	    }
 	    last = first;
 
-	    if ((objc == 5) && (TclGetIntForIndex(interp, objv[4], length1,
+	    if ((objc == 5) && (TclGetIntForIndexM(interp, objv[4], length1,
 		    &last) != TCL_OK)) {
 		return TCL_ERROR;
 	    }
@@ -2258,7 +2259,7 @@
 	    start = Tcl_UtfAtIndex(string1, first);
 	    end = Tcl_UtfAtIndex(start, last - first + 1);
 	    resultPtr = Tcl_NewStringObj(string1, end - string1);
-	    string2 = Tcl_GetString(resultPtr) + (start - string1);
+	    string2 = TclGetString(resultPtr) + (start - string1);
 
 	    if ((enum options) index == STR_TOLOWER) {
 		length2 = Tcl_UtfToLower(string2);
@@ -2293,7 +2294,7 @@
 
     dotrim:
 	if (objc == 4) {
-	    string2 = Tcl_GetStringFromObj(objv[3], &length2);
+	    string2 = TclGetStringFromObj(objv[3], &length2);
 	} else if (objc == 3) {
 	    string2 = " \t\n\r";
 	    length2 = strlen(string2);
@@ -2301,7 +2302,7 @@
 	    Tcl_WrongNumArgs(interp, 2, objv, "string ?chars?");
 	    return TCL_ERROR;
 	}
-	string1 = Tcl_GetStringFromObj(objv[2], &length1);
+	string1 = TclGetStringFromObj(objv[2], &length1);
 	checkEnd = string2 + length2;
 
 	if (left) {
@@ -2371,9 +2372,9 @@
 	    return TCL_ERROR;
 	}
 
-	string1 = Tcl_GetStringFromObj(objv[2], &length1);
+	string1 = TclGetStringFromObj(objv[2], &length1);
 	numChars = Tcl_NumUtfChars(string1, length1);
-	if (TclGetIntForIndex(interp, objv[3], numChars-1, &index) != TCL_OK){
+	if (TclGetIntForIndexM(interp, objv[3], numChars-1, &index) != TCL_OK){
 	    return TCL_ERROR;
 	}
 	if (index < 0) {
@@ -2408,9 +2409,9 @@
 	    return TCL_ERROR;
 	}
 
-	string1 = Tcl_GetStringFromObj(objv[2], &length1);
+	string1 = TclGetStringFromObj(objv[2], &length1);
 	numChars = Tcl_NumUtfChars(string1, length1);
-	if (TclGetIntForIndex(interp, objv[3], numChars-1, &index) != TCL_OK){
+	if (TclGetIntForIndexM(interp, objv[3], numChars-1, &index) != TCL_OK){
 	    return TCL_ERROR;
 	}
 	if (index >= numChars) {
@@ -2672,7 +2673,7 @@
 	Tcl_Obj **listv;
 	blist = objv[0];
 
-	if (Tcl_ListObjGetElements(interp, objv[0], &objc, &listv) != TCL_OK){
+	if (TclListObjGetElements(interp, objv[0], &objc, &listv) != TCL_OK){
 	    return TCL_ERROR;
 	}
 
@@ -2738,7 +2739,7 @@
 	 * See if the pattern matches the string.
 	 */
 
-	pattern = Tcl_GetStringFromObj(objv[i], &patternLength);
+	pattern = TclGetStringFromObj(objv[i], &patternLength);
 
 	if ((i == objc - 2) && (*pattern == 'd')
 		&& (strcmp(pattern, "default") == 0)) {
@@ -2921,7 +2922,7 @@
 
 	    ctxPtr->line = (int *) ckalloc(objc * sizeof(int));
 	    ctxPtr->nline = objc;
-	    TclListLines(Tcl_GetString(blist), bline, objc, ctxPtr->line);
+	    TclListLines(TclGetString(blist), bline, objc, ctxPtr->line);
 	} else {
 	    /*
 	     * This is either a dynamic code word, when all elements are
@@ -3026,7 +3027,7 @@
     if (objc == 2) {
 	count = 1;
     } else if (objc == 3) {
-	result = Tcl_GetIntFromObj(interp, objv[2], &count);
+	result = TclGetIntFromObj(interp, objv[2], &count);
 	if (result != TCL_OK) {
 	    return result;
 	}
Index: generic/tclCompCmds.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCompCmds.c,v
retrieving revision 1.121
diff -u -r1.121 tclCompCmds.c
--- generic/tclCompCmds.c	18 Oct 2007 21:16:18 -0000	1.121
+++ generic/tclCompCmds.c	11 Nov 2007 19:28:36 -0000
@@ -694,7 +694,7 @@
 
 	    intObj = Tcl_NewStringObj(word, numBytes);
 	    Tcl_IncrRefCount(intObj);
-	    code = Tcl_GetIntFromObj(NULL, intObj, &incrAmount);
+	    code = TclGetIntFromObj(NULL, intObj, &incrAmount);
 	    TclDecrRefCount(intObj);
 	    if (code != TCL_OK) {
 		return TCL_ERROR;
@@ -2200,7 +2200,7 @@
 	    int code;
 	    Tcl_Obj *intObj = Tcl_NewStringObj(word, numBytes);
 	    Tcl_IncrRefCount(intObj);
-	    code = Tcl_GetIntFromObj(NULL, intObj, &immValue);
+	    code = TclGetIntFromObj(NULL, intObj, &immValue);
 	    TclDecrRefCount(intObj);
 	    if ((code == TCL_OK) && (-127 <= immValue) && (immValue <= 127)) {
 		haveImmValue = 1;
@@ -2531,7 +2531,7 @@
 	int idx, result;
 
 	tmpObj = Tcl_NewStringObj(idxTokenPtr[1].start, idxTokenPtr[1].size);
-	result = Tcl_GetIntFromObj(NULL, tmpObj, &idx);
+	result = TclGetIntFromObj(NULL, tmpObj, &idx);
 	TclDecrRefCount(tmpObj);
 
 	if (result == TCL_OK && idx >= 0) {
@@ -3243,7 +3243,7 @@
 {
     Tcl_Obj *msg = Tcl_GetObjResult(interp);
     int numBytes;
-    const char *bytes = Tcl_GetStringFromObj(msg, &numBytes);
+    const char *bytes = TclGetStringFromObj(msg, &numBytes);
 
     TclEmitPush(TclRegisterNewLiteral(envPtr, bytes, numBytes), envPtr);
     CompileReturnInternal(envPtr, INST_SYNTAX, TCL_ERROR, 0,
@@ -3505,7 +3505,7 @@
 
 		    Tcl_Obj *copy = Tcl_NewStringObj(str, length);
 		    Tcl_IncrRefCount(copy);
-		    exactMatch = TclMatchIsTrivial(Tcl_GetString(copy));
+		    exactMatch = TclMatchIsTrivial(TclGetString(copy));
 		    TclDecrRefCount(copy);
 		}
 		PushLiteral(envPtr, str, length);
@@ -5346,7 +5346,7 @@
 	}
     }
 	    
-    tailName = Tcl_GetStringFromObj(tailPtr, &len);
+    tailName = TclGetStringFromObj(tailPtr, &len);
 
     if (len) {
 	if (*(tailName+len-1) == ')') {
Index: generic/tclCompExpr.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCompExpr.c,v
retrieving revision 1.88
diff -u -r1.88 tclCompExpr.c
--- generic/tclCompExpr.c	17 Oct 2007 04:35:18 -0000	1.88
+++ generic/tclCompExpr.c	11 Nov 2007 19:28:36 -0000
@@ -2057,8 +2057,8 @@
 	TclAdvanceLines(&envPtr->line, script,
 		script + TclParseAllWhiteSpace(script, numBytes));
 
-	Tcl_ListObjGetElements(NULL, litList, &objc, (Tcl_Obj ***)&litObjv);
-	Tcl_ListObjGetElements(NULL, funcList, &objc, &funcObjv);
+	TclListObjGetElements(NULL, litList, &objc, (Tcl_Obj ***)&litObjv);
+	TclListObjGetElements(NULL, funcList, &objc, &funcObjv);
 	CompileExprTree(interp, opTree, 0, &litObjv, funcObjv,
 		parsePtr->tokenPtr, envPtr, 1 /* optimize */);
     } else {
@@ -2206,7 +2206,8 @@
 
 		Tcl_DStringInit(&cmdName);
 		Tcl_DStringAppend(&cmdName, "tcl::mathfunc::", -1);
-		p = Tcl_GetStringFromObj(*funcObjv++, &length);
+		p = TclGetStringFromObj(*funcObjv, &length);
+		funcObjv++;
 		Tcl_DStringAppend(&cmdName, p, length);
 		TclEmitPush(TclRegisterNewNSLiteral(envPtr,
 			Tcl_DStringValue(&cmdName),
@@ -2345,7 +2346,7 @@
 	    Tcl_Obj *const *litObjv = *litObjvPtr;
 	    Tcl_Obj *literal = *litObjv;
 	    int length;
-	    const char *bytes = Tcl_GetStringFromObj(literal, &length);
+	    const char *bytes = TclGetStringFromObj(literal, &length);
 
 	    TclEmitPush(TclRegisterNewLiteral(envPtr, bytes, length), envPtr);
 	    (*litObjvPtr)++;
Index: generic/tclCompile.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCompile.c,v
retrieving revision 1.136
diff -u -r1.136 tclCompile.c
--- generic/tclCompile.c	20 Oct 2007 02:15:05 -0000	1.136
+++ generic/tclCompile.c	11 Nov 2007 19:28:38 -0000
@@ -484,7 +484,7 @@
     }
 #endif
 
-    stringPtr = Tcl_GetStringFromObj(objPtr, &length);
+    stringPtr = TclGetStringFromObj(objPtr, &length);
 
     /*
      * TIP #280: Pick up the CmdFrame in which the BC compiler was invoked and
Index: generic/tclDictObj.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclDictObj.c,v
retrieving revision 1.50
diff -u -r1.50 tclDictObj.c
--- generic/tclDictObj.c	8 Sep 2007 22:36:58 -0000	1.50
+++ generic/tclDictObj.c	11 Nov 2007 19:28:41 -0000
@@ -302,12 +302,12 @@
 	 */
 
 	keyPtr = (Tcl_Obj *) Tcl_GetHashKey(&dict->table, hPtr);
-	elem = Tcl_GetStringFromObj(keyPtr, &length);
+	elem = TclGetStringFromObj(keyPtr, &length);
 	dictPtr->length += Tcl_ScanCountedElement(elem, length,
 		&flagPtr[i]) + 1;
 
 	valuePtr = (Tcl_Obj *) Tcl_GetHashValue(hPtr);
-	elem = Tcl_GetStringFromObj(valuePtr, &length);
+	elem = TclGetStringFromObj(valuePtr, &length);
 	dictPtr->length += Tcl_ScanCountedElement(elem, length,
 		&flagPtr[i+1]) + 1;
     }
@@ -321,13 +321,13 @@
     for (i=0,hPtr=Tcl_FirstHashEntry(&dict->table,&search) ; i<numElems ;
 	    i+=2,hPtr=Tcl_NextHashEntry(&search)) {
 	keyPtr = (Tcl_Obj *) Tcl_GetHashKey(&dict->table, hPtr);
-	elem = Tcl_GetStringFromObj(keyPtr, &length);
+	elem = TclGetStringFromObj(keyPtr, &length);
 	dst += Tcl_ConvertCountedElement(elem, length, dst,
 		flagPtr[i] | (i==0 ? 0 : TCL_DONT_QUOTE_HASH) );
 	*(dst++) = ' ';
 
 	valuePtr = (Tcl_Obj *) Tcl_GetHashValue(hPtr);
-	elem = Tcl_GetStringFromObj(valuePtr, &length);
+	elem = TclGetStringFromObj(valuePtr, &length);
 	dst += Tcl_ConvertCountedElement(elem, length, dst,
 		flagPtr[i+1] | TCL_DONT_QUOTE_HASH);
 	*(dst++) = ' ';
@@ -388,7 +388,7 @@
 	int objc, i;
 	Tcl_Obj **objv;
 
-	if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) {
+	if (TclListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) {
 	    return TCL_ERROR;
 	}
 	if (objc & 1) {
@@ -405,7 +405,7 @@
 	 */
 
 	if (Tcl_IsShared(objPtr)) {
-	    (void) Tcl_GetString(objPtr);
+	    (void) TclGetString(objPtr);
 	}
 
 	/*
@@ -438,7 +438,7 @@
      * Get the string representation. Make it up-to-date if necessary.
      */
 
-    string = Tcl_GetStringFromObj(objPtr, &length);
+    string = TclGetStringFromObj(objPtr, &length);
     limit = (string + length);
 
     /*
@@ -2187,7 +2187,7 @@
 	return TCL_ERROR;
     }
 
-    if (Tcl_ListObjGetElements(interp, objv[2], &varc, &varv) != TCL_OK) {
+    if (TclListObjGetElements(interp, objv[2], &varc, &varv) != TCL_OK) {
 	return TCL_ERROR;
     }
     if (varc != 2) {
@@ -2512,7 +2512,7 @@
 	 * copying from the "dict for" implementation has occurred!
 	 */
 
-	if (Tcl_ListObjGetElements(interp, objv[4], &varc, &varv) != TCL_OK) {
+	if (TclListObjGetElements(interp, objv[4], &varc, &varv) != TCL_OK) {
 	    return TCL_ERROR;
 	}
 	if (varc != 2) {
@@ -2918,7 +2918,7 @@
      * Now process our updates on the leaf dictionary.
      */
 
-    Tcl_ListObjGetElements(NULL, keysPtr, &keyc, &keyv);
+    TclListObjGetElements(NULL, keysPtr, &keyc, &keyv);
     for (i=0 ; i<keyc ; i++) {
 	valPtr = Tcl_ObjGetVar2(interp, keyv[i], NULL, 0);
 	if (valPtr == NULL) {
Index: generic/tclExecute.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclExecute.c,v
retrieving revision 1.344
diff -u -r1.344 tclExecute.c
--- generic/tclExecute.c	10 Nov 2007 23:36:55 -0000	1.344
+++ generic/tclExecute.c	11 Nov 2007 19:28:42 -0000
@@ -1180,7 +1180,7 @@
 
 	/* TIP #280: No invoker (yet) - Expression compilation. */
 	int length;
-	const char *string = Tcl_GetStringFromObj(objPtr, &length);
+	const char *string = TclGetStringFromObj(objPtr, &length);
 	TclInitCompileEnv(interp, &compEnv, string, length, NULL, 0);
 	TclCompileExpr(interp, string, length, &compEnv);
 
@@ -1416,11 +1416,11 @@
 
     if (GetNumberFromObj(NULL, valuePtr, &ptr1, &type1) != TCL_OK) {
 	/* Produce error message (reparse?!) */
-	return Tcl_GetIntFromObj(interp, valuePtr, &type1);
+	return TclGetIntFromObj(interp, valuePtr, &type1);
     }
     if (GetNumberFromObj(NULL, incrPtr, &ptr2, &type2) != TCL_OK) {
 	/* Produce error message (reparse?!) */
-	Tcl_GetIntFromObj(interp, incrPtr, &type1);
+	TclGetIntFromObj(interp, incrPtr, &type1);
 	Tcl_AddErrorInfo(interp, "\n    (reading increment)");
 	return TCL_ERROR;
     }
@@ -1461,14 +1461,14 @@
 	 * Produce error message (reparse?!)
 	 */
 
-	return Tcl_GetIntFromObj(interp, valuePtr, &type1);
+	return TclGetIntFromObj(interp, valuePtr, &type1);
     }
     if ((type2 == TCL_NUMBER_DOUBLE) || (type2 == TCL_NUMBER_NAN)) {
 	/*
 	 * Produce error message (reparse?!)
 	 */
 
-	Tcl_GetIntFromObj(interp, incrPtr, &type1);
+	TclGetIntFromObj(interp, incrPtr, &type1);
 	Tcl_AddErrorInfo(interp, "\n    (reading increment)");
 	return TCL_ERROR;
     }
@@ -1965,7 +1965,7 @@
 	 */
 
 	for (currPtr=&OBJ_AT_DEPTH(opnd-2); currPtr<=&OBJ_AT_TOS; currPtr++) {
-	    bytes = Tcl_GetStringFromObj(*currPtr, &length);
+	    bytes = TclGetStringFromObj(*currPtr, &length);
 	    if (bytes != NULL) {
 		appendLen += length;
 	    }
@@ -1994,7 +1994,7 @@
 	 */
 
 	objResultPtr = OBJ_AT_DEPTH(opnd-1);
-	bytes = Tcl_GetStringFromObj(objResultPtr, &length);
+	bytes = TclGetStringFromObj(objResultPtr, &length);
 #if !TCL_COMPILE_DEBUG
 	if (!Tcl_IsShared(objResultPtr)) {
 	    Tcl_SetObjLength(objResultPtr, (length + appendLen));
@@ -2016,7 +2016,7 @@
 	 */
 
 	for (; currPtr <= &OBJ_AT_TOS; currPtr++) {
-	    bytes = Tcl_GetStringFromObj(*currPtr, &length);
+	    bytes = TclGetStringFromObj(*currPtr, &length);
 	    if (bytes != NULL) {
 		memcpy(p, bytes, (size_t) length);
 		p += length;
@@ -2063,7 +2063,7 @@
 	 */
 
 	valuePtr = OBJ_AT_TOS;
-	if (Tcl_ListObjGetElements(interp, valuePtr, &objc, &objv) != TCL_OK){
+	if (TclListObjGetElements(interp, valuePtr, &objc, &objv) != TCL_OK){
 	    TRACE_WITH_OBJ(("%.30s => ERROR: ", O2S(valuePtr)),
 		    Tcl_GetObjResult(interp));
 	    result = TCL_ERROR;
@@ -3317,7 +3317,7 @@
 	opnd = TclGetInt4AtPtr(pc+1);
 	jtPtr = (JumptableInfo *) codePtr->auxDataArrayPtr[opnd].clientData;
 	TRACE(("%d => %.20s ", opnd, O2S(OBJ_AT_TOS)));
-	hPtr = Tcl_FindHashEntry(&jtPtr->hashTable, Tcl_GetString(OBJ_AT_TOS));
+	hPtr = Tcl_FindHashEntry(&jtPtr->hashTable, TclGetString(OBJ_AT_TOS));
 	if (hPtr != NULL) {
 	    int jumpOffset = PTR2INT(Tcl_GetHashValue(hPtr));
 
@@ -3397,7 +3397,7 @@
 
 	valuePtr = OBJ_AT_TOS;
 
-	result = Tcl_ListObjLength(interp, valuePtr, &length);
+	result = TclListObjLength(interp, valuePtr, &length);
 	if (result == TCL_OK) {
 	    TclNewIntObj(objResultPtr, length);
 	    TRACE(("%.20s => %d\n", O2S(valuePtr), length));
@@ -3429,10 +3429,9 @@
 	 * Extract the desired list element.
 	 */
 
-	result = Tcl_ListObjGetElements(interp, valuePtr, &listc, &listv);
+	result = TclListObjGetElements(interp, valuePtr, &listc, &listv);
 	if ((result == TCL_OK) && (value2Ptr->typePtr != &tclListType)
-		&& (TclGetIntForIndex(NULL , value2Ptr, listc-1, &idx) == TCL_OK)) {
-
+		&& (TclGetIntForIndexM(NULL , value2Ptr, listc-1, &idx) == TCL_OK)) {
 	    Tcl_DecrRefCount(value2Ptr);
 	    tosPtr--;
 	    pcAdjustment = 1;
@@ -3472,7 +3471,8 @@
 	 * in the process.
 	 */
 
-	result = Tcl_ListObjGetElements(interp, valuePtr, &listc, &listv);
+	result = TclListObjGetElements(interp, valuePtr, &listc, &listv);
+	
 	if (result == TCL_OK) {
 	    /*
 	     * Select the list item based on the index. Negative operand means
@@ -3658,8 +3658,7 @@
 	 * Get the contents of the list, making sure that it really is a list
 	 * in the process.
 	 */
-
-	result = Tcl_ListObjGetElements(interp, valuePtr, &listc, &listv);
+	result = TclListObjGetElements(interp, valuePtr, &listc, &listv);
 
 	/*
 	 * Skip a lot of work if we're about to throw the result away (common
@@ -3736,8 +3735,8 @@
 	valuePtr = OBJ_UNDER_TOS;
 
 	/* TODO: Consider more efficient tests than strcmp() */
-	s1 = Tcl_GetStringFromObj(valuePtr, &s1len);
-	result = Tcl_ListObjLength(interp, value2Ptr, &llen);
+	s1 = TclGetStringFromObj(valuePtr, &s1len);
+	result = TclListObjLength(interp, value2Ptr, &llen);
 	if (result != TCL_OK) {
 	    TRACE_WITH_OBJ(("\"%.30s\" \"%.30s\" => ERROR: ", O2S(valuePtr),
 		    O2S(value2Ptr)), Tcl_GetObjResult(interp));
@@ -3753,7 +3752,7 @@
 	    do {
 		Tcl_ListObjIndex(NULL, value2Ptr, i, &o);
 		if (o != NULL) {
-		    s2 = Tcl_GetStringFromObj(o, &s2len);
+		    s2 = TclGetStringFromObj(o, &s2len);
 		} else {
 		    s2 = "";
 		}
@@ -3822,8 +3821,8 @@
 	    char *s1, *s2;
 	    int s1len, s2len;
 
-	    s1 = Tcl_GetStringFromObj(valuePtr, &s1len);
-	    s2 = Tcl_GetStringFromObj(value2Ptr, &s2len);
+	    s1 = TclGetStringFromObj(valuePtr, &s1len);
+	    s2 = TclGetStringFromObj(value2Ptr, &s2len);
 	    if (s1len == s2len) {
 		/*
 		 * We only need to check (in)equality when we have equal
@@ -3920,8 +3919,8 @@
 	     * \xC0\x80 null encoding for utf-8.
 	     */
 
-	    s1 = Tcl_GetStringFromObj(valuePtr, &s1len);
-	    s2 = Tcl_GetStringFromObj(value2Ptr, &s2len);
+	    s1 = TclGetStringFromObj(valuePtr, &s1len);
+	    s2 = TclGetStringFromObj(value2Ptr, &s2len);
 	    iResult = TclpUtfNcmp2(s1, s2,
 		    (size_t) ((s1len < s2len) ? s1len : s2len));
 	}
@@ -4018,7 +4017,7 @@
 	    length = Tcl_GetCharLength(valuePtr);
 	}
 
-	result = TclGetIntForIndex(interp, value2Ptr, length - 1, &index);
+	result = TclGetIntForIndexM(interp, value2Ptr, length - 1, &index);
 	if (result != TCL_OK) {
 	    goto checkForCatch;
 	}
@@ -6198,7 +6197,7 @@
 
 	    listVarPtr = &(compiledLocals[listTmpIndex]);
 	    listPtr = listVarPtr->value.objPtr;
-	    result = Tcl_ListObjLength(interp, listPtr, &listLen);
+	    result = TclListObjLength(interp, listPtr, &listLen);
 	    if (result == TCL_OK) {
 		if (listLen > (iterNum * numVars)) {
 		    continueLoop = 1;
@@ -6228,7 +6227,7 @@
 
 		listVarPtr = &(compiledLocals[listTmpIndex]);
 		listPtr = TclListObjCopy(NULL, listVarPtr->value.objPtr);
-		Tcl_ListObjGetElements(NULL, listPtr, &listLen, &elements);
+		TclListObjGetElements(interp, listPtr, &listLen, &elements);
 
 		valIndex = (iterNum * numVars);
 		for (j = 0;  j < numVars;  j++) {
@@ -6722,7 +6721,7 @@
 		goto dictUpdateStartFailed;
 	    }
 	}
-	if (Tcl_ListObjGetElements(interp, OBJ_AT_TOS, &length,
+	if (TclListObjGetElements(interp, OBJ_AT_TOS, &length,
 		&keyPtrPtr) != TCL_OK) {
 	    goto dictUpdateStartFailed;
 	}
@@ -6777,7 +6776,7 @@
 	    NEXT_INST_F(9, 1, 0);
 	}
 	if (Tcl_DictObjSize(interp, dictPtr, &length) != TCL_OK
-		|| Tcl_ListObjGetElements(interp, OBJ_AT_TOS, &length,
+		|| TclListObjGetElements(interp, OBJ_AT_TOS, &length,
 			&keyPtrPtr) != TCL_OK) {
 	    result = TCL_ERROR;
 	    goto checkForCatch;
Index: generic/tclGet.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclGet.c,v
retrieving revision 1.17
diff -u -r1.17 tclGet.c
--- generic/tclGet.c	7 Nov 2005 15:13:36 -0000	1.17
+++ generic/tclGet.c	11 Nov 2007 19:28:42 -0000
@@ -50,7 +50,7 @@
     obj.length = strlen(src);
     obj.typePtr = NULL;
 
-    code = Tcl_GetIntFromObj(interp, &obj, intPtr);
+    code = TclGetIntFromObj(interp, &obj, intPtr);
     if (obj.refCount > 1) {
 	Tcl_Panic("invalid sharing of Tcl_Obj on C stack");
     }
@@ -94,7 +94,7 @@
     obj.length = strlen(src);
     obj.typePtr = NULL;
 
-    code = Tcl_GetLongFromObj(interp, &obj, longPtr);
+    code = TclGetLongFromObj(interp, &obj, longPtr);
     if (obj.refCount > 1) {
 	Tcl_Panic("invalid sharing of Tcl_Obj on C stack");
     }
Index: generic/tclIO.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIO.c,v
retrieving revision 1.127
diff -u -r1.127 tclIO.c
--- generic/tclIO.c	8 Nov 2007 07:10:44 -0000	1.127
+++ generic/tclIO.c	11 Nov 2007 19:28:43 -0000
@@ -3300,7 +3300,7 @@
 	src = (char *) Tcl_GetByteArrayFromObj(objPtr, &srcLen);
 	return WriteBytes(chanPtr, src, srcLen);
     } else {
-	src = Tcl_GetStringFromObj(objPtr, &srcLen);
+	src = TclGetStringFromObj(objPtr, &srcLen);
 	return WriteChars(chanPtr, src, srcLen);
     }
 }
@@ -3815,7 +3815,7 @@
     TclNewObj(objPtr);
     charsStored = Tcl_GetsObj(chan, objPtr);
     if (charsStored > 0) {
-	string = Tcl_GetStringFromObj(objPtr, &length);
+	string = TclGetStringFromObj(objPtr, &length);
 	Tcl_DStringAppend(lineRead, string, length);
     }
     TclDecrRefCount(objPtr);
@@ -3892,7 +3892,7 @@
      * newline in the available input.
      */
 
-    Tcl_GetStringFromObj(objPtr, &oldLength);
+    TclGetStringFromObj(objPtr, &oldLength);
     oldFlags = statePtr->inputEncodingFlags;
     oldState = statePtr->inputEncodingState;
     oldRemoved = BUFFER_PADDING;
@@ -5094,14 +5094,14 @@
 	     * been pure Unicode).
 	     */
 
-	    Tcl_GetString(objPtr);
+	    TclGetString(objPtr);
 	}
 	offset = 0;
     } else {
 	if (encoding == NULL) {
 	    Tcl_GetByteArrayFromObj(objPtr, &offset);
 	} else {
-	    Tcl_GetStringFromObj(objPtr, &offset);
+	    TclGetStringFromObj(objPtr, &offset);
 	}
     }
 
@@ -8546,7 +8546,7 @@
 	    buffer = csPtr->buffer;
 	    sizeb = size;
 	} else {
-	    buffer = Tcl_GetStringFromObj(bufObj, &sizeb);
+	    buffer = TclGetStringFromObj(bufObj, &sizeb);
 	}
 
 	if (outBinary || sameEncoding) {
@@ -10275,7 +10275,7 @@
 	     * !"error", !integer, integer != 1 (numeric code for error)
 	     */
 
-	    res = Tcl_GetIntFromObj(NULL, lv[i+1], &val);
+	    res = TclGetIntFromObj(NULL, lv[i+1], &val);
 	    if (((res == TCL_OK) && (val != 1)) || ((res != TCL_OK) &&
 		    (0 != strcmp(TclGetString(lv[i+1]), "error")))) {
 		newcode = 1;
@@ -10285,7 +10285,7 @@
 	     * !integer, integer != 0
 	     */
 
-	    res = Tcl_GetIntFromObj(NULL, lv [i+1], &val);
+	    res = TclGetIntFromObj(NULL, lv [i+1], &val);
 	    if ((res != TCL_OK) || (val != 0)) {
 		newlevel = 0;
 	    }
Index: generic/tclIOCmd.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIOCmd.c,v
retrieving revision 1.44
diff -u -r1.44 tclIOCmd.c
--- generic/tclIOCmd.c	15 Oct 2007 21:27:48 -0000	1.44
+++ generic/tclIOCmd.c	11 Nov 2007 19:28:43 -0000
@@ -77,19 +77,19 @@
 	break;
 
     case 3: /* [puts -nonewline $x] or [puts $chan $x] */
-	if (strcmp(Tcl_GetString(objv[1]), "-nonewline") == 0) {
+	if (strcmp(TclGetString(objv[1]), "-nonewline") == 0) {
 	    newline = 0;
 	    channelId = "stdout";
 	} else {
 	    newline = 1;
-	    channelId = Tcl_GetString(objv[1]);
+	    channelId = TclGetString(objv[1]);
 	}
 	string = objv[2];
 	break;
 
     case 4: /* [puts -nonewline $chan $x] or [puts $chan $x nonewline] */
-	if (strcmp(Tcl_GetString(objv[1]), "-nonewline") == 0) {
-	    channelId = Tcl_GetString(objv[2]);
+	if (strcmp(TclGetString(objv[1]), "-nonewline") == 0) {
+	    channelId = TclGetString(objv[2]);
 	    string = objv[3];
 	} else {
 	    /*
@@ -101,14 +101,14 @@
 	    char *arg;
 	    int length;
 
-	    arg = Tcl_GetStringFromObj(objv[3], &length);
+	    arg = TclGetStringFromObj(objv[3], &length);
 	    if ((length != 9)
 		    || (strncmp(arg, "nonewline", (size_t) length) != 0)) {
 		Tcl_AppendResult(interp, "bad argument \"", arg,
 			"\": should be \"nonewline\"", NULL);
 		return TCL_ERROR;
 	    }
-	    channelId = Tcl_GetString(objv[1]);
+	    channelId = TclGetString(objv[1]);
 	    string = objv[2];
 	}
 	newline = 0;
@@ -190,7 +190,7 @@
 	Tcl_WrongNumArgs(interp, 1, objv, "channelId");
 	return TCL_ERROR;
     }
-    channelId = Tcl_GetString(objv[1]);
+    channelId = TclGetString(objv[1]);
     chan = Tcl_GetChannel(interp, channelId, &mode);
     if (chan == (Tcl_Channel) NULL) {
 	return TCL_ERROR;
@@ -253,7 +253,7 @@
 	Tcl_WrongNumArgs(interp, 1, objv, "channelId ?varName?");
 	return TCL_ERROR;
     }
-    name = Tcl_GetString(objv[1]);
+    name = TclGetString(objv[1]);
     chan = Tcl_GetChannel(interp, name, &mode);
     if (chan == (Tcl_Channel) NULL) {
 	return TCL_ERROR;
@@ -352,7 +352,7 @@
 
     i = 1;
     newline = 0;
-    if (strcmp(Tcl_GetString(objv[1]), "-nonewline") == 0) {
+    if (strcmp(TclGetString(objv[1]), "-nonewline") == 0) {
 	newline = 1;
 	i++;
     }
@@ -361,7 +361,7 @@
 	goto argerror;
     }
 
-    name = Tcl_GetString(objv[i]);
+    name = TclGetString(objv[i]);
     chan = Tcl_GetChannel(interp, name, &mode);
     if (chan == (Tcl_Channel) NULL) {
 	return TCL_ERROR;
@@ -382,9 +382,9 @@
     if (i < objc) {
 	char *arg;
 
-	arg = Tcl_GetString(objv[i]);
+	arg = TclGetString(objv[i]);
 	if (isdigit(UCHAR(arg[0]))) { /* INTL: digit */
-	    if (Tcl_GetIntFromObj(interp, objv[i], &toRead) != TCL_OK) {
+	    if (TclGetIntFromObj(interp, objv[i], &toRead) != TCL_OK) {
 		return TCL_ERROR;
 	    }
 	} else if (strcmp(arg, "nonewline") == 0) {
@@ -424,7 +424,7 @@
 	char *result;
 	int length;
 
-	result = Tcl_GetStringFromObj(resultPtr, &length);
+	result = TclGetStringFromObj(resultPtr, &length);
 	if (result[length - 1] == '\n') {
 	    Tcl_SetObjLength(resultPtr, length - 1);
 	}
@@ -475,7 +475,7 @@
 	Tcl_WrongNumArgs(interp, 1, objv, "channelId offset ?origin?");
 	return TCL_ERROR;
     }
-    chanName = Tcl_GetString(objv[1]);
+    chanName = TclGetString(objv[1]);
     chan = Tcl_GetChannel(interp, chanName, NULL);
     if (chan == (Tcl_Channel) NULL) {
 	return TCL_ERROR;
@@ -548,7 +548,7 @@
      * channel table of this interpreter.
      */
 
-    chanName = Tcl_GetString(objv[1]);
+    chanName = TclGetString(objv[1]);
     chan = Tcl_GetChannel(interp, chanName, NULL);
     if (chan == (Tcl_Channel) NULL) {
 	return TCL_ERROR;
@@ -603,7 +603,7 @@
 	return TCL_ERROR;
     }
 
-    arg = Tcl_GetString(objv[1]);
+    arg = TclGetString(objv[1]);
     chan = Tcl_GetChannel(interp, arg, NULL);
     if (chan == (Tcl_Channel) NULL) {
 	return TCL_ERROR;
@@ -630,7 +630,7 @@
 	    resultPtr = Tcl_DuplicateObj(resultPtr);
 	    Tcl_SetObjResult(interp, resultPtr);
 	}
-	string = Tcl_GetStringFromObj(resultPtr, &len);
+	string = TclGetStringFromObj(resultPtr, &len);
 	if ((len > 0) && (string[len - 1] == '\n')) {
 	    Tcl_SetObjLength(resultPtr, len - 1);
 	}
@@ -675,7 +675,7 @@
 	return TCL_ERROR;
     }
 
-    chanName = Tcl_GetString(objv[1]);
+    chanName = TclGetString(objv[1]);
     chan = Tcl_GetChannel(interp, chanName, NULL);
     if (chan == (Tcl_Channel) NULL) {
 	return TCL_ERROR;
@@ -697,7 +697,7 @@
 				 * Tcl_GetChannelOption. */
 
 	Tcl_DStringInit(&ds);
-	optionName = Tcl_GetString(objv[2]);
+	optionName = TclGetString(objv[2]);
 	if (Tcl_GetChannelOption(interp, chan, optionName, &ds) != TCL_OK) {
 	    Tcl_DStringFree(&ds);
 	    return TCL_ERROR;
@@ -707,8 +707,8 @@
     }
 
     for (i = 3; i < objc; i += 2) {
-	optionName = Tcl_GetString(objv[i-1]);
-	valueName = Tcl_GetString(objv[i]);
+	optionName = TclGetString(objv[i-1]);
+	valueName = TclGetString(objv[i]);
 	if (Tcl_SetChannelOption(interp, chan, optionName, valueName)
 		!= TCL_OK) {
 	    return TCL_ERROR;
@@ -753,7 +753,7 @@
 	return TCL_ERROR;
     }
 
-    arg = Tcl_GetString(objv[1]);
+    arg = TclGetString(objv[1]);
     chan = Tcl_GetChannel(interp, arg, &dummy);
     if (chan == NULL) {
 	return TCL_ERROR;
@@ -814,7 +814,7 @@
     keepNewline = 0;
     ignoreStderr = 0;
     for (skip = 1; skip < objc; skip++) {
-	string = Tcl_GetString(objv[skip]);
+	string = TclGetString(objv[skip]);
 	if (string[0] != '-') {
 	    break;
 	}
@@ -841,7 +841,7 @@
      */
 
     background = 0;
-    string = Tcl_GetString(objv[objc - 1]);
+    string = TclGetString(objv[objc - 1]);
     if ((string[0] == '&') && (string[1] == '\0')) {
 	objc--;
 	background = 1;
@@ -862,7 +862,7 @@
      */
 
     for (i = 0; i < argc; i++) {
-	argv[i] = Tcl_GetString(objv[i + skip]);
+	argv[i] = TclGetString(objv[i + skip]);
     }
     argv[argc] = NULL;
     chan = Tcl_OpenCommandChannel(interp, argc, argv, (background ? 0 :
@@ -926,7 +926,7 @@
      */
 
     if (keepNewline == 0) {
-	string = Tcl_GetStringFromObj(resultPtr, &length);
+	string = TclGetStringFromObj(resultPtr, &length);
 	if ((length > 0) && (string[length - 1] == '\n')) {
 	    Tcl_SetObjLength(resultPtr, length - 1);
 	}
@@ -971,7 +971,7 @@
 	return TCL_ERROR;
     }
 
-    arg = Tcl_GetString(objv[1]);
+    arg = TclGetString(objv[1]);
     chan = Tcl_GetChannel(interp, arg, &mode);
     if (chan == NULL) {
 	return TCL_ERROR;
@@ -1023,7 +1023,7 @@
     if (objc == 2) {
 	modeString = "r";
     } else {
-	modeString = Tcl_GetString(objv[2]);
+	modeString = TclGetString(objv[2]);
 	if (objc == 4) {
 	    char *permString = TclGetString(objv[3]);
 	    int code = TCL_ERROR;
@@ -1038,19 +1038,19 @@
 
 		TclNewLiteralStringObj(permObj, "0o");
 		Tcl_AppendToObj(permObj, permString+scanned+1, -1);
-		code = Tcl_GetIntFromObj(NULL, permObj, &prot);
+		code = TclGetIntFromObj(NULL, permObj, &prot);
 		Tcl_DecrRefCount(permObj);
 	    }
 
 	    if ((code == TCL_ERROR)
-		    && Tcl_GetIntFromObj(interp, objv[3], &prot) != TCL_OK) {
+		    && TclGetIntFromObj(interp, objv[3], &prot) != TCL_OK) {
 		return TCL_ERROR;
 	    }
 	}
     }
 
     pipeline = 0;
-    what = Tcl_GetString(objv[1]);
+    what = TclGetString(objv[1]);
     if (what[0] == '|') {
 	pipeline = 1;
     }
@@ -1410,7 +1410,7 @@
     }
 
     for (a = 1; a < objc; a++) {
-	arg = Tcl_GetString(objv[a]);
+	arg = TclGetString(objv[a]);
 	if (arg[0] != '-') {
 	    break;
 	}
@@ -1434,7 +1434,7 @@
 			"no argument given for -myaddr option", NULL);
 		return TCL_ERROR;
 	    }
-	    myaddr = Tcl_GetString(objv[a]);
+	    myaddr = TclGetString(objv[a]);
 	    break;
 	case SKT_MYPORT: {
 	    char *myPortName;
@@ -1445,7 +1445,7 @@
 			"no argument given for -myport option", NULL);
 		return TCL_ERROR;
 	    }
-	    myPortName = Tcl_GetString(objv[a]);
+	    myPortName = TclGetString(objv[a]);
 	    if (TclSockGetPort(interp, myPortName, "tcp", &myport) != TCL_OK) {
 		return TCL_ERROR;
 	    }
@@ -1464,7 +1464,7 @@
 			"no argument given for -server option", NULL);
 		return TCL_ERROR;
 	    }
-	    script = Tcl_GetString(objv[a]);
+	    script = TclGetString(objv[a]);
 	    break;
 	default:
 	    Tcl_Panic("Tcl_SocketObjCmd: bad option index to SocketOptions");
@@ -1478,7 +1478,7 @@
 	    return TCL_ERROR;
 	}
     } else if (a < objc) {
-	host = Tcl_GetString(objv[a]);
+	host = TclGetString(objv[a]);
 	a++;
     } else {
 	Interp *iPtr;
@@ -1495,7 +1495,7 @@
     }
 
     if (a == objc-1) {
-	if (TclSockGetPort(interp, Tcl_GetString(objv[a]), "tcp",
+	if (TclSockGetPort(interp, TclGetString(objv[a]), "tcp",
 		&port) != TCL_OK) {
 	    return TCL_ERROR;
 	}
@@ -1591,7 +1591,7 @@
      * writable, as appropriate.
      */
 
-    arg = Tcl_GetString(objv[1]);
+    arg = TclGetString(objv[1]);
     inChan = Tcl_GetChannel(interp, arg, &mode);
     if (inChan == (Tcl_Channel) NULL) {
 	return TCL_ERROR;
@@ -1601,7 +1601,7 @@
 		"\" wasn't opened for reading", NULL);
 	return TCL_ERROR;
     }
-    arg = Tcl_GetString(objv[2]);
+    arg = TclGetString(objv[2]);
     outChan = Tcl_GetChannel(interp, arg, &mode);
     if (outChan == (Tcl_Channel) NULL) {
 	return TCL_ERROR;
@@ -1621,7 +1621,7 @@
 	}
 	switch (index) {
 	case FcopySize:
-	    if (Tcl_GetIntFromObj(interp, objv[i+1], &toRead) != TCL_OK) {
+	    if (TclGetIntFromObj(interp, objv[i+1], &toRead) != TCL_OK) {
 		return TCL_ERROR;
 	    }
 	    break;
@@ -1678,7 +1678,7 @@
 	return TCL_ERROR;
     }
 
-    arg = Tcl_GetString(objv[2]);
+    arg = TclGetString(objv[2]);
     chan = Tcl_GetChannel(interp, arg, &mode);
     if (chan == NULL) {
 	return TCL_ERROR;
Index: generic/tclIOGT.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIOGT.c,v
retrieving revision 1.17
diff -u -r1.17 tclIOGT.c
--- generic/tclIOGT.c	17 Apr 2007 14:49:53 -0000	1.17
+++ generic/tclIOGT.c	11 Nov 2007 19:28:44 -0000
@@ -451,7 +451,7 @@
 	 */
 
 	resObj = Tcl_GetObjResult(dataPtr->interp);
-	Tcl_GetIntFromObj(dataPtr->interp, resObj, &dataPtr->maxRead);
+	TclGetIntFromObj(dataPtr->interp, resObj, &dataPtr->maxRead);
 	break;
     }
 
Index: generic/tclIOUtil.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIOUtil.c,v
retrieving revision 1.146
diff -u -r1.146 tclIOUtil.c
--- generic/tclIOUtil.c	15 Aug 2007 17:43:58 -0000	1.146
+++ generic/tclIOUtil.c	11 Nov 2007 19:28:45 -0000
@@ -3813,7 +3813,7 @@
      */
 
     if (lenPtr != NULL) {
-	Tcl_ListObjLength(NULL, result, lenPtr);
+	TclListObjLength(NULL, result, lenPtr);
     }
     return result;
 }
Index: generic/tclIndexObj.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIndexObj.c,v
retrieving revision 1.35
diff -u -r1.35 tclIndexObj.c
--- generic/tclIndexObj.c	20 Jun 2007 18:46:13 -0000	1.35
+++ generic/tclIndexObj.c	11 Nov 2007 19:28:45 -0000
@@ -533,7 +533,7 @@
 		elementStr = ecrPtr->fullSubcmdName;
 		elemLen = strlen(elementStr);
 	    } else {
-		elementStr = Tcl_GetStringFromObj(origObjv[i], &elemLen);
+		elementStr = TclGetStringFromObj(origObjv[i], &elemLen);
 	    }
 	    len = Tcl_ScanCountedElement(elementStr, elemLen, &flags);
 
@@ -588,7 +588,7 @@
 	     * Quote the argument if it contains spaces (Bug 942757).
 	     */
 
-	    elementStr = Tcl_GetStringFromObj(objv[i], &elemLen);
+	    elementStr = TclGetStringFromObj(objv[i], &elemLen);
 	    len = Tcl_ScanCountedElement(elementStr, elemLen, &flags);
 
 	    if (MAY_QUOTE_WORD && len != elemLen) {
Index: generic/tclInt.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclInt.h,v
retrieving revision 1.341
diff -u -r1.341 tclInt.h
--- generic/tclInt.h	10 Nov 2007 20:49:43 -0000	1.341
+++ generic/tclInt.h	11 Nov 2007 19:28:46 -0000
@@ -2099,17 +2099,56 @@
 } List;
 
 /*
- * Macro used to get the elements of a list object - do NOT forget to verify
- * that it is of list type before using!
+ * Macro used to get the elements of a list object.
  */
 
-#define TclListObjGetElements(listPtr, objc, objv) \
-    { \
-	List *listRepPtr = \
-		(List *) (listPtr)->internalRep.twoPtrValue.ptr1;\
-	(objc) = listRepPtr->elemCount;\
-	(objv) = &listRepPtr->elements;\
-    }
+#define ListRepPtr(listPtr) \
+    ((List *) (listPtr)->internalRep.twoPtrValue.ptr1)
+
+#define ListObjGetElements(listPtr, objc, objv) \
+    ((objv) = &(ListRepPtr(listPtr)->elements), \
+     (objc) = ListRepPtr(listPtr)->elemCount)
+
+#define ListObjLength(listPtr, len) \
+    ((len) = ListRepPtr(listPtr)->elemCount)
+
+#define TclListObjGetElements(interp, listPtr, objcPtr, objvPtr) \
+    (((listPtr)->typePtr == &tclListType) \
+	    ? ((ListObjGetElements((listPtr), *(objcPtr), *(objvPtr))), TCL_OK)\
+	    : Tcl_ListObjGetElements((interp), (listPtr), (objcPtr), (objvPtr)))
+
+#define TclListObjLength(interp, listPtr, lenPtr) \
+    (((listPtr)->typePtr == &tclListType) \
+	    ? ((ListObjLength((listPtr), *(lenPtr))), TCL_OK)\
+	    : Tcl_ListObjLength((interp), (listPtr), (lenPtr)))
+
+/*
+ * Macros providing a faster path to integers: Tcl_GetLongFromObj everywhere,
+ * Tcl_GetIntFromObj and TclGetIntForIndex on platforms where longs are ints.
+ *
+ * WARNING: these macros eval their args more than once.
+ */
+
+#define TclGetLongFromObj(interp, objPtr, longPtr) \
+    (((objPtr)->typePtr == &tclIntType)	\
+	    ? ((*(longPtr) = (long) (objPtr)->internalRep.otherValuePtr), TCL_OK) \
+	    : Tcl_GetLongFromObj((interp), (objPtr), (longPtr)))
+
+#if (LONG_MAX == INT_MAX)
+#define TclGetIntFromObj(interp, objPtr, intPtr) \
+    (((objPtr)->typePtr == &tclIntType)	\
+	    ? ((*(intPtr) = (long) (objPtr)->internalRep.otherValuePtr), TCL_OK) \
+	    : Tcl_GetIntFromObj((interp), (objPtr), (intPtr)))
+#define TclGetIntForIndexM(interp, objPtr, endValue, idxPtr) \
+    (((objPtr)->typePtr == &tclIntType)	\
+	    ? ((*(idxPtr) = (long) (objPtr)->internalRep.otherValuePtr), TCL_OK) \
+	    : TclGetIntForIndex((interp), (objPtr), (endValue), (idxPtr)))
+#else
+#define TclGetIntFromObj(interp, objPtr, intPtr) \
+    Tcl_GetIntFromObj((interp), (objPtr), (intPtr))
+#define TclGetIntForIndexM(interp, objPtr, ignore, idxPtr)	\
+    TclGetIntForIndex(interp, objPtr, ignore, idxPtr)
+#endif
 
 /*
  * Flag values for TclTraceDictPath().
@@ -3293,6 +3332,12 @@
 #define TclGetString(objPtr) \
     ((objPtr)->bytes? (objPtr)->bytes : Tcl_GetString((objPtr)))
 
+
+#define TclGetStringFromObj(objPtr, lenPtr) \
+    ((objPtr)->bytes \
+	    ? (*(lenPtr) = (objPtr)->length, (objPtr)->bytes)	\
+	    : Tcl_GetStringFromObj((objPtr), (lenPtr)))
+
 /*
  *----------------------------------------------------------------
  * Macro used by the Tcl core to clean out an object's internal
Index: generic/tclInterp.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclInterp.c,v
retrieving revision 1.78
diff -u -r1.78 tclInterp.c
--- generic/tclInterp.c	6 Sep 2007 19:23:56 -0000	1.78
+++ generic/tclInterp.c	11 Nov 2007 19:28:47 -0000
@@ -597,7 +597,7 @@
 	if (objc == 4) {
 	    return AliasDescribe(interp, slaveInterp, objv[3]);
 	}
-	if ((objc == 5) && (Tcl_GetString(objv[4])[0] == '\0')) {
+	if ((objc == 5) && (TclGetString(objv[4])[0] == '\0')) {
 	    return AliasDelete(interp, slaveInterp, objv[3]);
 	}
 	if (objc > 5) {
@@ -605,7 +605,7 @@
 	    if (masterInterp == (Tcl_Interp *) NULL) {
 		return TCL_ERROR;
 	    }
-	    if (Tcl_GetString(objv[5])[0] == '\0') {
+	    if (TclGetString(objv[5])[0] == '\0') {
 		if (objc == 6) {
 		    return AliasDelete(interp, slaveInterp, objv[3]);
 		}
@@ -813,7 +813,7 @@
 
 	namespaceName = NULL;
 	for (i = 3; i < objc; i++) {
-	    if (Tcl_GetString(objv[i])[0] != '-') {
+	    if (TclGetString(objv[i])[0] != '-') {
 		break;
 	    }
 	    if (Tcl_GetIndexFromObj(interp, objv[i], hiddenOptions, "option",
@@ -826,7 +826,7 @@
 		if (++i == objc) { /* There must be more arguments. */
 		    break;
 		} else {
-		    namespaceName = Tcl_GetString(objv[i]);
+		    namespaceName = TclGetString(objv[i]);
 		}
 	    } else {
 		i++;
@@ -936,7 +936,7 @@
 	if (masterInterp == NULL) {
 	    return TCL_ERROR;
 	}
-	chan = Tcl_GetChannel(masterInterp, Tcl_GetString(objv[3]), NULL);
+	chan = Tcl_GetChannel(masterInterp, TclGetString(objv[3]), NULL);
 	if (chan == NULL) {
 	    TclTransferResult(masterInterp, TCL_OK, interp);
 	    return TCL_ERROR;
@@ -965,7 +965,7 @@
 	    return TCL_ERROR;
 	}
 
-	aliasName = Tcl_GetString(objv[3]);
+	aliasName = TclGetString(objv[3]);
 
 	iiPtr = (InterpInfo *) ((Interp *) slaveInterp)->interpInfo;
 	hPtr = Tcl_FindHashEntry(&iiPtr->slave.aliasTable, aliasName);
@@ -997,7 +997,7 @@
 	if (masterInterp == NULL) {
 	    return TCL_ERROR;
 	}
-	chan = Tcl_GetChannel(masterInterp, Tcl_GetString(objv[3]), NULL);
+	chan = Tcl_GetChannel(masterInterp, TclGetString(objv[3]), NULL);
 	if (chan == NULL) {
 	    TclTransferResult(masterInterp, TCL_OK, interp);
 	    return TCL_ERROR;
@@ -1200,7 +1200,7 @@
 	*targetInterpPtr = aliasPtr->targetInterp;
     }
     if (targetNamePtr != NULL) {
-	*targetNamePtr = Tcl_GetString(objv[0]);
+	*targetNamePtr = TclGetString(objv[0]);
     }
     if (argcPtr != NULL) {
 	*argcPtr = objc - 1;
@@ -1209,7 +1209,7 @@
 	*argvPtr = (CONST char **)
 		ckalloc((unsigned) sizeof(CONST char *) * (objc - 1));
 	for (i = 1; i < objc; i++) {
-	    *argvPtr[i - 1] = Tcl_GetString(objv[i]);
+	    *argvPtr[i - 1] = TclGetString(objv[i]);
 	}
     }
     return TCL_OK;
@@ -1262,7 +1262,7 @@
 	*targetInterpPtr = aliasPtr->targetInterp;
     }
     if (targetNamePtr != (CONST char **) NULL) {
-	*targetNamePtr = Tcl_GetString(objv[0]);
+	*targetNamePtr = TclGetString(objv[0]);
     }
     if (objcPtr != (int *) NULL) {
 	*objcPtr = objc - 1;
@@ -1345,7 +1345,7 @@
 	}
 	cmdNamePtr = nextAliasPtr->objPtr;
 	aliasCmd = Tcl_FindCommand(nextAliasPtr->targetInterp,
-		Tcl_GetString(cmdNamePtr),
+		TclGetString(cmdNamePtr),
 		Tcl_GetGlobalNamespace(nextAliasPtr->targetInterp),
 		/*flags*/ 0);
 	if (aliasCmd == (Tcl_Command) NULL) {
@@ -1431,7 +1431,7 @@
     Tcl_Preserve(masterInterp);
 
     aliasPtr->slaveCmd = Tcl_CreateObjCommand(slaveInterp,
-	    Tcl_GetString(namePtr), AliasObjCmd, (ClientData) aliasPtr,
+	    TclGetString(namePtr), AliasObjCmd, (ClientData) aliasPtr,
 	    AliasObjCmdDeleteProc);
 
     if (TclPreventAliasLoop(interp, slaveInterp,
@@ -1477,7 +1477,7 @@
 	Tcl_Obj *newToken;
 	char *string;
 
-	string = Tcl_GetString(aliasPtr->token);
+	string = TclGetString(aliasPtr->token);
 	hPtr = Tcl_CreateHashEntry(&slavePtr->aliasTable, string, &isNew);
 	if (isNew != 0) {
 	    break;
@@ -1567,7 +1567,7 @@
      */
 
     slavePtr = &((InterpInfo *) ((Interp *) slaveInterp)->interpInfo)->slave;
-    hPtr = Tcl_FindHashEntry(&slavePtr->aliasTable, Tcl_GetString(namePtr));
+    hPtr = Tcl_FindHashEntry(&slavePtr->aliasTable, TclGetString(namePtr));
     if (hPtr == NULL) {
 	Tcl_AppendResult(interp, "alias \"", Tcl_GetString(namePtr),
 		"\" not found", NULL);
@@ -2015,7 +2015,7 @@
     Tcl_Interp *searchInterp;	/* Interim storage for interp. to find. */
     InterpInfo *masterInfoPtr;
 
-    if (Tcl_ListObjGetElements(interp, pathPtr, &objc, &objv) != TCL_OK) {
+    if (TclListObjGetElements(interp, pathPtr, &objc, &objv) != TCL_OK) {
 	return NULL;
     }
 
@@ -2023,7 +2023,7 @@
     for (i = 0; i < objc; i++) {
 	masterInfoPtr = (InterpInfo *) ((Interp *) searchInterp)->interpInfo;
 	hPtr = Tcl_FindHashEntry(&masterInfoPtr->master.slaveTable,
-		Tcl_GetString(objv[i]));
+		TclGetString(objv[i]));
 	if (hPtr == NULL) {
 	    searchInterp = NULL;
 	    break;
@@ -2069,7 +2069,7 @@
     if (objc) {
 	int length;
 
-	if (TCL_ERROR == Tcl_ListObjLength(NULL, objv[0], &length)
+	if (TCL_ERROR == TclListObjLength(NULL, objv[0], &length)
 		|| (length < 1)) {
 	    Tcl_AppendResult(interp, "cmdPrefix must be list of length >= 1",
 		    (char *) NULL);
@@ -2119,7 +2119,7 @@
     }
     if (objc < 2) {
 	masterInterp = interp;
-	path = Tcl_GetString(pathPtr);
+	path = TclGetString(pathPtr);
     } else {
 	Tcl_Obj *objPtr;
 
@@ -2129,7 +2129,7 @@
 	if (masterInterp == NULL) {
 	    return NULL;
 	}
-	path = Tcl_GetString(objv[objc - 1]);
+	path = TclGetString(objv[objc - 1]);
     }
     if (safe == 0) {
 	safe = Tcl_IsSafe(masterInterp);
@@ -2271,7 +2271,7 @@
 	    if (objc == 3) {
 		return AliasDescribe(interp, slaveInterp, objv[2]);
 	    }
-	    if (Tcl_GetString(objv[3])[0] == '\0') {
+	    if (TclGetString(objv[3])[0] == '\0') {
 		if (objc == 4) {
 		    return AliasDelete(interp, slaveInterp, objv[2]);
 		}
@@ -2338,7 +2338,7 @@
 
 	namespaceName = NULL;
 	for (i = 2; i < objc; i++) {
-	    if (Tcl_GetString(objv[i])[0] != '-') {
+	    if (TclGetString(objv[i])[0] != '-') {
 		break;
 	    }
 	    if (Tcl_GetIndexFromObj(interp, objv[i], hiddenOptions, "option",
@@ -2351,7 +2351,7 @@
 		if (++i == objc) { /* There must be more arguments. */
 		    break;
 		} else {
-		    namespaceName = Tcl_GetString(objv[i]);
+		    namespaceName = TclGetString(objv[i]);
 		}
 	    } else {
 		i++;
@@ -2534,8 +2534,8 @@
 	return TCL_ERROR;
     }
 
-    name = Tcl_GetString(objv[(objc == 1) ? 0 : 1]);
-    if (Tcl_ExposeCommand(slaveInterp, Tcl_GetString(objv[0]),
+    name = TclGetString(objv[(objc == 1) ? 0 : 1]);
+    if (Tcl_ExposeCommand(slaveInterp, TclGetString(objv[0]),
 	    name) != TCL_OK) {
 	TclTransferResult(slaveInterp, TCL_ERROR, interp);
 	return TCL_ERROR;
@@ -2577,7 +2577,7 @@
 		    (char *) NULL);
 	    return TCL_ERROR;
 	}
-	if (Tcl_GetIntFromObj(interp, objv[0], &limit) == TCL_ERROR) {
+	if (TclGetIntFromObj(interp, objv[0], &limit) == TCL_ERROR) {
 	    return TCL_ERROR;
 	}
 	if (limit <= 0) {
@@ -2634,8 +2634,8 @@
 	return TCL_ERROR;
     }
 
-    name = Tcl_GetString(objv[(objc == 1) ? 0 : 1]);
-    if (Tcl_HideCommand(slaveInterp, Tcl_GetString(objv[0]), name) != TCL_OK) {
+    name = TclGetString(objv[(objc == 1) ? 0 : 1]);
+    if (Tcl_HideCommand(slaveInterp, TclGetString(objv[0]), name) != TCL_OK) {
 	TclTransferResult(slaveInterp, TCL_ERROR, interp);
 	return TCL_ERROR;
     }
@@ -4110,7 +4110,7 @@
 		break;
 	    case OPT_GRAN:
 		granObj = objv[i+1];
-		if (Tcl_GetIntFromObj(interp, objv[i+1], &gran) != TCL_OK) {
+		if (TclGetIntFromObj(interp, objv[i+1], &gran) != TCL_OK) {
 		    return TCL_ERROR;
 		}
 		if (gran < 1) {
@@ -4125,7 +4125,7 @@
 		if (limitLen == 0) {
 		    break;
 		}
-		if (Tcl_GetIntFromObj(interp, objv[i+1], &limit) != TCL_OK) {
+		if (TclGetIntFromObj(interp, objv[i+1], &limit) != TCL_OK) {
 		    return TCL_ERROR;
 		}
 		if (limit < 0) {
@@ -4302,7 +4302,7 @@
 		break;
 	    case OPT_GRAN:
 		granObj = objv[i+1];
-		if (Tcl_GetIntFromObj(interp, objv[i+1], &gran) != TCL_OK) {
+		if (TclGetIntFromObj(interp, objv[i+1], &gran) != TCL_OK) {
 		    return TCL_ERROR;
 		}
 		if (gran < 1) {
@@ -4317,7 +4317,7 @@
 		if (milliLen == 0) {
 		    break;
 		}
-		if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK) {
+		if (TclGetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK) {
 		    return TCL_ERROR;
 		}
 		if (tmp < 0) {
@@ -4333,7 +4333,7 @@
 		if (secLen == 0) {
 		    break;
 		}
-		if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK) {
+		if (TclGetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK) {
 		    return TCL_ERROR;
 		}
 		if (tmp < 0) {
Index: generic/tclListObj.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclListObj.c,v
retrieving revision 1.47
diff -u -r1.47 tclListObj.c
--- generic/tclListObj.c	3 Sep 2007 21:27:22 -0000	1.47
+++ generic/tclListObj.c	11 Nov 2007 19:28:48 -0000
@@ -428,7 +428,7 @@
     if (listPtr->typePtr != &tclListType) {
 	int result, length;
 
-	(void) Tcl_GetStringFromObj(listPtr, &length);
+	(void) TclGetStringFromObj(listPtr, &length);
 	if (!length) {
 	    *objcPtr = 0;
 	    *objvPtr = NULL;
@@ -485,12 +485,12 @@
 	Tcl_Panic("%s called with shared object", "Tcl_ListObjAppendList");
     }
 
-    result = Tcl_ListObjLength(interp, listPtr, &listLen);
+    result = TclListObjLength(interp, listPtr, &listLen);
     if (result != TCL_OK) {
 	return result;
     }
 
-    result = Tcl_ListObjGetElements(interp, elemListPtr, &objc, &objv);
+    result = TclListObjGetElements(interp, elemListPtr, &objc, &objv);
     if (result != TCL_OK) {
 	return result;
     }
@@ -546,7 +546,7 @@
     if (listPtr->typePtr != &tclListType) {
 	int result, length;
 
-	(void) Tcl_GetStringFromObj(listPtr, &length);
+	(void) TclGetStringFromObj(listPtr, &length);
 	if (!length) {
 	    Tcl_SetListObj(listPtr, 1, &objPtr);
 	    return TCL_OK;
@@ -657,7 +657,7 @@
     if (listPtr->typePtr != &tclListType) {
 	int result, length;
 
-	(void) Tcl_GetStringFromObj(listPtr, &length);
+	(void) TclGetStringFromObj(listPtr, &length);
 	if (!length) {
 	    *objPtrPtr = NULL;
 	    return TCL_OK;
@@ -712,7 +712,7 @@
     if (listPtr->typePtr != &tclListType) {
 	int result, length;
 
-	(void) Tcl_GetStringFromObj(listPtr, &length);
+	(void) TclGetStringFromObj(listPtr, &length);
 	if (!length) {
 	    *intPtr = 0;
 	    return TCL_OK;
@@ -787,7 +787,7 @@
     if (listPtr->typePtr != &tclListType) {
 	int length;
 
-	(void) Tcl_GetStringFromObj(listPtr, &length);
+	(void) TclGetStringFromObj(listPtr, &length);
 	if (!length) {
 	    if (objc) {
 		Tcl_SetListObj(listPtr, objc, NULL);
@@ -1006,7 +1006,7 @@
      */
 
     if (argPtr->typePtr != &tclListType
-	    && TclGetIntForIndex(NULL , argPtr, 0, &index) == TCL_OK) {
+	    && TclGetIntForIndexM(NULL , argPtr, 0, &index) == TCL_OK) {
 	/*
 	 * argPtr designates a single index.
 	 */
@@ -1036,7 +1036,7 @@
 	return TclLindexFlat(interp, listPtr, 1, &argPtr);
     }
 
-    Tcl_ListObjGetElements(NULL, indexListCopy, &indexCount, &indices);
+    TclListObjGetElements(NULL, indexListCopy, &indexCount, &indices);
     listPtr = TclLindexFlat(interp, listPtr, indexCount, indices);
     Tcl_DecrRefCount(indexListCopy);
     return listPtr;
@@ -1101,9 +1101,9 @@
 
 	    break;
 	}
-	Tcl_ListObjGetElements(NULL, sublistCopy, &listLen, &elemPtrs);
+	TclListObjGetElements(NULL, sublistCopy, &listLen, &elemPtrs);
 
-	if (TclGetIntForIndex(interp, indexArray[i], /*endValue*/ listLen-1,
+	if (TclGetIntForIndexM(interp, indexArray[i], /*endValue*/ listLen-1,
 		&index) == TCL_OK) {
 	    if (index<0 || index>=listLen) {
 		/*
@@ -1112,7 +1112,7 @@
 		 */
 
 		while (++i < indexCount) {
-		    if (TclGetIntForIndex(interp, indexArray[i], -1, &index)
+		    if (TclGetIntForIndexM(interp, indexArray[i], -1, &index)
 			!= TCL_OK) {
 			Tcl_DecrRefCount(sublistCopy);
 			return NULL;
@@ -1180,7 +1180,7 @@
      */
 
     if (indexArgPtr->typePtr != &tclListType
-	    && TclGetIntForIndex(NULL, indexArgPtr, 0, &index) == TCL_OK) {
+	    && TclGetIntForIndexM(NULL, indexArgPtr, 0, &index) == TCL_OK) {
 	/*
 	 * indexArgPtr designates a single index.
 	 */
@@ -1198,7 +1198,7 @@
 
 	return TclLsetFlat(interp, listPtr, 1, &indexArgPtr, valuePtr);
     }
-    Tcl_ListObjGetElements(NULL, indexArgPtr, &indexCount, &indices);
+    TclListObjGetElements(NULL, indexArgPtr, &indexCount, &indices);
 
     /*
      * Let TclLsetFlat handle the actual lset'ting.
@@ -1307,17 +1307,24 @@
 
 	/* Check for the possible error conditions... */
 	result = TCL_ERROR;
-	if (Tcl_ListObjGetElements(interp, subListPtr, &elemCount, &elemPtrs)
+	if (TclListObjGetElements(interp, subListPtr, &elemCount, &elemPtrs)
 		!= TCL_OK) {
 	    /* ...the sublist we're indexing into isn't a list at all. */
 	    break;
 	}
 
-	if (TclGetIntForIndex(interp, *indexArray++, elemCount - 1, &index)
+	/*
+	 * WARNING: the macro TclGetIntForIndexM is not safe for
+	 * post-increments, avoid '*indexArray++' here.
+	 */
+	
+	if (TclGetIntForIndexM(interp, *indexArray, elemCount - 1, &index)
 		!= TCL_OK)  {
 	    /* ...the index we're trying to use isn't an index at all. */
+	    indexArray++;
 	    break;
 	}
+	indexArray++;
 
 	if (index < 0 || index >= elemCount) {
 	    /* ...the index points outside the sublist. */
@@ -1472,7 +1479,7 @@
     if (listPtr->typePtr != &tclListType) {
 	int length, result;
 
-	(void) Tcl_GetStringFromObj(listPtr, &length);
+	(void) TclGetStringFromObj(listPtr, &length);
 	if (!length) {
 	    Tcl_SetObjResult(interp,
 		    Tcl_NewStringObj("list index out of range", -1));
@@ -1654,7 +1661,7 @@
      * Get the string representation. Make it up-to-date if necessary.
      */
 
-    string = Tcl_GetStringFromObj(objPtr, &length);
+    string = TclGetStringFromObj(objPtr, &length);
 
     /*
      * Parse the string into separate string objects, and create a List
@@ -1794,7 +1801,7 @@
     listPtr->length = 1;
     elemPtrs = &listRepPtr->elements;
     for (i = 0; i < numElems; i++) {
-	elem = Tcl_GetStringFromObj(elemPtrs[i], &length);
+	elem = TclGetStringFromObj(elemPtrs[i], &length);
 	listPtr->length += Tcl_ScanCountedElement(elem, length, flagPtr+i)+1;
 
 	/*
@@ -1813,7 +1820,7 @@
     listPtr->bytes = ckalloc((unsigned) listPtr->length);
     dst = listPtr->bytes;
     for (i = 0; i < numElems; i++) {
-	elem = Tcl_GetStringFromObj(elemPtrs[i], &length);
+	elem = TclGetStringFromObj(elemPtrs[i], &length);
 	dst += Tcl_ConvertCountedElement(elem, length, dst,
 		flagPtr[i] | (i==0 ? 0 : TCL_DONT_QUOTE_HASH));
 	*dst = ' ';
Index: generic/tclLiteral.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclLiteral.c,v
retrieving revision 1.31
diff -u -r1.31 tclLiteral.c
--- generic/tclLiteral.c	31 Jul 2007 17:03:39 -0000	1.31
+++ generic/tclLiteral.c	11 Nov 2007 19:28:48 -0000
@@ -510,7 +510,7 @@
     char *bytes;
     int length, globalHash;
 
-    bytes = Tcl_GetStringFromObj(objPtr, &length);
+    bytes = TclGetStringFromObj(objPtr, &length);
     globalHash = (HashString(bytes, length) & globalTablePtr->mask);
     for (entryPtr=globalTablePtr->buckets[globalHash] ; entryPtr!=NULL;
 	    entryPtr=entryPtr->nextPtr) {
@@ -570,7 +570,7 @@
     TclReleaseLiteral(interp, lPtr->objPtr);
     lPtr->objPtr = newObjPtr;
 
-    bytes = Tcl_GetStringFromObj(newObjPtr, &length);
+    bytes = TclGetStringFromObj(newObjPtr, &length);
     localHash = (HashString(bytes, length) & localTablePtr->mask);
     nextPtrPtr = &localTablePtr->buckets[localHash];
 
@@ -820,7 +820,7 @@
     char *bytes;
     int length, index;
 
-    bytes = Tcl_GetStringFromObj(objPtr, &length);
+    bytes = TclGetStringFromObj(objPtr, &length);
     index = (HashString(bytes, length) & globalTablePtr->mask);
 
     /*
@@ -968,7 +968,7 @@
 
     for (oldChainPtr=oldBuckets ; oldSize>0 ; oldSize--,oldChainPtr++) {
 	for (entryPtr=*oldChainPtr ; entryPtr!=NULL ; entryPtr=*oldChainPtr) {
-	    bytes = Tcl_GetStringFromObj(entryPtr->objPtr, &length);
+	    bytes = TclGetStringFromObj(entryPtr->objPtr, &length);
 	    index = (HashString(bytes, length) & tablePtr->mask);
 
 	    *oldChainPtr = entryPtr->nextPtr;
Index: generic/tclNamesp.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclNamesp.c,v
retrieving revision 1.151
diff -u -r1.151 tclNamesp.c
--- generic/tclNamesp.c	27 Oct 2007 18:03:08 -0000	1.151
+++ generic/tclNamesp.c	11 Nov 2007 19:28:49 -0000
@@ -2664,7 +2664,7 @@
     Tcl_Namespace **nsPtrPtr)	/* Result namespace pointer goes here. */
 {
     if (GetNamespaceFromObj(interp, objPtr, nsPtrPtr) == TCL_ERROR) {
-	const char *name = Tcl_GetString(objPtr);
+	const char *name = TclGetString(objPtr);
 	if ((name[0] == ':') && (name[1] == ':')) {
 	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
 		    "namespace \"%s\" not found", name));
@@ -3003,7 +3003,7 @@
      * If "arg" is already a scoped value, then return it directly.
      */
 
-    arg = Tcl_GetStringFromObj(objv[2], &length);
+    arg = TclGetStringFromObj(objv[2], &length);
     while (*arg == ':') {
 	arg++;
 	length--;
@@ -3921,7 +3921,7 @@
      * There is a path given, so parse it into an array of namespace pointers.
      */
 
-    if (Tcl_ListObjGetElements(interp, objv[2], &nsObjc, &nsObjv) != TCL_OK) {
+    if (TclListObjGetElements(interp, objv[2], &nsObjc, &nsObjv) != TCL_OK) {
 	goto badNamespace;
     }
     if (nsObjc != 0) {
@@ -4300,7 +4300,7 @@
 
     if (handlerPtr == NULL) {
 	currNsPtr->unknownHandlerPtr = NULL;
-    } else if (Tcl_ListObjLength(interp, handlerPtr, &lstlen) != TCL_OK) {
+    } else if (TclListObjLength(interp, handlerPtr, &lstlen) != TCL_OK) {
 	/*
 	 * Not a list.
 	 */
@@ -4812,7 +4812,7 @@
 		name = TclGetString(objv[1]);
 		continue;
 	    case CRT_SUBCMDS:
-		if (Tcl_ListObjLength(interp, objv[1], &len) != TCL_OK) {
+		if (TclListObjLength(interp, objv[1], &len) != TCL_OK) {
 		    if (allocatedMapFlag) {
 			Tcl_DecrRefCount(mapObj);
 		    }
@@ -4842,7 +4842,7 @@
 		    Tcl_Obj **listv;
 		    char *cmd;
 
-		    if (Tcl_ListObjGetElements(interp, listObj, &len,
+		    if (TclListObjGetElements(interp, listObj, &len,
 			    &listv) != TCL_OK) {
 			Tcl_DictObjDone(&search);
 			if (patchedDict) {
@@ -4903,7 +4903,7 @@
 		}
 		continue;
 	    case CRT_UNKNOWN:
-		if (Tcl_ListObjLength(interp, objv[1], &len) != TCL_OK) {
+		if (TclListObjLength(interp, objv[1], &len) != TCL_OK) {
 		    if (allocatedMapFlag) {
 			Tcl_DecrRefCount(mapObj);
 		    }
@@ -5085,7 +5085,7 @@
 		}
 		switch ((enum EnsConfigOpts) index) {
 		case CONF_SUBCMDS:
-		    if (Tcl_ListObjLength(interp, objv[1], &len) != TCL_OK) {
+		    if (TclListObjLength(interp, objv[1], &len) != TCL_OK) {
 			if (allocatedMapFlag) {
 			    Tcl_DecrRefCount(mapObj);
 			}
@@ -5115,7 +5115,7 @@
 			Tcl_Obj **listv;
 			char *cmd;
 
-			if (Tcl_ListObjGetElements(interp, listObj, &len,
+			if (TclListObjGetElements(interp, listObj, &len,
 				&listv) != TCL_OK) {
 			    Tcl_DictObjDone(&search);
 			    if (patchedDict) {
@@ -5183,7 +5183,7 @@
 		    }
 		    continue;
 		case CONF_UNKNOWN:
-		    if (Tcl_ListObjLength(interp, objv[1], &len) != TCL_OK) {
+		    if (TclListObjLength(interp, objv[1], &len) != TCL_OK) {
 			if (allocatedMapFlag) {
 			    Tcl_DecrRefCount(mapObj);
 			}
@@ -5325,7 +5325,7 @@
     }
     if (subcmdList != NULL) {
 	int length;
-	if (Tcl_ListObjLength(interp, subcmdList, &length) != TCL_OK) {
+	if (TclListObjLength(interp, subcmdList, &length) != TCL_OK) {
 	    return TCL_ERROR;
 	}
 	if (length < 1) {
@@ -5456,7 +5456,7 @@
     if (unknownList != NULL) {
 	int length;
 
-	if (Tcl_ListObjLength(interp, unknownList, &length) != TCL_OK) {
+	if (TclListObjLength(interp, unknownList, &length) != TCL_OK) {
 	    return TCL_ERROR;
 	}
 	if (length < 1) {
@@ -5919,7 +5919,7 @@
 			    (iPtr->ensembleRewrite.sourceObjs == NULL);
 		    copyObj = TclListObjCopy(NULL, prefixObj);
 
-		    Tcl_ListObjGetElements(NULL, copyObj, &prefixObjc,
+		    TclListObjGetElements(NULL, copyObj, &prefixObjc,
 			    &prefixObjv);
 		    if (isRootEnsemble) {
 			iPtr->ensembleRewrite.sourceObjs = objv;
@@ -6075,7 +6075,7 @@
 	for (i=1 ; i<objc ; i++) {
 	    Tcl_ListObjAppendElement(NULL, unknownCmd, objv[i]);
 	}
-	Tcl_ListObjGetElements(NULL, unknownCmd, &paramc, &paramv);
+	TclListObjGetElements(NULL, unknownCmd, &paramc, &paramv);
 	Tcl_Preserve(ensemblePtr);
 	Tcl_IncrRefCount(unknownCmd);
 	result = Tcl_EvalObjv(interp, paramc, paramv, 0);
@@ -6099,7 +6099,7 @@
 	     * as our replacement.
 	     */
 
-	    if (Tcl_ListObjLength(interp, prefixObj, &prefixObjc) != TCL_OK) {
+	    if (TclListObjLength(interp, prefixObj, &prefixObjc) != TCL_OK) {
 		Tcl_DecrRefCount(prefixObj);
 		Tcl_AddErrorInfo(interp, "\n    while parsing result of "
 			"ensemble unknown subcommand handler");
@@ -6399,7 +6399,7 @@
 	Tcl_Obj **subcmdv, *target, *cmdObj, *cmdPrefixObj;
 	int subcmdc;
 
-	Tcl_ListObjGetElements(NULL, ensemblePtr->subcmdList, &subcmdc,
+	TclListObjGetElements(NULL, ensemblePtr->subcmdList, &subcmdc,
 		&subcmdv);
 	for (i=0 ; i<subcmdc ; i++) {
 	    char *name = TclGetString(subcmdv[i]);
Index: generic/tclObj.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclObj.c,v
retrieving revision 1.136
diff -u -r1.136 tclObj.c
--- generic/tclObj.c	11 Oct 2007 13:35:26 -0000	1.136
+++ generic/tclObj.c	11 Nov 2007 19:28:50 -0000
@@ -493,7 +493,7 @@
      * Get the test for a valid list out of the way first.
      */
 
-    if (Tcl_ListObjLength(interp, objPtr, &numElems) != TCL_OK) {
+    if (TclListObjLength(interp, objPtr, &numElems) != TCL_OK) {
 	return TCL_ERROR;
     }
 
@@ -1422,7 +1422,7 @@
     register Tcl_Obj *objPtr)	/* The object to parse/convert. */
 {
     int i, length, newBool;
-    char lowerCase[6], *str = Tcl_GetStringFromObj(objPtr, &length);
+    char lowerCase[6], *str = TclGetStringFromObj(objPtr, &length);
 
     if ((length == 0) || (length > 5)) {
 	/* longest valid boolean string rep. is "false" */
@@ -1901,9 +1901,12 @@
     register Tcl_Obj *objPtr,	/* The object from which to get a int. */
     register int *intPtr)	/* Place to store resulting int. */
 {
+#if (LONG_MAX == INT_MAX)
+    return TclGetLongFromObj(interp, objPtr, (long *) intPtr);
+#else
     long l;
 
-    if (Tcl_GetLongFromObj(interp, objPtr, &l) != TCL_OK) {
+    if (TclGetLongFromObj(interp, objPtr, &l) != TCL_OK) {
 	return TCL_ERROR;
     }
     if ((ULONG_MAX > UINT_MAX) && ((l > UINT_MAX) || (l < -(long)UINT_MAX))) {
@@ -1917,6 +1920,7 @@
     }
     *intPtr = (int) l;
     return TCL_OK;
+#endif
 }
 
 /*
@@ -1941,7 +1945,7 @@
     Tcl_Obj *objPtr)		/* Pointer to the object to convert */
 {
     long l;
-    return Tcl_GetLongFromObj(interp, objPtr, &l);
+    return TclGetLongFromObj(interp, objPtr, &l);
 }
 
 /*
Index: generic/tclParse.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclParse.c,v
retrieving revision 1.57
diff -u -r1.57 tclParse.c
--- generic/tclParse.c	15 Oct 2007 13:22:50 -0000	1.57
+++ generic/tclParse.c	11 Nov 2007 19:28:51 -0000
@@ -1921,7 +1921,7 @@
     Tcl_Token *endTokenPtr;
     Tcl_Obj *result;
     Tcl_Obj *errMsg = NULL;
-    CONST char *p = Tcl_GetStringFromObj(objPtr, &length);
+    CONST char *p = TclGetStringFromObj(objPtr, &length);
     Tcl_Parse *parsePtr = (Tcl_Parse *) TclStackAlloc(interp, sizeof(Tcl_Parse));
 
     TclParseInit(interp, p, length, parsePtr);
@@ -2435,7 +2435,7 @@
     CONST char *script;
     int length;
 
-    script = Tcl_GetStringFromObj(objPtr, &length);
+    script = TclGetStringFromObj(objPtr, &length);
     return CommandComplete(script, length);
 }
 
Index: generic/tclProc.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclProc.c,v
retrieving revision 1.135
diff -u -r1.135 tclProc.c
--- generic/tclProc.c	25 Sep 2007 20:27:18 -0000	1.135
+++ generic/tclProc.c	11 Nov 2007 19:28:51 -0000
@@ -411,7 +411,7 @@
 	 */
 
 	if (Tcl_IsShared(bodyPtr)) {
-	    bytes = Tcl_GetStringFromObj(bodyPtr, &length);
+	    bytes = TclGetStringFromObj(bodyPtr, &length);
 	    bodyPtr = Tcl_NewStringObj(bytes, length);
 	}
 
@@ -442,7 +442,7 @@
      * THIS FAILS IF THE ARG LIST OBJECT'S STRING REP CONTAINS NULS.
      */
 
-    args = Tcl_GetStringFromObj(argsPtr, &length);
+    args = TclGetStringFromObj(argsPtr, &length);
     result = Tcl_SplitList(interp, args, &numArgs, &argArray);
     if (result != TCL_OK) {
 	goto procError;
@@ -555,7 +555,7 @@
 
 	    if (localPtr->defValuePtr != NULL) {
 		int tmpLength;
-		char *tmpPtr = Tcl_GetStringFromObj(localPtr->defValuePtr,
+		char *tmpPtr = TclGetStringFromObj(localPtr->defValuePtr,
 			&tmpLength);
 
 		if ((valueLength != tmpLength) ||
@@ -781,7 +781,7 @@
 	    || objPtr->typePtr == &tclWideIntType
 #endif
 	    ) {
-	if (Tcl_GetIntFromObj(NULL, objPtr, &level) != TCL_OK || level < 0) {
+	if (TclGetIntFromObj(NULL, objPtr, &level) != TCL_OK || level < 0) {
 	    goto levelError;
 	}
 	level = curLevel - level;
@@ -2408,7 +2408,7 @@
      * length is not 2, then it cannot be converted to lambdaType.
      */
 
-    result = Tcl_ListObjGetElements(interp, objPtr, &objc, &objv);
+    result = TclListObjGetElements(interp, objPtr, &objc, &objv);
     if ((result != TCL_OK) || ((objc != 2) && (objc != 3))) {
 	TclNewLiteralStringObj(errPtr, "can't interpret \"");
 	Tcl_AppendObjToObj(errPtr, objPtr);
@@ -2539,7 +2539,7 @@
     if (objc == 2) {
 	TclNewLiteralStringObj(nsObjPtr, "::");
     } else {
-	char *nsName = Tcl_GetString(objv[2]);
+	char *nsName = TclGetString(objv[2]);
 
 	if ((*nsName != ':') || (*(nsName+1) != ':')) {
 	    TclNewLiteralStringObj(nsObjPtr, "::");
@@ -2624,7 +2624,7 @@
 	int numElem;
 
 	if ((lambdaPtr->typePtr == &tclCmdNameType) ||
-		(Tcl_ListObjGetElements(interp, lambdaPtr, &numElem,
+		(TclListObjGetElements(interp, lambdaPtr, &numElem,
 		&elemPtr) == TCL_OK && numElem == 1)) {
 	    return Tcl_EvalObjv(interp, objc-1, objv+1, 0);
 	}
Index: generic/tclRegexp.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclRegexp.c,v
retrieving revision 1.24
diff -u -r1.24 tclRegexp.c
--- generic/tclRegexp.c	7 Mar 2007 09:35:42 -0000	1.24
+++ generic/tclRegexp.c	11 Nov 2007 19:28:52 -0000
@@ -251,7 +251,7 @@
 	*startPtr = *endPtr = NULL;
     } else {
 	if (regexpPtr->objPtr) {
-	    string = Tcl_GetString(regexpPtr->objPtr);
+	    string = TclGetString(regexpPtr->objPtr);
 	} else {
 	    string = regexpPtr->string;
 	}
@@ -562,7 +562,7 @@
     regexpPtr = (TclRegexp *) objPtr->internalRep.otherValuePtr;
 
     if ((objPtr->typePtr != &tclRegexpType) || (regexpPtr->flags != flags)) {
-	pattern = Tcl_GetStringFromObj(objPtr, &length);
+	pattern = TclGetStringFromObj(objPtr, &length);
 
 	regexpPtr = CompileRegexp(interp, pattern, length, flags);
 	if (regexpPtr == NULL) {
Index: generic/tclResult.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclResult.c,v
retrieving revision 1.40
diff -u -r1.40 tclResult.c
--- generic/tclResult.c	10 Nov 2007 01:34:00 -0000	1.40
+++ generic/tclResult.c	11 Nov 2007 19:28:54 -0000
@@ -1218,7 +1218,7 @@
 	if (valuePtr != NULL) {
 	    int infoLen;
 
-	    (void) Tcl_GetStringFromObj(valuePtr, &infoLen);
+	    (void) TclGetStringFromObj(valuePtr, &infoLen);
 	    if (infoLen) {
 		iPtr->errorInfo = valuePtr;
 		Tcl_IncrRefCount(iPtr->errorInfo);
@@ -1234,7 +1234,7 @@
 
 	Tcl_DictObjGet(NULL, iPtr->returnOpts, keys[KEY_ERRORLINE], &valuePtr);
 	if (valuePtr != NULL) {
-	    Tcl_GetIntFromObj(NULL, valuePtr, &iPtr->errorLine);
+	    TclGetIntFromObj(NULL, valuePtr, &iPtr->errorLine);
 	}
     }
     if (level != 0) {
@@ -1287,10 +1287,10 @@
 
     for (;  objc > 1;  objv += 2, objc -= 2) {
 	int optLen;
-	CONST char *opt = Tcl_GetStringFromObj(objv[0], &optLen);
+	CONST char *opt = TclGetStringFromObj(objv[0], &optLen);
 	int compareLen;
 	CONST char *compare =
-		Tcl_GetStringFromObj(keys[KEY_OPTIONS], &compareLen);
+		TclGetStringFromObj(keys[KEY_OPTIONS], &compareLen);
 
 	if ((optLen == compareLen) && (strcmp(opt, compare) == 0)) {
 	    Tcl_DictSearch search;
@@ -1335,7 +1335,7 @@
 
     Tcl_DictObjGet(NULL, returnOpts, keys[KEY_CODE], &valuePtr);
     if ((valuePtr != NULL)
-	    && (TCL_ERROR == Tcl_GetIntFromObj(NULL, valuePtr, &code))) {
+	    && (TCL_ERROR == TclGetIntFromObj(NULL, valuePtr, &code))) {
 	static CONST char *returnCodes[] = {
 	    "ok", "error", "return", "break", "continue", NULL
 	};
@@ -1364,7 +1364,7 @@
 
     Tcl_DictObjGet(NULL, returnOpts, keys[KEY_LEVEL], &valuePtr);
     if (valuePtr != NULL) {
-	if ((TCL_ERROR == Tcl_GetIntFromObj(NULL, valuePtr, &level))
+	if ((TCL_ERROR == TclGetIntFromObj(NULL, valuePtr, &level))
 		|| (level < 0)) {
 	    /*
 	     * Value is not a legal level.
@@ -1496,7 +1496,7 @@
     int objc, level, code;
     Tcl_Obj **objv, *mergedOpts;
 
-    if (TCL_ERROR == Tcl_ListObjGetElements(interp, options, &objc, &objv)
+    if (TCL_ERROR == TclListObjGetElements(interp, options, &objc, &objv)
 	    || (objc % 2)) {
 	Tcl_ResetResult(interp);
 	Tcl_AppendResult(interp, "expected dict but got \"",
Index: generic/tclScan.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclScan.c,v
retrieving revision 1.25
diff -u -r1.25 tclScan.c
--- generic/tclScan.c	22 Jun 2007 20:42:24 -0000	1.25
+++ generic/tclScan.c	11 Nov 2007 19:28:54 -0000
@@ -899,7 +899,7 @@
 	    if (flags & SCAN_LONGER) {
 		if (Tcl_GetWideIntFromObj(NULL, objPtr, &wideValue) != TCL_OK) {
 		    wideValue = ~(Tcl_WideUInt)0 >> 1;	/* WIDE_MAX */
-		    if (Tcl_GetString(objPtr)[0] == '-') {
+		    if (TclGetString(objPtr)[0] == '-') {
 			wideValue++;	/* WIDE_MAX + 1 = WIDE_MIN */
 		    }
 		}
@@ -911,8 +911,8 @@
 		    Tcl_SetWideIntObj(objPtr, wideValue);
 		}
 	    } else if (!(flags & SCAN_BIG)) {
-		if (Tcl_GetLongFromObj(NULL, objPtr, &value) != TCL_OK) {
-		    if (Tcl_GetString(objPtr)[0] == '-') {
+		if (TclGetLongFromObj(NULL, objPtr, &value) != TCL_OK) {
+		    if (TclGetString(objPtr)[0] == '-') {
 			value = LONG_MIN;
 		    } else {
 			value = LONG_MAX;
Index: generic/tclStringObj.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclStringObj.c,v
retrieving revision 1.65
diff -u -r1.65 tclStringObj.c
--- generic/tclStringObj.c	28 Mar 2007 19:03:42 -0000	1.65
+++ generic/tclStringObj.c	11 Nov 2007 19:28:54 -0000
@@ -637,7 +637,7 @@
     }
 
     if (objPtr->bytes && (stringPtr->numChars == objPtr->length)) {
-	char *str = Tcl_GetString(objPtr);
+	char *str = TclGetString(objPtr);
 
 	/*
 	 * All of the characters in the Utf string are 1 byte chars, so we
@@ -1231,7 +1231,7 @@
 	    AppendUnicodeToUnicodeRep(objPtr, stringPtr->unicode,
 		    stringPtr->numChars);
 	} else {
-	    bytes = Tcl_GetStringFromObj(appendObjPtr, &length);
+	    bytes = TclGetStringFromObj(appendObjPtr, &length);
 	    AppendUtfToUnicodeRep(objPtr, bytes, length);
 	}
 	return;
@@ -1243,7 +1243,7 @@
      * characters in the final (appended-to) object.
      */
 
-    bytes = Tcl_GetStringFromObj(appendObjPtr, &length);
+    bytes = TclGetStringFromObj(appendObjPtr, &length);
 
     allOneByteChars = 0;
     numChars = stringPtr->numChars;
@@ -1715,7 +1715,7 @@
     if (Tcl_IsShared(appendObj)) {
 	Tcl_Panic("%s called with shared object", "Tcl_AppendFormatToObj");
     }
-    Tcl_GetStringFromObj(appendObj, &originalLength);
+    TclGetStringFromObj(appendObj, &originalLength);
 
     /*
      * Format string is NUL-terminated.
@@ -1832,7 +1832,7 @@
 		msg = badIndex[gotXpg];
 		goto errorMsg;
 	    }
-	    if (Tcl_GetIntFromObj(interp, objv[objIndex], &width) != TCL_OK) {
+	    if (TclGetIntFromObj(interp, objv[objIndex], &width) != TCL_OK) {
 		goto error;
 	    }
 	    if (width < 0) {
@@ -1863,7 +1863,7 @@
 		msg = badIndex[gotXpg];
 		goto errorMsg;
 	    }
-	    if (Tcl_GetIntFromObj(interp, objv[objIndex], &precision)
+	    if (TclGetIntFromObj(interp, objv[objIndex], &precision)
 		    != TCL_OK) {
 		goto error;
 	    }
@@ -1930,7 +1930,7 @@
 	case 'c': {
 	    char buf[TCL_UTF_MAX];
 	    int code, length;
-	    if (Tcl_GetIntFromObj(interp, segment, &code) != TCL_OK) {
+	    if (TclGetIntFromObj(interp, segment, &code) != TCL_OK) {
 		goto error;
 	    }
 	    length = Tcl_UniCharToUtf(code, buf);
@@ -1975,7 +1975,7 @@
 		    Tcl_DecrRefCount(objPtr);
 		}
 		isNegative = (w < (Tcl_WideInt)0);
-	    } else if (Tcl_GetLongFromObj(NULL, segment, &l) != TCL_OK) {
+	    } else if (TclGetLongFromObj(NULL, segment, &l) != TCL_OK) {
 		if (Tcl_GetWideIntFromObj(NULL, segment, &w) != TCL_OK) {
 		    Tcl_Obj *objPtr;
 
@@ -1985,7 +1985,7 @@
 		    mp_mod_2d(&big, (int) CHAR_BIT * sizeof(long), &big);
 		    objPtr = Tcl_NewBignumObj(&big);
 		    Tcl_IncrRefCount(objPtr);
-		    Tcl_GetLongFromObj(NULL, objPtr, &l);
+		    TclGetLongFromObj(NULL, objPtr, &l);
 		    Tcl_DecrRefCount(objPtr);
 		} else {
 		    l = Tcl_WideAsLong(w);
@@ -2040,7 +2040,7 @@
 		    pure = Tcl_NewLongObj(l);
 		}
 		Tcl_IncrRefCount(pure);
-		bytes = Tcl_GetStringFromObj(pure, &length);
+		bytes = TclGetStringFromObj(pure, &length);
 
 		/*
 		 * Already did the sign above.
@@ -2137,7 +2137,7 @@
 		}
 		pure = Tcl_NewObj();
 		Tcl_SetObjLength(pure, numDigits);
-		bytes = Tcl_GetString(pure);
+		bytes = TclGetString(pure);
 		length = numDigits;
 		while (numDigits--) {
 		    int digitOffset;
@@ -2230,7 +2230,7 @@
 	    segment = Tcl_NewObj();
 	    allocSegment = 1;
 	    Tcl_SetObjLength(segment, length);
-	    bytes = Tcl_GetString(segment);
+	    bytes = TclGetString(segment);
 	    Tcl_SetObjLength(segment, sprintf(bytes, spec, d));
 	    break;
 	}
@@ -2248,7 +2248,7 @@
 	case 'E':
 	case 'G':
 	case 'X': {
-	    Tcl_SetObjLength(segment, Tcl_UtfToUpper(Tcl_GetString(segment)));
+	    Tcl_SetObjLength(segment, Tcl_UtfToUpper(TclGetString(segment)));
 	}
 	}
 
@@ -2451,7 +2451,7 @@
 	    }
 	} while (seekingConversion);
     }
-    Tcl_ListObjGetElements(NULL, list, &objc, &objv);
+    TclListObjGetElements(NULL, list, &objc, &objv);
     code = Tcl_AppendFormatToObj(NULL, objPtr, format, objc, objv);
     if (code != TCL_OK) {
 	Tcl_AppendPrintfToObj(objPtr,
@@ -2578,12 +2578,12 @@
 	return objPtr;
     }
 
-    bytes = Tcl_GetString(objPtr);
+    bytes = TclGetString(objPtr);
     if (Tcl_IsShared(objPtr)) {
 	char *dest;
 	Tcl_Obj *resultPtr = Tcl_NewObj();
 	Tcl_SetObjLength(resultPtr, numChars);
-	dest = Tcl_GetString(resultPtr);
+	dest = TclGetString(resultPtr);
 	while (i < numChars) {
 	    dest[i++] = bytes[lastCharIdx--];
 	}
Index: generic/tclUtil.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclUtil.c,v
retrieving revision 1.86
diff -u -r1.86 tclUtil.c
--- generic/tclUtil.c	9 Nov 2007 18:55:16 -0000	1.86
+++ generic/tclUtil.c	11 Nov 2007 19:28:54 -0000
@@ -1161,7 +1161,7 @@
 
 	objPtr = objv[i];
 	if (objPtr->typePtr != &tclListType) {
-	    Tcl_GetString(objPtr);
+	    TclGetString(objPtr);
 	    if (objPtr->length) {
 		break;
 	    } else {
@@ -1192,7 +1192,7 @@
 	    if (objPtr->bytes && !objPtr->length) {
 		continue;
 	    }
-	    Tcl_ListObjGetElements(NULL, objPtr, &listc, &listv);
+	    TclListObjGetElements(NULL, objPtr, &listc, &listv);
 	    if (listc) {
 		if (resPtr) {
 		    Tcl_ListObjReplace(NULL, resPtr, INT_MAX, 0, listc, listv);
@@ -1219,7 +1219,7 @@
     allocSize = 0;
     for (i = 0;  i < objc;  i++) {
 	objPtr = objv[i];
-	element = Tcl_GetStringFromObj(objPtr, &length);
+	element = TclGetStringFromObj(objPtr, &length);
 	if ((element != NULL) && (length > 0)) {
 	    allocSize += (length + 1);
 	}
@@ -1249,7 +1249,7 @@
 	p = concatStr;
 	for (i = 0;  i < objc;  i++) {
 	    objPtr = objv[i];
-	    element = Tcl_GetStringFromObj(objPtr, &elemLength);
+	    element = TclGetStringFromObj(objPtr, &elemLength);
 	    while ((elemLength > 0) && (UCHAR(*element) < 127)
 		    && isspace(UCHAR(*element))) { /* INTL: ISO C space. */
 		element++;
@@ -2504,7 +2504,7 @@
     int *indexPtr)		/* Location filled in with an integer
 				 * representing an index. */
 {
-    if (Tcl_GetIntFromObj(NULL, objPtr, indexPtr) == TCL_OK) {
+    if (TclGetIntFromObj(NULL, objPtr, indexPtr) == TCL_OK) {
 	return TCL_OK;
     }
 
@@ -2518,7 +2518,7 @@
 
     } else {
 	int length;
-	char *opPtr, *bytes = Tcl_GetStringFromObj(objPtr, &length);
+	char *opPtr, *bytes = TclGetStringFromObj(objPtr, &length);
 
 	/* Leading whitespace is acceptable in an index */
 	while (length && isspace(UCHAR(*bytes))) { /* INTL: ISO space. */
@@ -2660,7 +2660,7 @@
      * Check for a string rep of the right form.
      */
 
-    bytes = Tcl_GetStringFromObj(objPtr, &length);
+    bytes = TclGetStringFromObj(objPtr, &length);
     if ((*bytes != 'e') || (strncmp(bytes, "end",
 	    (size_t)((length > 3) ? 3 : length)) != 0)) {
 	if (interp != NULL) {
@@ -2928,7 +2928,7 @@
     } else {
 	Tcl_CreateExitHandler(FreeProcessGlobalValue, (ClientData) pgvPtr);
     }
-    bytes = Tcl_GetStringFromObj(newValue, &pgvPtr->numBytes);
+    bytes = TclGetStringFromObj(newValue, &pgvPtr->numBytes);
     pgvPtr->value = ckalloc((unsigned int) pgvPtr->numBytes + 1);
     strcpy(pgvPtr->value, bytes);
     if (pgvPtr->encoding) {
Index: generic/tclVar.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclVar.c,v
retrieving revision 1.154
diff -u -r1.154 tclVar.c
--- generic/tclVar.c	3 Nov 2007 01:47:13 -0000	1.154
+++ generic/tclVar.c	11 Nov 2007 19:28:55 -0000
@@ -614,7 +614,7 @@
 	}
 	parsed = 1;
     }
-    part1 = Tcl_GetStringFromObj(part1Ptr, &len1);
+    part1 = TclGetStringFromObj(part1Ptr, &len1);
 
     if (!parsed && (*(part1 + len1 - 1) == ')')) {
 	/*
@@ -2572,7 +2572,7 @@
 		return TCL_ERROR;
 	    }
 	} else {
-	    result = Tcl_ListObjLength(interp, newValuePtr, &numElems);
+	    result = TclListObjLength(interp, newValuePtr, &numElems);
 	    if (result != TCL_OK) {
 		return result;
 	    }
@@ -2630,7 +2630,7 @@
 	    createdNewObj = 1;
 	}
 
-	result = Tcl_ListObjLength(interp, varValuePtr, &numElems);
+	result = TclListObjLength(interp, varValuePtr, &numElems);
 	if (result == TCL_OK) {
 	    result = Tcl_ListObjReplace(interp, varValuePtr, numElems, 0,
 		    (objc-2), (objv+2));
@@ -2971,7 +2971,7 @@
 	 */
 
 	TclNewObj(tmpResPtr);
-	result = Tcl_ListObjGetElements(interp, nameLstPtr, &count, &namePtrPtr);
+	result = TclListObjGetElements(interp, nameLstPtr, &count, &namePtrPtr);
 	if (result != TCL_OK) {
 	    goto errorInArrayGet;
 	}
@@ -3307,7 +3307,7 @@
 	int elemLen;
 	Tcl_Obj **elemPtrs, *copyListObj;
 
-	result = Tcl_ListObjGetElements(interp, arrayElemObj,
+	result = TclListObjGetElements(interp, arrayElemObj,
 		&elemLen, &elemPtrs);
 	if (result != TCL_OK) {
 	    return result;
@@ -4793,7 +4793,7 @@
 	Tcl_Panic("scalar parsedVarName without a string rep");
     }
 
-    part1 = Tcl_GetStringFromObj(arrayPtr, &len1);
+    part1 = TclGetStringFromObj(arrayPtr, &len1);
     len2 = strlen(part2);
 
     totalLen = len1 + len2 + 2;
