summaryrefslogtreecommitdiffstats
path: root/generic/tclInt.h
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclInt.h')
-rw-r--r--generic/tclInt.h88
1 files changed, 41 insertions, 47 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h
index b1bb0e6..6dac3ca 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -495,7 +495,7 @@ typedef struct EnsembleConfig {
* core, presumably because the ensemble
* itself has been updated. */
Tcl_Obj *parameterList; /* List of ensemble parameter names. */
- int numParameters; /* Cached number of parameters. This is either
+ size_t numParameters; /* Cached number of parameters. This is either
* 0 (if the parameterList field is NULL) or
* the length of the list in the parameterList
* field. */
@@ -929,12 +929,11 @@ typedef struct CompiledLocal {
* local. */
size_t nameLength; /* The number of bytes in local variable's name.
* Among others used to speed up var lookups. */
- int frameIndex; /* Index in the array of compiler-assigned
+ size_t frameIndex; /* Index in the array of compiler-assigned
* variables in the procedure call frame. */
- int flags; /* Flag bits for the local variable. Same as
- * the flags for the Var structure above,
- * although only VAR_ARGUMENT, VAR_TEMPORARY,
- * and VAR_RESOLVED make sense. */
+#if TCL_UTF_MAX < 9
+ int flags;
+#endif
Tcl_Obj *defValuePtr; /* Pointer to the default value of an
* argument, if any. NULL if not an argument
* or, if an argument, no default value. */
@@ -945,6 +944,12 @@ typedef struct CompiledLocal {
* is marked by a unique tag during
* compilation, and that same tag is used to
* find the variable at runtime. */
+#if TCL_UTF_MAX > 8
+ int flags; /* Flag bits for the local variable. Same as
+ * the flags for the Var structure above,
+ * although only VAR_ARGUMENT, VAR_TEMPORARY,
+ * and VAR_RESOLVED make sense. */
+#endif
char name[TCLFLEXARRAY]; /* Name of the local variable starts here. If
* the name is NULL, this will just be '\0'.
* The actual size of this field will be large
@@ -972,8 +977,8 @@ typedef struct Proc {
* procedure. */
Tcl_Obj *bodyPtr; /* Points to the ByteCode object for
* procedure's body command. */
- int numArgs; /* Number of formal parameters. */
- int numCompiledLocals; /* Count of local variables recognized by the
+ size_t numArgs; /* Number of formal parameters. */
+ size_t numCompiledLocals; /* Count of local variables recognized by the
* compiler including arguments and
* temporaries. */
CompiledLocal *firstLocalPtr;
@@ -1079,7 +1084,7 @@ typedef struct AssocData {
typedef struct LocalCache {
size_t refCount;
- int numVars;
+ size_t numVars;
Tcl_Obj *varName0;
} LocalCache;
@@ -1099,7 +1104,7 @@ typedef struct CallFrame {
* If FRAME_IS_PROC is set, the frame was
* pushed to execute a Tcl procedure and may
* have local vars. */
- int objc; /* This and objv below describe the arguments
+ size_t objc; /* This and objv below describe the arguments
* for this procedure call. */
Tcl_Obj *const *objv; /* Array of argument objects. */
struct CallFrame *callerPtr;
@@ -1113,7 +1118,7 @@ typedef struct CallFrame {
* callerPtr unless an "uplevel" command or
* something equivalent was active in the
* caller). */
- int level; /* Level of this procedure, for "uplevel"
+ size_t level; /* Level of this procedure, for "uplevel"
* purposes (i.e. corresponds to nesting of
* callerVarPtr's, not callerPtr's). 1 for
* outermost procedure, 0 for top-level. */
@@ -1127,8 +1132,8 @@ typedef struct CallFrame {
* recognized by the compiler, or created at
* execution time through, e.g., upvar.
* Initially NULL and created if needed. */
- int numCompiledLocals; /* Count of local variables recognized by the
- * compiler including arguments. */
+ size_t numCompiledLocals; /* Count of local variables recognized
+ * by the compiler including arguments. */
Var *compiledLocals; /* Points to the array of local variables
* recognized by the compiler. The compiler
* emits code that refers to these variables
@@ -1189,7 +1194,7 @@ typedef struct CmdFrame {
int level; /* Number of frames in stack, prevent O(n)
* scan of list. */
int *line; /* Lines the words of the command start on. */
- int nline;
+ size_t nline;
CallFrame *framePtr; /* Procedure activation record, may be
* NULL. */
struct CmdFrame *nextPtr; /* Link to calling frame. */
@@ -1243,7 +1248,7 @@ typedef struct CmdFrame {
typedef struct CFWord {
CmdFrame *framePtr; /* CmdFrame to access. */
- int word; /* Index of the word in the command. */
+ size_t word; /* Index of the word in the command. */
size_t refCount; /* Number of times the word is on the
* stack. */
} CFWord;
@@ -1252,7 +1257,7 @@ typedef struct CFWordBC {
CmdFrame *framePtr; /* CmdFrame to access. */
size_t pc; /* Instruction pointer of a command in
* ExtCmdLoc.loc[.] */
- int word; /* Index of word in
+ size_t word; /* Index of word in
* ExtCmdLoc.loc[cmd]->line[.] */
struct CFWordBC *prevPtr; /* Previous entry in stack for same Tcl_Obj. */
struct CFWordBC *nextPtr; /* Next entry for same command call. See
@@ -1281,7 +1286,7 @@ typedef struct CFWordBC {
#define CLL_END (-1)
typedef struct ContLineLoc {
- int num; /* Number of entries in loc, not counting the
+ size_t num; /* Number of entries in loc, not counting the
* final -1 marker entry. */
int loc[TCLFLEXARRAY];/* Table of locations, as character offsets.
* The table is allocated as part of the
@@ -1931,7 +1936,7 @@ typedef struct Interp {
/* First in list of active traces for interp,
* or NULL if no active traces. */
- int tracesForbiddingInline; /* Count of traces (in the list headed by
+ size_t tracesForbiddingInline; /* Count of traces (in the list headed by
* tracePtr) that forbid inline bytecode
* compilation. */
@@ -2370,8 +2375,8 @@ typedef enum TclEolTranslation {
typedef struct List {
size_t refCount;
- int maxElemCount; /* Total number of element array slots. */
- int elemCount; /* Current number of list elements. */
+ size_t maxElemCount; /* Total number of element array slots. */
+ size_t elemCount; /* Current number of list elements. */
int canonicalFlag; /* Set if the string representation was
* derived from the list representation. May
* be ignored if there is no string rep at
@@ -2775,7 +2780,7 @@ typedef struct ForIterData {
Tcl_Obj *body; /* Loop body. */
Tcl_Obj *next; /* Loop step script, NULL for 'while'. */
const char *msg; /* Error message part. */
- int word; /* Index of the body script in the command */
+ size_t word; /* Index of the body script in the command */
} ForIterData;
/* TIP #357 - Structure doing the bookkeeping of handles for Tcl_LoadFile
@@ -2857,7 +2862,7 @@ MODULE_SCOPE Tcl_ObjCmdProc TclChannelNamesCmd;
MODULE_SCOPE Tcl_NRPostProc TclClearRootEnsemble;
MODULE_SCOPE int TclCompareTwoNumbers(Tcl_Obj *valuePtr,
Tcl_Obj *value2Ptr);
-MODULE_SCOPE ContLineLoc *TclContinuationsEnter(Tcl_Obj *objPtr, int num,
+MODULE_SCOPE ContLineLoc *TclContinuationsEnter(Tcl_Obj *objPtr, size_t num,
int *loc);
MODULE_SCOPE void TclContinuationsEnterDerived(Tcl_Obj *objPtr,
int start, int *clNext);
@@ -2876,7 +2881,7 @@ MODULE_SCOPE Tcl_Command TclCreateEnsembleInNs(Tcl_Interp *interp,
MODULE_SCOPE void TclDeleteNamespaceVars(Namespace *nsPtr);
MODULE_SCOPE void TclDeleteNamespaceChildren(Namespace *nsPtr);
MODULE_SCOPE int TclFindDictElement(Tcl_Interp *interp,
- const char *dict, int dictLength,
+ const char *dict, size_t dictLength,
const char **elementPtr, const char **nextPtr,
size_t *sizePtr, int *literalPtr);
/* TIP #280 - Modified token based evaluation, with line information. */
@@ -2902,7 +2907,7 @@ MODULE_SCOPE char * TclDStringAppendDString(Tcl_DString *dsPtr,
Tcl_DString *toAppendPtr);
MODULE_SCOPE Tcl_Obj * TclDStringToObj(Tcl_DString *dsPtr);
MODULE_SCOPE Tcl_Obj *const *TclFetchEnsembleRoot(Tcl_Interp *interp,
- Tcl_Obj *const *objv, int objc, int *objcPtr);
+ Tcl_Obj *const *objv, size_t objc, size_t *objcPtr);
MODULE_SCOPE Tcl_Obj *const *TclEnsembleGetRewriteValues(Tcl_Interp *interp);
MODULE_SCOPE Tcl_Namespace *TclEnsureNamespace(Tcl_Interp *interp,
Tcl_Namespace *namespacePtr);
@@ -2998,14 +3003,14 @@ MODULE_SCOPE void TclInitObjSubsystem(void);
MODULE_SCOPE int TclInterpReady(Tcl_Interp *interp);
MODULE_SCOPE int TclIsDigitProc(int byte);
MODULE_SCOPE int TclIsBareword(int byte);
-MODULE_SCOPE Tcl_Obj * TclJoinPath(int elements, Tcl_Obj * const objv[],
+MODULE_SCOPE Tcl_Obj * TclJoinPath(size_t elements, Tcl_Obj * const objv[],
int forceRelative);
MODULE_SCOPE int TclJoinThread(Tcl_ThreadId id, int *result);
MODULE_SCOPE void TclLimitRemoveAllHandlers(Tcl_Interp *interp);
MODULE_SCOPE Tcl_Obj * TclLindexList(Tcl_Interp *interp,
Tcl_Obj *listPtr, Tcl_Obj *argPtr);
MODULE_SCOPE Tcl_Obj * TclLindexFlat(Tcl_Interp *interp, Tcl_Obj *listPtr,
- int indexCount, Tcl_Obj *const indexArray[]);
+ size_t indexCount, Tcl_Obj *const indexArray[]);
/* TIP #280 */
MODULE_SCOPE void TclListLines(Tcl_Obj *listObj, int line, int n,
int *lines, Tcl_Obj *const *elems);
@@ -3015,7 +3020,7 @@ MODULE_SCOPE Tcl_Obj * TclListObjRange(Tcl_Obj *listPtr, size_t fromIdx,
MODULE_SCOPE Tcl_Obj * TclLsetList(Tcl_Interp *interp, Tcl_Obj *listPtr,
Tcl_Obj *indexPtr, Tcl_Obj *valuePtr);
MODULE_SCOPE Tcl_Obj * TclLsetFlat(Tcl_Interp *interp, Tcl_Obj *listPtr,
- int indexCount, Tcl_Obj *const indexArray[],
+ size_t indexCount, Tcl_Obj *const indexArray[],
Tcl_Obj *valuePtr);
MODULE_SCOPE Tcl_Command TclMakeEnsemble(Tcl_Interp *interp, const char *name,
const EnsembleImplMap map[]);
@@ -3091,9 +3096,9 @@ MODULE_SCOPE int TclpMatchFiles(Tcl_Interp *interp, char *separators,
MODULE_SCOPE int TclpObjNormalizePath(Tcl_Interp *interp,
Tcl_Obj *pathPtr, int nextCheckpoint);
MODULE_SCOPE void TclpNativeJoinPath(Tcl_Obj *prefix, const char *joining);
-MODULE_SCOPE Tcl_Obj * TclpNativeSplitPath(Tcl_Obj *pathPtr, int *lenPtr);
+MODULE_SCOPE Tcl_Obj * TclpNativeSplitPath(Tcl_Obj *pathPtr, size_t *lenPtr);
MODULE_SCOPE Tcl_PathType TclpGetNativePathType(Tcl_Obj *pathPtr,
- int *driveNameLengthPtr, Tcl_Obj **driveNameRef);
+ size_t *driveNameLengthPtr, Tcl_Obj **driveNameRef);
MODULE_SCOPE int TclCrossFilesystemCopy(Tcl_Interp *interp,
Tcl_Obj *source, Tcl_Obj *target);
MODULE_SCOPE int TclpMatchInDirectory(Tcl_Interp *interp,
@@ -3141,7 +3146,7 @@ MODULE_SCOPE void TclSetProcessGlobalValue(ProcessGlobalValue *pgvPtr,
Tcl_Obj *newValue, Tcl_Encoding encoding);
MODULE_SCOPE void TclSignalExitThread(Tcl_ThreadId id, int result);
MODULE_SCOPE void TclSpellFix(Tcl_Interp *interp,
- Tcl_Obj *const *objv, int objc, size_t subIdx,
+ Tcl_Obj *const *objv, size_t objc, size_t subIdx,
Tcl_Obj *bad, Tcl_Obj *fix);
MODULE_SCOPE void * TclStackRealloc(Tcl_Interp *interp, void *ptr,
size_t numBytes);
@@ -3158,13 +3163,13 @@ MODULE_SCOPE int TclStringMatchObj(Tcl_Obj *stringObj,
MODULE_SCOPE void TclSubstCompile(Tcl_Interp *interp, const char *bytes,
size_t numBytes, int flags, int line,
struct CompileEnv *envPtr);
-MODULE_SCOPE int TclSubstOptions(Tcl_Interp *interp, int numOpts,
+MODULE_SCOPE int TclSubstOptions(Tcl_Interp *interp, size_t numOpts,
Tcl_Obj *const opts[], int *flagPtr);
MODULE_SCOPE void TclSubstParse(Tcl_Interp *interp, const char *bytes,
size_t numBytes, int flags, Tcl_Parse *parsePtr,
Tcl_InterpState *statePtr);
MODULE_SCOPE int TclSubstTokens(Tcl_Interp *interp, Tcl_Token *tokenPtr,
- int count, int *tokensLeftPtr, int line,
+ size_t count, int *tokensLeftPtr, int line,
int *clNextOuter, const char *outerScript);
MODULE_SCOPE size_t TclTrim(const char *bytes, size_t numBytes,
const char *trim, size_t numTrim, size_t *trimRight);
@@ -3302,7 +3307,7 @@ MODULE_SCOPE int TclDictWithFinish(Tcl_Interp *interp, Var *varPtr,
Tcl_Obj *part2Ptr, int index, int pathc,
Tcl_Obj *const pathv[], Tcl_Obj *keysPtr);
MODULE_SCOPE Tcl_Obj * TclDictWithInit(Tcl_Interp *interp, Tcl_Obj *dictPtr,
- int pathc, Tcl_Obj *const pathv[]);
+ size_t pathc, Tcl_Obj *const pathv[]);
MODULE_SCOPE int Tcl_DisassembleObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
@@ -4570,31 +4575,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)); \
} \
@@ -4643,7 +4637,7 @@ MODULE_SCOPE const TclFileAttrProcs tclpFileAttrProcs[];
* of counting along a string of all one-byte characters. The ANSI C
* "prototype" for this macro is:
*
- * MODULE_SCOPE void TclNumUtfCharsM(int numChars, const char *bytes,
+ * MODULE_SCOPE void TclNumUtfCharsM(size_t numChars, const char *bytes,
* size_t numBytes);
*----------------------------------------------------------------
*/