diff options
-rw-r--r-- | generic/tclCompCmds.c | 35 | ||||
-rw-r--r-- | generic/tclCompCmdsGR.c | 42 | ||||
-rw-r--r-- | generic/tclCompCmdsSZ.c | 34 | ||||
-rw-r--r-- | generic/tclCompile.c | 6 | ||||
-rw-r--r-- | generic/tclEnsemble.c | 6 | ||||
-rw-r--r-- | generic/tclInt.h | 3 | ||||
-rw-r--r-- | generic/tclProc.c | 4 | ||||
-rw-r--r-- | generic/tclTest.c | 6 | ||||
-rw-r--r-- | generic/tclUtil.c | 3 |
9 files changed, 68 insertions, 71 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 1ba556a..f832420 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -126,9 +126,9 @@ TclCompileAppendCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr, *valueTokenPtr; int isScalar, localIndex, numWords, i; - DefineLineInformation; /* TIP #280 */ /* TODO: Consider support for compiling expanded args. */ numWords = parsePtr->numWords; @@ -572,10 +572,10 @@ TclCompileCatchCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ JumpFixup jumpFixup; Tcl_Token *cmdTokenPtr, *resultNameTokenPtr, *optsNameTokenPtr; int resultIndex, optsIndex, range, dropScript = 0; - DefineLineInformation; /* TIP #280 */ int depth = TclGetStackDepth(envPtr); /* @@ -1004,9 +1004,9 @@ TclCompileDictSetCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; int i, dictVarIndex; - DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr; /* @@ -1130,9 +1130,9 @@ TclCompileDictGetCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; int i; - DefineLineInformation; /* TIP #280 */ /* * There must be at least two arguments after the command (the single-arg @@ -1166,9 +1166,9 @@ TclCompileDictGetWithDefaultCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; int i; - DefineLineInformation; /* TIP #280 */ /* * There must be at least three arguments after the command. @@ -1197,9 +1197,9 @@ TclCompileDictExistsCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; int i; - DefineLineInformation; /* TIP #280 */ /* * There must be at least two arguments after the command (the single-arg @@ -1234,8 +1234,8 @@ TclCompileDictUnsetCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - Tcl_Token *tokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr; int i, dictVarIndex; /* @@ -2350,13 +2350,13 @@ TclCompileErrorCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr; + /* * General syntax: [error message ?errorInfo? ?errorCode?] */ - Tcl_Token *tokenPtr; - DefineLineInformation; /* TIP #280 */ - if (parsePtr->numWords < 2 || parsePtr->numWords > 4) { return TCL_ERROR; } @@ -2467,11 +2467,11 @@ TclCompileForCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *startTokenPtr, *testTokenPtr, *nextTokenPtr, *bodyTokenPtr; JumpFixup jumpEvalCondFixup; int bodyCodeOffset, nextCodeOffset, jumpDist; int bodyRange, nextRange; - DefineLineInformation; /* TIP #280 */ if (parsePtr->numWords != 5) { return TCL_ERROR; @@ -2679,6 +2679,7 @@ CompileEachloopCmd( int collect) /* Select collecting or accumulating mode * (TCL_EACH_*) */ { + DefineLineInformation; /* TIP #280 */ Proc *procPtr = envPtr->procPtr; ForeachInfo *infoPtr=NULL; /* Points to the structure describing this * foreach command. Stored in a AuxData @@ -2688,7 +2689,6 @@ CompileEachloopCmd( int jumpBackOffset, infoIndex, range; int numWords, numLists, i, j, code = TCL_OK; Tcl_Obj *varListObj = NULL; - DefineLineInformation; /* TIP #280 */ /* * If the foreach command isn't in a procedure, don't compile it inline: @@ -3453,10 +3453,10 @@ TclPushVarName( /* * last char is ')' => potential array reference. */ - last = Tcl_UtfPrev(name + nameLen, name); + last = &name[nameLen-1]; if (*last == ')') { - for (p = name; p < last; p = Tcl_UtfNext(p)) { + for (p = name; p < last; p++) { if (*p == '(') { elName = p + 1; elNameLen = last - elName; @@ -3484,15 +3484,14 @@ TclPushVarName( } else if (interp && ((n = varTokenPtr->numComponents) > 1) && (varTokenPtr[1].type == TCL_TOKEN_TEXT) && (varTokenPtr[n].type == TCL_TOKEN_TEXT) - && (*((p = varTokenPtr[n].start + varTokenPtr[n].size)-1) == ')') - && (*Tcl_UtfPrev(p, varTokenPtr[n].start) == ')')) { + && (*(varTokenPtr[n].start + varTokenPtr[n].size - 1) == ')')) { /* * Check for parentheses inside first token. */ simpleVarName = 0; for (p = varTokenPtr[1].start, - last = p + varTokenPtr[1].size; p < last; p = Tcl_UtfNext(p)) { + last = p + varTokenPtr[1].size; p < last; p++) { if (*p == '(') { simpleVarName = 1; break; @@ -3560,7 +3559,7 @@ TclPushVarName( int hasNsQualifiers = 0; - for (p = name, last = p + nameLen-1; p < last; p = Tcl_UtfNext(p)) { + for (p = name, last = p + nameLen-1; p < last; p++) { if ((*p == ':') && (*(p+1) == ':')) { hasNsQualifiers = 1; break; diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index 1548933..b0afef8 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -89,9 +89,9 @@ TclCompileGlobalCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr; int localIndex, numWords, i; - DefineLineInformation; /* TIP #280 */ /* TODO: Consider support for compiling expanded args. */ numWords = parsePtr->numWords; @@ -170,6 +170,7 @@ TclCompileIfCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ JumpFixupArray jumpFalseFixupArray; /* Used to fix the ifFalse jump after each * test when its target PC is determined. */ @@ -186,7 +187,6 @@ TclCompileIfCmd( * "if 0 {..}" */ int boolVal; /* Value of static condition. */ int compileScripts = 1; - DefineLineInformation; /* TIP #280 */ /* * Only compile the "if" command if all arguments are simple words, in @@ -473,9 +473,9 @@ TclCompileIncrCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr, *incrTokenPtr; int isScalar, localIndex, haveImmValue, immValue; - DefineLineInformation; /* TIP #280 */ if ((parsePtr->numWords != 2) && (parsePtr->numWords != 3)) { return TCL_ERROR; @@ -668,9 +668,9 @@ TclCompileInfoExistsCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; int isScalar, localIndex; - DefineLineInformation; /* TIP #280 */ if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -841,9 +841,9 @@ TclCompileLappendCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr, *valueTokenPtr; int isScalar, localIndex, numWords, i; - DefineLineInformation; /* TIP #280 */ /* TODO: Consider support for compiling expanded args. */ numWords = parsePtr->numWords; @@ -956,9 +956,9 @@ TclCompileLassignCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; int isScalar, localIndex, numWords, idx; - DefineLineInformation; /* TIP #280 */ numWords = parsePtr->numWords; @@ -1059,9 +1059,9 @@ TclCompileLindexCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *idxTokenPtr, *valTokenPtr; int i, idx, numWords = parsePtr->numWords; - DefineLineInformation; /* TIP #280 */ /* * Quit if too few args. @@ -1262,8 +1262,8 @@ TclCompileLlengthCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { - Tcl_Token *varTokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *varTokenPtr; if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -1294,8 +1294,8 @@ TclCompileLrangeCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds the resulting instructions. */ { - Tcl_Token *tokenPtr, *listTokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr, *listTokenPtr; int idx1, idx2; if (parsePtr->numWords != 4) { @@ -1354,8 +1354,8 @@ TclCompileLinsertCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds the resulting instructions. */ { - Tcl_Token *tokenPtr, *listTokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr, *listTokenPtr; int idx, i; if (parsePtr->numWords < 3) { @@ -1456,8 +1456,8 @@ TclCompileLreplaceCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds the resulting instructions. */ { - Tcl_Token *tokenPtr, *listTokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr, *listTokenPtr; int idx1, idx2, i; int emptyPrefix=1, suffixStart = 0; @@ -1619,6 +1619,7 @@ TclCompileLsetCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds the resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ int tempDepth; /* Depth used for emitting one part of the * code burst. */ Tcl_Token *varTokenPtr; /* Pointer to the Tcl_Token representing the @@ -1626,7 +1627,6 @@ TclCompileLsetCmd( int localIndex; /* Index of var in local var table. */ int isScalar; /* Flag == 1 if scalar, 0 if array. */ int i; - DefineLineInformation; /* TIP #280 */ /* * Check argument count. @@ -1789,8 +1789,8 @@ TclCompileNamespaceCodeCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { - Tcl_Token *tokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr; if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -1838,8 +1838,8 @@ TclCompileNamespaceOriginCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { - Tcl_Token *tokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr; if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -1859,8 +1859,8 @@ TclCompileNamespaceQualifiersCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { - Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); int off; if (parsePtr->numWords != 2) { @@ -1894,8 +1894,8 @@ TclCompileNamespaceTailCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { - Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); JumpFixup jumpFixup; if (parsePtr->numWords != 2) { @@ -1930,9 +1930,9 @@ TclCompileNamespaceUpvarCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr; int localIndex, numWords, i; - DefineLineInformation; /* TIP #280 */ if (envPtr->procPtr == NULL) { return TCL_ERROR; @@ -2053,12 +2053,12 @@ TclCompileRegexpCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds the resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr; /* Pointer to the Tcl_Token representing the * parse of the RE or string. */ size_t len; int i, nocase, exact, sawLast, simple; const char *str; - DefineLineInformation; /* TIP #280 */ /* * We are only interested in compiling simple regexp cases. Currently @@ -2393,6 +2393,7 @@ TclCompileReturnCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ /* * General syntax: [return ?-option value ...? ?result?] * An even number of words means an explicit result argument is present. @@ -2403,7 +2404,6 @@ TclCompileReturnCmd( int numOptionWords = numWords - 1 - explicitResult; Tcl_Obj *returnOpts, **objv; Tcl_Token *wordTokenPtr = TokenAfter(parsePtr->tokenPtr); - DefineLineInformation; /* TIP #280 */ /* * Check for special case which can always be compiled: @@ -2644,9 +2644,9 @@ TclCompileUpvarCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr; int localIndex, numWords, i; - DefineLineInformation; /* TIP #280 */ Tcl_Obj *objPtr; if (envPtr->procPtr == NULL) { @@ -2750,9 +2750,9 @@ TclCompileVariableCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr, *valueTokenPtr; int localIndex, numWords, i; - DefineLineInformation; /* TIP #280 */ numWords = parsePtr->numWords; if (numWords < 2) { diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 982516a..6cc607a 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -129,9 +129,9 @@ TclCompileSetCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr, *valueTokenPtr; int isAssignment, isScalar, localIndex, numWords; - DefineLineInformation; /* TIP #280 */ numWords = parsePtr->numWords; if ((numWords != 2) && (numWords != 3)) { @@ -222,10 +222,10 @@ TclCompileStringCatCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ int i, numWords = parsePtr->numWords, numArgs; Tcl_Token *wordTokenPtr; Tcl_Obj *obj, *folded; - DefineLineInformation; /* TIP #280 */ /* Trivial case, no arg */ @@ -444,8 +444,8 @@ TclCompileStringInsertCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { - Tcl_Token *tokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr; int idx; if (parsePtr->numWords != 4) { @@ -1048,8 +1048,8 @@ TclCompileStringReplaceCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds the resulting instructions. */ { - Tcl_Token *tokenPtr, *valueTokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr, *valueTokenPtr; int first, last; if (parsePtr->numWords < 4 || parsePtr->numWords > 5) { @@ -1448,13 +1448,13 @@ TclCompileSubstCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ int numArgs = parsePtr->numWords - 1; int numOpts = numArgs - 1; int objc, flags = TCL_SUBST_ALL; Tcl_Obj **objv/*, *toSubst = NULL*/; Tcl_Token *wordTokenPtr = TokenAfter(parsePtr->tokenPtr); int code = TCL_ERROR; - DefineLineInformation; /* TIP #280 */ if (numArgs == 0) { return TCL_ERROR; @@ -1782,6 +1782,7 @@ TclCompileSwitchCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; /* Pointer to tokens in command. */ int numWords; /* Number of words in command. */ @@ -1798,7 +1799,6 @@ TclCompileSwitchCmd( int foundMode = 0; /* Have we seen a mode flag yet? */ int i, valueIndex; int result = TCL_ERROR; - DefineLineInformation; /* TIP #280 */ int *clNext = envPtr->clNext; /* @@ -3616,9 +3616,9 @@ TclCompileUnsetCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr; int isScalar, localIndex, flags = 1, i, varCount = 0, haveFlags = 0; - DefineLineInformation; /* TIP #280 */ /* TODO: Consider support for compiling expanded args. */ @@ -3753,13 +3753,13 @@ TclCompileWhileCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *testTokenPtr, *bodyTokenPtr; JumpFixup jumpEvalCondFixup; int testCodeOffset, bodyCodeOffset, jumpDist, range, code, boolVal; int loopMayEnd = 1; /* This is set to 0 if it is recognized as an * infinite loop. */ Tcl_Obj *boolObj; - DefineLineInformation; /* TIP #280 */ if (parsePtr->numWords != 3) { return TCL_ERROR; @@ -4015,8 +4015,8 @@ CompileUnaryOpCmd( int instruction, CompileEnv *envPtr) { - Tcl_Token *tokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr; if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -4057,8 +4057,8 @@ CompileAssociativeBinaryOpCmd( int instruction, CompileEnv *envPtr) { - Tcl_Token *tokenPtr = parsePtr->tokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr = parsePtr->tokenPtr; int words; /* TODO: Consider support for compiling expanded args. */ @@ -4142,8 +4142,8 @@ CompileComparisonOpCmd( int instruction, CompileEnv *envPtr) { - Tcl_Token *tokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr; /* TODO: Consider support for compiling expanded args. */ if (parsePtr->numWords < 3) { @@ -4296,15 +4296,15 @@ TclCompilePowOpCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) { + DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr = parsePtr->tokenPtr; + int words; + /* * This one has its own implementation because the ** operator is the only * one with right associativity. */ - Tcl_Token *tokenPtr = parsePtr->tokenPtr; - DefineLineInformation; /* TIP #280 */ - int words; - for (words=1 ; words<parsePtr->numWords ; words++) { tokenPtr = TokenAfter(tokenPtr); CompileWord(envPtr, tokenPtr, interp, words); @@ -4497,8 +4497,8 @@ TclCompileMinusOpCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) { - Tcl_Token *tokenPtr = parsePtr->tokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr = parsePtr->tokenPtr; int words; /* TODO: Consider support for compiling expanded args. */ @@ -4542,8 +4542,8 @@ TclCompileDivOpCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) { - Tcl_Token *tokenPtr = parsePtr->tokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr = parsePtr->tokenPtr; int words; /* TODO: Consider support for compiling expanded args. */ diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 6899dbb..4c5f543 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1829,9 +1829,9 @@ TclCompileInvocation( size_t numWords, CompileEnv *envPtr) { + DefineLineInformation; size_t wordIdx = 0; int depth = TclGetStackDepth(envPtr); - DefineLineInformation; if (cmdObj) { CompileCmdLiteral(interp, cmdObj, envPtr); @@ -1874,8 +1874,8 @@ CompileExpanded( int numWords, CompileEnv *envPtr) { - int wordIdx = 0; DefineLineInformation; + int wordIdx = 0; int depth = TclGetStackDepth(envPtr); StartExpanding(envPtr); @@ -1933,8 +1933,8 @@ CompileCmdCompileProc( Command *cmdPtr, CompileEnv *envPtr) { - int unwind = 0, incrOffset = -1; DefineLineInformation; + int unwind = 0, incrOffset = -1; int depth = TclGetStackDepth(envPtr); /* diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 4776be8..faa0263 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -2907,6 +2907,7 @@ TclCompileEnsemble( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); Tcl_Obj *mapObj, *subcmdObj, *targetCmdObj, *listObj, **elems; Tcl_Obj *replaced = Tcl_NewObj(), *replacement; @@ -2916,7 +2917,6 @@ TclCompileEnsemble( int ourResult = TCL_ERROR; size_t numBytes; const char *word; - DefineLineInformation; Tcl_IncrRefCount(replaced); if (parsePtr->numWords < depth + 1) { @@ -3245,6 +3245,7 @@ TclAttemptCompileProc( Command *cmdPtr, CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; int result, i; Tcl_Token *saveTokenPtr = parsePtr->tokenPtr; int savedStackDepth = envPtr->currStackDepth; @@ -3254,7 +3255,6 @@ TclAttemptCompileProc( #ifdef TCL_COMPILE_DEBUG int savedExceptDepth = envPtr->exceptDepth; #endif - DefineLineInformation; if (cmdPtr->compileProc == NULL) { return TCL_ERROR; @@ -3378,12 +3378,12 @@ CompileToInvokedCommand( Command *cmdPtr, CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; Tcl_Token *tokPtr; Tcl_Obj *objPtr, **words; const char *bytes; int i, numWords, cmdLit, extraLiteralFlags = LITERAL_CMD_NAME; size_t length; - DefineLineInformation; /* * Push the words of the command. Take care; the command words may be diff --git a/generic/tclInt.h b/generic/tclInt.h index 456ee15..d6d6d0e 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4660,9 +4660,6 @@ MODULE_SCOPE const TclFileAttrProcs tclpFileAttrProcs[]; ((unsigned char) *((src) - 1)) < 0x80 ? (src) - 1 : \ Tcl_UtfPrev(src, start)) -#define TclUtfNext(src) \ - ((((unsigned char) *(src)) < 0x80) ? (src) + 1 : Tcl_UtfNext(src)) - /* *---------------------------------------------------------------- * Macro that encapsulates the logic that determines when it is safe to diff --git a/generic/tclProc.c b/generic/tclProc.c index 60b7662..6f51da8 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -545,7 +545,7 @@ TclCreateProc( */ argnamei = argname; - argnamelast = Tcl_UtfPrev(argname + nameLength, argname); + argnamelast = (nameLength > 0) ? (argname + nameLength - 1) : argname; while (argnamei < argnamelast) { if (*argnamei == '(') { if (*argnamelast == ')') { /* We have an array element. */ @@ -566,7 +566,7 @@ TclCreateProc( "FORMALARGUMENTFORMAT", NULL); goto procError; } - argnamei = Tcl_UtfNext(argnamei); + argnamei++; } if (precompiled) { diff --git a/generic/tclTest.c b/generic/tclTest.c index 39ea585..0857eba 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -6844,10 +6844,10 @@ TestUtfNextCmd( memcpy(buffer + 1, bytes, numBytes); buffer[0] = buffer[numBytes + 1] = buffer[numBytes + 2] = buffer[numBytes + 3] = '\xA0'; - first = result = TclUtfNext(buffer + 1); + first = result = Tcl_UtfNext(buffer + 1); while ((buffer[0] = *p++) != '\0') { /* Run Tcl_UtfNext with many more possible bytes at src[-1], all should give the same result */ - result = TclUtfNext(buffer + 1); + result = Tcl_UtfNext(buffer + 1); if (first != result) { Tcl_AppendResult(interp, "Tcl_UtfNext is not supposed to read src[-1]", NULL); return TCL_ERROR; @@ -6856,7 +6856,7 @@ TestUtfNextCmd( p = tobetested; while ((buffer[numBytes + 1] = *p++) != '\0') { /* Run Tcl_UtfNext with many more possible bytes at src[end], all should give the same result */ - result = TclUtfNext(buffer + 1); + result = Tcl_UtfNext(buffer + 1); if (first != result) { first = buffer; break; diff --git a/generic/tclUtil.c b/generic/tclUtil.c index f7accd8..c4da26d 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -1805,8 +1805,9 @@ TclTrim( /* If we did not trim the whole string, it starts with a character * that we will not trim. Skip over it. */ if (numBytes > 0) { + int ch; const char *first = bytes + trimLeft; - bytes = TclUtfNext(first); + bytes += TclUtfToUCS4(first, &ch); numBytes -= (bytes - first); if (numBytes > 0) { |