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 /generic/tclCompCmdsGR.c | |
parent | 517053cc1d72cef6525a8b477a7b1cdda5439fbc (diff) | |
download | tcl-108b27d54956ad01e5bfe6ba29a2a244251ccb57.zip tcl-108b27d54956ad01e5bfe6ba29a2a244251ccb57.tar.gz tcl-108b27d54956ad01e5bfe6ba29a2a244251ccb57.tar.bz2 |
More progress
Diffstat (limited to 'generic/tclCompCmdsGR.c')
-rw-r--r-- | generic/tclCompCmdsGR.c | 124 |
1 files changed, 62 insertions, 62 deletions
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) { |