diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-03-06 15:28:52 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-03-06 15:28:52 (GMT) |
commit | 108b27d54956ad01e5bfe6ba29a2a244251ccb57 (patch) | |
tree | 6df213ebe754eae25cfa620c56e9b75804eff2f4 | |
parent | 517053cc1d72cef6525a8b477a7b1cdda5439fbc (diff) | |
download | tcl-108b27d54956ad01e5bfe6ba29a2a244251ccb57.zip tcl-108b27d54956ad01e5bfe6ba29a2a244251ccb57.tar.gz tcl-108b27d54956ad01e5bfe6ba29a2a244251ccb57.tar.bz2 |
More progress
-rw-r--r-- | doc/ParseCmd.3 | 8 | ||||
-rw-r--r-- | generic/tcl.h | 21 | ||||
-rw-r--r-- | generic/tclAssembly.c | 64 | ||||
-rw-r--r-- | generic/tclBasic.c | 8 | ||||
-rw-r--r-- | generic/tclCompCmds.c | 140 | ||||
-rw-r--r-- | generic/tclCompCmdsGR.c | 124 | ||||
-rw-r--r-- | generic/tclCompCmdsSZ.c | 118 | ||||
-rw-r--r-- | generic/tclCompExpr.c | 16 | ||||
-rw-r--r-- | generic/tclCompile.c | 18 | ||||
-rw-r--r-- | generic/tclEnsemble.c | 34 | ||||
-rw-r--r-- | generic/tclExecute.c | 10 | ||||
-rw-r--r-- | generic/tclInt.h | 15 | ||||
-rw-r--r-- | generic/tclParse.c | 40 | ||||
-rw-r--r-- | generic/tclTest.c | 8 |
14 files changed, 309 insertions, 315 deletions
diff --git a/doc/ParseCmd.3 b/doc/ParseCmd.3 index 9da0d42..d93f00c 100644 --- a/doc/ParseCmd.3 +++ b/doc/ParseCmd.3 @@ -196,12 +196,12 @@ return parse information in two data structures, Tcl_Parse and Tcl_Token: .CS typedef struct Tcl_Parse { const char *\fIcommentStart\fR; - int \fIcommentSize\fR; + size_t \fIcommentSize\fR; const char *\fIcommandStart\fR; - int \fIcommandSize\fR; - int \fInumWords\fR; + size_t \fIcommandSize\fR; + size_t \fInumWords\fR; Tcl_Token *\fItokenPtr\fR; - int \fInumTokens\fR; + size_t \fInumTokens\fR; ... } \fBTcl_Parse\fR; diff --git a/generic/tcl.h b/generic/tcl.h index 2356089..b609feb 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -1766,22 +1766,28 @@ typedef struct Tcl_Parse { * field is 0. */ const char *commandStart; /* First character in first word of * command. */ - int commandSize; /* Number of bytes in command, including first + size_t commandSize; /* Number of bytes in command, including first * character of first word, up through the * terminating newline, close bracket, or * semicolon. */ - int numWords; /* Total number of words in command. May be + size_t numWords; /* Total number of words in command. May be * 0. */ Tcl_Token *tokenPtr; /* Pointer to first token representing the * words of the command. Initially points to * staticTokens, but may change to point to * malloc-ed space if command exceeds space in * staticTokens. */ - int numTokens; /* Total number of tokens in command. */ - int tokensAvailable; /* Total number of tokens available at + size_t numTokens; /* Total number of tokens in command. */ + size_t tokensAvailable; /* Total number of tokens available at * *tokenPtr. */ int errorType; /* One of the parsing error types defined * above. */ +#if TCL_MAJOR_VERSION > 8 + int incomplete; /* This field is set to 1 by Tcl_ParseCommand + * if the command appears to be incomplete. + * This information is used by + * Tcl_CommandComplete. */ +#endif /* * The fields below are intended only for the private use of the parser. @@ -1800,10 +1806,9 @@ typedef struct Tcl_Parse { * beginning of region where the error * occurred (e.g. the open brace if the close * brace is missing). */ - int incomplete; /* This field is set to 1 by Tcl_ParseCommand - * if the command appears to be incomplete. - * This information is used by - * Tcl_CommandComplete. */ +#if TCL_MAJOR_VERSION < 9 + int incomplete; +#endif Tcl_Token staticTokens[NUM_STATIC_TOKENS]; /* Initial space for tokens for command. This * space should be large enough to accommodate diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 1ea3d37..e3e7bfc 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -970,7 +970,7 @@ TclCompileAssembleCmd( * Make sure that the command has a single arg that is a simple word. */ - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { return TCL_ERROR; } tokenPtr = TokenAfter(parsePtr->tokenPtr); @@ -1074,8 +1074,8 @@ TclAssembleCode( * Process the line of code. */ - if (parsePtr->numWords > 0) { - size_t instLen = parsePtr->commandSize; + if ((int)parsePtr->numWords > 0) { + size_t instLen = (int)parsePtr->commandSize; /* Length in bytes of the current command */ if (parsePtr->term == parsePtr->commandStart + instLen - 1) { @@ -1304,7 +1304,7 @@ AssembleOneLine( switch (instType) { case ASSEM_PUSH: - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "value"); goto cleanup; } @@ -1317,7 +1317,7 @@ AssembleOneLine( break; case ASSEM_1BYTE: - if (parsePtr->numWords != 1) { + if ((int)parsePtr->numWords != 1) { Tcl_WrongNumArgs(interp, 1, &instNameObj, ""); goto cleanup; } @@ -1332,7 +1332,7 @@ AssembleOneLine( * are being resolved. */ - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "label"); goto cleanup; } @@ -1347,7 +1347,7 @@ AssembleOneLine( break; case ASSEM_BOOL: - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "boolean"); goto cleanup; } @@ -1358,7 +1358,7 @@ AssembleOneLine( break; case ASSEM_BOOL_LVT4: - if (parsePtr->numWords != 3) { + if ((int)parsePtr->numWords != 3) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "boolean varName"); goto cleanup; } @@ -1374,7 +1374,7 @@ AssembleOneLine( break; case ASSEM_CLOCK_READ: - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "imm8"); goto cleanup; } @@ -1391,7 +1391,7 @@ AssembleOneLine( break; case ASSEM_CONCAT1: - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "imm8"); goto cleanup; } @@ -1405,7 +1405,7 @@ AssembleOneLine( case ASSEM_DICT_GET: case ASSEM_DICT_GET_DEF: - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "count"); goto cleanup; } @@ -1417,7 +1417,7 @@ AssembleOneLine( break; case ASSEM_DICT_SET: - if (parsePtr->numWords != 3) { + if ((int)parsePtr->numWords != 3) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "count varName"); goto cleanup; } @@ -1434,7 +1434,7 @@ AssembleOneLine( break; case ASSEM_DICT_UNSET: - if (parsePtr->numWords != 3) { + if ((int)parsePtr->numWords != 3) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "count varName"); goto cleanup; } @@ -1451,7 +1451,7 @@ AssembleOneLine( break; case ASSEM_END_CATCH: - if (parsePtr->numWords != 1) { + if ((int)parsePtr->numWords != 1) { Tcl_WrongNumArgs(interp, 1, &instNameObj, ""); goto cleanup; } @@ -1465,7 +1465,7 @@ AssembleOneLine( * code, the message ("script" or "expression") and an evaluator * callback that calls TclCompileScript or TclCompileExpr. */ - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, ((TalInstructionTable[tblIdx].tclInstCode == INST_EVAL_STK) ? "script" : "expression")); @@ -1491,7 +1491,7 @@ AssembleOneLine( break; case ASSEM_INVOKE: - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "count"); goto cleanup; } @@ -1505,7 +1505,7 @@ AssembleOneLine( case ASSEM_JUMP: case ASSEM_JUMP4: - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "label"); goto cleanup; } @@ -1533,7 +1533,7 @@ AssembleOneLine( break; case ASSEM_JUMPTABLE: - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "table"); goto cleanup; } @@ -1561,7 +1561,7 @@ AssembleOneLine( break; case ASSEM_LABEL: - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "name"); goto cleanup; } @@ -1579,7 +1579,7 @@ AssembleOneLine( break; case ASSEM_LINDEX_MULTI: - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "count"); goto cleanup; } @@ -1591,7 +1591,7 @@ AssembleOneLine( break; case ASSEM_LIST: - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "count"); goto cleanup; } @@ -1603,7 +1603,7 @@ AssembleOneLine( break; case ASSEM_INDEX: - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "count"); goto cleanup; } @@ -1614,7 +1614,7 @@ AssembleOneLine( break; case ASSEM_LSET_FLAT: - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "count"); goto cleanup; } @@ -1633,7 +1633,7 @@ AssembleOneLine( break; case ASSEM_LVT: - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "varname"); goto cleanup; } @@ -1645,7 +1645,7 @@ AssembleOneLine( break; case ASSEM_LVT1: - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "varname"); goto cleanup; } @@ -1657,7 +1657,7 @@ AssembleOneLine( break; case ASSEM_LVT1_SINT1: - if (parsePtr->numWords != 3) { + if ((int)parsePtr->numWords != 3) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "varName imm8"); goto cleanup; } @@ -1672,7 +1672,7 @@ AssembleOneLine( break; case ASSEM_LVT4: - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "varname"); goto cleanup; } @@ -1684,7 +1684,7 @@ AssembleOneLine( break; case ASSEM_OVER: - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "count"); goto cleanup; } @@ -1696,7 +1696,7 @@ AssembleOneLine( break; case ASSEM_REGEXP: - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "boolean"); goto cleanup; } @@ -1709,7 +1709,7 @@ AssembleOneLine( break; case ASSEM_REVERSE: - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "count"); goto cleanup; } @@ -1721,7 +1721,7 @@ AssembleOneLine( break; case ASSEM_SINT1: - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "imm8"); goto cleanup; } @@ -1733,7 +1733,7 @@ AssembleOneLine( break; case ASSEM_SINT4_LVT4: - if (parsePtr->numWords != 3) { + if ((int)parsePtr->numWords != 3) { Tcl_WrongNumArgs(interp, 1, &instNameObj, "count varName"); goto cleanup; } diff --git a/generic/tclBasic.c b/generic/tclBasic.c index fe4f5cb..642f366 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -5146,7 +5146,7 @@ TclEvalEx( parsePtr->commandStart - outerScript); gotParse = 1; - if (parsePtr->numWords > 0) { + if ((int)parsePtr->numWords > 0) { /* * TIP #280. Track lines within the words of the current * command. We use a separate pointer into the table of @@ -5302,7 +5302,7 @@ TclEvalEx( eeFramePtr->len = parsePtr->commandSize; if (parsePtr->term == - parsePtr->commandStart + parsePtr->commandSize - 1) { + parsePtr->commandStart + (int)parsePtr->commandSize - 1) { eeFramePtr->len--; } @@ -5353,7 +5353,7 @@ TclEvalEx( * executed command. */ - next = parsePtr->commandStart + parsePtr->commandSize; + next = parsePtr->commandStart + (int)parsePtr->commandSize; bytesLeft -= next - p; p = next; TclAdvanceLines(&line, parsePtr->commandStart, p); @@ -5379,7 +5379,7 @@ TclEvalEx( } } if ((code == TCL_ERROR) && !(iPtr->flags & ERR_ALREADY_LOGGED)) { - commandLength = parsePtr->commandSize; + commandLength = (int)parsePtr->commandSize; if (parsePtr->term == parsePtr->commandStart + commandLength - 1) { /* * The terminator character (such as ; or ]) of the command where diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index c1cd174..9791bcc 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -255,7 +255,7 @@ TclCompileArrayExistsCmd( Tcl_Token *tokenPtr; int isScalar, localIndex; - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { return TCL_ERROR; } @@ -293,7 +293,7 @@ TclCompileArraySetCmd( Tcl_Obj *literalObj; ForeachInfo *infoPtr; - if (parsePtr->numWords != 3) { + if ((int)parsePtr->numWords != 3) { return TCL_ERROR; } @@ -461,7 +461,7 @@ TclCompileArrayUnsetCmd( Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); int isScalar, localIndex; - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { return TclCompileBasic2ArgCmd(interp, parsePtr, cmdPtr, envPtr); } @@ -519,7 +519,7 @@ TclCompileBreakCmd( ExceptionRange *rangePtr; ExceptionAux *auxPtr; - if (parsePtr->numWords != 1) { + if ((int)parsePtr->numWords != 1) { return TCL_ERROR; } @@ -584,7 +584,7 @@ TclCompileCatchCmd( * Let runtime checks determine if syntax has changed. */ - if ((parsePtr->numWords < 2) || (parsePtr->numWords > 4)) { + if (((int)parsePtr->numWords < 2) || ((int)parsePtr->numWords > 4)) { return TCL_ERROR; } @@ -593,7 +593,7 @@ TclCompileCatchCmd( * (not in a procedure), don't compile it inline: the payoff is too small. */ - if ((parsePtr->numWords >= 3) && !EnvHasLVT(envPtr)) { + if (((int)parsePtr->numWords >= 3) && !EnvHasLVT(envPtr)) { return TCL_ERROR; } @@ -604,7 +604,7 @@ TclCompileCatchCmd( resultIndex = optsIndex = -1; cmdTokenPtr = TokenAfter(parsePtr->tokenPtr); - if (parsePtr->numWords >= 3) { + if ((int)parsePtr->numWords >= 3) { resultNameTokenPtr = TokenAfter(cmdTokenPtr); /* DGP */ resultIndex = LocalScalarFromToken(resultNameTokenPtr, envPtr); @@ -613,7 +613,7 @@ TclCompileCatchCmd( } /* DKF */ - if (parsePtr->numWords == 4) { + if ((int)parsePtr->numWords == 4) { optsNameTokenPtr = TokenAfter(resultNameTokenPtr); optsIndex = LocalScalarFromToken(optsNameTokenPtr, envPtr); if (optsIndex < 0) { @@ -759,7 +759,7 @@ TclCompileClockClicksCmd( { Tcl_Token* tokenPtr; - switch (parsePtr->numWords) { + switch ((int)parsePtr->numWords) { case 1: /* * No args @@ -821,7 +821,7 @@ TclCompileClockReadingCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - if (parsePtr->numWords != 1) { + if ((int)parsePtr->numWords != 1) { return TCL_ERROR; } @@ -862,7 +862,7 @@ TclCompileConcatCmd( int i; /* TODO: Consider compiling expansion case. */ - if (parsePtr->numWords == 1) { + if ((int)parsePtr->numWords == 1) { /* * [concat] without arguments just pushes an empty object. */ @@ -877,7 +877,7 @@ TclCompileConcatCmd( */ TclNewObj(listObj); - for (i = 1, tokenPtr = parsePtr->tokenPtr; i < parsePtr->numWords; i++) { + for (i = 1, tokenPtr = parsePtr->tokenPtr; i < (int)parsePtr->numWords; i++) { tokenPtr = TokenAfter(tokenPtr); TclNewObj(objPtr); if (!TclWordKnownAtCompileTime(tokenPtr, objPtr)) { @@ -906,7 +906,7 @@ TclCompileConcatCmd( * General case: runtime concat. */ - for (i = 1, tokenPtr = parsePtr->tokenPtr; i < parsePtr->numWords; i++) { + for (i = 1, tokenPtr = parsePtr->tokenPtr; i < (int)parsePtr->numWords; i++) { tokenPtr = TokenAfter(tokenPtr); CompileWord(envPtr, tokenPtr, interp, i); } @@ -949,7 +949,7 @@ TclCompileContinueCmd( * There should be no argument after the "continue". */ - if (parsePtr->numWords != 1) { + if ((int)parsePtr->numWords != 1) { return TCL_ERROR; } @@ -1013,7 +1013,7 @@ TclCompileDictSetCmd( * There must be at least one argument after the command. */ - if (parsePtr->numWords < 4) { + if ((int)parsePtr->numWords < 4) { return TCL_ERROR; } @@ -1034,7 +1034,7 @@ TclCompileDictSetCmd( */ tokenPtr = TokenAfter(varTokenPtr); - for (i=2 ; i< parsePtr->numWords ; i++) { + for (i=2 ; i< (int)parsePtr->numWords ; i++) { CompileWord(envPtr, tokenPtr, interp, i); tokenPtr = TokenAfter(tokenPtr); } @@ -1043,7 +1043,7 @@ TclCompileDictSetCmd( * Now emit the instruction to do the dict manipulation. */ - TclEmitInstInt4( INST_DICT_SET, parsePtr->numWords-3, envPtr); + TclEmitInstInt4( INST_DICT_SET, (int)parsePtr->numWords-3, envPtr); TclEmitInt4( dictVarIndex, envPtr); TclAdjustStackDepth(-1, envPtr); return TCL_OK; @@ -1066,7 +1066,7 @@ TclCompileDictIncrCmd( * There must be at least two arguments after the command. */ - if (parsePtr->numWords < 3 || parsePtr->numWords > 4) { + if ((int)parsePtr->numWords < 3 || (int)parsePtr->numWords > 4) { return TCL_ERROR; } varTokenPtr = TokenAfter(parsePtr->tokenPtr); @@ -1076,7 +1076,7 @@ TclCompileDictIncrCmd( * Parse the increment amount, if present. */ - if (parsePtr->numWords == 4) { + if ((int)parsePtr->numWords == 4) { const char *word; size_t numBytes; int code; @@ -1140,7 +1140,7 @@ TclCompileDictGetCmd( */ /* TODO: Consider support for compiling expanded args. */ - if (parsePtr->numWords < 3) { + if ((int)parsePtr->numWords < 3) { return TCL_ERROR; } tokenPtr = TokenAfter(parsePtr->tokenPtr); @@ -1149,11 +1149,11 @@ TclCompileDictGetCmd( * Only compile this because we need INST_DICT_GET anyway. */ - for (i=1 ; i<parsePtr->numWords ; i++) { + for (i=1 ; i<(int)parsePtr->numWords ; i++) { CompileWord(envPtr, tokenPtr, interp, i); tokenPtr = TokenAfter(tokenPtr); } - TclEmitInstInt4(INST_DICT_GET, parsePtr->numWords-2, envPtr); + TclEmitInstInt4(INST_DICT_GET, (int)parsePtr->numWords-2, envPtr); TclAdjustStackDepth(-1, envPtr); return TCL_OK; } @@ -1175,16 +1175,16 @@ TclCompileDictGetWithDefaultCmd( */ /* TODO: Consider support for compiling expanded args. */ - if (parsePtr->numWords < 4) { + if ((int)parsePtr->numWords < 4) { return TCL_ERROR; } tokenPtr = TokenAfter(parsePtr->tokenPtr); - for (i=1 ; i<parsePtr->numWords ; i++) { + for (i=1 ; i<(int)parsePtr->numWords ; i++) { CompileWord(envPtr, tokenPtr, interp, i); tokenPtr = TokenAfter(tokenPtr); } - TclEmitInstInt4(INST_DICT_GET_DEF, parsePtr->numWords-3, envPtr); + TclEmitInstInt4(INST_DICT_GET_DEF, (int)parsePtr->numWords-3, envPtr); TclAdjustStackDepth(-2, envPtr); return TCL_OK; } @@ -1207,7 +1207,7 @@ TclCompileDictExistsCmd( */ /* TODO: Consider support for compiling expanded args. */ - if (parsePtr->numWords < 3) { + if ((int)parsePtr->numWords < 3) { return TCL_ERROR; } tokenPtr = TokenAfter(parsePtr->tokenPtr); @@ -1216,11 +1216,11 @@ TclCompileDictExistsCmd( * Now we do the code generation. */ - for (i=1 ; i<parsePtr->numWords ; i++) { + for (i=1 ; i<(int)parsePtr->numWords ; i++) { CompileWord(envPtr, tokenPtr, interp, i); tokenPtr = TokenAfter(tokenPtr); } - TclEmitInstInt4(INST_DICT_EXISTS, parsePtr->numWords-2, envPtr); + TclEmitInstInt4(INST_DICT_EXISTS, (int)parsePtr->numWords-2, envPtr); TclAdjustStackDepth(-1, envPtr); return TCL_OK; } @@ -1244,7 +1244,7 @@ TclCompileDictUnsetCmd( */ /* TODO: Consider support for compiling expanded args. */ - if (parsePtr->numWords < 3) { + if ((int)parsePtr->numWords < 3) { return TCL_ERROR; } @@ -1264,7 +1264,7 @@ TclCompileDictUnsetCmd( * Remaining words (the key path) can be handled normally. */ - for (i=2 ; i<parsePtr->numWords ; i++) { + for (i=2 ; i<(int)parsePtr->numWords ; i++) { tokenPtr = TokenAfter(tokenPtr); CompileWord(envPtr, tokenPtr, interp, i); } @@ -1273,7 +1273,7 @@ TclCompileDictUnsetCmd( * Now emit the instruction to do the dict manipulation. */ - TclEmitInstInt4( INST_DICT_UNSET, parsePtr->numWords-2, envPtr); + TclEmitInstInt4( INST_DICT_UNSET, (int)parsePtr->numWords-2, envPtr); TclEmitInt4( dictVarIndex, envPtr); return TCL_OK; } @@ -1295,7 +1295,7 @@ TclCompileDictCreateCmd( int i; size_t len; - if ((parsePtr->numWords & 1) == 0) { + if (((int)parsePtr->numWords & 1) == 0) { return TCL_ERROR; } @@ -1306,7 +1306,7 @@ TclCompileDictCreateCmd( tokenPtr = TokenAfter(parsePtr->tokenPtr); TclNewObj(dictObj); Tcl_IncrRefCount(dictObj); - for (i=1 ; i<parsePtr->numWords ; i+=2) { + for (i=1 ; i<(int)parsePtr->numWords ; i+=2) { TclNewObj(keyObj); Tcl_IncrRefCount(keyObj); if (!TclWordKnownAtCompileTime(tokenPtr, keyObj)) { @@ -1356,7 +1356,7 @@ TclCompileDictCreateCmd( Emit14Inst( INST_STORE_SCALAR, worker, envPtr); TclEmitOpcode( INST_POP, envPtr); tokenPtr = TokenAfter(parsePtr->tokenPtr); - for (i=1 ; i<parsePtr->numWords ; i+=2) { + for (i=1 ; i<(int)parsePtr->numWords ; i+=2) { CompileWord(envPtr, tokenPtr, interp, i); tokenPtr = TokenAfter(tokenPtr); CompileWord(envPtr, tokenPtr, interp, i+1); @@ -1391,10 +1391,10 @@ TclCompileDictMergeCmd( */ /* TODO: Consider support for compiling expanded args. (less likely) */ - if (parsePtr->numWords < 2) { + if ((int)parsePtr->numWords < 2) { PushStringLiteral(envPtr, ""); return TCL_OK; - } else if (parsePtr->numWords == 2) { + } else if ((int)parsePtr->numWords == 2) { tokenPtr = TokenAfter(parsePtr->tokenPtr); CompileWord(envPtr, tokenPtr, interp, 1); TclEmitOpcode( INST_DUP, envPtr); @@ -1433,7 +1433,7 @@ TclCompileDictMergeCmd( outLoop = TclCreateExceptRange(CATCH_EXCEPTION_RANGE, envPtr); TclEmitInstInt4( INST_BEGIN_CATCH4, outLoop, envPtr); ExceptionRangeStarts(envPtr, outLoop); - for (i=2 ; i<parsePtr->numWords ; i++) { + for (i=2 ; i<(int)parsePtr->numWords ; i++) { /* * Get the dictionary, and merge its pairs into the first dict (using * a small loop). @@ -1539,7 +1539,7 @@ CompileDictEachCmd( * There must be three arguments after the command. */ - if (parsePtr->numWords != 4) { + if ((int)parsePtr->numWords != 4) { return TclCompileBasic3ArgCmd(interp, parsePtr, cmdPtr, envPtr); } @@ -1761,7 +1761,7 @@ TclCompileDictUpdateCmd( * There must be at least one argument after the command. */ - if (parsePtr->numWords < 5) { + if ((int)parsePtr->numWords < 5) { return TCL_ERROR; } @@ -1770,10 +1770,10 @@ TclCompileDictUpdateCmd( * dict update <lit(eral)> <any> <lit> ?<any> <lit> ...? <lit> */ - if ((parsePtr->numWords - 1) & 1) { + if (((int)parsePtr->numWords - 1) & 1) { return TCL_ERROR; } - numVars = (parsePtr->numWords - 3) / 2; + numVars = ((int)parsePtr->numWords - 3) / 2; /* * The dictionary variable must be a local scalar that is knowable at @@ -1840,7 +1840,7 @@ TclCompileDictUpdateCmd( TclEmitInstInt4( INST_BEGIN_CATCH4, range, envPtr); ExceptionRangeStarts(envPtr, range); - BODY(bodyTokenPtr, parsePtr->numWords - 1); + BODY(bodyTokenPtr, (int)parsePtr->numWords - 1); ExceptionRangeEnds(envPtr, range); /* @@ -1913,7 +1913,7 @@ TclCompileDictAppendCmd( */ /* TODO: Consider support for compiling expanded args. */ - if (parsePtr->numWords<4 || parsePtr->numWords>100) { + if ((int)parsePtr->numWords<4 || (int)parsePtr->numWords>100) { return TCL_ERROR; } @@ -1932,12 +1932,12 @@ TclCompileDictAppendCmd( */ tokenPtr = TokenAfter(tokenPtr); - for (i=2 ; i<parsePtr->numWords ; i++) { + for (i=2 ; i<(int)parsePtr->numWords ; i++) { CompileWord(envPtr, tokenPtr, interp, i); tokenPtr = TokenAfter(tokenPtr); } - if (parsePtr->numWords > 4) { - TclEmitInstInt1(INST_STR_CONCAT1, parsePtr->numWords-3, envPtr); + if ((int)parsePtr->numWords > 4) { + TclEmitInstInt1(INST_STR_CONCAT1, (int)parsePtr->numWords-3, envPtr); } /* @@ -1967,7 +1967,7 @@ TclCompileDictLappendCmd( /* TODO: Consider support for compiling expanded args. */ /* Probably not. Why is INST_DICT_LAPPEND limited to one value? */ - if (parsePtr->numWords != 4) { + if ((int)parsePtr->numWords != 4) { return TCL_ERROR; } @@ -2014,7 +2014,7 @@ TclCompileDictWithCmd( */ /* TODO: Consider support for compiling expanded args. */ - if (parsePtr->numWords < 3) { + if ((int)parsePtr->numWords < 3) { return TCL_ERROR; } @@ -2025,7 +2025,7 @@ TclCompileDictWithCmd( varTokenPtr = TokenAfter(parsePtr->tokenPtr); tokenPtr = TokenAfter(varTokenPtr); - for (i=3 ; i<parsePtr->numWords ; i++) { + for (i=3 ; i<(int)parsePtr->numWords ; i++) { tokenPtr = TokenAfter(tokenPtr); } if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { @@ -2053,7 +2053,7 @@ TclCompileDictWithCmd( * Determine if we're manipulating a dict in a simple local variable. */ - gotPath = (parsePtr->numWords > 3); + gotPath = ((int)parsePtr->numWords > 3); dictVar = LocalScalarFromToken(varTokenPtr, envPtr); /* @@ -2072,11 +2072,11 @@ TclCompileDictWithCmd( */ tokenPtr = TokenAfter(varTokenPtr); - for (i=2 ; i<parsePtr->numWords-1 ; i++) { + for (i=2 ; i<(int)parsePtr->numWords-1 ; i++) { CompileWord(envPtr, tokenPtr, interp, i); tokenPtr = TokenAfter(tokenPtr); } - TclEmitInstInt4(INST_LIST, parsePtr->numWords-3,envPtr); + TclEmitInstInt4(INST_LIST, (int)parsePtr->numWords-3,envPtr); Emit14Inst( INST_LOAD_SCALAR, dictVar, envPtr); TclEmitInstInt4(INST_OVER, 1, envPtr); TclEmitOpcode( INST_DICT_EXPAND, envPtr); @@ -2099,11 +2099,11 @@ TclCompileDictWithCmd( */ tokenPtr = varTokenPtr; - for (i=1 ; i<parsePtr->numWords-1 ; i++) { + for (i=1 ; i<(int)parsePtr->numWords-1 ; i++) { CompileWord(envPtr, tokenPtr, interp, i); tokenPtr = TokenAfter(tokenPtr); } - TclEmitInstInt4(INST_LIST, parsePtr->numWords-3,envPtr); + TclEmitInstInt4(INST_LIST, (int)parsePtr->numWords-3,envPtr); TclEmitInstInt4(INST_OVER, 1, envPtr); TclEmitOpcode( INST_LOAD_STK, envPtr); TclEmitInstInt4(INST_OVER, 1, envPtr); @@ -2154,11 +2154,11 @@ TclCompileDictWithCmd( } tokenPtr = TokenAfter(varTokenPtr); if (gotPath) { - for (i=2 ; i<parsePtr->numWords-1 ; i++) { + for (i=2 ; i<(int)parsePtr->numWords-1 ; i++) { CompileWord(envPtr, tokenPtr, interp, i); tokenPtr = TokenAfter(tokenPtr); } - TclEmitInstInt4( INST_LIST, parsePtr->numWords-3,envPtr); + TclEmitInstInt4( INST_LIST, (int)parsePtr->numWords-3,envPtr); Emit14Inst( INST_STORE_SCALAR, pathTmp, envPtr); TclEmitOpcode( INST_POP, envPtr); } @@ -2184,7 +2184,7 @@ TclCompileDictWithCmd( TclEmitInstInt4( INST_BEGIN_CATCH4, range, envPtr); ExceptionRangeStarts(envPtr, range); - BODY(tokenPtr, parsePtr->numWords - 1); + BODY(tokenPtr, (int)parsePtr->numWords - 1); ExceptionRangeEnds(envPtr, range); /* @@ -2220,7 +2220,7 @@ TclCompileDictWithCmd( if (dictVar == -1) { Emit14Inst( INST_LOAD_SCALAR, varNameTmp, envPtr); } - if (parsePtr->numWords > 3) { + if ((int)parsePtr->numWords > 3) { Emit14Inst( INST_LOAD_SCALAR, pathTmp, envPtr); } else { PushStringLiteral(envPtr, ""); @@ -2359,7 +2359,7 @@ TclCompileErrorCmd( * General syntax: [error message ?errorInfo? ?errorCode?] */ - if (parsePtr->numWords < 2 || parsePtr->numWords > 4) { + if ((int)parsePtr->numWords < 2 || (int)parsePtr->numWords > 4) { return TCL_ERROR; } @@ -2374,13 +2374,13 @@ TclCompileErrorCmd( * Construct the options. Note that -code and -level are not here. */ - if (parsePtr->numWords == 2) { + if ((int)parsePtr->numWords == 2) { PushStringLiteral(envPtr, ""); } else { PushStringLiteral(envPtr, "-errorinfo"); tokenPtr = TokenAfter(tokenPtr); CompileWord(envPtr, tokenPtr, interp, 2); - if (parsePtr->numWords == 3) { + if ((int)parsePtr->numWords == 3) { TclEmitInstInt4( INST_LIST, 2, envPtr); } else { PushStringLiteral(envPtr, "-errorcode"); @@ -2427,7 +2427,7 @@ TclCompileExprCmd( { Tcl_Token *firstWordPtr; - if (parsePtr->numWords == 1) { + if ((int)parsePtr->numWords == 1) { return TCL_ERROR; } @@ -2439,7 +2439,7 @@ TclCompileExprCmd( envPtr->extCmdMapPtr->nuloc-1].line[1]; firstWordPtr = TokenAfter(parsePtr->tokenPtr); - TclCompileExprWords(interp, firstWordPtr, parsePtr->numWords-1, envPtr); + TclCompileExprWords(interp, firstWordPtr, (int)parsePtr->numWords-1, envPtr); return TCL_OK; } @@ -2475,7 +2475,7 @@ TclCompileForCmd( int bodyCodeOffset, nextCodeOffset, jumpDist; int bodyRange, nextRange; - if (parsePtr->numWords != 5) { + if ((int)parsePtr->numWords != 5) { return TCL_ERROR; } @@ -2702,7 +2702,7 @@ CompileEachloopCmd( return TCL_ERROR; } - numWords = parsePtr->numWords; + numWords = (int)parsePtr->numWords; if ((numWords < 4) || (numWords%2 != 0)) { return TCL_ERROR; } @@ -3162,7 +3162,7 @@ TclCompileFormatCmd( * Don't handle any guaranteed-error cases. */ - if (parsePtr->numWords < 2) { + if ((int)parsePtr->numWords < 2) { return TCL_ERROR; } @@ -3179,8 +3179,8 @@ TclCompileFormatCmd( return TCL_ERROR; } - objv = (Tcl_Obj **)Tcl_Alloc((parsePtr->numWords-2) * sizeof(Tcl_Obj *)); - for (i=0 ; i+2 < parsePtr->numWords ; i++) { + objv = (Tcl_Obj **)Tcl_Alloc(((int)parsePtr->numWords-2) * sizeof(Tcl_Obj *)); + for (i=0 ; i+2 < (int)parsePtr->numWords ; i++) { tokenPtr = TokenAfter(tokenPtr); TclNewObj(objv[i]); Tcl_IncrRefCount(objv[i]); @@ -3195,7 +3195,7 @@ TclCompileFormatCmd( */ tmpObj = Tcl_Format(interp, TclGetString(formatObj), - parsePtr->numWords-2, objv); + (int)parsePtr->numWords-2, objv); for (; --i>=0 ;) { Tcl_DecrRefCount(objv[i]); } @@ -3256,7 +3256,7 @@ TclCompileFormatCmd( * Check if the number of things to concatenate will fit in a byte. */ - if (i+2 != parsePtr->numWords || i > 125) { + if (i+2 != (int)parsePtr->numWords || i > 125) { Tcl_DecrRefCount(formatObj); return TCL_ERROR; } diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index bb1c21b..6486b21 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -95,7 +95,7 @@ TclCompileGlobalCmd( int localIndex, numWords, i; /* TODO: Consider support for compiling expanded args. */ - numWords = parsePtr->numWords; + numWords = (int)parsePtr->numWords; if (numWords < 2) { return TCL_ERROR; } @@ -196,7 +196,7 @@ TclCompileIfCmd( tokenPtr = parsePtr->tokenPtr; wordIdx = 0; - numWords = parsePtr->numWords; + numWords = (int)parsePtr->numWords; for (wordIdx = 0; wordIdx < numWords; wordIdx++) { if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { @@ -478,7 +478,7 @@ TclCompileIncrCmd( Tcl_Token *varTokenPtr, *incrTokenPtr; int isScalar, localIndex, haveImmValue, immValue; - if ((parsePtr->numWords != 2) && (parsePtr->numWords != 3)) { + if (((int)parsePtr->numWords != 2) && ((int)parsePtr->numWords != 3)) { return TCL_ERROR; } @@ -494,7 +494,7 @@ TclCompileIncrCmd( haveImmValue = 0; immValue = 1; - if (parsePtr->numWords == 3) { + if ((int)parsePtr->numWords == 3) { incrTokenPtr = TokenAfter(varTokenPtr); if (incrTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) { const char *word = incrTokenPtr[1].start; @@ -594,9 +594,9 @@ TclCompileInfoCommandsCmd( * We require one compile-time known argument for the case we can compile. */ - if (parsePtr->numWords == 1) { + if ((int)parsePtr->numWords == 1) { return TclCompileBasic0ArgCmd(interp, parsePtr, cmdPtr, envPtr); - } else if (parsePtr->numWords != 2) { + } else if ((int)parsePtr->numWords != 2) { return TCL_ERROR; } tokenPtr = TokenAfter(parsePtr->tokenPtr); @@ -649,7 +649,7 @@ TclCompileInfoCoroutineCmd( * Only compile [info coroutine] without arguments. */ - if (parsePtr->numWords != 1) { + if ((int)parsePtr->numWords != 1) { return TCL_ERROR; } @@ -673,7 +673,7 @@ TclCompileInfoExistsCmd( Tcl_Token *tokenPtr; int isScalar, localIndex; - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { return TCL_ERROR; } @@ -721,13 +721,13 @@ TclCompileInfoLevelCmd( * Only compile [info level] without arguments or with a single argument. */ - if (parsePtr->numWords == 1) { + if ((int)parsePtr->numWords == 1) { /* * Not much to do; we compile to a single instruction... */ TclEmitOpcode( INST_INFO_LEVEL_NUM, envPtr); - } else if (parsePtr->numWords != 2) { + } else if ((int)parsePtr->numWords != 2) { return TCL_ERROR; } else { DefineLineInformation; /* TIP #280 */ @@ -754,7 +754,7 @@ TclCompileInfoObjectClassCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { return TCL_ERROR; } CompileWord(envPtr, tokenPtr, interp, 1); @@ -779,7 +779,7 @@ TclCompileInfoObjectIsACmd( * engine. */ - if (parsePtr->numWords != 3) { + if ((int)parsePtr->numWords != 3) { return TCL_ERROR; } if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD || tokenPtr[1].size < 1 @@ -808,7 +808,7 @@ TclCompileInfoObjectNamespaceCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { return TCL_ERROR; } CompileWord(envPtr, tokenPtr, interp, 1); @@ -847,7 +847,7 @@ TclCompileLappendCmd( int isScalar, localIndex, numWords, i; /* TODO: Consider support for compiling expanded args. */ - numWords = parsePtr->numWords; + numWords = (int)parsePtr->numWords; if (numWords < 3) { return TCL_ERROR; } @@ -961,7 +961,7 @@ TclCompileLassignCmd( Tcl_Token *tokenPtr; int isScalar, localIndex, numWords, idx; - numWords = parsePtr->numWords; + numWords = (int)parsePtr->numWords; /* * Check for command syntax error, but we'll punt that to runtime. @@ -1062,7 +1062,7 @@ TclCompileLindexCmd( { DefineLineInformation; /* TIP #280 */ Tcl_Token *idxTokenPtr, *valTokenPtr; - int i, idx, numWords = parsePtr->numWords; + int i, idx, numWords = (int)parsePtr->numWords; /* * Quit if not enough args. @@ -1155,7 +1155,7 @@ TclCompileListCmd( int i, numWords, concat, build; Tcl_Obj *listObj, *objPtr; - if (parsePtr->numWords == 1) { + if ((int)parsePtr->numWords == 1) { /* * [list] without arguments just pushes an empty object. */ @@ -1169,7 +1169,7 @@ TclCompileListCmd( * implement with a simple push. */ - numWords = parsePtr->numWords; + numWords = (int)parsePtr->numWords; valueTokenPtr = TokenAfter(parsePtr->tokenPtr); TclNewObj(listObj); for (i = 1; i < numWords && listObj != NULL; i++) { @@ -1192,7 +1192,7 @@ TclCompileListCmd( * Push the all values onto the stack. */ - numWords = parsePtr->numWords; + numWords = (int)parsePtr->numWords; valueTokenPtr = TokenAfter(parsePtr->tokenPtr); concat = build = 0; for (i = 1; i < numWords; i++) { @@ -1266,7 +1266,7 @@ TclCompileLlengthCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr; - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { return TCL_ERROR; } varTokenPtr = TokenAfter(parsePtr->tokenPtr); @@ -1299,7 +1299,7 @@ TclCompileLrangeCmd( Tcl_Token *tokenPtr, *listTokenPtr; int idx1, idx2; - if (parsePtr->numWords != 4) { + if ((int)parsePtr->numWords != 4) { return TCL_ERROR; } listTokenPtr = TokenAfter(parsePtr->tokenPtr); @@ -1359,7 +1359,7 @@ TclCompileLinsertCmd( Tcl_Token *tokenPtr, *listTokenPtr; int idx, i; - if (parsePtr->numWords < 3) { + if ((int)parsePtr->numWords < 3) { return TCL_ERROR; } listTokenPtr = TokenAfter(parsePtr->tokenPtr); @@ -1392,13 +1392,13 @@ TclCompileLinsertCmd( */ CompileWord(envPtr, listTokenPtr, interp, 1); - if (parsePtr->numWords == 3) { + if ((int)parsePtr->numWords == 3) { TclEmitInstInt4( INST_LIST_RANGE_IMM, 0, envPtr); TclEmitInt4( (int)TCL_INDEX_END, envPtr); return TCL_OK; } - for (i=3 ; i<parsePtr->numWords ; i++) { + for (i=3 ; i<(int)parsePtr->numWords ; i++) { tokenPtr = TokenAfter(tokenPtr); CompileWord(envPtr, tokenPtr, interp, i); } @@ -1462,7 +1462,7 @@ TclCompileLreplaceCmd( int idx1, idx2, i; int emptyPrefix=1, suffixStart = 0; - if (parsePtr->numWords < 4) { + if ((int)parsePtr->numWords < 4) { return TCL_ERROR; } listTokenPtr = TokenAfter(parsePtr->tokenPtr); @@ -1510,10 +1510,10 @@ TclCompileLreplaceCmd( * Push all the replacement values next so any errors raised in * creating them get raised first. */ - if (parsePtr->numWords > 4) { + if ((int)parsePtr->numWords > 4) { /* Push the replacement arguments */ tokenPtr = TokenAfter(tokenPtr); - for (i=4 ; i<parsePtr->numWords ; i++) { + for (i=4 ; i<(int)parsePtr->numWords ; i++) { CompileWord(envPtr, tokenPtr, interp, i); tokenPtr = TokenAfter(tokenPtr); } @@ -1524,7 +1524,7 @@ TclCompileLreplaceCmd( emptyPrefix = 0; } - if ((idx1 == suffixStart) && (parsePtr->numWords == 4)) { + if ((idx1 == suffixStart) && ((int)parsePtr->numWords == 4)) { /* * This is a "no-op". Example: [lreplace {a b c} 2 0] * We still do a list operation to get list-verification @@ -1634,7 +1634,7 @@ TclCompileLsetCmd( */ /* TODO: Consider support for compiling expanded args. */ - if (parsePtr->numWords < 3) { + if ((int)parsePtr->numWords < 3) { /* * Fail at run time, not in compilation. */ @@ -1658,7 +1658,7 @@ TclCompileLsetCmd( * Push the "index" args and the new element value. */ - for (i=2 ; i<parsePtr->numWords ; ++i) { + for (i=2 ; i<(int)parsePtr->numWords ; ++i) { varTokenPtr = TokenAfter(varTokenPtr); CompileWord(envPtr, varTokenPtr, interp, i); } @@ -1669,9 +1669,9 @@ TclCompileLsetCmd( if (localIndex < 0) { if (isScalar) { - tempDepth = parsePtr->numWords - 2; + tempDepth = (int)parsePtr->numWords - 2; } else { - tempDepth = parsePtr->numWords - 1; + tempDepth = (int)parsePtr->numWords - 1; } TclEmitInstInt4( INST_OVER, tempDepth, envPtr); } @@ -1682,9 +1682,9 @@ TclCompileLsetCmd( if (!isScalar) { if (localIndex < 0) { - tempDepth = parsePtr->numWords - 1; + tempDepth = (int)parsePtr->numWords - 1; } else { - tempDepth = parsePtr->numWords - 2; + tempDepth = (int)parsePtr->numWords - 2; } TclEmitInstInt4( INST_OVER, tempDepth, envPtr); } @@ -1711,10 +1711,10 @@ TclCompileLsetCmd( * Emit the correct variety of 'lset' instruction. */ - if (parsePtr->numWords == 4) { + if ((int)parsePtr->numWords == 4) { TclEmitOpcode( INST_LSET_LIST, envPtr); } else { - TclEmitInstInt4( INST_LSET_FLAT, parsePtr->numWords-1, envPtr); + TclEmitInstInt4( INST_LSET_FLAT, (int)parsePtr->numWords-1, envPtr); } /* @@ -1770,7 +1770,7 @@ TclCompileNamespaceCurrentCmd( * Only compile [namespace current] without arguments. */ - if (parsePtr->numWords != 1) { + if ((int)parsePtr->numWords != 1) { return TCL_ERROR; } @@ -1793,7 +1793,7 @@ TclCompileNamespaceCodeCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { return TCL_ERROR; } tokenPtr = TokenAfter(parsePtr->tokenPtr); @@ -1842,7 +1842,7 @@ TclCompileNamespaceOriginCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { return TCL_ERROR; } tokenPtr = TokenAfter(parsePtr->tokenPtr); @@ -1864,7 +1864,7 @@ TclCompileNamespaceQualifiersCmd( Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); int off; - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { return TCL_ERROR; } @@ -1899,7 +1899,7 @@ TclCompileNamespaceTailCmd( Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); JumpFixup jumpFixup; - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { return TCL_ERROR; } @@ -1943,7 +1943,7 @@ TclCompileNamespaceUpvarCmd( * Only compile [namespace upvar ...]: needs an even number of args, >=4 */ - numWords = parsePtr->numWords; + numWords = (int)parsePtr->numWords; if ((numWords % 2) || (numWords < 4)) { return TCL_ERROR; } @@ -1995,7 +1995,7 @@ TclCompileNamespaceWhichCmd( Tcl_Token *tokenPtr, *opt; int idx; - if (parsePtr->numWords < 2 || parsePtr->numWords > 3) { + if ((int)parsePtr->numWords < 2 || (int)parsePtr->numWords > 3) { return TCL_ERROR; } tokenPtr = TokenAfter(parsePtr->tokenPtr); @@ -2006,7 +2006,7 @@ TclCompileNamespaceWhichCmd( * "-variable" (currently) and anything else is an error. */ - if (parsePtr->numWords == 3) { + if ((int)parsePtr->numWords == 3) { if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { return TCL_ERROR; } @@ -2068,7 +2068,7 @@ TclCompileRegexpCmd( * regexp ?-nocase? ?--? {^staticString$} $var */ - if (parsePtr->numWords < 3) { + if ((int)parsePtr->numWords < 3) { return TCL_ERROR; } @@ -2083,7 +2083,7 @@ TclCompileRegexpCmd( * handling, but satisfies our stricter needs. */ - for (i = 1; i < parsePtr->numWords - 2; i++) { + for (i = 1; i < (int)parsePtr->numWords - 2; i++) { varTokenPtr = TokenAfter(varTokenPtr); if (varTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { /* @@ -2109,7 +2109,7 @@ TclCompileRegexpCmd( } } - if ((parsePtr->numWords - i) != 2) { + if (((int)parsePtr->numWords - i) != 2) { /* * We don't support capturing to variables. */ @@ -2162,7 +2162,7 @@ TclCompileRegexpCmd( } if (!simple) { - CompileWord(envPtr, varTokenPtr, interp, parsePtr->numWords - 2); + CompileWord(envPtr, varTokenPtr, interp, (int)parsePtr->numWords - 2); } /* @@ -2170,7 +2170,7 @@ TclCompileRegexpCmd( */ varTokenPtr = TokenAfter(varTokenPtr); - CompileWord(envPtr, varTokenPtr, interp, parsePtr->numWords - 1); + CompileWord(envPtr, varTokenPtr, interp, (int)parsePtr->numWords - 1); if (simple) { if (exact && !nocase) { @@ -2247,7 +2247,7 @@ TclCompileRegsubCmd( int exact, quantified, result = TCL_ERROR; size_t len; - if (parsePtr->numWords < 5 || parsePtr->numWords > 6) { + if ((int)parsePtr->numWords < 5 || (int)parsePtr->numWords > 6) { return TCL_ERROR; } @@ -2274,7 +2274,7 @@ TclCompileRegsubCmd( } if (TclGetString(patternObj)[0] == '-') { if (strcmp(TclGetString(patternObj), "--") != 0 - || parsePtr->numWords == 5) { + || (int)parsePtr->numWords == 5) { goto done; } tokenPtr = TokenAfter(tokenPtr); @@ -2283,7 +2283,7 @@ TclCompileRegsubCmd( if (!TclWordKnownAtCompileTime(tokenPtr, patternObj)) { goto done; } - } else if (parsePtr->numWords == 6) { + } else if ((int)parsePtr->numWords == 6) { goto done; } @@ -2354,7 +2354,7 @@ TclCompileRegsubCmd( PushLiteral(envPtr, bytes, len); bytes = Tcl_GetStringFromObj(replacementObj, &len); PushLiteral(envPtr, bytes, len); - CompileWord(envPtr, stringTokenPtr, interp, parsePtr->numWords - 2); + CompileWord(envPtr, stringTokenPtr, interp, (int)parsePtr->numWords - 2); TclEmitOpcode( INST_STR_MAP, envPtr); done: @@ -2401,7 +2401,7 @@ TclCompileReturnCmd( */ int level, code, objc, status = TCL_OK; size_t size; - int numWords = parsePtr->numWords; + int numWords = (int)parsePtr->numWords; int explicitResult = (0 == (numWords % 2)); int numOptionWords = numWords - 1 - explicitResult; Tcl_Obj *returnOpts, **objv; @@ -2655,7 +2655,7 @@ TclCompileUpvarCmd( return TCL_ERROR; } - numWords = parsePtr->numWords; + numWords = (int)parsePtr->numWords; if (numWords < 3) { return TCL_ERROR; } @@ -2756,7 +2756,7 @@ TclCompileVariableCmd( Tcl_Token *varTokenPtr, *valueTokenPtr; int localIndex, numWords, i; - numWords = parsePtr->numWords; + numWords = (int)parsePtr->numWords; if (numWords < 2) { return TCL_ERROR; } @@ -2930,11 +2930,11 @@ TclCompileObjectNextCmd( Tcl_Token *tokenPtr = parsePtr->tokenPtr; int i; - if (parsePtr->numWords > 255) { + if ((int)parsePtr->numWords > 255) { return TCL_ERROR; } - for (i=0 ; i<parsePtr->numWords ; i++) { + for (i=0 ; i<(int)parsePtr->numWords ; i++) { CompileWord(envPtr, tokenPtr, interp, i); tokenPtr = TokenAfter(tokenPtr); } @@ -2954,11 +2954,11 @@ TclCompileObjectNextToCmd( Tcl_Token *tokenPtr = parsePtr->tokenPtr; int i; - if (parsePtr->numWords < 2 || parsePtr->numWords > 255) { + if ((int)parsePtr->numWords < 2 || (int)parsePtr->numWords > 255) { return TCL_ERROR; } - for (i=0 ; i<parsePtr->numWords ; i++) { + for (i=0 ; i<(int)parsePtr->numWords ; i++) { CompileWord(envPtr, tokenPtr, interp, i); tokenPtr = TokenAfter(tokenPtr); } @@ -2980,9 +2980,9 @@ TclCompileObjectSelfCmd( * bytecoding is at all reasonable. */ - if (parsePtr->numWords == 1) { + if ((int)parsePtr->numWords == 1) { goto compileSelfObject; - } else if (parsePtr->numWords == 2) { + } else if ((int)parsePtr->numWords == 2) { Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr), *subcmd; if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD || tokenPtr[1].size==0) { diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index d1b33c8..70c1a1d 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -133,7 +133,7 @@ TclCompileSetCmd( Tcl_Token *varTokenPtr, *valueTokenPtr; int isAssignment, isScalar, localIndex, numWords; - numWords = parsePtr->numWords; + numWords = (int)parsePtr->numWords; if ((numWords != 2) && (numWords != 3)) { return TCL_ERROR; } @@ -223,7 +223,7 @@ TclCompileStringCatCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ - int i, numWords = parsePtr->numWords, numArgs; + int i, numWords = (int)parsePtr->numWords, numArgs; Tcl_Token *wordTokenPtr; Tcl_Obj *obj, *folded; @@ -300,7 +300,7 @@ TclCompileStringCmpCmd( * We don't support any flags; the bytecode isn't that sophisticated. */ - if (parsePtr->numWords != 3) { + if ((int)parsePtr->numWords != 3) { return TCL_ERROR; } @@ -331,7 +331,7 @@ TclCompileStringEqualCmd( * We don't support any flags; the bytecode isn't that sophisticated. */ - if (parsePtr->numWords != 3) { + if ((int)parsePtr->numWords != 3) { return TCL_ERROR; } @@ -362,7 +362,7 @@ TclCompileStringFirstCmd( * We don't support any flags; the bytecode isn't that sophisticated. */ - if (parsePtr->numWords != 3) { + if ((int)parsePtr->numWords != 3) { return TCL_ERROR; } @@ -393,7 +393,7 @@ TclCompileStringLastCmd( * We don't support any flags; the bytecode isn't that sophisticated. */ - if (parsePtr->numWords != 3) { + if ((int)parsePtr->numWords != 3) { return TCL_ERROR; } @@ -420,7 +420,7 @@ TclCompileStringIndexCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; - if (parsePtr->numWords != 3) { + if ((int)parsePtr->numWords != 3) { return TCL_ERROR; } @@ -448,7 +448,7 @@ TclCompileStringInsertCmd( Tcl_Token *tokenPtr; int idx; - if (parsePtr->numWords != 4) { + if ((int)parsePtr->numWords != 4) { return TCL_ERROR; } @@ -523,7 +523,7 @@ TclCompileStringIsCmd( InstStringClassType strClassType; Tcl_Obj *isClass; - if (parsePtr->numWords < 3 || parsePtr->numWords > 6) { + if ((int)parsePtr->numWords < 3 || (int)parsePtr->numWords > 6) { return TCL_ERROR; } TclNewObj(isClass); @@ -549,12 +549,12 @@ TclCompileStringIsCmd( * way to have more than 4 arguments. */ - if (parsePtr->numWords != 3 && parsePtr->numWords != 4) { + if ((int)parsePtr->numWords != 3 && (int)parsePtr->numWords != 4) { return TCL_ERROR; } tokenPtr = TokenAfter(tokenPtr); - if (parsePtr->numWords == 3) { + if ((int)parsePtr->numWords == 3) { allowEmpty = 1; } else { if (!GotLiteral(tokenPtr, "-strict")) { @@ -573,7 +573,7 @@ TclCompileStringIsCmd( * 5. Lists */ - CompileWord(envPtr, tokenPtr, interp, parsePtr->numWords-1); + CompileWord(envPtr, tokenPtr, interp, (int)parsePtr->numWords-1); switch ((enum isClassesEnum) t) { case STR_IS_ALNUM: @@ -798,7 +798,7 @@ TclCompileStringMatchCmd( int i, exactMatch = 0, nocase = 0; const char *str; - if (parsePtr->numWords < 3 || parsePtr->numWords > 4) { + if ((int)parsePtr->numWords < 3 || (int)parsePtr->numWords > 4) { return TCL_ERROR; } tokenPtr = TokenAfter(parsePtr->tokenPtr); @@ -807,7 +807,7 @@ TclCompileStringMatchCmd( * Check if we have a -nocase flag. */ - if (parsePtr->numWords == 4) { + if ((int)parsePtr->numWords == 4) { if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { return TclCompileBasic3ArgCmd(interp, parsePtr, cmdPtr, envPtr); } @@ -877,7 +877,7 @@ TclCompileStringLenCmd( Tcl_Token *tokenPtr; Tcl_Obj *objPtr; - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { return TCL_ERROR; } @@ -929,7 +929,7 @@ TclCompileStringMapCmd( * thing to map). */ - if (parsePtr->numWords != 3) { + if ((int)parsePtr->numWords != 3) { return TCL_ERROR; } mapTokenPtr = TokenAfter(parsePtr->tokenPtr); @@ -979,7 +979,7 @@ TclCompileStringRangeCmd( Tcl_Token *stringTokenPtr, *fromTokenPtr, *toTokenPtr; int idx1, idx2; - if (parsePtr->numWords != 4) { + if ((int)parsePtr->numWords != 4) { return TCL_ERROR; } stringTokenPtr = TokenAfter(parsePtr->tokenPtr); @@ -1054,7 +1054,7 @@ TclCompileStringReplaceCmd( Tcl_Token *tokenPtr, *valueTokenPtr; int first, last; - if (parsePtr->numWords < 4 || parsePtr->numWords > 5) { + if ((int)parsePtr->numWords < 4 || (int)parsePtr->numWords > 5) { return TCL_ERROR; } @@ -1119,7 +1119,7 @@ TclCompileStringReplaceCmd( */ || ((first >= (int)TCL_INDEX_START) && (last >= (int)TCL_INDEX_START) && (last < first))) { /* Know (last < first) */ - if (parsePtr->numWords == 5) { + if ((int)parsePtr->numWords == 5) { tokenPtr = TokenAfter(tokenPtr); CompileWord(envPtr, tokenPtr, interp, 4); OP( POP); /* Pop newString */ @@ -1128,7 +1128,7 @@ TclCompileStringReplaceCmd( return TCL_OK; } - if (parsePtr->numWords == 5) { + if ((int)parsePtr->numWords == 5) { /* * When we have a string replacement, we have to take care about * not replacing empty substrings that [string replace] promises @@ -1230,7 +1230,7 @@ TclCompileStringReplaceCmd( CompileWord(envPtr, tokenPtr, interp, 2); tokenPtr = TokenAfter(tokenPtr); CompileWord(envPtr, tokenPtr, interp, 3); - if (parsePtr->numWords == 5) { + if ((int)parsePtr->numWords == 5) { tokenPtr = TokenAfter(tokenPtr); CompileWord(envPtr, tokenPtr, interp, 4); } else { @@ -1251,13 +1251,13 @@ TclCompileStringTrimLCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; - if (parsePtr->numWords != 2 && parsePtr->numWords != 3) { + if ((int)parsePtr->numWords != 2 && (int)parsePtr->numWords != 3) { return TCL_ERROR; } tokenPtr = TokenAfter(parsePtr->tokenPtr); CompileWord(envPtr, tokenPtr, interp, 1); - if (parsePtr->numWords == 3) { + if ((int)parsePtr->numWords == 3) { tokenPtr = TokenAfter(tokenPtr); CompileWord(envPtr, tokenPtr, interp, 2); } else { @@ -1278,13 +1278,13 @@ TclCompileStringTrimRCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; - if (parsePtr->numWords != 2 && parsePtr->numWords != 3) { + if ((int)parsePtr->numWords != 2 && (int)parsePtr->numWords != 3) { return TCL_ERROR; } tokenPtr = TokenAfter(parsePtr->tokenPtr); CompileWord(envPtr, tokenPtr, interp, 1); - if (parsePtr->numWords == 3) { + if ((int)parsePtr->numWords == 3) { tokenPtr = TokenAfter(tokenPtr); CompileWord(envPtr, tokenPtr, interp, 2); } else { @@ -1305,13 +1305,13 @@ TclCompileStringTrimCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; - if (parsePtr->numWords != 2 && parsePtr->numWords != 3) { + if ((int)parsePtr->numWords != 2 && (int)parsePtr->numWords != 3) { return TCL_ERROR; } tokenPtr = TokenAfter(parsePtr->tokenPtr); CompileWord(envPtr, tokenPtr, interp, 1); - if (parsePtr->numWords == 3) { + if ((int)parsePtr->numWords == 3) { tokenPtr = TokenAfter(tokenPtr); CompileWord(envPtr, tokenPtr, interp, 2); } else { @@ -1333,7 +1333,7 @@ TclCompileStringToUpperCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { return TclCompileBasic1To3ArgCmd(interp, parsePtr, cmdPtr, envPtr); } @@ -1355,7 +1355,7 @@ TclCompileStringToLowerCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { return TclCompileBasic1To3ArgCmd(interp, parsePtr, cmdPtr, envPtr); } @@ -1377,7 +1377,7 @@ TclCompileStringToTitleCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { return TclCompileBasic1To3ArgCmd(interp, parsePtr, cmdPtr, envPtr); } @@ -1452,7 +1452,7 @@ TclCompileSubstCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ - int numArgs = parsePtr->numWords - 1; + int numArgs = (int)parsePtr->numWords - 1; int numOpts = numArgs - 1; int objc, flags = TCL_SUBST_ALL; Tcl_Obj **objv/*, *toSubst = NULL*/; @@ -1822,7 +1822,7 @@ TclCompileSwitchCmd( tokenPtr = TokenAfter(parsePtr->tokenPtr); valueIndex = 1; - numWords = parsePtr->numWords-1; + numWords = (int)parsePtr->numWords-1; /* * Check for options. @@ -2664,7 +2664,7 @@ TclCompileTailcallCmd( Tcl_Token *tokenPtr = parsePtr->tokenPtr; int i; - if (parsePtr->numWords < 2 || parsePtr->numWords > 256 + if ((int)parsePtr->numWords < 2 || (int)parsePtr->numWords > 256 || envPtr->procPtr == NULL) { return TCL_ERROR; } @@ -2672,11 +2672,11 @@ TclCompileTailcallCmd( /* make room for the nsObjPtr */ /* TODO: Doesn't this have to be a known value? */ CompileWord(envPtr, tokenPtr, interp, 0); - for (i=1 ; i<parsePtr->numWords ; i++) { + for (i=1 ; i<(int)parsePtr->numWords ; i++) { tokenPtr = TokenAfter(tokenPtr); CompileWord(envPtr, tokenPtr, interp, i); } - TclEmitInstInt1( INST_TAILCALL, parsePtr->numWords, envPtr); + TclEmitInstInt1( INST_TAILCALL, (int)parsePtr->numWords, envPtr); return TCL_OK; } @@ -2707,7 +2707,7 @@ TclCompileThrowCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ - int numWords = parsePtr->numWords; + int numWords = (int)parsePtr->numWords; Tcl_Token *codeToken, *msgToken; Tcl_Obj *objPtr; int codeKnown, codeIsList, codeIsValid; @@ -2810,7 +2810,7 @@ TclCompileTryCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { - int numWords = parsePtr->numWords, numHandlers, result = TCL_ERROR; + int numWords = (int)parsePtr->numWords, numHandlers, result = TCL_ERROR; Tcl_Token *bodyToken, *finallyToken, *tokenPtr; Tcl_Token **handlerTokens = NULL; Tcl_Obj **matchClauses = NULL; @@ -3633,7 +3633,7 @@ TclCompileUnsetCmd( * push/rotate. [Bug 3970f54c4e] */ - for (i=1,varTokenPtr=parsePtr->tokenPtr ; i<parsePtr->numWords ; i++) { + for (i=1,varTokenPtr=parsePtr->tokenPtr ; i<(int)parsePtr->numWords ; i++) { Tcl_Obj *leadingWord; TclNewObj(leadingWord); @@ -3697,7 +3697,7 @@ TclCompileUnsetCmd( for (i=0; i<haveFlags;i++) { varTokenPtr = TokenAfter(varTokenPtr); } - for (i=1+haveFlags ; i<parsePtr->numWords ; i++) { + for (i=1+haveFlags ; i<(int)parsePtr->numWords ; i++) { /* * Decide if we can use a frame slot for the var/array name or if we * need to emit code to compute and push the name at runtime. We use a @@ -3767,7 +3767,7 @@ TclCompileWhileCmd( * infinite loop. */ Tcl_Obj *boolObj; - if (parsePtr->numWords != 3) { + if ((int)parsePtr->numWords != 3) { return TCL_ERROR; } @@ -3936,11 +3936,11 @@ TclCompileYieldCmd( TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { - if (parsePtr->numWords < 1 || parsePtr->numWords > 2) { + if ((int)parsePtr->numWords < 1 || (int)parsePtr->numWords > 2) { return TCL_ERROR; } - if (parsePtr->numWords == 1) { + if ((int)parsePtr->numWords == 1) { PUSH(""); } else { DefineLineInformation; /* TIP #280 */ @@ -3982,12 +3982,12 @@ TclCompileYieldToCmd( Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); int i; - if (parsePtr->numWords < 2) { + if ((int)parsePtr->numWords < 2) { return TCL_ERROR; } OP( NS_CURRENT); - for (i = 1 ; i < parsePtr->numWords ; i++) { + for (i = 1 ; i < (int)parsePtr->numWords ; i++) { CompileWord(envPtr, tokenPtr, interp, i); tokenPtr = TokenAfter(tokenPtr); } @@ -4024,7 +4024,7 @@ CompileUnaryOpCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { return TCL_ERROR; } tokenPtr = TokenAfter(parsePtr->tokenPtr); @@ -4068,11 +4068,11 @@ CompileAssociativeBinaryOpCmd( int words; /* TODO: Consider support for compiling expanded args. */ - for (words=1 ; words<parsePtr->numWords ; words++) { + for (words=1 ; words<(int)parsePtr->numWords ; words++) { tokenPtr = TokenAfter(tokenPtr); CompileWord(envPtr, tokenPtr, interp, words); } - if (parsePtr->numWords <= 2) { + if ((int)parsePtr->numWords <= 2) { PushLiteral(envPtr, identity, -1); words++; } @@ -4116,7 +4116,7 @@ CompileStrictlyBinaryOpCmd( int instruction, CompileEnv *envPtr) { - if (parsePtr->numWords != 3) { + if ((int)parsePtr->numWords != 3) { return TCL_ERROR; } return CompileAssociativeBinaryOpCmd(interp, parsePtr, @@ -4152,9 +4152,9 @@ CompileComparisonOpCmd( Tcl_Token *tokenPtr; /* TODO: Consider support for compiling expanded args. */ - if (parsePtr->numWords < 3) { + if ((int)parsePtr->numWords < 3) { PUSH("1"); - } else if (parsePtr->numWords == 3) { + } else if ((int)parsePtr->numWords == 3) { tokenPtr = TokenAfter(parsePtr->tokenPtr); CompileWord(envPtr, tokenPtr, interp, 1); tokenPtr = TokenAfter(tokenPtr); @@ -4176,11 +4176,11 @@ CompileComparisonOpCmd( CompileWord(envPtr, tokenPtr, interp, 2); STORE(tmpIndex); TclEmitOpcode(instruction, envPtr); - for (words=3 ; words<parsePtr->numWords ;) { + for (words=3 ; words<(int)parsePtr->numWords ;) { LOAD(tmpIndex); tokenPtr = TokenAfter(tokenPtr); CompileWord(envPtr, tokenPtr, interp, words); - if (++words < parsePtr->numWords) { + if (++words < (int)parsePtr->numWords) { STORE(tmpIndex); } TclEmitOpcode(instruction, envPtr); @@ -4311,11 +4311,11 @@ TclCompilePowOpCmd( * one with right associativity. */ - for (words=1 ; words<parsePtr->numWords ; words++) { + for (words=1 ; words<(int)parsePtr->numWords ; words++) { tokenPtr = TokenAfter(tokenPtr); CompileWord(envPtr, tokenPtr, interp, words); } - if (parsePtr->numWords <= 2) { + if ((int)parsePtr->numWords <= 2) { PUSH("1"); words++; } @@ -4508,14 +4508,14 @@ TclCompileMinusOpCmd( int words; /* TODO: Consider support for compiling expanded args. */ - if (parsePtr->numWords == 1) { + if ((int)parsePtr->numWords == 1) { /* * Fallback to direct eval to report syntax error. */ return TCL_ERROR; } - for (words=1 ; words<parsePtr->numWords ; words++) { + for (words=1 ; words<(int)parsePtr->numWords ; words++) { tokenPtr = TokenAfter(tokenPtr); CompileWord(envPtr, tokenPtr, interp, words); } @@ -4553,17 +4553,17 @@ TclCompileDivOpCmd( int words; /* TODO: Consider support for compiling expanded args. */ - if (parsePtr->numWords == 1) { + if ((int)parsePtr->numWords == 1) { /* * Fallback to direct eval to report syntax error. */ return TCL_ERROR; } - if (parsePtr->numWords == 2) { + if ((int)parsePtr->numWords == 2) { PUSH("1.0"); } - for (words=1 ; words<parsePtr->numWords ; words++) { + for (words=1 ; words<(int)parsePtr->numWords ; words++) { tokenPtr = TokenAfter(tokenPtr); CompileWord(envPtr, tokenPtr, interp, words); } diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index 937e71e..12a88b7 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -915,7 +915,7 @@ ParseExpr( */ TclGrowParseTokenArray(parsePtr, 2); - wordIndex = parsePtr->numTokens; + wordIndex = (int)parsePtr->numTokens; tokenPtr = parsePtr->tokenPtr + wordIndex; tokenPtr->type = TCL_TOKEN_WORD; tokenPtr->start = start; @@ -955,7 +955,7 @@ ParseExpr( Tcl_Parse *nestedPtr = (Tcl_Parse *) TclStackAlloc(interp, sizeof(Tcl_Parse)); - tokenPtr = parsePtr->tokenPtr + parsePtr->numTokens; + tokenPtr = parsePtr->tokenPtr + (int)parsePtr->numTokens; tokenPtr->type = TCL_TOKEN_COMMAND; tokenPtr->start = start; tokenPtr->numComponents = 0; @@ -1023,7 +1023,7 @@ ParseExpr( tokenPtr = parsePtr->tokenPtr + wordIndex; tokenPtr->size = scanned; - tokenPtr->numComponents = parsePtr->numTokens - wordIndex - 1; + tokenPtr->numComponents = (int)parsePtr->numTokens - wordIndex - 1; if (!parseOnly && ((lexeme == QUOTED) || (lexeme == BRACED))) { /* * When this expression is destined to be compiled, and a @@ -1560,7 +1560,7 @@ ConvertTreeToTokens( scanned = ParseLexeme(start, numBytes, &lexeme, NULL); TclGrowParseTokenArray(parsePtr, 2); - subExprTokenPtr = parsePtr->tokenPtr + parsePtr->numTokens; + subExprTokenPtr = parsePtr->tokenPtr + (int)parsePtr->numTokens; subExprTokenPtr->type = TCL_TOKEN_SUB_EXPR; subExprTokenPtr->start = start; subExprTokenPtr->size = scanned; @@ -1599,7 +1599,7 @@ ConvertTreeToTokens( */ TclGrowParseTokenArray(parsePtr, toCopy); - subExprTokenPtr = parsePtr->tokenPtr + parsePtr->numTokens; + subExprTokenPtr = parsePtr->tokenPtr + (int)parsePtr->numTokens; memcpy(subExprTokenPtr, tokenPtr, toCopy * sizeof(Tcl_Token)); subExprTokenPtr->type = TCL_TOKEN_SUB_EXPR; @@ -1612,7 +1612,7 @@ ConvertTreeToTokens( */ TclGrowParseTokenArray(parsePtr, toCopy+1); - subExprTokenPtr = parsePtr->tokenPtr + parsePtr->numTokens; + subExprTokenPtr = parsePtr->tokenPtr + (int)parsePtr->numTokens; *subExprTokenPtr = *tokenPtr; subExprTokenPtr->type = TCL_TOKEN_SUB_EXPR; subExprTokenPtr->numComponents++; @@ -1678,7 +1678,7 @@ ConvertTreeToTokens( */ TclGrowParseTokenArray(parsePtr, 2); - subExprTokenIdx = parsePtr->numTokens; + subExprTokenIdx = (int)parsePtr->numTokens; subExprTokenPtr = parsePtr->tokenPtr + subExprTokenIdx; parsePtr->numTokens += 2; subExprTokenPtr->type = TCL_TOKEN_SUB_EXPR; @@ -1806,7 +1806,7 @@ ConvertTreeToTokens( */ subExprTokenPtr->numComponents = - (parsePtr->numTokens - subExprTokenIdx) - 1; + ((int)parsePtr->numTokens - subExprTokenIdx) - 1; /* * Finally, as we return up the tree to our parent, pop the diff --git a/generic/tclCompile.c b/generic/tclCompile.c index cfdbda0..430c2c1 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -2026,7 +2026,7 @@ CompileCommandTokens( int startCodeOffset = envPtr->codeNext - envPtr->codeStart; int depth = TclGetStackDepth(envPtr); - assert (parsePtr->numWords > 0); + assert ((int)parsePtr->numWords > 0); /* Pre-Compile */ @@ -2044,7 +2044,7 @@ CompileCommandTokens( EnterCmdWordData(eclPtr, parsePtr->commandStart - envPtr->source, parsePtr->tokenPtr, parsePtr->commandStart, - parsePtr->numWords, cmdLine, + (int)parsePtr->numWords, cmdLine, clNext, &wlines, envPtr); wlineat = eclPtr->nuloc - 1; @@ -2071,7 +2071,7 @@ CompileCommandTokens( } } if (cmdPtr && !(cmdPtr->flags & CMD_COMPILES_EXPANDED)) { - expand = ExpandRequested(parsePtr->tokenPtr, parsePtr->numWords); + expand = ExpandRequested(parsePtr->tokenPtr, (int)parsePtr->numWords); if (expand) { /* We need to expand, but compileProc cannot. */ cmdPtr = NULL; @@ -2086,15 +2086,15 @@ CompileCommandTokens( if (code == TCL_ERROR) { if (expand < 0) { - expand = ExpandRequested(parsePtr->tokenPtr, parsePtr->numWords); + expand = ExpandRequested(parsePtr->tokenPtr, (int)parsePtr->numWords); } if (expand) { CompileExpanded(interp, parsePtr->tokenPtr, - cmdKnown ? cmdObj : NULL, parsePtr->numWords, envPtr); + cmdKnown ? cmdObj : NULL, (int)parsePtr->numWords, envPtr); } else { TclCompileInvocation(interp, parsePtr->tokenPtr, - cmdKnown ? cmdObj : NULL, parsePtr->numWords, envPtr); + cmdKnown ? cmdObj : NULL, (int)parsePtr->numWords, envPtr); } } @@ -2215,7 +2215,7 @@ TclCompileScript( numBytes -= next - p; p = next; - if (parsePtr->numWords == 0) { + if ((int)parsePtr->numWords == 0) { /* * The "command" parsed has no words. In this case we can skip * the rest of the loop body. With no words, clearly @@ -2229,7 +2229,7 @@ TclCompileScript( * Tcl_FreeParse() to do. * * The advantage of this shortcut is that CompileCommandTokens() - * can be written with an assumption that parsePtr->numWords > 0, with + * can be written with an assumption that (int)parsePtr->numWords > 0, with * the implication the CCT() always generates bytecode. */ continue; @@ -2720,7 +2720,7 @@ TclCompileNoOp( int i; tokenPtr = parsePtr->tokenPtr; - for (i = 1; i < parsePtr->numWords; i++) { + for (i = 1; i < (int)parsePtr->numWords; i++) { tokenPtr = tokenPtr + tokenPtr->numComponents + 1; if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 69b20a2..c24a1e6 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -2920,7 +2920,7 @@ TclCompileEnsemble( TclNewObj(replaced); Tcl_IncrRefCount(replaced); - if (parsePtr->numWords < depth + 1) { + if ((int)parsePtr->numWords < depth + 1) { goto failed; } if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { @@ -3147,7 +3147,7 @@ TclCompileEnsemble( if (cmdPtr->compileProc == TclCompileEnsemble) { tokenPtr = TokenAfter(tokenPtr); - if (parsePtr->numWords < depth + 1 + if ((int)parsePtr->numWords < depth + 1 || tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { /* * Too hard because the user has done something unpleasant like @@ -3393,7 +3393,7 @@ CompileToInvokedCommand( */ TclListObjGetElements(NULL, replacements, &numWords, &words); - for (i = 0, tokPtr = parsePtr->tokenPtr; i < parsePtr->numWords; + for (i = 0, tokPtr = parsePtr->tokenPtr; i < (int)parsePtr->numWords; i++, tokPtr = TokenAfter(tokPtr)) { if (i > 0 && (size_t)i <= numWords) { bytes = Tcl_GetStringFromObj(words[i-1], &length); @@ -3438,7 +3438,7 @@ CompileToInvokedCommand( * Do the replacing dispatch. */ - TclEmitInvoke(envPtr, INST_INVOKE_REPLACE, parsePtr->numWords,numWords+1); + TclEmitInvoke(envPtr, INST_INVOKE_REPLACE, (int)parsePtr->numWords,numWords+1); } /* @@ -3468,7 +3468,7 @@ CompileBasicNArgCommand( Tcl_IncrRefCount(objPtr); Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr, objPtr); TclCompileInvocation(interp, parsePtr->tokenPtr, objPtr, - parsePtr->numWords, envPtr); + (int)parsePtr->numWords, envPtr); Tcl_DecrRefCount(objPtr); return TCL_OK; } @@ -3488,7 +3488,7 @@ TclCompileBasic0ArgCmd( * which is the only code that sees the shenanigans of ensemble dispatch. */ - if (parsePtr->numWords != 1) { + if ((int)parsePtr->numWords != 1) { return TCL_ERROR; } @@ -3510,7 +3510,7 @@ TclCompileBasic1ArgCmd( * which is the only code that sees the shenanigans of ensemble dispatch. */ - if (parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 2) { return TCL_ERROR; } @@ -3532,7 +3532,7 @@ TclCompileBasic2ArgCmd( * which is the only code that sees the shenanigans of ensemble dispatch. */ - if (parsePtr->numWords != 3) { + if ((int)parsePtr->numWords != 3) { return TCL_ERROR; } @@ -3554,7 +3554,7 @@ TclCompileBasic3ArgCmd( * which is the only code that sees the shenanigans of ensemble dispatch. */ - if (parsePtr->numWords != 4) { + if ((int)parsePtr->numWords != 4) { return TCL_ERROR; } @@ -3576,7 +3576,7 @@ TclCompileBasic0Or1ArgCmd( * which is the only code that sees the shenanigans of ensemble dispatch. */ - if (parsePtr->numWords != 1 && parsePtr->numWords != 2) { + if ((int)parsePtr->numWords != 1 && (int)parsePtr->numWords != 2) { return TCL_ERROR; } @@ -3598,7 +3598,7 @@ TclCompileBasic1Or2ArgCmd( * which is the only code that sees the shenanigans of ensemble dispatch. */ - if (parsePtr->numWords != 2 && parsePtr->numWords != 3) { + if ((int)parsePtr->numWords != 2 && (int)parsePtr->numWords != 3) { return TCL_ERROR; } @@ -3620,7 +3620,7 @@ TclCompileBasic2Or3ArgCmd( * which is the only code that sees the shenanigans of ensemble dispatch. */ - if (parsePtr->numWords != 3 && parsePtr->numWords != 4) { + if ((int)parsePtr->numWords != 3 && (int)parsePtr->numWords != 4) { return TCL_ERROR; } @@ -3642,7 +3642,7 @@ TclCompileBasic0To2ArgCmd( * which is the only code that sees the shenanigans of ensemble dispatch. */ - if (parsePtr->numWords < 1 || parsePtr->numWords > 3) { + if ((int)parsePtr->numWords < 1 || (int)parsePtr->numWords > 3) { return TCL_ERROR; } @@ -3664,7 +3664,7 @@ TclCompileBasic1To3ArgCmd( * which is the only code that sees the shenanigans of ensemble dispatch. */ - if (parsePtr->numWords < 2 || parsePtr->numWords > 4) { + if ((int)parsePtr->numWords < 2 || (int)parsePtr->numWords > 4) { return TCL_ERROR; } @@ -3686,7 +3686,7 @@ TclCompileBasicMin0ArgCmd( * which is the only code that sees the shenanigans of ensemble dispatch. */ - if (parsePtr->numWords < 1) { + if ((int)parsePtr->numWords < 1) { return TCL_ERROR; } @@ -3708,7 +3708,7 @@ TclCompileBasicMin1ArgCmd( * which is the only code that sees the shenanigans of ensemble dispatch. */ - if (parsePtr->numWords < 2) { + if ((int)parsePtr->numWords < 2) { return TCL_ERROR; } @@ -3730,7 +3730,7 @@ TclCompileBasicMin2ArgCmd( * which is the only code that sees the shenanigans of ensemble dispatch. */ - if (parsePtr->numWords < 3) { + if ((int)parsePtr->numWords < 3) { return TCL_ERROR; } diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 5229f65..91796b3 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2125,7 +2125,7 @@ TEBCresume( * instruction. */ - TRACE_WITH_OBJ(("%u => ... after \"%.20s\": TCL_OK, result=", + TRACE_WITH_OBJ(("%" TCL_Z_MODIFIER "u => ... after \"%.20s\": TCL_OK, result=", objc, cmdNameBuf), Tcl_GetObjResult(interp)); /* @@ -2845,7 +2845,7 @@ TEBCresume( O2S(objPtr)); } for (i = 0; i < objc; i++) { - if (i < opnd) { + if (i < (size_t)opnd) { fprintf(stdout, "<"); TclPrintObject(stdout, objv[i], 15); fprintf(stdout, ">"); @@ -4643,7 +4643,7 @@ TEBCresume( goto gotError; } TclNewIntObj(objResultPtr, length); - TRACE_APPEND(("%d\n", length)); + TRACE_APPEND(("%" TCL_Z_MODIFIER "u\n", length)); NEXT_INST_F(1, 1, 1); case INST_LIST_INDEX: /* lindex with objc == 3 */ @@ -6355,7 +6355,7 @@ TEBCresume( if (TclPtrSetVarIdx(interp, varPtr, NULL, NULL, NULL, valuePtr, TCL_LEAVE_ERR_MSG, varIndex)==NULL){ CACHE_STACK_INFO(); - TRACE_APPEND(("ERROR init. index temp %d: %.30s", + TRACE_APPEND(("ERROR init. index temp %" TCL_Z_MODIFIER "u: %.30s", varIndex, O2S(Tcl_GetObjResult(interp)))); goto gotError; } @@ -6402,7 +6402,7 @@ TEBCresume( tmpPtr = OBJ_AT_DEPTH(1); infoPtr = (ForeachInfo *)tmpPtr->internalRep.twoPtrValue.ptr1; numLists = infoPtr->numLists; - TRACE_APPEND(("=> appending to list at depth %d\n", 3 + numLists)); + TRACE_APPEND(("=> appending to list at depth %" TCL_Z_MODIFIER "u\n", 3 + numLists)); objPtr = OBJ_AT_DEPTH(3 + numLists); Tcl_ListObjAppendElement(NULL, objPtr, OBJ_AT_TOS); diff --git a/generic/tclInt.h b/generic/tclInt.h index af2a6ba..c6b7180 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4590,31 +4590,20 @@ MODULE_SCOPE const TclFileAttrProcs tclpFileAttrProcs[]; #define TCL_MIN_TOKEN_GROWTH TCL_MIN_GROWTH/sizeof(Tcl_Token) #endif -#define TCL_MAX_TOKENS (int)(UINT_MAX / sizeof(Tcl_Token)) #define TclGrowTokenArray(tokenPtr, used, available, append, staticPtr) \ do { \ - int _needed = (used) + (append); \ - if (_needed > TCL_MAX_TOKENS) { \ - Tcl_Panic("max # of tokens for a Tcl parse (%d) exceeded", \ - TCL_MAX_TOKENS); \ - } \ + size_t _needed = (used) + (append); \ if (_needed > (available)) { \ - int allocated = 2 * _needed; \ + size_t allocated = 2 * _needed; \ Tcl_Token *oldPtr = (tokenPtr); \ Tcl_Token *newPtr; \ if (oldPtr == (staticPtr)) { \ oldPtr = NULL; \ } \ - if (allocated > TCL_MAX_TOKENS) { \ - allocated = TCL_MAX_TOKENS; \ - } \ newPtr = (Tcl_Token *)Tcl_AttemptRealloc((char *) oldPtr, \ allocated * sizeof(Tcl_Token)); \ if (newPtr == NULL) { \ allocated = _needed + (append) + TCL_MIN_TOKEN_GROWTH; \ - if (allocated > TCL_MAX_TOKENS) { \ - allocated = TCL_MAX_TOKENS; \ - } \ newPtr = (Tcl_Token *)Tcl_Realloc((char *) oldPtr, \ allocated * sizeof(Tcl_Token)); \ } \ diff --git a/generic/tclParse.c b/generic/tclParse.c index 614401f..52c11d4 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -303,7 +303,7 @@ Tcl_ParseCommand( */ TclGrowParseTokenArray(parsePtr, 1); - wordIndex = parsePtr->numTokens; + wordIndex = (int)parsePtr->numTokens; tokenPtr = &parsePtr->tokenPtr[wordIndex]; tokenPtr->type = TCL_TOKEN_WORD; @@ -344,7 +344,7 @@ Tcl_ParseCommand( expPtr = &parsePtr->tokenPtr[expIdx]; if ((0 == expandWord) /* Haven't seen prefix already */ - && (1 == parsePtr->numTokens - expIdx) + && (1 == (int)parsePtr->numTokens - expIdx) /* Only one token */ && (((1 == expPtr->size) /* Same length as prefix */ @@ -379,7 +379,7 @@ Tcl_ParseCommand( tokenPtr = &parsePtr->tokenPtr[wordIndex]; tokenPtr->size = src - tokenPtr->start; - tokenPtr->numComponents = parsePtr->numTokens - (wordIndex + 1); + tokenPtr->numComponents = (int)parsePtr->numTokens - (wordIndex + 1); if (expandWord) { size_t i; int isLiteral = 1; @@ -471,7 +471,7 @@ Tcl_ParseCommand( const char *listStart; int growthNeeded = wordIndex + 2*elemCount - - parsePtr->numTokens; + - (int)parsePtr->numTokens; parsePtr->numWords += elemCount - 1; if (growthNeeded > 0) { @@ -1082,10 +1082,10 @@ ParseTokens( * for the parsed variable name. */ - originalTokens = parsePtr->numTokens; + originalTokens = (int)parsePtr->numTokens; while (numBytes && !((type = CHAR_TYPE(*src)) & mask)) { TclGrowParseTokenArray(parsePtr, 1); - tokenPtr = &parsePtr->tokenPtr[parsePtr->numTokens]; + tokenPtr = &parsePtr->tokenPtr[(int)parsePtr->numTokens]; tokenPtr->start = src; tokenPtr->numComponents = 0; @@ -1119,7 +1119,7 @@ ParseTokens( * the dirty work of parsing the name. */ - varToken = parsePtr->numTokens; + varToken = (int)parsePtr->numTokens; if (Tcl_ParseVarName(parsePtr->interp, src, numBytes, parsePtr, 1) != TCL_OK) { return TCL_ERROR; @@ -1230,7 +1230,7 @@ ParseTokens( */ if (mask & TYPE_SPACE) { - if (parsePtr->numTokens == originalTokens) { + if ((int)parsePtr->numTokens == originalTokens) { goto finishToken; } break; @@ -1251,14 +1251,14 @@ ParseTokens( Tcl_Panic("ParseTokens encountered unknown character"); } } - if (parsePtr->numTokens == originalTokens) { + if ((int)parsePtr->numTokens == originalTokens) { /* * There was nothing in this range of text. Add an empty token for the * empty range, so that there is always at least one token added. */ TclGrowParseTokenArray(parsePtr, 1); - tokenPtr = &parsePtr->tokenPtr[parsePtr->numTokens]; + tokenPtr = &parsePtr->tokenPtr[(int)parsePtr->numTokens]; tokenPtr->start = src; tokenPtr->numComponents = 0; @@ -1365,10 +1365,10 @@ Tcl_ParseVarName( src = start; TclGrowParseTokenArray(parsePtr, 2); - tokenPtr = &parsePtr->tokenPtr[parsePtr->numTokens]; + tokenPtr = &parsePtr->tokenPtr[(int)parsePtr->numTokens]; tokenPtr->type = TCL_TOKEN_VARIABLE; tokenPtr->start = src; - varIndex = parsePtr->numTokens; + varIndex = (int)parsePtr->numTokens; parsePtr->numTokens++; tokenPtr++; src++; @@ -1480,7 +1480,7 @@ Tcl_ParseVarName( } tokenPtr = &parsePtr->tokenPtr[varIndex]; tokenPtr->size = src - tokenPtr->start; - tokenPtr->numComponents = parsePtr->numTokens - (varIndex + 1); + tokenPtr->numComponents = (int)parsePtr->numTokens - (varIndex + 1); return TCL_OK; /* @@ -1543,7 +1543,7 @@ Tcl_ParseVar( if (termPtr != NULL) { *termPtr = start + parsePtr->tokenPtr->size; } - if (parsePtr->numTokens == 1) { + if ((int)parsePtr->numTokens == 1) { /* * There isn't a variable name after all: the $ is just a $. */ @@ -1552,7 +1552,7 @@ Tcl_ParseVar( return "$"; } - code = TclSubstTokens(interp, parsePtr->tokenPtr, parsePtr->numTokens, + code = TclSubstTokens(interp, parsePtr->tokenPtr, (int)parsePtr->numTokens, NULL, 1, NULL, NULL); Tcl_FreeParse(parsePtr); TclStackFree(interp, parsePtr); @@ -1641,7 +1641,7 @@ Tcl_ParseBraces( } src = start; - startIndex = parsePtr->numTokens; + startIndex = (int)parsePtr->numTokens; TclGrowParseTokenArray(parsePtr, 1); tokenPtr = &parsePtr->tokenPtr[startIndex]; @@ -1679,7 +1679,7 @@ Tcl_ParseBraces( */ if ((src != tokenPtr->start) - || (parsePtr->numTokens == startIndex)) { + || ((int)parsePtr->numTokens == startIndex)) { tokenPtr->size = (src - tokenPtr->start); parsePtr->numTokens++; } @@ -1707,7 +1707,7 @@ Tcl_ParseBraces( parsePtr->numTokens++; } TclGrowParseTokenArray(parsePtr, 2); - tokenPtr = &parsePtr->tokenPtr[parsePtr->numTokens]; + tokenPtr = &parsePtr->tokenPtr[(int)parsePtr->numTokens]; tokenPtr->type = TCL_TOKEN_BS; tokenPtr->start = src; tokenPtr->size = length; @@ -1978,7 +1978,7 @@ TclSubstParse( */ Tcl_Token *varTokenPtr = - parsePtr->tokenPtr + parsePtr->numTokens - 2; + parsePtr->tokenPtr + (int)parsePtr->numTokens - 2; if (varTokenPtr->type != TCL_TOKEN_VARIABLE) { Tcl_Panic("TclSubstParse: programming error"); @@ -2048,7 +2048,7 @@ TclSubstParse( */ TclGrowParseTokenArray(parsePtr, 1); - tokenPtr = &(parsePtr->tokenPtr[parsePtr->numTokens]); + tokenPtr = &(parsePtr->tokenPtr[(int)parsePtr->numTokens]); tokenPtr->start = parsePtr->term; tokenPtr->numComponents = 0; tokenPtr->type = TCL_TOKEN_COMMAND; diff --git a/generic/tclTest.c b/generic/tclTest.c index a88062e..7dd6d44 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -3519,10 +3519,10 @@ PrintParse( Tcl_Obj *objPtr; const char *typeString; Tcl_Token *tokenPtr; - int i; + size_t i; objPtr = Tcl_GetObjResult(interp); - if (parsePtr->commentSize > 0) { + if (parsePtr->commentSize + 1 > 1) { Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj(parsePtr->commentStart, parsePtr->commentSize)); @@ -3532,8 +3532,8 @@ PrintParse( Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj(parsePtr->commandStart, parsePtr->commandSize)); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewIntObj(parsePtr->numWords)); - for (i = 0; i < parsePtr->numTokens; i++) { + Tcl_NewWideIntObj(parsePtr->numWords)); + for (i = 0; i < (size_t)parsePtr->numTokens; i++) { tokenPtr = &parsePtr->tokenPtr[i]; switch (tokenPtr->type) { case TCL_TOKEN_EXPAND_WORD: |