summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-05-20 10:07:19 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-05-20 10:07:19 (GMT)
commitb27acbe84f73b35a0b28f078eb6a758f26a57595 (patch)
tree7c7ea7c9bbdbfbe030cf936560bcce477e3c0e78 /generic
parent6643ceb1413079a9b7175b6c9fae4d81e0a0d40a (diff)
downloadtcl-b27acbe84f73b35a0b28f078eb6a758f26a57595.zip
tcl-b27acbe84f73b35a0b28f078eb6a758f26a57595.tar.gz
tcl-b27acbe84f73b35a0b28f078eb6a758f26a57595.tar.bz2
More int/Tcl_Size backport
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBasic.c136
-rw-r--r--generic/tclEnsemble.c73
-rw-r--r--generic/tclEvent.c11
-rw-r--r--generic/tclExecute.c12
-rw-r--r--generic/tclIOGT.c4
-rw-r--r--generic/tclIORChan.c35
-rw-r--r--generic/tclOODefineCmds.c18
-rw-r--r--generic/tclOOInfo.c2
-rw-r--r--generic/tclVar.c50
9 files changed, 175 insertions, 166 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 4159cc4..b7bc311 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -105,7 +105,7 @@ typedef struct {
* cancellation. */
char *result; /* The script cancellation result or NULL for
* a default result. */
- int length; /* Length of the above error message. */
+ Tcl_Size length; /* Length of the above error message. */
void *clientData; /* Not used. */
int flags; /* Additional flags */
} CancelInfo;
@@ -634,7 +634,7 @@ buildInfoObjCmd(
return TCL_ERROR;
}
if (objc == 2) {
- int len;
+ Tcl_Size len;
const char *arg = TclGetStringFromObj(objv[1], &len);
if (len == 7 && !strcmp(arg, "version")) {
char buf[80];
@@ -1288,13 +1288,12 @@ Tcl_CreateInterp(void)
Tcl_CreateObjCommand(interp, "::tcl::build-info",
buildInfoObjCmd, (void *)version, NULL);
-
if (TclTommath_Init(interp) != TCL_OK) {
- Tcl_Panic("%s", TclGetString(Tcl_GetObjResult(interp)));
+ Tcl_Panic("%s", Tcl_GetStringResult(interp));
}
if (TclOOInit(interp) != TCL_OK) {
- Tcl_Panic("%s", TclGetString(Tcl_GetObjResult(interp)));
+ Tcl_Panic("%s", Tcl_GetStringResult(interp));
}
/*
@@ -1304,10 +1303,10 @@ Tcl_CreateInterp(void)
#ifdef HAVE_ZLIB
if (TclZlibInit(interp) != TCL_OK) {
- Tcl_Panic("%s", TclGetString(Tcl_GetObjResult(interp)));
+ Tcl_Panic("%s", Tcl_GetStringResult(interp));
}
if (TclZipfs_Init(interp) != TCL_OK) {
- Tcl_Panic("%s", Tcl_GetString(Tcl_GetObjResult(interp)));
+ Tcl_Panic("%s", Tcl_GetStringResult(interp));
}
#endif
@@ -1439,7 +1438,7 @@ TclHideUnsafeCommands(
TclGetString(hideName)) != TCL_OK) {
Tcl_Panic("problem making '%s %s' safe: %s",
unsafePtr->ensembleNsName, unsafePtr->commandName,
- Tcl_GetString(Tcl_GetObjResult(interp)));
+ Tcl_GetStringResult(interp));
}
Tcl_CreateObjCommand(interp, TclGetString(cmdName),
BadEnsembleSubcommand, (void *)unsafePtr, NULL);
@@ -1454,7 +1453,7 @@ TclHideUnsafeCommands(
unsafePtr->ensembleNsName) != TCL_OK) {
Tcl_Panic("problem making '%s' safe: %s",
unsafePtr->ensembleNsName,
- Tcl_GetString(Tcl_GetObjResult(interp)));
+ Tcl_GetStringResult(interp));
}
}
}
@@ -1833,7 +1832,7 @@ DeleteInterpProc(
Tcl_HashSearch search;
Tcl_HashTable *hTablePtr;
ResolverScheme *resPtr, *nextResPtr;
- int i;
+ Tcl_Size i;
/*
* Punt if there is an error in the Tcl_Release/Tcl_Preserve matchup,
@@ -4420,8 +4419,8 @@ TclInterpReady(
Interp *iPtr = (Interp *) interp;
/*
- * Reset both the interpreter's string and object results and clear out
- * any previous error information.
+ * Reset the interpreter's result and clear out any previous error
+ * information.
*/
Tcl_ResetResult(interp);
@@ -4570,7 +4569,7 @@ Tcl_Canceled(
if (flags & TCL_LEAVE_ERR_MSG) {
const char *id, *message = NULL;
- int length;
+ Tcl_Size length;
/*
* Setup errorCode variables so that we can differentiate between
@@ -4741,7 +4740,7 @@ int
Tcl_EvalObjv(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* command. Also used for error reporting. */
- int objc, /* Number of words in command. */
+ Tcl_Size objc, /* Number of words in command. */
Tcl_Obj *const objv[], /* An array of pointers to objects that are
* the words that make up the command. */
int flags) /* Collection of OR-ed bits that control the
@@ -4760,7 +4759,7 @@ int
TclNREvalObjv(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* command. Also used for error reporting. */
- int objc, /* Number of words in command. */
+ Tcl_Size objc, /* Number of words in command. */
Tcl_Obj *const objv[], /* An array of pointers to objects that are
* the words that make up the command. */
int flags, /* Collection of OR-ed bits that control the
@@ -5192,7 +5191,7 @@ TEOV_Error(
Interp *iPtr = (Interp *) interp;
Tcl_Obj *listPtr;
const char *cmdString;
- int cmdLen;
+ Tcl_Size cmdLen;
int objc = PTR2INT(data[0]);
Tcl_Obj **objv = (Tcl_Obj **)data[1];
@@ -5221,7 +5220,7 @@ TEOV_NotFound(
{
Command * cmdPtr;
Interp *iPtr = (Interp *) interp;
- int i, newObjc, handlerObjc;
+ Tcl_Size i, newObjc, handlerObjc;
Tcl_Obj **newObjv, **handlerObjv;
CallFrame *varFramePtr = iPtr->varFramePtr;
Namespace *currNsPtr = NULL;/* Used to check for and invoke any registered
@@ -5348,7 +5347,7 @@ TEOV_RunEnterTraces(
{
Interp *iPtr = (Interp *) interp;
Command *cmdPtr = *cmdPtrPtr;
- int length, newEpoch, cmdEpoch = cmdPtr->cmdEpoch;
+ Tcl_Size length, newEpoch, cmdEpoch = cmdPtr->cmdEpoch;
int traceCode = TCL_OK;
const char *command = TclGetStringFromObj(commandPtr, &length);
@@ -5401,7 +5400,7 @@ TEOV_RunLeaveTraces(
Tcl_Obj *commandPtr = (Tcl_Obj *)data[1];
Command *cmdPtr = (Command *)data[2];
Tcl_Obj **objv = (Tcl_Obj **)data[3];
- int length;
+ Tcl_Size length;
const char *command = TclGetStringFromObj(commandPtr, &length);
if (!(cmdPtr->flags & CMD_DYING)) {
@@ -5484,7 +5483,7 @@ Tcl_EvalTokensStandard(
* errors. */
Tcl_Token *tokenPtr, /* Pointer to first in an array of tokens to
* evaluate and concatenate. */
- int count) /* Number of tokens to consider at tokenPtr.
+ Tcl_Size count) /* Number of tokens to consider at tokenPtr.
* Must be at least 1. */
{
return TclSubstTokens(interp, tokenPtr, count, /* numLeftPtr */ NULL, 1,
@@ -5567,7 +5566,7 @@ Tcl_EvalEx(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* script. Also used for error reporting. */
const char *script, /* First character of script to evaluate. */
- int numBytes, /* Number of bytes in script. If < 0, the
+ Tcl_Size numBytes, /* Number of bytes in script. If -1, the
* script consists of all bytes up to the
* first null character. */
int flags) /* Collection of OR-ed bits that control the
@@ -5582,13 +5581,13 @@ TclEvalEx(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* script. Also used for error reporting. */
const char *script, /* First character of script to evaluate. */
- int numBytes, /* Number of bytes in script. If < 0, the
+ Tcl_Size numBytes, /* Number of bytes in script. If -1, the
* script consists of all bytes up to the
* first NUL character. */
int flags, /* Collection of OR-ed bits that control the
* evaluation of the script. Only
* TCL_EVAL_GLOBAL is currently supported. */
- int line, /* The line the script starts on. */
+ Tcl_Size line, /* The line the script starts on. */
int *clNextOuter, /* Information about an outer context for */
const char *outerScript) /* continuation line data. This is set only in
* TclSubstTokens(), to properly handle
@@ -5613,8 +5612,8 @@ TclEvalEx(
Tcl_Obj **objv, **objvSpace;
int *expand, *lines, *lineSpace;
Tcl_Token *tokenPtr;
- int bytesLeft, expandRequested, code = TCL_OK;
- int commandLength;
+ int expandRequested, code = TCL_OK;
+ Tcl_Size bytesLeft, commandLength;
CallFrame *savedVarFramePtr;/* Saves old copy of iPtr->varFramePtr in case
* TCL_EVAL_GLOBAL was set. */
int allowExceptions = (iPtr->evalFlags & TCL_ALLOW_EXCEPTIONS);
@@ -5754,7 +5753,7 @@ TclEvalEx(
* per-command parsing.
*/
- int wordLine = line;
+ Tcl_Size wordLine = line;
const char *wordStart = parsePtr->commandStart;
int *wordCLNext = clNext;
unsigned int objectsNeeded = 0;
@@ -5809,7 +5808,7 @@ TclEvalEx(
objv[objectsUsed] = Tcl_GetObjResult(interp);
Tcl_IncrRefCount(objv[objectsUsed]);
if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) {
- int numElements;
+ Tcl_Size numElements;
code = TclListObjLengthM(interp, objv[objectsUsed],
&numElements);
@@ -5860,7 +5859,7 @@ TclEvalEx(
objectsUsed = 0;
while (wordIdx--) {
if (expand[wordIdx]) {
- int numElements;
+ Tcl_Size numElements;
Tcl_Obj **elements, *temp = copy[wordIdx];
TclListObjGetElementsM(NULL, temp, &numElements,
@@ -6053,7 +6052,7 @@ TclEvalEx(
void
TclAdvanceLines(
- int *line,
+ Tcl_Size *line,
const char *start,
const char *end)
{
@@ -6088,7 +6087,7 @@ TclAdvanceLines(
void
TclAdvanceContinuations(
- int *line,
+ Tcl_Size *line,
int **clNextPtrPtr,
int loc)
{
@@ -6268,7 +6267,7 @@ TclArgumentBCEnter(
void *codePtr,
CmdFrame *cfPtr,
int cmd,
- int pc)
+ Tcl_Size pc)
{
ExtCmdLoc *eclPtr;
int word;
@@ -6634,7 +6633,7 @@ TclNREvalObjEx(
if (TclListObjIsCanonical(objPtr)) {
CmdFrame *eoFramePtr = NULL;
- int objc;
+ Tcl_Size objc;
Tcl_Obj *listPtr, **objv;
/*
@@ -6744,7 +6743,7 @@ TclNREvalObjEx(
*/
const char *script;
- int numSrcBytes;
+ Tcl_Size numSrcBytes;
/*
* Now we check if we have data about invisible continuation lines for
@@ -6798,7 +6797,7 @@ TEOEx_ByteCodeCallback(
}
if ((result != TCL_OK) && (result != TCL_ERROR) && !allowExceptions) {
const char *script;
- int numSrcBytes;
+ Tcl_Size numSrcBytes;
ProcessUnexpectedResult(interp, result);
result = TCL_ERROR;
@@ -7522,7 +7521,7 @@ Tcl_VarEvalVA(
*
* Results:
* A standard Tcl return result. An error message or other result may be
- * left in interp->result.
+ * left in the interp.
*
* Side effects:
* Depends on what was done by the command.
@@ -7601,14 +7600,14 @@ Tcl_GlobalEval(
*----------------------------------------------------------------------
*/
-int
+Tcl_Size
Tcl_SetRecursionLimit(
Tcl_Interp *interp, /* Interpreter whose nesting limit is to be
* set. */
- int depth) /* New value for maximum depth. */
+ Tcl_Size depth) /* New value for maximum depth. */
{
Interp *iPtr = (Interp *) interp;
- int old;
+ Tcl_Size old;
old = iPtr->maxNestingDepth;
if (depth > 0) {
@@ -8084,7 +8083,7 @@ ExprAbsFunc(
goto unChanged;
} else if (l == 0) {
if (TclHasStringRep(objv[1])) {
- int numBytes;
+ Tcl_Size numBytes;
const char *bytes = TclGetStringFromObj(objv[1], &numBytes);
while (numBytes) {
@@ -9164,7 +9163,7 @@ Tcl_NRCallObjProc(
Tcl_Interp *interp,
Tcl_ObjCmdProc *objProc,
void *clientData,
- int objc,
+ Tcl_Size objc,
Tcl_Obj *const objv[])
{
NRE_callback *rootPtr = TOP_CB(interp);
@@ -9344,7 +9343,7 @@ int
Tcl_NREvalObjv(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* command. Also used for error reporting. */
- int objc, /* Number of words in command. */
+ Tcl_Size objc, /* Number of words in command. */
Tcl_Obj *const objv[], /* An array of pointers to objects that are
* the words that make up the command. */
int flags) /* Collection of OR-ed bits that control the
@@ -9359,7 +9358,7 @@ int
Tcl_NRCmdSwap(
Tcl_Interp *interp,
Tcl_Command cmd,
- int objc,
+ Tcl_Size objc,
Tcl_Obj *const objv[],
int flags)
{
@@ -9551,7 +9550,7 @@ TclNRTailcallEval(
Interp *iPtr = (Interp *) interp;
Tcl_Obj *listPtr = (Tcl_Obj *)data[0], *nsObjPtr;
Tcl_Namespace *nsPtr;
- int objc;
+ Tcl_Size objc;
Tcl_Obj **objv;
TclListObjGetElementsM(interp, listPtr, &objc, &objv);
@@ -9899,7 +9898,7 @@ TclNRCoroutineActivateCallback(
*/
corPtr->stackLevel = &corPtr;
- int numLevels = corPtr->auxNumLevels;
+ Tcl_Size numLevels = corPtr->auxNumLevels;
corPtr->auxNumLevels = iPtr->numLevels;
SAVE_CONTEXT(corPtr->caller);
@@ -9948,7 +9947,7 @@ TclNRCoroutineActivateCallback(
corPtr->yieldPtr = NULL;
corPtr->stackLevel = NULL;
- int numLevels = iPtr->numLevels;
+ Tcl_Size numLevels = iPtr->numLevels;
iPtr->numLevels = corPtr->auxNumLevels;
corPtr->auxNumLevels = numLevels - corPtr->auxNumLevels;
@@ -9975,7 +9974,7 @@ TclNREvalList(
Tcl_Interp *interp,
TCL_UNUSED(int) /*result*/)
{
- int objc;
+ Tcl_Size objc;
Tcl_Obj **objv;
Tcl_Obj *listPtr = (Tcl_Obj *)data[0];
@@ -10191,7 +10190,7 @@ TclNRCoroProbeObjCmd(
*/
corPtr->stackLevel = &corPtr;
- int numLevels = corPtr->auxNumLevels;
+ Tcl_Size numLevels = corPtr->auxNumLevels;
corPtr->auxNumLevels = iPtr->numLevels;
/*
@@ -10235,30 +10234,31 @@ InjectHandler(
{
CoroutineData *corPtr = (CoroutineData *)data[0];
Tcl_Obj *listPtr = (Tcl_Obj *)data[1];
- int nargs = PTR2INT(data[2]);
+ Tcl_Size nargs = PTR2INT(data[2]);
void *isProbe = data[3];
- int objc;
+ Tcl_Size objc;
Tcl_Obj **objv;
if (!isProbe) {
- /*
- * If this is [coroinject], add the extra arguments now.
- */
-
- if (nargs == COROUTINE_ARGUMENTS_SINGLE_OPTIONAL) {
- Tcl_ListObjAppendElement(NULL, listPtr,
- Tcl_NewStringObj("yield", -1));
- } else if (nargs == COROUTINE_ARGUMENTS_ARBITRARY) {
- Tcl_ListObjAppendElement(NULL, listPtr,
- Tcl_NewStringObj("yieldto", -1));
- } else {
- /*
- * I don't think this is reachable...
- */
+ /*
+ * If this is [coroinject], add the extra arguments now.
+ */
- Tcl_ListObjAppendElement(NULL, listPtr, Tcl_NewWideIntObj(nargs));
- }
- Tcl_ListObjAppendElement(NULL, listPtr, Tcl_GetObjResult(interp));
+ if (nargs == COROUTINE_ARGUMENTS_SINGLE_OPTIONAL) {
+ Tcl_ListObjAppendElement(NULL, listPtr,
+ Tcl_NewStringObj("yield", TCL_INDEX_NONE));
+ } else if (nargs == COROUTINE_ARGUMENTS_ARBITRARY) {
+ Tcl_ListObjAppendElement(NULL, listPtr,
+ Tcl_NewStringObj("yieldto", TCL_INDEX_NONE));
+ } else {
+ /*
+ * I don't think this is reachable...
+ */
+ Tcl_Obj *nargsObj;
+ TclNewIndexObj(nargsObj, nargs);
+ Tcl_ListObjAppendElement(NULL, listPtr, nargsObj);
+ }
+ Tcl_ListObjAppendElement(NULL, listPtr, Tcl_GetObjResult(interp));
}
/*
@@ -10281,7 +10281,7 @@ InjectHandlerPostCall(
{
CoroutineData *corPtr = (CoroutineData *)data[0];
Tcl_Obj *listPtr = (Tcl_Obj *)data[1];
- int nargs = PTR2INT(data[2]);
+ Tcl_Size nargs = PTR2INT(data[2]);
void *isProbe = data[3];
/*
@@ -10304,7 +10304,7 @@ InjectHandlerPostCall(
}
corPtr->nargs = nargs;
corPtr->stackLevel = NULL;
- int numLevels = iPtr->numLevels;
+ Tcl_Size numLevels = iPtr->numLevels;
iPtr->numLevels = corPtr->auxNumLevels;
corPtr->auxNumLevels = numLevels - corPtr->auxNumLevels;
iPtr->execEnvPtr = corPtr->callerEEPtr;
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c
index 2a33398..b946a84 100644
--- a/generic/tclEnsemble.c
+++ b/generic/tclEnsemble.c
@@ -105,7 +105,7 @@ static const Tcl_ObjType ensembleCmdType = {
*/
typedef struct {
- int epoch; /* Used to confirm when the data in this
+ Tcl_Size epoch; /* Used to confirm when the data in this
* really structure matches up with the
* ensemble. */
Command *token; /* Reference to the command for which this
@@ -188,7 +188,7 @@ TclNamespaceEnsembleCmd(
switch ((enum EnsSubcmds) index) {
case ENS_CREATE: {
const char *name;
- int len;
+ Tcl_Size len;
int allocatedMapFlag = 0;
/*
* Defaults
@@ -500,7 +500,7 @@ TclNamespaceEnsembleCmd(
Tcl_SetObjResult(interp, resultObj);
} else {
- int len;
+ Tcl_Size len;
int allocatedMapFlag = 0;
Tcl_Obj *subcmdObj = NULL, *mapObj = NULL, *paramObj = NULL,
*unknownObj = NULL; /* Defaults, silence gcc 4 warnings */
@@ -799,7 +799,7 @@ Tcl_SetEnsembleSubcommandList(
return TCL_ERROR;
}
if (subcmdList != NULL) {
- int length;
+ Tcl_Size length;
if (TclListObjLengthM(interp, subcmdList, &length) != TCL_OK) {
return TCL_ERROR;
@@ -866,7 +866,7 @@ Tcl_SetEnsembleParameterList(
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
Tcl_Obj *oldList;
- int length;
+ Tcl_Size length;
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -951,7 +951,7 @@ Tcl_SetEnsembleMappingDict(
return TCL_ERROR;
}
if (mapDict != NULL) {
- int size;
+ Tcl_Size size;
int done;
Tcl_DictSearch search;
Tcl_Obj *valuePtr;
@@ -1051,7 +1051,7 @@ Tcl_SetEnsembleUnknownHandler(
return TCL_ERROR;
}
if (unknownList != NULL) {
- int length;
+ Tcl_Size length;
if (TclListObjLengthM(interp, unknownList, &length) != TCL_OK) {
return TCL_ERROR;
@@ -1535,7 +1535,7 @@ TclMakeEnsemble(
Tcl_DString buf, hiddenBuf;
const char **nameParts = NULL;
const char *cmdName = NULL;
- int i, nameCount = 0;
+ Tcl_Size i, nameCount = 0;
int ensembleFlags = 0, hiddenLen;
/*
@@ -1637,7 +1637,7 @@ TclMakeEnsemble(
Tcl_DStringSetLength(&hiddenBuf, hiddenLen);
if (Tcl_HideCommand(interp, "___tmp",
Tcl_DStringAppend(&hiddenBuf, map[i].name, -1))) {
- Tcl_Panic("%s", Tcl_GetString(Tcl_GetObjResult(interp)));
+ Tcl_Panic("%s", Tcl_GetStringResult(interp));
}
} else {
/*
@@ -1714,7 +1714,7 @@ NsEnsembleImplementationCmdNR(
int reparseCount = 0; /* Number of reparses. */
Tcl_Obj *errorObj; /* Used for building error messages. */
Tcl_Obj *subObj;
- int subIdx;
+ Tcl_Size subIdx;
/*
* Must recheck objc since numParameters might have changed. See test
@@ -1817,8 +1817,8 @@ NsEnsembleImplementationCmdNR(
* it (a non-unique prefix produces an error).
*/
char *fullName = NULL; /* Full name of the subcommand. */
- int stringLength, i;
- int tableLength = ensemblePtr->subcommandTable.numEntries;
+ Tcl_Size stringLength, i;
+ Tcl_Size tableLength = ensemblePtr->subcommandTable.numEntries;
Tcl_Obj *fix;
subcmdName = TclGetStringFromObj(subObj, &stringLength);
@@ -1895,7 +1895,7 @@ NsEnsembleImplementationCmdNR(
Tcl_Obj *copyPtr; /* The list of words to dispatch on.
* Will be freed by the dispatch engine. */
Tcl_Obj **copyObjv;
- int copyObjc, prefixObjc;
+ Tcl_Size copyObjc, prefixObjc;
TclListObjLengthM(NULL, prefixObj, &prefixObjc);
@@ -1978,7 +1978,7 @@ NsEnsembleImplementationCmdNR(
if (ensemblePtr->subcommandTable.numEntries == 1) {
Tcl_AppendToObj(errorObj, ensemblePtr->subcommandArrayPtr[0], -1);
} else {
- int i;
+ Tcl_Size i;
for (i=0 ; i<ensemblePtr->subcommandTable.numEntries-1 ; i++) {
Tcl_AppendToObj(errorObj, ensemblePtr->subcommandArrayPtr[i], -1);
@@ -2023,8 +2023,8 @@ TclClearRootEnsemble(
int
TclInitRewriteEnsemble(
Tcl_Interp *interp,
- int numRemoved,
- int numInserted,
+ Tcl_Size numRemoved,
+ Tcl_Size numInserted,
Tcl_Obj *const *objv)
{
Interp *iPtr = (Interp *) interp;
@@ -2036,7 +2036,7 @@ TclInitRewriteEnsemble(
iPtr->ensembleRewrite.numRemovedObjs = numRemoved;
iPtr->ensembleRewrite.numInsertedObjs = numInserted;
} else {
- int numIns = iPtr->ensembleRewrite.numInsertedObjs;
+ Tcl_Size numIns = iPtr->ensembleRewrite.numInsertedObjs;
if (numIns < numRemoved) {
iPtr->ensembleRewrite.numRemovedObjs += numRemoved - numIns;
@@ -2115,16 +2115,16 @@ void
TclSpellFix(
Tcl_Interp *interp,
Tcl_Obj *const *objv,
- int objc,
- int badIdx,
+ Tcl_Size objc,
+ Tcl_Size badIdx,
Tcl_Obj *bad,
Tcl_Obj *fix)
{
Interp *iPtr = (Interp *) interp;
Tcl_Obj *const *search;
Tcl_Obj **store;
- int idx;
- int size;
+ Tcl_Size idx;
+ Tcl_Size size;
if (iPtr->ensembleRewrite.sourceObjs == NULL) {
iPtr->ensembleRewrite.sourceObjs = objv;
@@ -2240,8 +2240,8 @@ Tcl_Obj *const *
TclFetchEnsembleRoot(
Tcl_Interp *interp,
Tcl_Obj *const *objv,
- int objc,
- int *objcPtr)
+ Tcl_Size objc,
+ Tcl_Size *objcPtr)
{
Tcl_Obj *const *sourceObjs;
Interp *iPtr = (Interp *) interp;
@@ -2291,8 +2291,9 @@ EnsembleUnknownCallback(
Tcl_Obj *const objv[],
Tcl_Obj **prefixObjPtr)
{
- int paramc, i, prefixObjc;
+ Tcl_Size paramc;
int result;
+ Tcl_Size i, prefixObjc;
Tcl_Obj **paramv, *unknownCmd, *ensObj;
/*
@@ -2580,7 +2581,7 @@ BuildEnsembleConfig(
{
Tcl_HashSearch search; /* Used for scanning the commands in
* the namespace for this ensemble. */
- int i, j;
+ Tcl_Size i, j;
int isNew;
Tcl_HashTable *hash = &ensemblePtr->subcommandTable;
Tcl_HashEntry *hPtr;
@@ -2591,7 +2592,7 @@ BuildEnsembleConfig(
Tcl_InitHashTable(hash, TCL_STRING_KEYS);
if (subList) {
- int subc;
+ Tcl_Size subc;
Tcl_Obj **subv, *target, *cmdObj, *cmdPrefixObj;
const char *name;
@@ -2738,7 +2739,7 @@ BuildEnsembleConfig(
}
/*
- * Create a sorted array of all subcommands in the ensemble; hash tables
+ * Create a sorted array of all subcommands in the ensemble. Hash tables
* are all very well for a quick look for an exact match, but they can't
* determine things like whether a string is a prefix of another, at least
* not without a lot of preparation, and they're not useful for generating
@@ -2923,7 +2924,7 @@ TclCompileEnsemble(
Command *oldCmdPtr = cmdPtr, *newCmdPtr;
int result, flags = 0, depth = 1, invokeAnyway = 0;
int ourResult = TCL_ERROR;
- int i, len;
+ Tcl_Size i, len;
TCL_HASH_TYPE numBytes;
const char *word;
@@ -2994,7 +2995,7 @@ TclCompileEnsemble(
(void) Tcl_GetEnsembleSubcommandList(NULL, ensemble, &listObj);
if (listObj != NULL) {
- int sclen;
+ Tcl_Size sclen;
const char *str;
Tcl_Obj *matchObj = NULL;
@@ -3251,20 +3252,20 @@ int
TclAttemptCompileProc(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
- int depth,
+ Tcl_Size depth,
Command *cmdPtr,
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation;
int result;
- int i;
+ Tcl_Size i;
Tcl_Token *saveTokenPtr = parsePtr->tokenPtr;
- int savedStackDepth = envPtr->currStackDepth;
+ Tcl_Size savedStackDepth = envPtr->currStackDepth;
TCL_HASH_TYPE savedCodeNext = envPtr->codeNext - envPtr->codeStart;
- int savedAuxDataArrayNext = envPtr->auxDataArrayNext;
- int savedExceptArrayNext = envPtr->exceptArrayNext;
+ Tcl_Size savedAuxDataArrayNext = envPtr->auxDataArrayNext;
+ Tcl_Size savedExceptArrayNext = envPtr->exceptArrayNext;
#ifdef TCL_COMPILE_DEBUG
- int savedExceptDepth = envPtr->exceptDepth;
+ Tcl_Size savedExceptDepth = envPtr->exceptDepth;
#endif
if (cmdPtr->compileProc == NULL) {
@@ -3394,7 +3395,7 @@ CompileToInvokedCommand(
Tcl_Obj *objPtr, **words;
const char *bytes;
int cmdLit, extraLiteralFlags = LITERAL_CMD_NAME;
- int i, numWords, length;
+ Tcl_Size i, numWords, length;
/*
* Push the words of the command. Take care; the command words may be
diff --git a/generic/tclEvent.c b/generic/tclEvent.c
index 56004aa..41c8700 100644
--- a/generic/tclEvent.c
+++ b/generic/tclEvent.c
@@ -234,7 +234,8 @@ HandleBgErrors(
Tcl_Preserve(assocPtr);
Tcl_Preserve(interp);
while (assocPtr->firstBgPtr != NULL) {
- int code, prefixObjc;
+ int code;
+ Tcl_Size prefixObjc;
Tcl_Obj **prefixObjv, **tempObjv;
/*
@@ -488,7 +489,7 @@ TclDefaultBgErrorHandlerObjCmd(
} else {
Tcl_DiscardInterpState(saved);
Tcl_WriteChars(errChannel,
- "bgerror failed to handle background error.\n",-1);
+ "bgerror failed to handle background error.\n", -1);
Tcl_WriteChars(errChannel, " Original error: ", -1);
Tcl_WriteObj(errChannel, tempObjv[1]);
Tcl_WriteChars(errChannel, "\n", -1);
@@ -1956,10 +1957,10 @@ Tcl_UpdateObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int optionIndex;
int flags = 0; /* Initialized to avoid compiler warning. */
static const char *const updateOptions[] = {"idletasks", NULL};
enum updateOptionsEnum {OPT_IDLETASKS};
+ int optionIndex;
if (objc == 1) {
flags = TCL_ALL_EVENTS|TCL_DONT_WAIT;
@@ -2058,8 +2059,8 @@ int
Tcl_CreateThread(
Tcl_ThreadId *idPtr, /* Return, the ID of the thread */
Tcl_ThreadCreateProc *proc, /* Main() function of the thread */
- void *clientData, /* The one argument to Main() */
- int stackSize, /* Size of stack for the new thread */
+ void *clientData, /* The one argument to Main() */
+ Tcl_Size stackSize, /* Size of stack for the new thread */
int flags) /* Flags controlling behaviour of the new
* thread. */
{
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 422eb19..31926a9 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -7866,8 +7866,8 @@ TEBCresume(
while (auxObjList) {
if ((catchTop != initCatchTop)
- && (PTR2UINT(*catchTop) >
- PTR2UINT(auxObjList->internalRep.twoPtrValue.ptr2))) {
+ && (PTR2INT(*catchTop) >
+ PTR2INT(auxObjList->internalRep.twoPtrValue.ptr2))) {
break;
}
POP_TAUX_OBJ();
@@ -7948,10 +7948,10 @@ TEBCresume(
}
#ifdef TCL_COMPILE_DEBUG
if (traceInstructions) {
- fprintf(stdout, " ... found catch at %d, catchTop=%" TCL_Z_MODIFIER "u, "
- "unwound to %" TCL_Z_MODIFIER "u, new pc %" TCL_Z_MODIFIER "u\n",
- rangePtr->codeOffset, (size_t)(catchTop - initCatchTop - 1),
- PTR2UINT(*catchTop), (size_t)rangePtr->catchOffset);
+ fprintf(stdout, " ... found catch at %d, catchTop=%" TCL_T_MODIFIER "d, "
+ "unwound to %" TCL_T_MODIFIER "d, new pc %" TCL_T_MODIFIER "d\n",
+ rangePtr->codeOffset, (catchTop - initCatchTop - 1),
+ PTR2INT(*catchTop), rangePtr->catchOffset);
}
#endif
pc = (codePtr->codeStart + rangePtr->catchOffset);
diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c
index 51fa94d..93442a1 100644
--- a/generic/tclIOGT.c
+++ b/generic/tclIOGT.c
@@ -266,7 +266,7 @@ TclChannelTransform(
Channel *chanPtr; /* The actual channel. */
ChannelState *statePtr; /* State info for channel. */
int mode; /* Read/write mode of the channel. */
- int objc;
+ Tcl_Size objc;
TransformChannelData *dataPtr;
Tcl_DString ds;
@@ -383,7 +383,7 @@ ExecuteCallback(
* interpreters. */
{
Tcl_Obj *resObj; /* See below, switch (transmit). */
- int resLen;
+ Tcl_Size resLen;
unsigned char *resBuf;
Tcl_InterpState state = NULL;
int res = TCL_OK;
diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c
index 29f47ba..ccb61fc 100644
--- a/generic/tclIORChan.c
+++ b/generic/tclIORChan.c
@@ -274,13 +274,13 @@ typedef struct {
struct ForwardParamInput {
ForwardParamBase base; /* "Supertype". MUST COME FIRST. */
char *buf; /* O: Where to store the read bytes */
- int toRead; /* I: #bytes to read,
+ Tcl_Size toRead; /* I: #bytes to read,
* O: #bytes actually read */
};
struct ForwardParamOutput {
ForwardParamBase base; /* "Supertype". MUST COME FIRST. */
const char *buf; /* I: Where the bytes to write come from */
- int toWrite; /* I: #bytes to write,
+ Tcl_Size toWrite; /* I: #bytes to write,
* O: #bytes actually written */
};
struct ForwardParamSeek {
@@ -520,7 +520,7 @@ TclChanCreateObjCmd(
Tcl_Obj *cmdNameObj; /* Command name */
Tcl_Channel chan; /* Token for the new channel */
Tcl_Obj *modeObj; /* mode in obj form for method call */
- int listc; /* Result of 'initialize', and of */
+ Tcl_Size listc; /* Result of 'initialize', and of */
Tcl_Obj **listv; /* its sublist in the 2nd element */
int methIndex; /* Encoded method name */
int result; /* Result code for 'initialize' */
@@ -1062,10 +1062,10 @@ UnmarshallErrorResult(
Tcl_Interp *interp,
Tcl_Obj *msgObj)
{
- int lc;
+ Tcl_Size lc;
Tcl_Obj **lv;
int explicitResult;
- int numOptions;
+ Tcl_Size numOptions;
/*
* Process the caught message.
@@ -1341,7 +1341,7 @@ ReflectInput(
{
ReflectedChannel *rcPtr = (ReflectedChannel *)clientData;
Tcl_Obj *toReadObj;
- int bytec; /* Number of returned bytes */
+ Tcl_Size bytec; /* Number of returned bytes */
unsigned char *bytev; /* Array of returned bytes */
Tcl_Obj *resObj; /* Result data for 'read' */
@@ -1369,7 +1369,7 @@ ReflectInput(
PassReceivedError(rcPtr->chan, &p);
*errorCodePtr = EINVAL;
}
- p.input.toRead = -1;
+ p.input.toRead = TCL_INDEX_NONE;
} else {
*errorCodePtr = EOK;
}
@@ -1944,7 +1944,8 @@ ReflectGetOption(
ReflectedChannel *rcPtr = (ReflectedChannel *)clientData;
Tcl_Obj *optionObj;
Tcl_Obj *resObj; /* Result data for 'configure' */
- int listc, result = TCL_OK;
+ Tcl_Size listc;
+ int result = TCL_OK;
Tcl_Obj **listv;
MethodName method;
@@ -2037,11 +2038,11 @@ ReflectGetOption(
Tcl_ResetResult(interp);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"Expected list with even number of "
- "elements, got %d element%s instead", listc,
+ "elements, got %" TCL_SIZE_MODIFIER "d element%s instead", listc,
(listc == 1 ? "" : "s")));
goto error;
} else {
- int len;
+ Tcl_Size len;
const char *str = TclGetStringFromObj(resObj, &len);
if (len) {
@@ -2166,7 +2167,7 @@ EncodeEventMask(
int *mask)
{
int events; /* Mask of events to post */
- int listc; /* #elements in eventspec list */
+ Tcl_Size listc; /* #elements in eventspec list */
Tcl_Obj **listv; /* Elements of eventspec list */
int evIndex; /* Id of event for an element of the eventspec
* list. */
@@ -2477,7 +2478,7 @@ InvokeTclMethod(
*/
if (result != TCL_ERROR) {
- int cmdLen;
+ Tcl_Size cmdLen;
const char *cmdString = TclGetStringFromObj(cmd, &cmdLen);
Tcl_IncrRefCount(cmd);
@@ -3150,14 +3151,14 @@ ForwardProc(
* Process a regular result.
*/
- int bytec; /* Number of returned bytes */
+ Tcl_Size bytec; /* Number of returned bytes */
unsigned char *bytev; /* Array of returned bytes */
bytev = Tcl_GetByteArrayFromObj(resObj, &bytec);
if (paramPtr->input.toRead < bytec) {
ForwardSetStaticError(paramPtr, msg_read_toomuch);
- paramPtr->input.toRead = -1;
+ paramPtr->input.toRead = TCL_IO_FAILURE;
} else {
if (bytec > 0) {
memcpy(paramPtr->input.buf, bytev, bytec);
@@ -3329,7 +3330,7 @@ ForwardProc(
* NOTE (4) as well.
*/
- int listc;
+ Tcl_Size listc;
Tcl_Obj **listv;
if (TclListObjGetElementsM(interp, resObj, &listc,
@@ -3349,7 +3350,7 @@ ForwardProc(
ForwardSetDynamicError(paramPtr, buf);
} else {
- int len;
+ Tcl_Size len;
const char *str = TclGetStringFromObj(resObj, &len);
if (len) {
@@ -3461,7 +3462,7 @@ ForwardSetObjError(
ForwardParam *paramPtr,
Tcl_Obj *obj)
{
- int len;
+ Tcl_Size len;
const char *msgStr = TclGetStringFromObj(obj, &len);
len++;
diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c
index bac7c15..77d6163 100644
--- a/generic/tclOODefineCmds.c
+++ b/generic/tclOODefineCmds.c
@@ -3109,11 +3109,12 @@ ResolveClass(
static void
InstallReadableProps(
PropertyStorage *props,
- int objc,
+ Tcl_Size objc,
Tcl_Obj *const objv[])
{
Tcl_Obj *propObj;
- int i, n, created;
+ Tcl_Size i, n;
+ int created;
Tcl_HashTable uniqueTable;
if (props->allReadableCache) {
@@ -3205,7 +3206,7 @@ ClassRPropsSet(
Tcl_Obj *const *objv)
{
Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp);
- int varc;
+ Tcl_Size varc;
Tcl_Obj **varv;
if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) {
@@ -3270,7 +3271,7 @@ ObjRPropsSet(
Tcl_Obj *const *objv)
{
Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp);
- int varc;
+ Tcl_Size varc;
Tcl_Obj **varv;
if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) {
@@ -3305,11 +3306,12 @@ ObjRPropsSet(
static void
InstallWritableProps(
PropertyStorage *props,
- int objc,
+ Tcl_Size objc,
Tcl_Obj *const objv[])
{
Tcl_Obj *propObj;
- int i, n, created;
+ Tcl_Size i, n;
+ int created;
Tcl_HashTable uniqueTable;
if (props->allWritableCache) {
@@ -3401,7 +3403,7 @@ ClassWPropsSet(
Tcl_Obj *const *objv)
{
Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp);
- int varc;
+ Tcl_Size varc;
Tcl_Obj **varv;
if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) {
@@ -3466,7 +3468,7 @@ ObjWPropsSet(
Tcl_Obj *const *objv)
{
Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp);
- int varc;
+ Tcl_Size varc;
Tcl_Obj **varv;
if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) {
diff --git a/generic/tclOOInfo.c b/generic/tclOOInfo.c
index f7f5de1..b87877f 100644
--- a/generic/tclOOInfo.c
+++ b/generic/tclOOInfo.c
@@ -1889,7 +1889,7 @@ static void
SortPropList(
Tcl_Obj *list)
{
- int ec;
+ Tcl_Size ec;
Tcl_Obj **ev;
Tcl_ListObjGetElements(NULL, list, &ec, &ev);
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 8ff43f0..65430f9 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -266,7 +266,7 @@ static const Tcl_ObjType localVarNameType = {
const Tcl_ObjInternalRep *irPtr; \
irPtr = TclFetchInternalRep((objPtr), &localVarNameType); \
(name) = irPtr ? (Tcl_Obj *)irPtr->twoPtrValue.ptr1 : NULL; \
- (index) = irPtr ? PTR2INT(irPtr->twoPtrValue.ptr2) : -1; \
+ (index) = irPtr ? PTR2INT(irPtr->twoPtrValue.ptr2) : TCL_INDEX_NONE; \
} while (0)
static const Tcl_ObjType parsedVarNameType = {
@@ -605,7 +605,7 @@ TclObjLookupVarEx(
const char *errMsg = NULL;
int index, parsed = 0;
- int localIndex;
+ Tcl_Size localIndex;
Tcl_Obj *namePtr, *arrayPtr, *elem;
*arrayPtrPtr = NULL;
@@ -660,7 +660,7 @@ TclObjLookupVarEx(
* part1Ptr is possibly an unparsed array element.
*/
- int len;
+ Tcl_Size len;
const char *part1 = TclGetStringFromObj(part1Ptr, &len);
if ((len > 1) && (part1[len - 1] == ')')) {
@@ -842,7 +842,8 @@ TclLookupSimpleVar(
* the variable. */
Namespace *varNsPtr, *cxtNsPtr, *dummy1Ptr, *dummy2Ptr;
ResolverScheme *resPtr;
- int isNew, i, result, varLen;
+ int isNew, i, result;
+ Tcl_Size varLen;
const char *varName = TclGetStringFromObj(varNamePtr, &varLen);
varPtr = NULL;
@@ -976,7 +977,7 @@ TclLookupSimpleVar(
if (localCt > 0) {
Tcl_Obj **objPtrPtr = &varFramePtr->localCachePtr->varName0;
const char *localNameStr;
- int localLen;
+ Tcl_Size localLen;
for (i=0 ; i<localCt ; i++, objPtrPtr++) {
Tcl_Obj *objPtr = *objPtrPtr;
@@ -2954,9 +2955,9 @@ Tcl_LappendObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *varValuePtr, *newValuePtr;
- int numElems, createdNewObj;
+ Tcl_Size numElems;
Var *varPtr, *arrayPtr;
- int result;
+ int result, createdNewObj;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "varName ?value ...?");
@@ -3172,7 +3173,8 @@ ArrayForNRCmd(
Tcl_Obj *varListObj, *arrayNameObj, *scriptObj;
ArraySearch *searchPtr = NULL;
Var *varPtr;
- int isArray, numVars;
+ int isArray;
+ Tcl_Size numVars;
/*
* array for {k v} a body
@@ -3248,7 +3250,8 @@ ArrayForLoopCallback(
Tcl_Obj *keyObj, *valueObj;
Var *varPtr;
Var *arrayPtr;
- int done, varc;
+ int done;
+ Tcl_Size varc;
/*
* Process the result from the previous execution of the script body.
@@ -3756,7 +3759,8 @@ ArrayGetCmd(
Tcl_Obj **nameObjPtr, *patternObj;
Tcl_HashSearch search;
const char *pattern;
- int i, count, result, isArray;
+ Tcl_Size i, count;
+ int result, isArray;
switch (objc) {
case 2:
@@ -4080,7 +4084,7 @@ ArraySetCmd(
Tcl_Obj *arrayNameObj;
Tcl_Obj *arrayElemObj;
Var *varPtr, *arrayPtr;
- int result, i;
+ int result;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "arrayName list");
@@ -4158,8 +4162,9 @@ ArraySetCmd(
* -compatibility reasons) a list.
*/
- int elemLen;
+ Tcl_Size elemLen;
Tcl_Obj **elemPtrs, *copyListObj;
+ Tcl_Size i;
result = TclListObjLengthM(interp, arrayElemObj, &elemLen);
if (result != TCL_OK) {
@@ -4961,7 +4966,7 @@ Tcl_GetVariableFullName(
Tcl_AppendObjToObj(objPtr, namePtr);
}
} else if (iPtr->varFramePtr->procPtr) {
- int index = varPtr - iPtr->varFramePtr->compiledLocals;
+ Tcl_Size index = varPtr - iPtr->varFramePtr->compiledLocals;
if (index >= 0 && index < iPtr->varFramePtr->numCompiledLocals) {
namePtr = localName(iPtr->varFramePtr, index);
@@ -5587,7 +5592,7 @@ TclDeleteCompiledLocalVars(
* assigned local variables to delete. */
{
Var *varPtr;
- int numLocals, i;
+ size_t numLocals, i;
Tcl_Obj **namePtrPtr;
numLocals = framePtr->numCompiledLocals;
@@ -5785,7 +5790,7 @@ static void
FreeLocalVarName(
Tcl_Obj *objPtr)
{
- int index;
+ Tcl_Size index;
Tcl_Obj *namePtr;
LocalGetInternalRep(objPtr, index, namePtr);
@@ -5801,7 +5806,7 @@ DupLocalVarName(
Tcl_Obj *srcPtr,
Tcl_Obj *dupPtr)
{
- int index;
+ Tcl_Size index;
Tcl_Obj *namePtr;
LocalGetInternalRep(srcPtr, index, namePtr);
@@ -6381,7 +6386,8 @@ AppendLocals(
{
Interp *iPtr = (Interp *) interp;
Var *varPtr;
- int i, localVarCt, added;
+ Tcl_Size i, localVarCt;
+ int added;
Tcl_Obj *objNamePtr;
const char *varName;
TclVarHashTable *localVarTablePtr;
@@ -6577,13 +6583,13 @@ FreeVarEntry(
static int
CompareVarKeys(
- void *keyPtr, /* New key to compare. */
+ void *keyPtr, /* New key to compare. */
Tcl_HashEntry *hPtr) /* Existing key to compare. */
{
Tcl_Obj *objPtr1 = (Tcl_Obj *)keyPtr;
Tcl_Obj *objPtr2 = hPtr->key.objPtr;
const char *p1, *p2;
- int l1, l2;
+ Tcl_Size l1, l2;
/*
* If the object pointers are the same then they match.
@@ -6597,10 +6603,8 @@ CompareVarKeys(
* register.
*/
- p1 = TclGetString(objPtr1);
- l1 = objPtr1->length;
- p2 = TclGetString(objPtr2);
- l2 = objPtr2->length;
+ p1 = TclGetStringFromObj(objPtr1, &l1);
+ p2 = TclGetStringFromObj(objPtr2, &l2);
/*
* Only compare string representations of the same length.