diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclBasic.c | 24 | ||||
-rw-r--r-- | generic/tclBinary.c | 33 | ||||
-rw-r--r-- | generic/tclClock.c | 36 | ||||
-rw-r--r-- | generic/tclCmdAH.c | 12 | ||||
-rw-r--r-- | generic/tclCmdIL.c | 72 | ||||
-rw-r--r-- | generic/tclCmdMZ.c | 87 | ||||
-rw-r--r-- | generic/tclCompCmds.c | 14 | ||||
-rw-r--r-- | generic/tclCompExpr.c | 11 | ||||
-rw-r--r-- | generic/tclCompile.c | 4 | ||||
-rw-r--r-- | generic/tclDictObj.c | 22 | ||||
-rw-r--r-- | generic/tclExecute.c | 59 | ||||
-rw-r--r-- | generic/tclGet.c | 6 | ||||
-rw-r--r-- | generic/tclIO.c | 18 | ||||
-rw-r--r-- | generic/tclIOCmd.c | 84 | ||||
-rw-r--r-- | generic/tclIOGT.c | 4 | ||||
-rw-r--r-- | generic/tclIOUtil.c | 4 | ||||
-rw-r--r-- | generic/tclIndexObj.c | 6 | ||||
-rw-r--r-- | generic/tclInt.h | 65 | ||||
-rw-r--r-- | generic/tclInterp.c | 66 | ||||
-rw-r--r-- | generic/tclListObj.c | 49 | ||||
-rw-r--r-- | generic/tclLiteral.c | 10 | ||||
-rw-r--r-- | generic/tclNamesp.c | 34 | ||||
-rw-r--r-- | generic/tclObj.c | 14 | ||||
-rw-r--r-- | generic/tclParse.c | 6 | ||||
-rw-r--r-- | generic/tclProc.c | 16 | ||||
-rw-r--r-- | generic/tclRegexp.c | 6 | ||||
-rw-r--r-- | generic/tclResult.c | 16 | ||||
-rw-r--r-- | generic/tclScan.c | 8 | ||||
-rw-r--r-- | generic/tclStringObj.c | 34 | ||||
-rw-r--r-- | generic/tclUtil.c | 18 | ||||
-rw-r--r-- | generic/tclVar.c | 14 |
31 files changed, 457 insertions, 395 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index b30a155..6ec97ef 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.278 2007/11/11 06:32:29 das Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.279 2007/11/11 19:32:13 msofer Exp $ */ #include "tclInt.h" @@ -3594,7 +3594,7 @@ TclEvalObjvInternal( */ 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 @@ TclEvalEx( 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 @@ TclEvalObjEx( 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 @@ Tcl_ExprLongObj( 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 @@ TclObjInvoke( 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_AppendObjToErrorInfo( 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 @@ ExprIntFunc( 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 @@ ExprIntFunc( 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 @@ ExprSrandFunc( 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 @@ ExprSrandFunc( 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 @@ TclDTraceInfo( 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; } diff --git a/generic/tclBinary.c b/generic/tclBinary.c index 2cfaff5..bf81665 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBinary.c,v 1.37 2007/11/09 18:50:54 hobbs Exp $ + * RCS: @(#) $Id: tclBinary.c,v 1.38 2007/11/11 19:32:14 msofer Exp $ */ #include "tclInt.h" @@ -397,7 +397,7 @@ SetByteArrayFromAny( 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 @@ Tcl_BinaryObjCmd( * 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 @@ Tcl_BinaryObjCmd( 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 @@ Tcl_BinaryObjCmd( */ arg = 3; - format = Tcl_GetString(objv[2]); + format = TclGetString(objv[2]); cursor = buffer; maxPos = cursor; while (*format != 0) { @@ -812,7 +815,8 @@ Tcl_BinaryObjCmd( 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 @@ Tcl_BinaryObjCmd( 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 @@ Tcl_BinaryObjCmd( 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 @@ Tcl_BinaryObjCmd( 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 @@ Tcl_BinaryObjCmd( 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 @@ Tcl_BinaryObjCmd( 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 @@ FormatNumber( 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 @@ FormatNumber( 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 @@ FormatNumber( * 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; diff --git a/generic/tclClock.c b/generic/tclClock.c index ff3e7bb..b6fe95b 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclClock.c,v 1.61 2007/04/20 05:51:09 kennykb Exp $ + * RCS: @(#) $Id: tclClock.c,v 1.62 2007/11/11 19:32:14 msofer Exp $ */ #include "tclInt.h" @@ -323,7 +323,7 @@ ClockConvertlocaltoutcObjCmd( &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 @@ ClockGetdatefieldsObjCmd( 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 @@ ClockGetjuliandayfromerayearmonthdayObjCmd ( &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 @@ ClockGetjuliandayfromerayearweekdayObjCmd ( &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 @@ ConvertLocalToUTC( * 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 @@ ConvertLocalToUTCUsingTable( 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 @@ ConvertUTCToLocal( * 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 @@ ConvertUTCToLocalUsingTable( 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 @@ ClockGetenvObjCmd( 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 = ""; diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index d8748b1..43a5e6c 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdAH.c,v 1.89 2007/06/20 18:46:07 dgp Exp $ + * RCS: @(#) $Id: tclCmdAH.c,v 1.90 2007/11/11 19:32:14 msofer Exp $ */ #include "tclInt.h" @@ -125,7 +125,7 @@ Tcl_CaseObjCmd( 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 @@ Tcl_EncodingObjCmd( * 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 @@ Tcl_FileObjCmd( 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 @@ Tcl_ForeachObjCmd( 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 @@ Tcl_ForeachObjCmd( 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) { diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index d3aee97..ba6febb 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdIL.c,v 1.123 2007/09/13 15:25:50 das Exp $ + * RCS: @(#) $Id: tclCmdIL.c,v 1.124 2007/11/11 19:32:14 msofer Exp $ */ #include "tclInt.h" @@ -540,7 +540,7 @@ InfoBodyCmd( * run before. [Bug #545644] */ - (void) Tcl_GetString(bodyPtr); + (void) TclGetString(bodyPtr); } resultPtr = Tcl_NewStringObj(bodyPtr->bytes, bodyPtr->length); @@ -1082,7 +1082,7 @@ InfoFrameCmd( * 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 @@ InfoLevelCmd( 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 @@ Tcl_JoinObjCmd( * 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 @@ Tcl_LassignObjCmd( return TCL_ERROR; } - Tcl_ListObjGetElements(NULL, listCopyPtr, &listObjc, &listObjv); + TclListObjGetElements(NULL, listCopyPtr, &listObjc, &listObjv); objc -= 2; objv += 2; @@ -2198,7 +2198,7 @@ Tcl_LinsertObjCmd( 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 @@ Tcl_LinsertObjCmd( * 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 @@ Tcl_LlengthObjCmd( 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 @@ Tcl_LrangeObjCmd( 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 @@ Tcl_LrangeObjCmd( 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_LrepeatObjCmd( 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 @@ Tcl_LreplaceObjCmd( 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 @@ Tcl_LreplaceObjCmd( * 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_LreverseObjCmd( 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 @@ Tcl_LsearchObjCmd( */ 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 @@ Tcl_LsearchObjCmd( */ 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 @@ Tcl_LsearchObjCmd( * 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 @@ Tcl_LsearchObjCmd( */ 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 @@ Tcl_LsearchObjCmd( 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 @@ Tcl_LsearchObjCmd( break; } } else { - patternBytes = Tcl_GetStringFromObj(patObj, &length); + patternBytes = TclGetStringFromObj(patObj, &length); } /* @@ -3077,7 +3077,7 @@ Tcl_LsearchObjCmd( 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 @@ Tcl_LsearchObjCmd( 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 @@ Tcl_LsearchObjCmd( 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 @@ Tcl_LsortObjCmd( * 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 @@ Tcl_LsortObjCmd( */ 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 @@ Tcl_LsortObjCmd( 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 @@ SortCompare( } 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 @@ SortCompare( * 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 @@ SortCompare( * 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 @@ SelectObjFromSublist( 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; } diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index c1d54ff..e4ae079 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdMZ.c,v 1.156 2007/11/01 11:11:44 dkf Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.157 2007/11/11 19:32:14 msofer Exp $ */ #include "tclInt.h" @@ -156,7 +156,7 @@ Tcl_RegexpObjCmd( 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 @@ Tcl_RegexpObjCmd( 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 @@ Tcl_RegsubObjCmd( 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 @@ Tcl_RegsubObjCmd( 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 @@ Tcl_SplitObjCmd( 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 @@ Tcl_StringObjCmd( } 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 @@ Tcl_StringObjCmd( 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 @@ Tcl_StringObjCmd( * 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 @@ Tcl_StringObjCmd( * 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 @@ Tcl_StringObjCmd( 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 @@ Tcl_StringObjCmd( 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 @@ Tcl_StringObjCmd( } 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 @@ Tcl_StringObjCmd( */ 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 @@ Tcl_StringObjCmd( 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 @@ Tcl_StringObjCmd( * well-formed lists. */ - if (TCL_OK == Tcl_ListObjLength(NULL, objPtr, &length2)) { + if (TCL_OK == TclListObjLength(NULL, objPtr, &length2)) { break; } @@ -1719,7 +1720,7 @@ Tcl_StringObjCmd( * 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 @@ Tcl_StringObjCmd( } 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 @@ Tcl_StringObjCmd( } 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_StringObjCmd( } 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 @@ Tcl_StringObjCmd( } 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 @@ Tcl_StringObjCmd( 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 @@ Tcl_StringObjCmd( 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 @@ Tcl_StringObjCmd( 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 @@ Tcl_StringObjCmd( 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_StringObjCmd( 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 @@ Tcl_StringObjCmd( } 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 @@ Tcl_StringObjCmd( 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 @@ Tcl_StringObjCmd( 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_StringObjCmd( 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 @@ Tcl_StringObjCmd( 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 @@ Tcl_StringObjCmd( 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_SwitchObjCmd( 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 @@ Tcl_SwitchObjCmd( * 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 @@ Tcl_SwitchObjCmd( 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 @@ Tcl_TimeObjCmd( 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; } diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 99cb133..035dd24 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompCmds.c,v 1.121 2007/10/18 21:16:18 dgp Exp $ + * RCS: @(#) $Id: tclCompCmds.c,v 1.122 2007/11/11 19:32:14 msofer Exp $ */ #include "tclInt.h" @@ -694,7 +694,7 @@ TclCompileDictCmd( 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 @@ TclCompileIncrCmd( 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 @@ TclCompileLindexCmd( 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 @@ TclCompileSyntaxError( { 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 @@ TclCompileStringCmd( 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 @@ IndexTailVarIfKnown( } } - tailName = Tcl_GetStringFromObj(tailPtr, &len); + tailName = TclGetStringFromObj(tailPtr, &len); if (len) { if (*(tailName+len-1) == ')') { diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index a53a6f1..48208d8 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompExpr.c,v 1.88 2007/10/17 04:35:18 kennykb Exp $ + * RCS: @(#) $Id: tclCompExpr.c,v 1.89 2007/11/11 19:32:14 msofer Exp $ */ #include "tclInt.h" @@ -2057,8 +2057,8 @@ TclCompileExpr( 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 @@ CompileExprTree( 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 @@ CompileExprTree( 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)++; diff --git a/generic/tclCompile.c b/generic/tclCompile.c index dab1b22..d66f356 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompile.c,v 1.136 2007/10/20 02:15:05 msofer Exp $ + * RCS: @(#) $Id: tclCompile.c,v 1.137 2007/11/11 19:32:14 msofer Exp $ */ #include "tclInt.h" @@ -484,7 +484,7 @@ TclSetByteCodeFromAny( } #endif - stringPtr = Tcl_GetStringFromObj(objPtr, &length); + stringPtr = TclGetStringFromObj(objPtr, &length); /* * TIP #280: Pick up the CmdFrame in which the BC compiler was invoked and diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index d8e4165..6f2acc3 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclDictObj.c,v 1.50 2007/09/08 22:36:58 dkf Exp $ + * RCS: @(#) $Id: tclDictObj.c,v 1.51 2007/11/11 19:32:14 msofer Exp $ */ #include "tclInt.h" @@ -302,12 +302,12 @@ UpdateStringOfDict( */ 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 @@ UpdateStringOfDict( 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 @@ SetDictFromAny( 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 @@ SetDictFromAny( */ if (Tcl_IsShared(objPtr)) { - (void) Tcl_GetString(objPtr); + (void) TclGetString(objPtr); } /* @@ -438,7 +438,7 @@ SetDictFromAny( * 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 @@ DictForCmd( 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 @@ DictFilterCmd( * 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 @@ DictWithCmd( * 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) { diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 2f3d617..cb72097 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclExecute.c,v 1.344 2007/11/10 23:36:55 msofer Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.345 2007/11/11 19:32:14 msofer Exp $ */ #include "tclInt.h" @@ -1180,7 +1180,7 @@ Tcl_ExprObj( /* 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 @@ TclIncrObj( 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 @@ TclIncrObj( * 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 @@ TclExecuteByteCode( */ 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 @@ TclExecuteByteCode( */ 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 @@ TclExecuteByteCode( */ 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 @@ TclExecuteByteCode( */ 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 @@ TclExecuteByteCode( 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 @@ TclExecuteByteCode( 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 @@ TclExecuteByteCode( * 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 @@ TclExecuteByteCode( * 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 @@ TclExecuteByteCode( * 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 @@ TclExecuteByteCode( 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 @@ TclExecuteByteCode( 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 @@ TclExecuteByteCode( 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 @@ TclExecuteByteCode( * \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 @@ TclExecuteByteCode( 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 @@ TclExecuteByteCode( 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 @@ TclExecuteByteCode( 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 @@ TclExecuteByteCode( 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 @@ TclExecuteByteCode( 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; diff --git a/generic/tclGet.c b/generic/tclGet.c index 058323d..57530bc 100644 --- a/generic/tclGet.c +++ b/generic/tclGet.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclGet.c,v 1.17 2005/11/07 15:13:36 dkf Exp $ + * RCS: @(#) $Id: tclGet.c,v 1.18 2007/11/11 19:32:15 msofer Exp $ */ #include "tclInt.h" @@ -50,7 +50,7 @@ Tcl_GetInt( 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 @@ TclGetLong( 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"); } diff --git a/generic/tclIO.c b/generic/tclIO.c index 1b96c3b..4b9843d 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIO.c,v 1.127 2007/11/08 07:10:44 das Exp $ + * RCS: @(#) $Id: tclIO.c,v 1.128 2007/11/11 19:32:15 msofer Exp $ */ #include "tclInt.h" @@ -3300,7 +3300,7 @@ Tcl_WriteObj( 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 @@ Tcl_Gets( 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 @@ Tcl_GetsObj( * 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 @@ DoReadChars( * 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 @@ CopyData( buffer = csPtr->buffer; sizeb = size; } else { - buffer = Tcl_GetStringFromObj(bufObj, &sizeb); + buffer = TclGetStringFromObj(bufObj, &sizeb); } if (outBinary || sameEncoding) { @@ -10275,7 +10275,7 @@ FixLevelCode( * !"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 @@ FixLevelCode( * !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; } diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 1c25295..f69506c 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOCmd.c,v 1.44 2007/10/15 21:27:48 dgp Exp $ + * RCS: @(#) $Id: tclIOCmd.c,v 1.45 2007/11/11 19:32:15 msofer Exp $ */ #include "tclInt.h" @@ -77,19 +77,19 @@ Tcl_PutsObjCmd( 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 @@ Tcl_PutsObjCmd( 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_FlushObjCmd( 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_GetsObjCmd( 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 @@ Tcl_ReadObjCmd( 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 @@ Tcl_ReadObjCmd( 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 @@ Tcl_ReadObjCmd( 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 @@ Tcl_ReadObjCmd( 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_SeekObjCmd( 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 @@ Tcl_TellObjCmd( * 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 @@ Tcl_CloseObjCmd( 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 @@ Tcl_CloseObjCmd( 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 @@ Tcl_FconfigureObjCmd( 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_FconfigureObjCmd( * 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 @@ Tcl_FconfigureObjCmd( } 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 @@ Tcl_EofObjCmd( 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 @@ Tcl_ExecObjCmd( 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 @@ Tcl_ExecObjCmd( */ 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 @@ Tcl_ExecObjCmd( */ 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 @@ Tcl_ExecObjCmd( */ 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 @@ Tcl_FblockedObjCmd( 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 @@ Tcl_OpenObjCmd( 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 @@ Tcl_OpenObjCmd( 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 @@ Tcl_SocketObjCmd( } for (a = 1; a < objc; a++) { - arg = Tcl_GetString(objv[a]); + arg = TclGetString(objv[a]); if (arg[0] != '-') { break; } @@ -1434,7 +1434,7 @@ Tcl_SocketObjCmd( "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 @@ Tcl_SocketObjCmd( "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 @@ Tcl_SocketObjCmd( "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 @@ Tcl_SocketObjCmd( return TCL_ERROR; } } else if (a < objc) { - host = Tcl_GetString(objv[a]); + host = TclGetString(objv[a]); a++; } else { Interp *iPtr; @@ -1495,7 +1495,7 @@ Tcl_SocketObjCmd( } 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 @@ Tcl_FcopyObjCmd( * 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 @@ Tcl_FcopyObjCmd( "\" 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 @@ Tcl_FcopyObjCmd( } 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 @@ TclChanPendingObjCmd( return TCL_ERROR; } - arg = Tcl_GetString(objv[2]); + arg = TclGetString(objv[2]); chan = Tcl_GetChannel(interp, arg, &mode); if (chan == NULL) { return TCL_ERROR; diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c index 2460e4a..509172e 100644 --- a/generic/tclIOGT.c +++ b/generic/tclIOGT.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * CVS: $Id: tclIOGT.c,v 1.17 2007/04/17 14:49:53 dkf Exp $ + * CVS: $Id: tclIOGT.c,v 1.18 2007/11/11 19:32:15 msofer Exp $ */ #include "tclInt.h" @@ -451,7 +451,7 @@ ExecuteCallback( */ resObj = Tcl_GetObjResult(dataPtr->interp); - Tcl_GetIntFromObj(dataPtr->interp, resObj, &dataPtr->maxRead); + TclGetIntFromObj(dataPtr->interp, resObj, &dataPtr->maxRead); break; } diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 90cc2c4..9a7aa72 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -17,7 +17,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOUtil.c,v 1.146 2007/08/15 17:43:58 dkf Exp $ + * RCS: @(#) $Id: tclIOUtil.c,v 1.147 2007/11/11 19:32:15 msofer Exp $ */ #include "tclInt.h" @@ -3813,7 +3813,7 @@ Tcl_FSSplitPath( */ if (lenPtr != NULL) { - Tcl_ListObjLength(NULL, result, lenPtr); + TclListObjLength(NULL, result, lenPtr); } return result; } diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index ef2f3ed..407ab14 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIndexObj.c,v 1.35 2007/06/20 18:46:13 dgp Exp $ + * RCS: @(#) $Id: tclIndexObj.c,v 1.36 2007/11/11 19:32:16 msofer Exp $ */ #include "tclInt.h" @@ -533,7 +533,7 @@ Tcl_WrongNumArgs( 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 @@ Tcl_WrongNumArgs( * 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) { diff --git a/generic/tclInt.h b/generic/tclInt.h index 48e20b2..6d6916c 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInt.h,v 1.341 2007/11/10 20:49:43 das Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.342 2007/11/11 19:32:16 msofer Exp $ */ #ifndef _TCLINT @@ -2099,17 +2099,56 @@ typedef struct List { } 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 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr); #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 diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 781e5b5..8389ed2 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInterp.c,v 1.78 2007/09/06 19:23:56 dgp Exp $ + * RCS: @(#) $Id: tclInterp.c,v 1.79 2007/11/11 19:32:16 msofer Exp $ */ #include "tclInt.h" @@ -597,7 +597,7 @@ Tcl_InterpObjCmd( 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 @@ Tcl_InterpObjCmd( 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 @@ Tcl_InterpObjCmd( 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 @@ Tcl_InterpObjCmd( 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 @@ Tcl_InterpObjCmd( 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 @@ Tcl_InterpObjCmd( 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 @@ Tcl_InterpObjCmd( 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 @@ Tcl_GetAlias( *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 @@ Tcl_GetAlias( *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 @@ Tcl_GetAliasObj( *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 @@ TclPreventAliasLoop( } 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 @@ AliasCreate( 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 @@ AliasCreate( 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 @@ AliasDelete( */ 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 @@ GetInterp( 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 @@ GetInterp( 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 @@ SlaveBgerror( 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 @@ SlaveCreate( } if (objc < 2) { masterInterp = interp; - path = Tcl_GetString(pathPtr); + path = TclGetString(pathPtr); } else { Tcl_Obj *objPtr; @@ -2129,7 +2129,7 @@ SlaveCreate( 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 @@ SlaveObjCmd( 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 @@ SlaveObjCmd( 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 @@ SlaveObjCmd( 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 @@ SlaveExpose( 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 @@ SlaveRecursionLimit( (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 @@ SlaveHide( 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 @@ SlaveCommandLimitCmd( 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 @@ SlaveCommandLimitCmd( 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 @@ SlaveTimeLimitCmd( 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 @@ SlaveTimeLimitCmd( 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 @@ SlaveTimeLimitCmd( 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) { diff --git a/generic/tclListObj.c b/generic/tclListObj.c index c1d1bfa..49602f8 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclListObj.c,v 1.47 2007/09/03 21:27:22 kennykb Exp $ + * RCS: @(#) $Id: tclListObj.c,v 1.48 2007/11/11 19:32:16 msofer Exp $ */ #include "tclInt.h" @@ -428,7 +428,7 @@ Tcl_ListObjGetElements( 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_ListObjAppendList( 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 @@ Tcl_ListObjAppendElement( 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 @@ Tcl_ListObjIndex( 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 @@ Tcl_ListObjLength( 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 @@ Tcl_ListObjReplace( 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 @@ TclLindexList( */ 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 @@ TclLindexList( 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 @@ TclLindexFlat( 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 @@ TclLindexFlat( */ 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 @@ TclLsetList( */ 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 @@ TclLsetList( 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 @@ TclLsetFlat( /* 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 @@ TclListObjSetElement( 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 @@ SetListFromAny( * 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 @@ UpdateStringOfList( 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 @@ UpdateStringOfList( 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 = ' '; diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c index ba9b812..71489e4 100644 --- a/generic/tclLiteral.c +++ b/generic/tclLiteral.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclLiteral.c,v 1.31 2007/07/31 17:03:39 msofer Exp $ + * RCS: @(#) $Id: tclLiteral.c,v 1.32 2007/11/11 19:32:16 msofer Exp $ */ #include "tclInt.h" @@ -510,7 +510,7 @@ TclLookupLiteralEntry( 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 @@ TclHideLiteral( 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 @@ TclReleaseLiteral( char *bytes; int length, index; - bytes = Tcl_GetStringFromObj(objPtr, &length); + bytes = TclGetStringFromObj(objPtr, &length); index = (HashString(bytes, length) & globalTablePtr->mask); /* @@ -968,7 +968,7 @@ RebuildLiteralTable( 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; diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 430eb49..a6f89cf 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -23,7 +23,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclNamesp.c,v 1.151 2007/10/27 18:03:08 msofer Exp $ + * RCS: @(#) $Id: tclNamesp.c,v 1.152 2007/11/11 19:32:16 msofer Exp $ */ #include "tclInt.h" @@ -2664,7 +2664,7 @@ TclGetNamespaceFromObj( 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 @@ NamespaceCodeCmd( * 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 @@ NamespacePathCmd( * 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 @@ Tcl_SetNamespaceUnknownHandler( 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 @@ NamespaceEnsembleCmd( 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 @@ NamespaceEnsembleCmd( 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 @@ NamespaceEnsembleCmd( } 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 @@ NamespaceEnsembleCmd( } 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 @@ NamespaceEnsembleCmd( 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 @@ NamespaceEnsembleCmd( } 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 @@ Tcl_SetEnsembleSubcommandList( } 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 @@ Tcl_SetEnsembleUnknownHandler( 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 @@ NsEnsembleImplementationCmd( (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 @@ NsEnsembleImplementationCmd( for (i=1 ; i<objc ; i++) { Tcl_ListObjAppendElement(NULL, unknownCmd, objv[i]); } - Tcl_ListObjGetElements(NULL, unknownCmd, ¶mc, ¶mv); + TclListObjGetElements(NULL, unknownCmd, ¶mc, ¶mv); Tcl_Preserve(ensemblePtr); Tcl_IncrRefCount(unknownCmd); result = Tcl_EvalObjv(interp, paramc, paramv, 0); @@ -6099,7 +6099,7 @@ NsEnsembleImplementationCmd( * 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 @@ BuildEnsembleConfig( 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]); diff --git a/generic/tclObj.c b/generic/tclObj.c index 28f00ff..f44f3af 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclObj.c,v 1.136 2007/10/11 13:35:26 msofer Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.137 2007/11/11 19:32:16 msofer Exp $ */ #include "tclInt.h" @@ -493,7 +493,7 @@ Tcl_AppendAllObjTypes( * 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 @@ ParseBoolean( 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 @@ Tcl_GetIntFromObj( 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 @@ Tcl_GetIntFromObj( } *intPtr = (int) l; return TCL_OK; +#endif } /* @@ -1941,7 +1945,7 @@ SetIntFromAny( Tcl_Obj *objPtr) /* Pointer to the object to convert */ { long l; - return Tcl_GetLongFromObj(interp, objPtr, &l); + return TclGetLongFromObj(interp, objPtr, &l); } /* diff --git a/generic/tclParse.c b/generic/tclParse.c index b11e5bf..ba1198a 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclParse.c,v 1.57 2007/10/15 13:22:50 msofer Exp $ + * RCS: @(#) $Id: tclParse.c,v 1.58 2007/11/11 19:32:17 msofer Exp $ */ #include "tclInt.h" @@ -1921,7 +1921,7 @@ Tcl_SubstObj( 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 @@ TclObjCommandComplete( CONST char *script; int length; - script = Tcl_GetStringFromObj(objPtr, &length); + script = TclGetStringFromObj(objPtr, &length); return CommandComplete(script, length); } diff --git a/generic/tclProc.c b/generic/tclProc.c index eac4033..2b062bf 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclProc.c,v 1.135 2007/09/25 20:27:18 dkf Exp $ + * RCS: @(#) $Id: tclProc.c,v 1.136 2007/11/11 19:32:17 msofer Exp $ */ #include "tclInt.h" @@ -411,7 +411,7 @@ TclCreateProc( */ if (Tcl_IsShared(bodyPtr)) { - bytes = Tcl_GetStringFromObj(bodyPtr, &length); + bytes = TclGetStringFromObj(bodyPtr, &length); bodyPtr = Tcl_NewStringObj(bytes, length); } @@ -442,7 +442,7 @@ TclCreateProc( * 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 @@ TclCreateProc( 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 @@ TclObjGetFrame( || 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 @@ SetLambdaFromAny( * 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 @@ SetLambdaFromAny( 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 @@ Tcl_ApplyObjCmd( 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); } diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c index a5a8095..89e2061 100644 --- a/generic/tclRegexp.c +++ b/generic/tclRegexp.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclRegexp.c,v 1.24 2007/03/07 09:35:42 dkf Exp $ + * RCS: @(#) $Id: tclRegexp.c,v 1.25 2007/11/11 19:32:17 msofer Exp $ */ #include "tclInt.h" @@ -251,7 +251,7 @@ Tcl_RegExpRange( *startPtr = *endPtr = NULL; } else { if (regexpPtr->objPtr) { - string = Tcl_GetString(regexpPtr->objPtr); + string = TclGetString(regexpPtr->objPtr); } else { string = regexpPtr->string; } @@ -562,7 +562,7 @@ Tcl_GetRegExpFromObj( 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) { diff --git a/generic/tclResult.c b/generic/tclResult.c index 1601619..c68c155 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclResult.c,v 1.40 2007/11/10 01:34:00 msofer Exp $ + * RCS: @(#) $Id: tclResult.c,v 1.41 2007/11/11 19:32:17 msofer Exp $ */ #include "tclInt.h" @@ -1218,7 +1218,7 @@ TclProcessReturn( 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 @@ TclProcessReturn( 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 @@ TclMergeReturnOptions( 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 @@ TclMergeReturnOptions( 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 @@ TclMergeReturnOptions( 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 @@ Tcl_SetReturnOptions( 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 \"", diff --git a/generic/tclScan.c b/generic/tclScan.c index aa1fe75..8aa7c38 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclScan.c,v 1.25 2007/06/22 20:42:24 dgp Exp $ + * RCS: @(#) $Id: tclScan.c,v 1.26 2007/11/11 19:32:17 msofer Exp $ */ #include "tclInt.h" @@ -899,7 +899,7 @@ Tcl_ScanObjCmd( 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_ScanObjCmd( 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; diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 2ab51fb..bdfe6f2 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -33,7 +33,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStringObj.c,v 1.65 2007/03/28 19:03:42 dgp Exp $ */ + * RCS: @(#) $Id: tclStringObj.c,v 1.66 2007/11/11 19:32:17 msofer Exp $ */ #include "tclInt.h" #include "tommath.h" @@ -637,7 +637,7 @@ Tcl_GetRange( } 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 @@ Tcl_AppendObjToObj( 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 @@ Tcl_AppendObjToObj( * 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 @@ Tcl_AppendFormatToObj( 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 @@ Tcl_AppendFormatToObj( 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 @@ Tcl_AppendFormatToObj( 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 @@ Tcl_AppendFormatToObj( 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_AppendFormatToObj( 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 @@ Tcl_AppendFormatToObj( 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 @@ Tcl_AppendFormatToObj( 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 @@ Tcl_AppendFormatToObj( } pure = Tcl_NewObj(); Tcl_SetObjLength(pure, numDigits); - bytes = Tcl_GetString(pure); + bytes = TclGetString(pure); length = numDigits; while (numDigits--) { int digitOffset; @@ -2230,7 +2230,7 @@ Tcl_AppendFormatToObj( 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 @@ Tcl_AppendFormatToObj( 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 @@ AppendPrintfToObjVA( } } 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 @@ TclStringObjReverse( 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--]; } diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 815769a..1bcd957 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUtil.c,v 1.86 2007/11/09 18:55:16 hobbs Exp $ + * RCS: @(#) $Id: tclUtil.c,v 1.87 2007/11/11 19:32:17 msofer Exp $ */ #include "tclInt.h" @@ -1161,7 +1161,7 @@ Tcl_ConcatObj( objPtr = objv[i]; if (objPtr->typePtr != &tclListType) { - Tcl_GetString(objPtr); + TclGetString(objPtr); if (objPtr->length) { break; } else { @@ -1192,7 +1192,7 @@ Tcl_ConcatObj( 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 @@ Tcl_ConcatObj( 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 @@ Tcl_ConcatObj( 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 @@ TclGetIntForIndex( 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 @@ TclGetIntForIndex( } 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 @@ SetEndOffsetFromAny( * 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 @@ TclSetProcessGlobalValue( } 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) { diff --git a/generic/tclVar.c b/generic/tclVar.c index 56d57c3..02c049b 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclVar.c,v 1.154 2007/11/03 01:47:13 msofer Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.155 2007/11/11 19:32:17 msofer Exp $ */ #include "tclInt.h" @@ -614,7 +614,7 @@ TclObjLookupVarEx( } parsed = 1; } - part1 = Tcl_GetStringFromObj(part1Ptr, &len1); + part1 = TclGetStringFromObj(part1Ptr, &len1); if (!parsed && (*(part1 + len1 - 1) == ')')) { /* @@ -2572,7 +2572,7 @@ Tcl_LappendObjCmd( 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 @@ Tcl_LappendObjCmd( 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 @@ Tcl_ArrayObjCmd( */ 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 @@ TclArraySet( 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 @@ UpdateParsedVarName( Tcl_Panic("scalar parsedVarName without a string rep"); } - part1 = Tcl_GetStringFromObj(arrayPtr, &len1); + part1 = TclGetStringFromObj(arrayPtr, &len1); len2 = strlen(part2); totalLen = len1 + len2 + 2; |