diff options
Diffstat (limited to 'generic/tclInt.h')
| -rw-r--r-- | generic/tclInt.h | 2129 |
1 files changed, 834 insertions, 1295 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h index 39eec2e..18574c3 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -9,8 +9,6 @@ * Copyright (c) 1998-1999 by Scriptics Corporation. * Copyright (c) 2001, 2002 by Kevin B. Kenny. All rights reserved. * Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net> - * Copyright (c) 2006-2008 by Joe Mistachkin. All rights reserved. - * Copyright (c) 2008 by Miguel Sofer. All rights reserved. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -152,13 +150,13 @@ typedef struct Tcl_ResolvedVarInfo { } Tcl_ResolvedVarInfo; typedef int (Tcl_ResolveCompiledVarProc)(Tcl_Interp *interp, - const char *name, size_t length, Tcl_Namespace *context, + CONST84 char *name, int length, Tcl_Namespace *context, Tcl_ResolvedVarInfo **rPtr); -typedef int (Tcl_ResolveVarProc)(Tcl_Interp *interp, const char *name, +typedef int (Tcl_ResolveVarProc)(Tcl_Interp *interp, CONST84 char *name, Tcl_Namespace *context, int flags, Tcl_Var *rPtr); -typedef int (Tcl_ResolveCmdProc)(Tcl_Interp *interp, const char *name, +typedef int (Tcl_ResolveCmdProc)(Tcl_Interp *interp, CONST84 char *name, Tcl_Namespace *context, int flags, Tcl_Command *rPtr); typedef struct Tcl_ResolverInfo { @@ -202,14 +200,6 @@ typedef struct TclVarHashTable { #define TclVarHashFindVar(tablePtr, key) \ TclVarHashCreateVar((tablePtr), (key), NULL) -/* - * Define this to reduce the amount of space that the average namespace - * consumes by only allocating the table of child namespaces when necessary. - * Defining it breaks compatibility for Tcl extensions (e.g., itcl) which - * reach directly into the Namespace structure. - */ - -#undef BREAK_NAMESPACE_COMPAT /* * The structure below defines a namespace. @@ -233,15 +223,8 @@ typedef struct Namespace { struct Namespace *parentPtr;/* Points to the namespace that contains this * one. NULL if this is the global * namespace. */ -#ifndef BREAK_NAMESPACE_COMPAT Tcl_HashTable childTable; /* Contains any child namespaces. Indexed by * strings; values have type (Namespace *). */ -#else - Tcl_HashTable *childTablePtr; - /* Contains any child namespaces. Indexed by - * strings; values have type (Namespace *). If - * NULL, there are no children. */ -#endif long nsId; /* Unique id for the namespace. */ Tcl_Interp *interp; /* The interpreter containing this * namespace. */ @@ -319,19 +302,13 @@ typedef struct Namespace { Tcl_Obj *unknownHandlerPtr; /* A script fragment to be used when command * resolution in this namespace fails. TIP * 181. */ - size_t commandPathLength; /* The length of the explicit path. */ + int commandPathLength; /* The length of the explicit path. */ NamespacePathEntry *commandPathArray; /* The explicit path of the namespace as an * array. */ NamespacePathEntry *commandPathSourceList; /* Linked list of path entries that point to * this namespace. */ - Tcl_NamespaceDeleteProc *earlyDeleteProc; - /* Just like the deleteProc field (and called - * with the same clientData) but called at the - * start of the deletion process, so there is - * a chance for code to do stuff inside the - * namespace before deletion completes. */ } Namespace; /* @@ -370,17 +347,13 @@ struct NamespacePathEntry { * unit that refers to the namespace has been freed (i.e., when * the namespace's refCount is 0), the namespace's storage will * be freed. - * NS_KILLED - 1 means that TclTeardownNamespace has already been called on - * this namespace and it should not be called again [Bug 1355942] - * NS_SUPPRESS_COMPILATION - - * Marks the commands in this namespace for not being compiled, - * forcing them to be looked up every time. + * NS_KILLED 1 means that TclTeardownNamespace has already been called on + * this namespace and it should not be called again [Bug 1355942] */ #define NS_DYING 0x01 #define NS_DEAD 0x02 #define NS_KILLED 0x04 -#define NS_SUPPRESS_COMPILATION 0x08 /* * Flags passed to TclGetNamespaceForQualName: @@ -396,7 +369,7 @@ struct NamespacePathEntry { /* * The data cached in an ensemble subcommand's Tcl_Obj rep (reference in - * otherValuePtr field). This structure is not shared between Tcl_Objs + * twoPtrValue.ptr1 field). This structure is not shared between Tcl_Objs * referring to the same subcommand, even where one is a duplicate of another. */ @@ -416,91 +389,10 @@ typedef struct { } EnsembleCmdRep; /* - * The client data for an ensemble command. This consists of the table of - * commands that are actually exported by the namespace, and an epoch counter - * that, combined with the exportLookupEpoch field of the namespace structure, - * defines whether the table contains valid data or will need to be recomputed - * next time the ensemble command is called. - */ - -typedef struct EnsembleConfig { - Namespace *nsPtr; /* The namspace backing this ensemble up. */ - Tcl_Command token; /* The token for the command that provides - * ensemble support for the namespace, or NULL - * if the command has been deleted (or never - * existed; the global namespace never has an - * ensemble command.) */ - int epoch; /* The epoch at which this ensemble's table of - * exported commands is valid. */ - char **subcommandArrayPtr; /* Array of ensemble subcommand names. At all - * consistent points, this will have the same - * number of entries as there are entries in - * the subcommandTable hash. */ - Tcl_HashTable subcommandTable; - /* Hash table of ensemble subcommand names, - * which are its keys so this also provides - * the storage management for those subcommand - * names. The contents of the entry values are - * object version the prefix lists to use when - * substituting for the command/subcommand to - * build the ensemble implementation command. - * Has to be stored here as well as in - * subcommandDict because that field is NULL - * when we are deriving the ensemble from the - * namespace exports list. FUTURE WORK: use - * object hash table here. */ - struct EnsembleConfig *next;/* The next ensemble in the linked list of - * ensembles associated with a namespace. If - * this field points to this ensemble, the - * structure has already been unlinked from - * all lists, and cannot be found by scanning - * the list from the namespace's ensemble - * field. */ - int flags; /* ORed combo of TCL_ENSEMBLE_PREFIX, - * ENSEMBLE_DEAD and ENSEMBLE_COMPILE. */ - - /* OBJECT FIELDS FOR ENSEMBLE CONFIGURATION */ - - Tcl_Obj *subcommandDict; /* Dictionary providing mapping from - * subcommands to their implementing command - * prefixes, or NULL if we are to build the - * map automatically from the namespace - * exports. */ - Tcl_Obj *subcmdList; /* List of commands that this ensemble - * actually provides, and whose implementation - * will be built using the subcommandDict (if - * present and defined) and by simple mapping - * to the namespace otherwise. If NULL, - * indicates that we are using the (dynamic) - * list of currently exported commands. */ - Tcl_Obj *unknownHandler; /* Script prefix used to handle the case when - * no match is found (according to the rule - * defined by flag bit TCL_ENSEMBLE_PREFIX) or - * NULL to use the default error-generating - * behaviour. The script execution gets all - * the arguments to the ensemble command - * (including objv[0]) and will have the - * results passed directly back to the caller - * (including the error code) unless the code - * is TCL_CONTINUE in which case the - * subcommand will be reparsed by the ensemble - * core, presumably because the ensemble - * itself has been updated. */ - Tcl_Obj *parameterList; /* List of ensemble parameter names. */ - 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. */ -} EnsembleConfig; - -/* - * Various bits for the EnsembleConfig.flags field. + * Flag to enable bytecode compilation of an ensemble. */ -#define ENSEMBLE_DEAD 0x1 /* Flag value to say that the ensemble is dead - * and on its way out. */ -#define ENSEMBLE_COMPILE 0x4 /* Flag to enable bytecode compilation of an - * ensemble. */ +#define ENSEMBLE_COMPILE 0x4 /* *---------------------------------------------------------------- @@ -589,30 +481,6 @@ typedef struct ActiveVarTrace { } ActiveVarTrace; /* - * The following structure describes an enumerative search in progress on an - * array variable; this are invoked with options to the "array" command. - */ - -typedef struct ArraySearch { - int id; /* Integer id used to distinguish among - * multiple concurrent searches for the same - * array. */ - struct Var *varPtr; /* Pointer to array variable that's being - * searched. */ - Tcl_HashSearch search; /* Info kept by the hash module about progress - * through the array. */ - Tcl_HashEntry *nextEntry; /* Non-null means this is the next element to - * be enumerated (it's leftover from the - * Tcl_FirstHashEntry call or from an "array - * anymore" command). NULL means must call - * Tcl_NextHashEntry to get value to - * return. */ - struct ArraySearch *nextPtr;/* Next in list of all active searches for - * this variable, or NULL if this is the last - * one. */ -} ArraySearch; - -/* * The structure below defines a variable, which associates a string name with * a Tcl_Obj value. These structures are kept in procedure call frames (for * local variables recognized by the compiler) or in the heap (for global @@ -886,9 +754,6 @@ typedef struct VarInHash { #define TclIsVarDirectWritable(varPtr) \ !((varPtr)->flags & (VAR_ARRAY|VAR_LINK|VAR_TRACED_WRITE|VAR_DEAD_HASH)) -#define TclIsVarDirectUnsettable(varPtr) \ - !((varPtr)->flags & (VAR_ARRAY|VAR_LINK|VAR_TRACED_READ|VAR_TRACED_WRITE|VAR_TRACED_UNSET|VAR_DEAD_HASH)) - #define TclIsVarDirectModifyable(varPtr) \ ( !((varPtr)->flags & (VAR_ARRAY|VAR_LINK|VAR_TRACED_READ|VAR_TRACED_WRITE)) \ && (varPtr)->value.objPtr) @@ -937,10 +802,10 @@ typedef struct CompiledLocal { /* Next compiler-recognized local variable for * this procedure, or NULL if this is the last * local. */ - size_t nameLength; /* The number of characters in local + int nameLength; /* The number of characters in local * variable's name. Used to speed up variable * lookups. */ - size_t frameIndex; /* Index in the array of compiler-assigned + int 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, @@ -956,7 +821,7 @@ typedef struct CompiledLocal { * is marked by a unique ClientData tag during * compilation, and that same tag is used to * find the variable at runtime. */ - char name[1]; /* Name of the local variable starts here. If + char name[4]; /* 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 * enough to hold the name. MUST BE THE LAST @@ -983,8 +848,8 @@ typedef struct Proc { * procedure. */ Tcl_Obj *bodyPtr; /* Points to the ByteCode object for * procedure's body command. */ - size_t numArgs; /* Number of formal parameters. */ - size_t numCompiledLocals; /* Count of local variables recognized by the + int numArgs; /* Number of formal parameters. */ + int numCompiledLocals; /* Count of local variables recognized by the * compiler including arguments and * temporaries. */ CompiledLocal *firstLocalPtr; @@ -1003,7 +868,7 @@ typedef struct Proc { * of a procedure (or lambda term or ...). */ -typedef void (ProcErrorProc)(Tcl_Interp *interp, Tcl_Obj *procNameObj); +typedef void (*ProcErrorProc)(Tcl_Interp *interp, Tcl_Obj *procNameObj); /* * The structure below defines a command trace. This is used to allow Tcl @@ -1090,7 +955,7 @@ typedef struct AssocData { typedef struct LocalCache { int refCount; - size_t numVars; + int numVars; Tcl_Obj *varName0; } LocalCache; @@ -1110,7 +975,7 @@ typedef struct CallFrame { * If FRAME_IS_PROC is set, the frame was * pushed to execute a Tcl procedure and may * have local vars. */ - size_t objc; /* This and objv below describe the arguments + int objc; /* This and objv below describe the arguments * for this procedure call. */ Tcl_Obj *const *objv; /* Array of argument objects. */ struct CallFrame *callerPtr; @@ -1138,7 +1003,7 @@ typedef struct CallFrame { * recognized by the compiler, or created at * execution time through, e.g., upvar. * Initially NULL and created if needed. */ - size_t numCompiledLocals; /* Count of local variables recognized by the + int 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 @@ -1154,20 +1019,10 @@ typedef struct CallFrame { * meaning of the value is, which we do not * specify. */ LocalCache *localCachePtr; - struct NRE_callback *tailcallPtr; - /* NULL if no tailcall is scheduled */ } CallFrame; #define FRAME_IS_PROC 0x1 #define FRAME_IS_LAMBDA 0x2 -#define FRAME_IS_METHOD 0x4 /* The frame is a method body, and the frame's - * clientData field contains a CallContext - * reference. Part of TIP#257. */ -#define FRAME_IS_OO_DEFINE 0x8 /* The frame is part of the inside workings of - * the [oo::define] command; the clientData - * field contains an Object reference that has - * been confirmed to refer to a class. Part of - * TIP#257. */ /* * TIP #280 @@ -1243,22 +1098,15 @@ typedef struct CmdFrame { union { struct { const char *cmd; /* The executed command, if possible... */ - size_t len; /* ... and its length. */ + int len; /* ... and its length. */ } str; Tcl_Obj *listPtr; /* Tcl_EvalObjEx, cmd list. */ } cmd; - int numLevels; /* Value of interp's numLevels when the frame - * was pushed. */ - const struct CFWordBC *litarg; - /* Link to set of literal arguments which have - * ben pushed on the lineLABCPtr stack by - * TclArgumentBCEnter(). These will be removed - * by TclArgumentBCRelease. */ } CmdFrame; typedef struct CFWord { CmdFrame *framePtr; /* CmdFrame to access. */ - size_t word; /* Index of the word in the command. */ + int word; /* Index of the word in the command. */ int refCount; /* Number of times the word is on the * stack. */ } CFWord; @@ -1270,9 +1118,6 @@ typedef struct CFWordBC { int 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 - * CmdFrame litarg field for the list start. */ - Tcl_Obj *obj; /* Back reference to hashtable key */ } CFWordBC; /* @@ -1298,7 +1143,7 @@ typedef struct CFWordBC { typedef struct ContLineLoc { int num; /* Number of entries in loc, not counting the * final -1 marker entry. */ - ssize_t loc[1]; /* Table of locations, as character offsets. + int loc[1]; /* Table of locations, as character offsets. * The table is allocated as part of the * structure, extending behind the nominal end * of the structure. An entry containing the @@ -1340,18 +1185,17 @@ typedef struct ContLineLoc { * by [info frame]. Contains a sub-structure for each extra field. */ -typedef Tcl_Obj * (GetFrameInfoValueProc)(ClientData clientData); +typedef Tcl_Obj *(*GetFrameInfoValueProc)(ClientData clientData); typedef struct { const char *name; /* Name of this field. */ - GetFrameInfoValueProc *proc; - /* Function to generate a Tcl_Obj* from the + GetFrameInfoValueProc proc; /* Function to generate a Tcl_Obj* from the * clientData, or just use the clientData * directly (after casting) if NULL. */ ClientData clientData; /* Context for above function, or Tcl_Obj* if * proc field is NULL. */ } ExtraFrameInfoField; typedef struct { - size_t length; /* Length of array. */ + int length; /* Length of array. */ ExtraFrameInfoField fields[2]; /* Really as long as necessary, but this is * long enough for nearly anything. */ @@ -1463,48 +1307,12 @@ typedef struct ExecStack { * currently active execution stack. */ -typedef struct CorContext { - struct CallFrame *framePtr; - struct CallFrame *varFramePtr; - struct CmdFrame *cmdFramePtr; /* See Interp.cmdFramePtr */ - Tcl_HashTable *lineLABCPtr; /* See Interp.lineLABCPtr */ -} CorContext; - -typedef struct CoroutineData { - struct Command *cmdPtr; /* The command handle for the coroutine. */ - struct ExecEnv *eePtr; /* The special execution environment (stacks, - * etc.) for the coroutine. */ - struct ExecEnv *callerEEPtr;/* The execution environment for the caller of - * the coroutine, which might be the - * interpreter global environment or another - * coroutine. */ - CorContext caller; - CorContext running; - Tcl_HashTable *lineLABCPtr; /* See Interp.lineLABCPtr */ - void *stackLevel; - int auxNumLevels; /* While the coroutine is running the - * numLevels of the create/resume command is - * stored here; for suspended coroutines it - * holds the nesting numLevels at yield. */ - ssize_t nargs; /* Number of args required for resuming this - * coroutine; -2 means "0 or 1" (default), -1 - * means "any" */ -} CoroutineData; - typedef struct ExecEnv { ExecStack *execStackPtr; /* Points to the first item in the evaluation * stack on the heap. */ Tcl_Obj *constants[2]; /* Pointers to constant "0" and "1" objs. */ - struct Tcl_Interp *interp; - struct NRE_callback *callbackPtr; - /* Top callback in NRE's stack. */ - struct CoroutineData *corPtr; - int rewind; } ExecEnv; -#define COR_IS_SUSPENDED(corPtr) \ - ((corPtr)->stackLevel == NULL) - /* * The definitions for the LiteralTable and LiteralEntry structures. Each * interpreter contains a LiteralTable. It is used to reduce the storage @@ -1545,11 +1353,11 @@ typedef struct LiteralTable { LiteralEntry *staticBuckets[TCL_SMALL_HASH_TABLE]; /* Bucket array used for small tables to avoid * mallocs and frees. */ - size_t numBuckets; /* Total number of buckets allocated at + int numBuckets; /* Total number of buckets allocated at * **buckets. */ - size_t numEntries; /* Total number of entries present in + int numEntries; /* Total number of entries present in * table. */ - size_t rebuildSize; /* Enlarge table when numEntries gets to be + int rebuildSize; /* Enlarge table when numEntries gets to be * this large. */ int mask; /* Mask value used in hashing function. */ } LiteralTable; @@ -1602,10 +1410,6 @@ typedef struct { const char *name; /* The name of the subcommand. */ Tcl_ObjCmdProc *proc; /* The implementation of the subcommand. */ CompileProc *compileProc; /* The compiler for the subcommand. */ - Tcl_ObjCmdProc *nreProc; /* NRE implementation of this command. */ - ClientData clientData; /* Any clientData to give the command. */ - int unsafe; /* Whether this command is to be hidden by - * default in a safe interpreter. */ } EnsembleImplMap; /* @@ -1698,7 +1502,6 @@ typedef struct Command { * command. */ CommandTrace *tracePtr; /* First in list of all traces set for this * command. */ - Tcl_ObjCmdProc *nreProc; /* NRE implementation of this command. */ } Command; /* @@ -1725,6 +1528,7 @@ typedef struct Command { #define CMD_IS_DELETED 0x1 #define CMD_TRACE_ACTIVE 0x2 #define CMD_HAS_EXEC_TRACES 0x4 +#define CMD_REDEF_IN_PROGRESS 0x10 /* *---------------------------------------------------------------- @@ -1774,24 +1578,6 @@ enum PkgPreferOptions { /* *---------------------------------------------------------------- - * This structure shadows the first few fields of the memory cache for the - * allocator defined in tclThreadAlloc.c; it has to be kept in sync with the - * definition there. - * Some macros require knowledge of some fields in the struct in order to - * avoid hitting the TSD unnecessarily. In order to facilitate this, a pointer - * to the relevant fields is kept in the objCache field in struct Interp. - *---------------------------------------------------------------- - */ - -typedef struct AllocCache { - struct Cache *nextPtr; /* Linked list of cache entries. */ - Tcl_ThreadId owner; /* Which thread's cache is this? */ - Tcl_Obj *firstObjPtr; /* List of free objects for thread. */ - size_t numObjects; /* Number of objects for thread. */ -} AllocCache; - -/* - *---------------------------------------------------------------- * This structure defines an interpreter, which is a collection of commands * plus other state information related to interpreting commands, such as * variable storage. Primary responsibility for this data structure is in @@ -1829,7 +1615,7 @@ typedef struct Interp { int errorLine; /* When TCL_ERROR is returned, this gives the * line number in the command where the error * occurred (1 means first line). */ - const struct TclStubs *stubTable; + struct TclStubs *stubTable; /* Pointer to the exported Tcl stub table. On * previous versions of Tcl this is a pointer * to the objResultPtr or a pointer to a @@ -1886,9 +1672,9 @@ typedef struct Interp { char *appendResult; /* Storage space for results generated by * Tcl_AppendResult. Ckalloc-ed. NULL means * not yet allocated. */ - size_t appendAvl; /* Total amount of space available at + int appendAvl; /* Total amount of space available at * partialResult. */ - size_t appendUsed; /* Number of non-null bytes currently stored + int appendUsed; /* Number of non-null bytes currently stored * at partialResult. */ /* @@ -2123,57 +1909,23 @@ typedef struct Interp { * They are used by the macros defined below. */ - AllocCache *allocCache; + void *allocCache; void *pendingObjDataPtr; /* Pointer to the Cache and PendingObjData * structs for this interp's thread; see * tclObj.c and tclThreadAlloc.c */ int *asyncReadyPtr; /* Pointer to the asyncReady indicator for * this interp's thread; see tclAsync.c */ - /* - * The pointer to the object system root ekeko. c.f. TIP #257. - */ + int *stackBound; /* Pointer to the limit stack address + * allowable for invoking a new command + * without "risking" a C-stack overflow; see + * TclpCheckStackSpace in the platform's + * directory. */ - void *objectFoundation; /* Pointer to the Foundation structure of the - * object system, which contains things like - * references to key namespaces. See - * tclOOInt.h and tclOO.c for real definition - * and setup. */ - - struct NRE_callback *deferredCallbacks; - /* Callbacks that are set previous to a call - * to some Eval function but that actually - * belong to the command that is about to be - * called - i.e., they should be run *before* - * any tailcall is invoked. */ - - /* - * TIP #285, Script cancellation support. - */ - - Tcl_AsyncHandler asyncCancel; - /* Async handler token for Tcl_CancelEval. */ - Tcl_Obj *asyncCancelMsg; /* Error message set by async cancel handler - * for the propagation of arbitrary Tcl - * errors. This information, if present - * (asyncCancelMsg not NULL), takes precedence - * over the default error messages returned by - * a script cancellation operation. */ - - /* - * TIP #348 IMPLEMENTATION - Substituted error stack - */ - - Tcl_Obj *errorStack; /* [info errorstack] value (as a Tcl_Obj). */ - Tcl_Obj *upLiteral; /* "UP" literal for [info errorstack] */ - Tcl_Obj *callLiteral; /* "CALL" literal for [info errorstack] */ - Tcl_Obj *innerLiteral; /* "INNER" literal for [info errorstack] */ - Tcl_Obj *innerContext; /* cached list for fast reallocation */ - int resetErrorStack; /* controls cleaning up of ::errorStack */ #ifdef TCL_COMPILE_STATS /* * Statistical information about the bytecode compiler and interpreter's - * operation. This should be the last field of Interp. + * operation. */ ByteCodeStats stats; /* Holds compilation and execution statistics @@ -2189,33 +1941,6 @@ typedef struct Interp { *((iPtr)->asyncReadyPtr) /* - * Macros for script cancellation support (TIP #285). - */ - -#define TclCanceled(iPtr) \ - (((iPtr)->flags & CANCELED) || ((iPtr)->flags & TCL_CANCEL_UNWIND)) - -#define TclSetCancelFlags(iPtr, cancelFlags) \ - (iPtr)->flags |= CANCELED; \ - if ((cancelFlags) & TCL_CANCEL_UNWIND) { \ - (iPtr)->flags |= TCL_CANCEL_UNWIND; \ - } - -#define TclUnsetCancelFlags(iPtr) \ - (iPtr)->flags &= (~(CANCELED | TCL_CANCEL_UNWIND)) - -/* - * General list of interpreters. Doubly linked for easier removal of items - * deep in the list. - */ - -typedef struct InterpList { - Interp *interpPtr; - struct InterpList *prevPtr; - struct InterpList *nextPtr; -} InterpList; - -/* * Macros for splicing into and out of doubly linked lists. They assume * existence of struct items 'prevPtr' and 'nextPtr'. * @@ -2253,7 +1978,6 @@ typedef struct InterpList { #define TCL_ALLOW_EXCEPTIONS 4 #define TCL_EVAL_FILE 2 #define TCL_EVAL_CTX 8 -#define TCL_EVAL_REDIRECT 16 /* * Flag bits for Interp structures: @@ -2286,16 +2010,6 @@ typedef struct InterpList { * of the wrong-num-args string in Tcl_WrongNumArgs. * Makes it append instead of replacing and uses * different intermediate text. - * CANCELED: Non-zero means that the script in progress should be - * canceled as soon as possible. This can be checked by - * extensions (and the core itself) by calling - * Tcl_Canceled and checking if TCL_ERROR is returned. - * This is a one-shot flag that is reset immediately upon - * being detected; however, if the TCL_CANCEL_UNWIND flag - * is set Tcl_Canceled will continue to report that the - * script in progress has been canceled thereby allowing - * the evaluation stack for the interp to be fully - * unwound. * * WARNING: For the sake of some extensions that have made use of former * internal values, do not re-use the flag values 2 (formerly ERR_IN_PROGRESS) @@ -2311,7 +2025,6 @@ typedef struct InterpList { #define INTERP_TRACE_IN_PROGRESS 0x200 #define INTERP_ALTERNATE_WRONG_ARGS 0x400 #define ERR_LEGACY_COPY 0x800 -#define CANCELED 0x1000 /* * Maximum number of levels of nesting permitted in Tcl commands (used to @@ -2321,35 +2034,6 @@ typedef struct InterpList { #define MAX_NESTING_DEPTH 1000 /* - * TIP#143 limit handler internal representation. - */ - -struct LimitHandler { - int flags; /* The state of this particular handler. */ - Tcl_LimitHandlerProc *handlerProc; - /* The handler callback. */ - ClientData clientData; /* Opaque argument to the handler callback. */ - Tcl_LimitHandlerDeleteProc *deleteProc; - /* How to delete the clientData. */ - LimitHandler *prevPtr; /* Previous item in linked list of - * handlers. */ - LimitHandler *nextPtr; /* Next item in linked list of handlers. */ -}; - -/* - * Values for the LimitHandler flags field. - * LIMIT_HANDLER_ACTIVE - Whether the handler is currently being - * processed; handlers are never to be entered reentrantly. - * LIMIT_HANDLER_DELETED - Whether the handler has been deleted. This - * should not normally be observed because when a handler is - * deleted it is also spliced out of the list of handlers, but - * even so we will be careful. - */ - -#define LIMIT_HANDLER_ACTIVE 0x01 -#define LIMIT_HANDLER_DELETED 0x02 - -/* * The macro below is used to modify a "char" value (e.g. by casting it to an * unsigned character) so that it can be used safely with macros such as * isspace. @@ -2438,8 +2122,8 @@ typedef enum TclEolTranslation { typedef struct List { int refCount; - size_t maxElemCount; /* Total number of element array slots. */ - size_t elemCount; /* Current number of list elements. */ + int maxElemCount; /* Total number of element array slots. */ + int 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 @@ -2450,8 +2134,6 @@ typedef struct List { #define LIST_MAX \ (1 + (int)(((size_t)UINT_MAX - sizeof(List))/sizeof(Tcl_Obj *))) -#define LIST_SIZE(numElems) \ - (unsigned)(sizeof(List) + (((numElems) - 1) * sizeof(Tcl_Obj *))) /* * Macro used to get the elements of a list object. @@ -2490,14 +2172,6 @@ typedef struct List { (((listPtr)->typePtr == &tclListType) ? ListObjIsCanonical((listPtr)) : 0) /* - * Modes for collecting (or not) in the implementations of TclNRForeachCmd, - * TclNRLmapCmd and their compilations. - */ - -#define TCL_EACH_KEEP_NONE 0 /* Discard iteration result like [foreach] */ -#define TCL_EACH_COLLECT 1 /* Collect iteration result like [lmap] */ - -/* * Macros providing a faster path to integers: Tcl_GetLongFromObj everywhere, * Tcl_GetIntFromObj and TclGetIntForIndex on platforms where longs are ints. * @@ -2567,8 +2241,6 @@ typedef struct List { #define TCL_FILESYSTEM_VERSION_2 ((Tcl_FSVersion) 0x2) typedef ClientData (TclFSGetCwdProc2)(ClientData clientData); -typedef int (Tcl_FSLoadFileProc2) (Tcl_Interp *interp, Tcl_Obj *pathPtr, - Tcl_LoadHandle *handlePtr, Tcl_FSUnloadFileProc **unloadProcPtr, int flags); /* * The following types are used for getting and storing platform-specific file @@ -2618,10 +2290,10 @@ typedef enum Tcl_PathPart { *---------------------------------------------------------------- */ -typedef int (TclStatProc_)(const char *path, struct stat *buf); -typedef int (TclAccessProc_)(const char *path, int mode); +typedef int (TclStatProc_)(CONST char *path, struct stat *buf); +typedef int (TclAccessProc_)(CONST char *path, int mode); typedef Tcl_Channel (TclOpenFileChannelProc_)(Tcl_Interp *interp, - const char *fileName, const char *modeString, int permissions); + CONST char *fileName, CONST char *modeString, int permissions); /* *---------------------------------------------------------------- @@ -2638,8 +2310,8 @@ typedef Tcl_ObjCmdProc *TclObjCmdProcType; *---------------------------------------------------------------- */ -typedef void (TclInitProcessGlobalValueProc)(char **valuePtr, - size_t *lengthPtr, Tcl_Encoding *encodingPtr); +typedef void (TclInitProcessGlobalValueProc)(char **valuePtr, int *lengthPtr, + Tcl_Encoding *encodingPtr); /* * A ProcessGlobalValue struct exists for each internal value in Tcl that is @@ -2652,7 +2324,7 @@ typedef void (TclInitProcessGlobalValueProc)(char **valuePtr, typedef struct ProcessGlobalValue { int epoch; /* Epoch counter to detect changes in the * master value. */ - size_t numBytes; /* Length of the master string. */ + int numBytes; /* Length of the master string. */ char *value; /* The master string value. */ Tcl_Encoding encoding; /* system encoding when master string was * initialized. */ @@ -2686,8 +2358,6 @@ typedef struct ProcessGlobalValue { * prefixes. */ #define TCL_PARSE_NO_WHITESPACE 32 /* Reject leading/trailing whitespace. */ -#define TCL_PARSE_BINARY_ONLY 64 - /* Parse binary even without prefix. */ /* *---------------------------------------------------------------------- @@ -2711,7 +2381,9 @@ MODULE_SCOPE char *tclNativeExecutableName; MODULE_SCOPE int tclFindExecutableSearchDone; MODULE_SCOPE char *tclMemDumpFileName; MODULE_SCOPE TclPlatformType tclPlatform; -MODULE_SCOPE Tcl_NotifierProcs tclNotifierHooks; +MODULE_SCOPE Tcl_NotifierProcs tclOriginalNotifier; + +MODULE_SCOPE Tcl_Encoding tclIdentityEncoding; /* * TIP #233 (Virtualized Time) @@ -2726,33 +2398,32 @@ MODULE_SCOPE ClientData tclTimeClientData; * Variables denoting the Tcl object types defined in the core. */ -MODULE_SCOPE const Tcl_ObjType tclBignumType; -MODULE_SCOPE const Tcl_ObjType tclBooleanType; -MODULE_SCOPE const Tcl_ObjType tclByteArrayType; -MODULE_SCOPE const Tcl_ObjType tclByteCodeType; -MODULE_SCOPE const Tcl_ObjType tclDoubleType; -MODULE_SCOPE const Tcl_ObjType tclEndOffsetType; -MODULE_SCOPE const Tcl_ObjType tclIntType; -MODULE_SCOPE const Tcl_ObjType tclListType; -MODULE_SCOPE const Tcl_ObjType tclDictType; -MODULE_SCOPE const Tcl_ObjType tclProcBodyType; -MODULE_SCOPE const Tcl_ObjType tclStringType; -MODULE_SCOPE const Tcl_ObjType tclArraySearchType; -MODULE_SCOPE const Tcl_ObjType tclEnsembleCmdType; +MODULE_SCOPE Tcl_ObjType tclBignumType; +MODULE_SCOPE Tcl_ObjType tclBooleanType; +MODULE_SCOPE Tcl_ObjType tclByteArrayType; +MODULE_SCOPE Tcl_ObjType tclByteCodeType; +MODULE_SCOPE Tcl_ObjType tclDoubleType; +MODULE_SCOPE Tcl_ObjType tclEndOffsetType; +MODULE_SCOPE Tcl_ObjType tclIntType; +MODULE_SCOPE Tcl_ObjType tclListType; +MODULE_SCOPE Tcl_ObjType tclDictType; +MODULE_SCOPE Tcl_ObjType tclProcBodyType; +MODULE_SCOPE Tcl_ObjType tclStringType; +MODULE_SCOPE Tcl_ObjType tclArraySearchType; +MODULE_SCOPE Tcl_ObjType tclEnsembleCmdType; #ifndef NO_WIDE_TYPE -MODULE_SCOPE const Tcl_ObjType tclWideIntType; +MODULE_SCOPE Tcl_ObjType tclWideIntType; #endif -MODULE_SCOPE const Tcl_ObjType tclRegexpType; -MODULE_SCOPE Tcl_ObjType tclCmdNameType; +MODULE_SCOPE Tcl_ObjType tclRegexpType; /* * Variables denoting the hash key types defined in the core. */ -MODULE_SCOPE const Tcl_HashKeyType tclArrayHashKeyType; -MODULE_SCOPE const Tcl_HashKeyType tclOneWordHashKeyType; -MODULE_SCOPE const Tcl_HashKeyType tclStringHashKeyType; -MODULE_SCOPE const Tcl_HashKeyType tclObjHashKeyType; +MODULE_SCOPE Tcl_HashKeyType tclArrayHashKeyType; +MODULE_SCOPE Tcl_HashKeyType tclOneWordHashKeyType; +MODULE_SCOPE Tcl_HashKeyType tclStringHashKeyType; +MODULE_SCOPE Tcl_HashKeyType tclObjHashKeyType; /* * The head of the list of free Tcl objects, and the total number of Tcl @@ -2777,77 +2448,6 @@ MODULE_SCOPE long tclObjsShared[TCL_MAX_SHARED_OBJ_STATS]; MODULE_SCOPE char * tclEmptyStringRep; MODULE_SCOPE char tclEmptyString; -/* - *---------------------------------------------------------------- - * Procedures shared among Tcl modules but not used by the outside world, - * introduced by/for NRE. - *---------------------------------------------------------------- - */ - -MODULE_SCOPE Tcl_ObjCmdProc TclNRApplyObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclNREvalObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclNRCatchObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclNRExprObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclNRForObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclNRForeachCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclNRIfObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclNRLmapCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclNRSourceObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclNRSubstObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclNRSwitchObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclNRTryObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclNRUplevelObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclNRWhileObjCmd; - -MODULE_SCOPE Tcl_NRPostProc TclNRForIterCallback; -MODULE_SCOPE Tcl_NRPostProc TclNRCoroutineActivateCallback; -MODULE_SCOPE Tcl_ObjCmdProc TclNRTailcallObjCmd; -MODULE_SCOPE Tcl_NRPostProc TclNRTailcallEval; -MODULE_SCOPE Tcl_ObjCmdProc TclNRCoroutineObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclNRYieldObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclNRYieldmObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclNRYieldToObjCmd; - -MODULE_SCOPE void TclSpliceTailcall(Tcl_Interp *interp, - struct NRE_callback *tailcallPtr); - -/* - * This structure holds the data for the various iteration callbacks used to - * NRE the 'for' and 'while' commands. We need a separate structure because we - * have more than the 4 client data entries we can provide directly thorugh - * the callback API. It is the 'word' information which puts us over the - * limit. It is needed because the loop body is argument 4 of 'for' and - * argument 2 of 'while'. Not providing the correct index confuses the #280 - * code. We TclSmallAlloc/Free this. - */ - -typedef struct ForIterData { - Tcl_Obj *cond; /* Loop condition expression. */ - 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 */ -} ForIterData; - -/* TIP #357 - Structure doing the bookkeeping of handles for Tcl_LoadFile - * and Tcl_FindSymbol. This structure corresponds to an opaque - * typedef in tcl.h */ - -typedef void* TclFindSymbolProc(Tcl_Interp* interp, Tcl_LoadHandle loadHandle, - const char* symbol); -struct Tcl_LoadHandle_ { - ClientData clientData; /* Client data is the load handle in the - * native filesystem if a module was loaded - * there, or an opaque pointer to a structure - * for further bookkeeping on load-from-VFS - * and load-from-memory */ - TclFindSymbolProc* findSymbolProcPtr; - /* Procedure that resolves symbols in a - * loaded module */ - Tcl_FSUnloadFileProc* unloadFileProcPtr; - /* Procedure that unloads a loaded module */ -}; - /* Flags for conversion of doubles to digit strings */ #define TCL_DD_SHORTEST 0x4 @@ -2881,74 +2481,67 @@ struct Tcl_LoadHandle_ { */ MODULE_SCOPE void TclAppendBytesToByteArray(Tcl_Obj *objPtr, - const unsigned char *bytes, size_t len); -MODULE_SCOPE int TclNREvalCmd(Tcl_Interp *interp, Tcl_Obj *objPtr, - int flags); -MODULE_SCOPE void TclPushTailcallPoint(Tcl_Interp *interp); -MODULE_SCOPE void TclAdvanceContinuations(int *line, ssize_t **next, - int loc); -MODULE_SCOPE void TclAdvanceLines(int *line, const char *start, + const unsigned char *bytes, int len); +MODULE_SCOPE void TclAdvanceContinuations(int* line, int** next, int loc); +MODULE_SCOPE void TclAdvanceLines(int *line, const char *start, const char *end); -MODULE_SCOPE void TclArgumentEnter(Tcl_Interp *interp, - Tcl_Obj *objv[], size_t objc, CmdFrame *cf); -MODULE_SCOPE void TclArgumentRelease(Tcl_Interp *interp, - Tcl_Obj *objv[], size_t objc); -MODULE_SCOPE void TclArgumentBCEnter(Tcl_Interp *interp, - Tcl_Obj *objv[], size_t objc, - void *codePtr, CmdFrame *cfPtr, int pc); -MODULE_SCOPE void TclArgumentBCRelease(Tcl_Interp *interp, - CmdFrame *cfPtr); -MODULE_SCOPE void TclArgumentGet(Tcl_Interp *interp, Tcl_Obj *obj, +MODULE_SCOPE void TclArgumentEnter(Tcl_Interp* interp, + Tcl_Obj* objv[], int objc, CmdFrame* cf); +MODULE_SCOPE void TclArgumentRelease(Tcl_Interp* interp, + Tcl_Obj* objv[], int objc); +MODULE_SCOPE void TclArgumentGet(Tcl_Interp* interp, Tcl_Obj* obj, CmdFrame **cfPtrPtr, int *wordPtr); +MODULE_SCOPE void TclArgumentBCEnter(Tcl_Interp *interp, + Tcl_Obj* objv[], int objc, + void *codePtr, CmdFrame *cfPtr, int pc); +MODULE_SCOPE void TclArgumentBCRelease(Tcl_Interp *interp, + Tcl_Obj *objv[], int objc, + void *codePtr, int pc); MODULE_SCOPE int TclArraySet(Tcl_Interp *interp, Tcl_Obj *arrayNameObj, Tcl_Obj *arrayElemObj); -MODULE_SCOPE double TclBignumToDouble(const mp_int *bignum); +MODULE_SCOPE double TclBignumToDouble(mp_int *bignum); MODULE_SCOPE int TclByteArrayMatch(const unsigned char *string, - size_t strLen, const unsigned char *pattern, - size_t ptnLen, int flags); -MODULE_SCOPE double TclCeil(const mp_int *a); + int strLen, const unsigned char *pattern, + int ptnLen, int flags); +MODULE_SCOPE double TclCeil(mp_int *a); +MODULE_SCOPE void TclChannelPreserve(Tcl_Channel chan); +MODULE_SCOPE void TclChannelRelease(Tcl_Channel chan); +MODULE_SCOPE int TclCheckBadOctal(Tcl_Interp *interp, const char *value); MODULE_SCOPE int TclChanCaughtErrorBypass(Tcl_Interp *interp, Tcl_Channel chan); -MODULE_SCOPE Tcl_ObjCmdProc TclChannelNamesCmd; -MODULE_SCOPE int TclClearRootEnsemble(ClientData data[], - Tcl_Interp *interp, int result); -MODULE_SCOPE ContLineLoc *TclContinuationsEnter(Tcl_Obj *objPtr, int num, - ssize_t *loc); +MODULE_SCOPE ContLineLoc* TclContinuationsEnter(Tcl_Obj *objPtr, int num, + int *loc); MODULE_SCOPE void TclContinuationsEnterDerived(Tcl_Obj *objPtr, - size_t start, ssize_t *clNext); -MODULE_SCOPE ContLineLoc *TclContinuationsGet(Tcl_Obj *objPtr); + int start, int *clNext); +MODULE_SCOPE ContLineLoc* TclContinuationsGet(Tcl_Obj *objPtr); MODULE_SCOPE void TclContinuationsCopy(Tcl_Obj *objPtr, Tcl_Obj *originObjPtr); -MODULE_SCOPE size_t TclConvertElement(const char *src, size_t length, +MODULE_SCOPE int TclConvertElement(CONST char *src, int length, char *dst, int flags); MODULE_SCOPE void TclDeleteNamespaceVars(Namespace *nsPtr); /* TIP #280 - Modified token based evulation, with line information. */ MODULE_SCOPE int TclEvalEx(Tcl_Interp *interp, const char *script, - size_t numBytes, int flags, int line, - ssize_t *clNextOuter, const char *outerScript); -MODULE_SCOPE Tcl_ObjCmdProc TclFileAttrsCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclFileCopyCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclFileDeleteCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclFileLinkCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclFileMakeDirsCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclFileReadLinkCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclFileRenameCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclFileTemporaryCmd; + int numBytes, int flags, int line, + int *clNextOuter, CONST char *outerScript); +MODULE_SCOPE int TclFileAttrsCmd(Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]); +MODULE_SCOPE int TclFileCopyCmd(Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]); +MODULE_SCOPE int TclFileDeleteCmd(Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]); +MODULE_SCOPE int TclFileMakeDirsCmd(Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]); +MODULE_SCOPE int TclFileRenameCmd(Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]); MODULE_SCOPE void TclCreateLateExitHandler(Tcl_ExitProc *proc, ClientData clientData); MODULE_SCOPE void TclDeleteLateExitHandler(Tcl_ExitProc *proc, ClientData clientData); -MODULE_SCOPE char * TclDStringAppendObj(Tcl_DString *dsPtr, - Tcl_Obj *objPtr); -MODULE_SCOPE char * TclDStringAppendDString(Tcl_DString *dsPtr, - Tcl_DString *toAppendPtr); -MODULE_SCOPE Tcl_Obj * TclDStringToObj(Tcl_DString *dsPtr); MODULE_SCOPE void TclFinalizeAllocSubsystem(void); MODULE_SCOPE void TclFinalizeAsync(void); MODULE_SCOPE void TclFinalizeDoubleConversion(void); MODULE_SCOPE void TclFinalizeEncodingSubsystem(void); MODULE_SCOPE void TclFinalizeEnvironment(void); -MODULE_SCOPE void TclFinalizeEvaluation(void); MODULE_SCOPE void TclFinalizeExecution(void); MODULE_SCOPE void TclFinalizeIOSubsystem(void); MODULE_SCOPE void TclFinalizeFilesystem(void); @@ -2961,22 +2554,19 @@ MODULE_SCOPE void TclFinalizeObjects(void); MODULE_SCOPE void TclFinalizePreserve(void); MODULE_SCOPE void TclFinalizeSynchronization(void); MODULE_SCOPE void TclFinalizeThreadAlloc(void); +MODULE_SCOPE void TclFinalizeThreadAllocThread(void); MODULE_SCOPE void TclFinalizeThreadData(void); MODULE_SCOPE void TclFinalizeThreadObjects(void); -MODULE_SCOPE double TclFloor(const mp_int *a); +MODULE_SCOPE double TclFloor(mp_int *a); MODULE_SCOPE void TclFormatNaN(double value, char *buffer); MODULE_SCOPE int TclFSFileAttrIndex(Tcl_Obj *pathPtr, const char *attributeName, int *indexPtr); -MODULE_SCOPE int TclNREvalFile(Tcl_Interp *interp, Tcl_Obj *pathPtr, - const char *encodingName); MODULE_SCOPE void TclFSUnloadTempFile(Tcl_LoadHandle loadHandle); MODULE_SCOPE int * TclGetAsyncReadyPtr(void); MODULE_SCOPE Tcl_Obj * TclGetBgErrorHandler(Tcl_Interp *interp); MODULE_SCOPE int TclGetChannelFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Channel *chanPtr, int *modePtr, int flags); -MODULE_SCOPE int TclGetCompletionCodeFromObj(Tcl_Interp *interp, - Tcl_Obj *value, int *code); MODULE_SCOPE int TclGetNumberFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, ClientData *clientDataPtr, int *typePtr); @@ -2984,7 +2574,9 @@ MODULE_SCOPE int TclGetOpenModeEx(Tcl_Interp *interp, const char *modeString, int *seekFlagPtr, int *binaryPtr); MODULE_SCOPE Tcl_Obj * TclGetProcessGlobalValue(ProcessGlobalValue *pgvPtr); -MODULE_SCOPE const char *TclGetSrcInfoForCmd(Interp *iPtr, size_t *lenPtr); +MODULE_SCOPE const char *TclGetSrcInfoForCmd(Interp *iPtr, int *lenPtr); +MODULE_SCOPE char * TclGetStringStorage(Tcl_Obj *objPtr, + unsigned int *sizePtr); MODULE_SCOPE int TclGlob(Tcl_Interp *interp, char *pattern, Tcl_Obj *unquotedPrefix, int globFlags, Tcl_GlobTypeData *types); @@ -2993,16 +2585,14 @@ MODULE_SCOPE int TclIncrObj(Tcl_Interp *interp, Tcl_Obj *valuePtr, MODULE_SCOPE Tcl_Obj * TclIncrObjVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, Tcl_Obj *incrPtr, int flags); MODULE_SCOPE int TclInfoExistsCmd(ClientData dummy, Tcl_Interp *interp, - size_t objc, Tcl_Obj *const objv[]); -MODULE_SCOPE int TclInfoCoroutineCmd(ClientData dummy, Tcl_Interp *interp, - size_t objc, Tcl_Obj *const objv[]); + int objc, Tcl_Obj *const objv[]); MODULE_SCOPE Tcl_Obj * TclInfoFrame(Tcl_Interp *interp, CmdFrame *framePtr); MODULE_SCOPE int TclInfoGlobalsCmd(ClientData dummy, Tcl_Interp *interp, - size_t objc, Tcl_Obj *const objv[]); + int objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TclInfoLocalsCmd(ClientData dummy, Tcl_Interp *interp, - size_t objc, Tcl_Obj *const objv[]); + int objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TclInfoVarsCmd(ClientData dummy, Tcl_Interp *interp, - size_t objc, Tcl_Obj *const objv[]); + int objc, Tcl_Obj *const objv[]); MODULE_SCOPE void TclInitAlloc(void); MODULE_SCOPE void TclInitDbCkalloc(void); MODULE_SCOPE void TclInitDoubleConversion(void); @@ -3016,77 +2606,75 @@ MODULE_SCOPE void TclInitNotifier(void); MODULE_SCOPE void TclInitObjSubsystem(void); MODULE_SCOPE void TclInitSubsystems(void); MODULE_SCOPE int TclInterpReady(Tcl_Interp *interp); -MODULE_SCOPE int TclIsLocalScalar(const char *src, size_t len); MODULE_SCOPE int TclIsSpaceProc(char byte); -MODULE_SCOPE Tcl_Obj * TclJoinPath(size_t elements, Tcl_Obj *const objv[]); +MODULE_SCOPE int TclIsBareword(char byte); 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, - size_t indexCount, Tcl_Obj *const indexArray[]); + int indexCount, Tcl_Obj *const indexArray[]); /* TIP #280 */ -MODULE_SCOPE void TclListLines(Tcl_Obj *listObj, int line, - size_t numLines, int *lines, - Tcl_Obj *const *elems); +MODULE_SCOPE void TclListLines(Tcl_Obj *listObj, int line, int n, + int *lines, Tcl_Obj *const *elems); MODULE_SCOPE Tcl_Obj * TclListObjCopy(Tcl_Interp *interp, Tcl_Obj *listPtr); +MODULE_SCOPE int TclLoadFile(Tcl_Interp *interp, Tcl_Obj *pathPtr, + int symc, const char *symbols[], + Tcl_PackageInitProc **procPtrs[], + Tcl_LoadHandle *handlePtr, + ClientData *clientDataPtr, + Tcl_FSUnloadFileProc **unloadProcPtr); 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, - size_t indexCount, Tcl_Obj *const indexArray[], + int indexCount, Tcl_Obj *const indexArray[], Tcl_Obj *valuePtr); MODULE_SCOPE Tcl_Command TclMakeEnsemble(Tcl_Interp *interp, const char *name, const EnsembleImplMap map[]); -MODULE_SCOPE size_t TclMaxListLength(const char *bytes, size_t numBytes, - const char **endPtr); -MODULE_SCOPE int TclMergeReturnOptions(Tcl_Interp *interp, size_t objc, +MODULE_SCOPE int TclMaxListLength(CONST char *bytes, int numBytes, + CONST char **endPtr); +MODULE_SCOPE int TclMergeReturnOptions(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], Tcl_Obj **optionsPtrPtr, int *codePtr, int *levelPtr); -MODULE_SCOPE Tcl_Obj * TclNoErrorStack(Tcl_Interp *interp, Tcl_Obj *options); -MODULE_SCOPE int TclNokia770Doubles(void); -MODULE_SCOPE void TclNsDecrRefCount(Namespace *nsPtr); +MODULE_SCOPE int TclNokia770Doubles(); MODULE_SCOPE void TclObjVarErrMsg(Tcl_Interp *interp, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, const char *operation, const char *reason, int index); MODULE_SCOPE int TclObjInvokeNamespace(Tcl_Interp *interp, - size_t objc, Tcl_Obj *const objv[], + int objc, Tcl_Obj *const objv[], Tcl_Namespace *nsPtr, int flags); MODULE_SCOPE int TclObjUnsetVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, int flags); -MODULE_SCOPE size_t TclParseBackslash(const char *src, - size_t numBytes, size_t *readPtr, char *dst); -MODULE_SCOPE size_t TclParseHex(const char *src, size_t numBytes, - int *resultPtr); +MODULE_SCOPE int TclParseBackslash(const char *src, + int numBytes, int *readPtr, char *dst); +MODULE_SCOPE int TclParseHex(const char *src, int numBytes, + Tcl_UniChar *resultPtr); MODULE_SCOPE int TclParseNumber(Tcl_Interp *interp, Tcl_Obj *objPtr, const char *expected, const char *bytes, - size_t numBytes, const char **endPtrPtr, - int flags); + int numBytes, const char **endPtrPtr, int flags); MODULE_SCOPE void TclParseInit(Tcl_Interp *interp, const char *string, - size_t numBytes, Tcl_Parse *parsePtr); -MODULE_SCOPE size_t TclParseAllWhiteSpace(const char *src, - size_t numBytes); + int numBytes, Tcl_Parse *parsePtr); +MODULE_SCOPE int TclParseAllWhiteSpace(const char *src, int numBytes); MODULE_SCOPE int TclProcessReturn(Tcl_Interp *interp, int code, int level, Tcl_Obj *returnOpts); +#ifndef TCL_NO_STACK_CHECK +MODULE_SCOPE int TclpGetCStackParams(int **stackBoundPtr); +#endif MODULE_SCOPE int TclpObjLstat(Tcl_Obj *pathPtr, Tcl_StatBuf *buf); MODULE_SCOPE Tcl_Obj * TclpTempFileName(void); -MODULE_SCOPE Tcl_Obj * TclpTempFileNameForLibrary(Tcl_Interp *interp, Tcl_Obj* pathPtr); MODULE_SCOPE Tcl_Obj * TclNewFSPathObj(Tcl_Obj *dirPtr, const char *addStrRep, - size_t len); -MODULE_SCOPE int TclpDeleteFile(const void *path); + int len); +MODULE_SCOPE int TclpDeleteFile(const char *path); MODULE_SCOPE void TclpFinalizeCondition(Tcl_Condition *condPtr); MODULE_SCOPE void TclpFinalizeMutex(Tcl_Mutex *mutexPtr); MODULE_SCOPE void TclpFinalizePipes(void); MODULE_SCOPE void TclpFinalizeSockets(void); -MODULE_SCOPE int TclCreateSocketAddress(Tcl_Interp *interp, - struct addrinfo **addrlist, - const char *host, int port, int willBind, - const char **errorMsgPtr); MODULE_SCOPE int TclpThreadCreate(Tcl_ThreadId *idPtr, - Tcl_ThreadCreateProc *proc, ClientData clientData, - size_t stackSize, int flags); -MODULE_SCOPE int TclpFindVariable(const char *name, size_t *lengthPtr); + Tcl_ThreadCreateProc proc, ClientData clientData, + int stackSize, int flags); +MODULE_SCOPE int TclpFindVariable(const char *name, int *lengthPtr); MODULE_SCOPE void TclpInitLibraryPath(char **valuePtr, - size_t *lengthPtr, Tcl_Encoding *encodingPtr); + int *lengthPtr, Tcl_Encoding *encodingPtr); MODULE_SCOPE void TclpInitLock(void); MODULE_SCOPE void TclpInitPlatform(void); MODULE_SCOPE void TclpInitUnlock(void); @@ -3098,10 +2686,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, size_t *lenPtr); +MODULE_SCOPE Tcl_Obj * TclpNativeSplitPath(Tcl_Obj *pathPtr, int *lenPtr); MODULE_SCOPE Tcl_PathType TclpGetNativePathType(Tcl_Obj *pathPtr, - size_t *driveNameLengthPtr, - Tcl_Obj **driveNameRef); + int *driveNameLengthPtr, Tcl_Obj **driveNameRef); MODULE_SCOPE int TclCrossFilesystemCopy(Tcl_Interp *interp, Tcl_Obj *source, Tcl_Obj *target); MODULE_SCOPE int TclpMatchInDirectory(Tcl_Interp *interp, @@ -3112,27 +2699,31 @@ MODULE_SCOPE Tcl_FSDupInternalRepProc TclNativeDupInternalRep; MODULE_SCOPE Tcl_Obj * TclpObjLink(Tcl_Obj *pathPtr, Tcl_Obj *toPtr, int linkType); MODULE_SCOPE int TclpObjChdir(Tcl_Obj *pathPtr); -MODULE_SCOPE Tcl_Channel TclpOpenTemporaryFile(Tcl_Obj *dirObj, - Tcl_Obj *basenameObj, Tcl_Obj *extensionObj, - Tcl_Obj *resultingNameObj); MODULE_SCOPE Tcl_Obj * TclPathPart(Tcl_Interp *interp, Tcl_Obj *pathPtr, Tcl_PathPart portion); +#ifndef TclpPanic +MODULE_SCOPE void TclpPanic(const char *format, ...); +#endif MODULE_SCOPE char * TclpReadlink(const char *fileName, Tcl_DString *linkPtr); +#ifndef TclpReleaseFile +MODULE_SCOPE void TclpReleaseFile(TclFile file); +#endif MODULE_SCOPE void TclpSetInterfaces(void); MODULE_SCOPE void TclpSetVariables(Tcl_Interp *interp); -MODULE_SCOPE void * TclThreadStorageKeyGet(Tcl_ThreadDataKey *keyPtr); -MODULE_SCOPE void TclThreadStorageKeySet(Tcl_ThreadDataKey *keyPtr, +MODULE_SCOPE void TclpUnloadFile(Tcl_LoadHandle loadHandle); +MODULE_SCOPE void * TclpThreadDataKeyGet(Tcl_ThreadDataKey *keyPtr); +MODULE_SCOPE void TclpThreadDataKeySet(Tcl_ThreadDataKey *keyPtr, void *data); MODULE_SCOPE void TclpThreadExit(int status); +MODULE_SCOPE size_t TclpThreadGetStackSize(void); MODULE_SCOPE void TclRememberCondition(Tcl_Condition *mutex); MODULE_SCOPE void TclRememberJoinableThread(Tcl_ThreadId id); MODULE_SCOPE void TclRememberMutex(Tcl_Mutex *mutex); MODULE_SCOPE void TclRemoveScriptLimitCallbacks(Tcl_Interp *interp); MODULE_SCOPE int TclReToGlob(Tcl_Interp *interp, const char *reStr, - size_t reStrLen, Tcl_DString *dsPtr, - int *flagsPtr); -MODULE_SCOPE size_t TclScanElement(const char *string, size_t length, + int reStrLen, Tcl_DString *dsPtr, int *flagsPtr); +MODULE_SCOPE int TclScanElement(CONST char *string, int length, int *flagPtr); MODULE_SCOPE void TclSetBgErrorHandler(Tcl_Interp *interp, Tcl_Obj *cmdPrefix); @@ -3140,62 +2731,48 @@ MODULE_SCOPE void TclSetBignumIntRep(Tcl_Obj *objPtr, mp_int *bignumValue); MODULE_SCOPE void TclSetCmdNameObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Command *cmdPtr); -MODULE_SCOPE void TclSetDuplicateObj(Tcl_Obj *dupPtr, Tcl_Obj *objPtr); MODULE_SCOPE void TclSetProcessGlobalValue(ProcessGlobalValue *pgvPtr, Tcl_Obj *newValue, Tcl_Encoding encoding); MODULE_SCOPE void TclSignalExitThread(Tcl_ThreadId id, int result); MODULE_SCOPE void * TclStackRealloc(Tcl_Interp *interp, void *ptr, - size_t numBytes); -MODULE_SCOPE int TclStringMatch(const char *str, size_t strLen, - const char *pattern, size_t ptnLen, int flags); + int numBytes); +MODULE_SCOPE int TclStringMatch(const char *str, int strLen, + const char *pattern, int ptnLen, int flags); MODULE_SCOPE int TclStringMatchObj(Tcl_Obj *stringObj, Tcl_Obj *patternObj, int flags); MODULE_SCOPE Tcl_Obj * TclStringObjReverse(Tcl_Obj *objPtr); -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, 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, - size_t count, size_t *tokensLeftPtr, int line, - ssize_t *clNextOuter, const char *outerScript); -MODULE_SCOPE int TclTrimLeft(const char *bytes, size_t numBytes, - const char *trim, size_t numTrim); -MODULE_SCOPE int TclTrimRight(const char *bytes, size_t numBytes, - const char *trim, size_t numTrim); + int count, int *tokensLeftPtr, int line, + int *clNextOuter, CONST char *outerScript); +MODULE_SCOPE void TclTransferResult(Tcl_Interp *sourceInterp, int result, + Tcl_Interp *targetInterp); +MODULE_SCOPE int TclTrimLeft(const char *bytes, int numBytes, + const char *trim, int numTrim); +MODULE_SCOPE int TclTrimRight(const char *bytes, int numBytes, + const char *trim, int numTrim); MODULE_SCOPE Tcl_Obj * TclpNativeToNormalized(ClientData clientData); MODULE_SCOPE Tcl_Obj * TclpFilesystemPathType(Tcl_Obj *pathPtr); +MODULE_SCOPE Tcl_PackageInitProc *TclpFindSymbol(Tcl_Interp *interp, + Tcl_LoadHandle loadHandle, const char *symbol); MODULE_SCOPE int TclpDlopen(Tcl_Interp *interp, Tcl_Obj *pathPtr, Tcl_LoadHandle *loadHandle, - Tcl_FSUnloadFileProc **unloadProcPtr, int flags); + Tcl_FSUnloadFileProc **unloadProcPtr); MODULE_SCOPE int TclpUtime(Tcl_Obj *pathPtr, struct utimbuf *tval); #ifdef TCL_LOAD_FROM_MEMORY -MODULE_SCOPE void * TclpLoadMemoryGetBuffer(Tcl_Interp *interp, - size_t size); +MODULE_SCOPE void * TclpLoadMemoryGetBuffer(Tcl_Interp *interp, int size); MODULE_SCOPE int TclpLoadMemory(Tcl_Interp *interp, void *buffer, - size_t size, size_t codeSize, - Tcl_LoadHandle *loadHandle, - Tcl_FSUnloadFileProc **unloadProcPtr, int flags); + int size, int codeSize, Tcl_LoadHandle *loadHandle, + Tcl_FSUnloadFileProc **unloadProcPtr); #endif MODULE_SCOPE void TclInitThreadStorage(void); -MODULE_SCOPE void TclFinalizeThreadDataThread(void); +MODULE_SCOPE void TclpFinalizeThreadDataThread(void); MODULE_SCOPE void TclFinalizeThreadStorage(void); #ifdef TCL_WIDE_CLICKS MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void); MODULE_SCOPE double TclpWideClicksToNanoseconds(Tcl_WideInt clicks); #endif MODULE_SCOPE Tcl_Obj * TclDisassembleByteCodeObj(Tcl_Obj *objPtr); -MODULE_SCOPE int TclZlibInit(Tcl_Interp *interp); -MODULE_SCOPE void * TclpThreadCreateKey(void); -MODULE_SCOPE void TclpThreadDeleteKey(void *keyPtr); -MODULE_SCOPE void TclpThreadSetMasterTSD(void *tsdKeyPtr, void *ptr); -MODULE_SCOPE void * TclpThreadGetMasterTSD(void *tsdKeyPtr); - -MODULE_SCOPE void TclErrorStackResetIf(Tcl_Interp *interp, - const char *msg, size_t length); +MODULE_SCOPE int TclUtfCasecmp(CONST char *cs, CONST char *ct); /* *---------------------------------------------------------------- @@ -3203,141 +2780,266 @@ MODULE_SCOPE void TclErrorStackResetIf(Tcl_Interp *interp, *---------------------------------------------------------------- */ -MODULE_SCOPE Tcl_ObjCmdProc Tcl_AfterObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_AppendObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_ApplyObjCmd; -MODULE_SCOPE Tcl_Command TclInitArrayCmd(Tcl_Interp *interp); -MODULE_SCOPE Tcl_Command TclInitBinaryCmd(Tcl_Interp *interp); -MODULE_SCOPE Tcl_ObjCmdProc Tcl_BreakObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_CatchObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_CdObjCmd; +MODULE_SCOPE int Tcl_AfterObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_AppendObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_ApplyObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_ArrayObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_BinaryObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_BreakObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_CaseObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_CatchObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_CdObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); MODULE_SCOPE Tcl_Command TclInitChanCmd(Tcl_Interp *interp); -MODULE_SCOPE Tcl_ObjCmdProc TclChanCreateObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclChanPostEventObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclChanPopObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclChanPushObjCmd; +MODULE_SCOPE int TclChanCreateObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclChanPostEventObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); MODULE_SCOPE void TclClockInit(Tcl_Interp *interp); -MODULE_SCOPE Tcl_ObjCmdProc TclClockOldscanObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_CloseObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_ConcatObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_ContinueObjCmd; +MODULE_SCOPE int TclClockOldscanObjCmd( + ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_CloseObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_ConcatObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_ContinueObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); MODULE_SCOPE Tcl_TimerToken TclCreateAbsoluteTimerHandler( Tcl_Time *timePtr, Tcl_TimerProc *proc, ClientData clientData); -MODULE_SCOPE Tcl_ObjCmdProc TclDefaultBgErrorHandlerObjCmd; +MODULE_SCOPE int TclDefaultBgErrorHandlerObjCmd( + ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]); MODULE_SCOPE Tcl_Command TclInitDictCmd(Tcl_Interp *interp); -MODULE_SCOPE int TclDictWithFinish(Tcl_Interp *interp, Var *varPtr, - Var *arrayPtr, Tcl_Obj *part1Ptr, - Tcl_Obj *part2Ptr, int index, size_t pathc, - Tcl_Obj *const pathv[], Tcl_Obj *keysPtr); -MODULE_SCOPE Tcl_Obj * TclDictWithInit(Tcl_Interp *interp, Tcl_Obj *dictPtr, - size_t pathc, Tcl_Obj *const pathv[]); -MODULE_SCOPE Tcl_ObjCmdProc Tcl_DisassembleObjCmd; - -/* Assemble command function */ -MODULE_SCOPE Tcl_ObjCmdProc Tcl_AssembleObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclNRAssembleObjCmd; - -MODULE_SCOPE Tcl_ObjCmdProc Tcl_EncodingObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_EofObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_ErrorObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_EvalObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_ExecObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_ExitObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_ExprObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_FblockedObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_FconfigureObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_FcopyObjCmd; -MODULE_SCOPE Tcl_Command TclInitFileCmd(Tcl_Interp *interp); -MODULE_SCOPE int TclMakeFileCommandSafe(Tcl_Interp *interp); -MODULE_SCOPE Tcl_ObjCmdProc Tcl_FileEventObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_FlushObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_ForObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_ForeachObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_FormatObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_GetsObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_GlobalObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_GlobObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_IfObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_IncrObjCmd; +MODULE_SCOPE int Tcl_DisassembleObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_EncodingObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_EofObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_ErrorObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_EvalObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_ExecObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_ExitObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_ExprObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_FblockedObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_FconfigureObjCmd( + ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_FcopyObjCmd(ClientData dummy, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_FileObjCmd(ClientData dummy, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_FileEventObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_FlushObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_ForObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_ForeachObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_FormatObjCmd(ClientData dummy, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_GetsObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_GlobalObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_GlobObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_IfObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_IncrObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); MODULE_SCOPE Tcl_Command TclInitInfoCmd(Tcl_Interp *interp); -MODULE_SCOPE Tcl_ObjCmdProc Tcl_InterpObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_JoinObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_LappendObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_LassignObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_LindexObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_LinsertObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_LlengthObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_ListObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_LmapObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_LoadObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_LrangeObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_LrepeatObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_LreplaceObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_LreverseObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_LsearchObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_LsetObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_LsortObjCmd; -MODULE_SCOPE Tcl_Command TclInitNamespaceCmd(Tcl_Interp *interp); -MODULE_SCOPE Tcl_ObjCmdProc TclNamespaceEnsembleCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_OpenObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_PackageObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_PidObjCmd; -MODULE_SCOPE Tcl_Command TclInitPrefixCmd(Tcl_Interp *interp); -MODULE_SCOPE Tcl_ObjCmdProc Tcl_PutsObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_PwdObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_ReadObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_RegexpObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_RegsubObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_RenameObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_RepresentationCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_ReturnObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_ScanObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_SeekObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_SetObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_SplitObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_SocketObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_SourceObjCmd; +MODULE_SCOPE int Tcl_InterpObjCmd(ClientData clientData, + Tcl_Interp *interp, int argc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_JoinObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_LappendObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_LassignObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_LindexObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_LinsertObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_LlengthObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_ListObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_LoadObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_LrangeObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_LrepeatObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_LreplaceObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_LreverseObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_LsearchObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_LsetObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_LsortObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_NamespaceObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_OpenObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_PackageObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_PidObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_PutsObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_PwdObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_ReadObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_RegexpObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_RegsubObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_RenameObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_ReturnObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_ScanObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_SeekObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_SetObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_SplitObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_SocketObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_SourceObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); MODULE_SCOPE Tcl_Command TclInitStringCmd(Tcl_Interp *interp); -MODULE_SCOPE Tcl_ObjCmdProc Tcl_SubstObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_SwitchObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_TellObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_ThrowObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_TimeObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_TraceObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_TryObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_UnloadObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_UnsetObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_UpdateObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_UplevelObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_UpvarObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_VariableObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_VwaitObjCmd; -MODULE_SCOPE Tcl_ObjCmdProc Tcl_WhileObjCmd; - -MODULE_SCOPE Tcl_ObjCmdProc TclAddOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclAndOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclDivOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclEqOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclGeqOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclGreaterOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclInOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclInvertOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclLeqOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclLessOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclLshiftOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclMinusOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclModOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclMulOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclNeqOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclNiOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclNotOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclOrOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclPowOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclRshiftOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclStreqOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclStrneqOpCmd; -MODULE_SCOPE Tcl_ObjCmdProc TclXorOpCmd; +MODULE_SCOPE int Tcl_SubstObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_SwitchObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_TellObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_TimeObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_TraceObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_UnloadObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_UnsetObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_UpdateObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_UplevelObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_UpvarObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_VariableObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_VwaitObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_WhileObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); /* *---------------------------------------------------------------- @@ -3345,107 +3047,262 @@ MODULE_SCOPE Tcl_ObjCmdProc TclXorOpCmd; *---------------------------------------------------------------- */ -MODULE_SCOPE CompileProc TclCompileAppendCmd; -MODULE_SCOPE CompileProc TclCompileArrayExistsCmd; -MODULE_SCOPE CompileProc TclCompileArraySetCmd; -MODULE_SCOPE CompileProc TclCompileArrayUnsetCmd; -MODULE_SCOPE CompileProc TclCompileAssembleCmd; -MODULE_SCOPE CompileProc TclCompileBreakCmd; -MODULE_SCOPE CompileProc TclCompileCatchCmd; -MODULE_SCOPE CompileProc TclCompileContinueCmd; -MODULE_SCOPE CompileProc TclCompileDictAppendCmd; -MODULE_SCOPE CompileProc TclCompileDictCreateCmd; -MODULE_SCOPE CompileProc TclCompileDictExistsCmd; -MODULE_SCOPE CompileProc TclCompileDictForCmd; -MODULE_SCOPE CompileProc TclCompileDictGetCmd; -MODULE_SCOPE CompileProc TclCompileDictIncrCmd; -MODULE_SCOPE CompileProc TclCompileDictLappendCmd; -MODULE_SCOPE CompileProc TclCompileDictMapCmd; -MODULE_SCOPE CompileProc TclCompileDictMergeCmd; -MODULE_SCOPE CompileProc TclCompileDictSetCmd; -MODULE_SCOPE CompileProc TclCompileDictUnsetCmd; -MODULE_SCOPE CompileProc TclCompileDictUpdateCmd; -MODULE_SCOPE CompileProc TclCompileDictWithCmd; -MODULE_SCOPE CompileProc TclCompileEnsemble; -MODULE_SCOPE CompileProc TclCompileErrorCmd; -MODULE_SCOPE CompileProc TclCompileExprCmd; -MODULE_SCOPE CompileProc TclCompileForCmd; -MODULE_SCOPE CompileProc TclCompileForeachCmd; -MODULE_SCOPE CompileProc TclCompileFormatCmd; -MODULE_SCOPE CompileProc TclCompileGlobalCmd; -MODULE_SCOPE CompileProc TclCompileIfCmd; -MODULE_SCOPE CompileProc TclCompileInfoCommandsCmd; -MODULE_SCOPE CompileProc TclCompileInfoCoroutineCmd; -MODULE_SCOPE CompileProc TclCompileInfoExistsCmd; -MODULE_SCOPE CompileProc TclCompileInfoLevelCmd; -MODULE_SCOPE CompileProc TclCompileInfoObjectClassCmd; -MODULE_SCOPE CompileProc TclCompileInfoObjectIsACmd; -MODULE_SCOPE CompileProc TclCompileInfoObjectNamespaceCmd; -MODULE_SCOPE CompileProc TclCompileIncrCmd; -MODULE_SCOPE CompileProc TclCompileLappendCmd; -MODULE_SCOPE CompileProc TclCompileLassignCmd; -MODULE_SCOPE CompileProc TclCompileLindexCmd; -MODULE_SCOPE CompileProc TclCompileListCmd; -MODULE_SCOPE CompileProc TclCompileLlengthCmd; -MODULE_SCOPE CompileProc TclCompileLmapCmd; -MODULE_SCOPE CompileProc TclCompileLrangeCmd; -MODULE_SCOPE CompileProc TclCompileLreplaceCmd; -MODULE_SCOPE CompileProc TclCompileLsetCmd; -MODULE_SCOPE CompileProc TclCompileNamespaceCodeCmd; -MODULE_SCOPE CompileProc TclCompileNamespaceCurrentCmd; -MODULE_SCOPE CompileProc TclCompileNamespaceQualifiersCmd; -MODULE_SCOPE CompileProc TclCompileNamespaceTailCmd; -MODULE_SCOPE CompileProc TclCompileNamespaceUpvarCmd; -MODULE_SCOPE CompileProc TclCompileNamespaceWhichCmd; -MODULE_SCOPE CompileProc TclCompileNoOp; -MODULE_SCOPE CompileProc TclCompileObjectSelfCmd; -MODULE_SCOPE CompileProc TclCompileRegexpCmd; -MODULE_SCOPE CompileProc TclCompileRegsubCmd; -MODULE_SCOPE CompileProc TclCompileReturnCmd; -MODULE_SCOPE CompileProc TclCompileSetCmd; -MODULE_SCOPE CompileProc TclCompileStringCmpCmd; -MODULE_SCOPE CompileProc TclCompileStringEqualCmd; -MODULE_SCOPE CompileProc TclCompileStringFirstCmd; -MODULE_SCOPE CompileProc TclCompileStringIndexCmd; -MODULE_SCOPE CompileProc TclCompileStringLastCmd; -MODULE_SCOPE CompileProc TclCompileStringLenCmd; -MODULE_SCOPE CompileProc TclCompileStringMapCmd; -MODULE_SCOPE CompileProc TclCompileStringMatchCmd; -MODULE_SCOPE CompileProc TclCompileStringRangeCmd; -MODULE_SCOPE CompileProc TclCompileSubstCmd; -MODULE_SCOPE CompileProc TclCompileSwitchCmd; -MODULE_SCOPE CompileProc TclCompileTailcallCmd; -MODULE_SCOPE CompileProc TclCompileThrowCmd; -MODULE_SCOPE CompileProc TclCompileTryCmd; -MODULE_SCOPE CompileProc TclCompileUnsetCmd; -MODULE_SCOPE CompileProc TclCompileUpvarCmd; -MODULE_SCOPE CompileProc TclCompileVariableCmd; -MODULE_SCOPE CompileProc TclCompileWhileCmd; -MODULE_SCOPE CompileProc TclCompileYieldCmd; - -MODULE_SCOPE CompileProc TclCompileAddOpCmd; -MODULE_SCOPE CompileProc TclCompileAndOpCmd; -MODULE_SCOPE CompileProc TclCompileDivOpCmd; -MODULE_SCOPE CompileProc TclCompileEqOpCmd; -MODULE_SCOPE CompileProc TclCompileGeqOpCmd; -MODULE_SCOPE CompileProc TclCompileGreaterOpCmd; -MODULE_SCOPE CompileProc TclCompileInOpCmd; -MODULE_SCOPE CompileProc TclCompileInvertOpCmd; -MODULE_SCOPE CompileProc TclCompileLeqOpCmd; -MODULE_SCOPE CompileProc TclCompileLessOpCmd; -MODULE_SCOPE CompileProc TclCompileLshiftOpCmd; -MODULE_SCOPE CompileProc TclCompileMinusOpCmd; -MODULE_SCOPE CompileProc TclCompileModOpCmd; -MODULE_SCOPE CompileProc TclCompileMulOpCmd; -MODULE_SCOPE CompileProc TclCompileNeqOpCmd; -MODULE_SCOPE CompileProc TclCompileNiOpCmd; -MODULE_SCOPE CompileProc TclCompileNotOpCmd; -MODULE_SCOPE CompileProc TclCompileOrOpCmd; -MODULE_SCOPE CompileProc TclCompilePowOpCmd; -MODULE_SCOPE CompileProc TclCompileRshiftOpCmd; -MODULE_SCOPE CompileProc TclCompileStreqOpCmd; -MODULE_SCOPE CompileProc TclCompileStrneqOpCmd; -MODULE_SCOPE CompileProc TclCompileXorOpCmd; +MODULE_SCOPE int TclCompileAppendCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileBreakCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileCatchCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileContinueCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileDictAppendCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileDictForCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileDictGetCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileDictIncrCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileDictLappendCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileDictSetCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileDictUpdateCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileEnsemble(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileExprCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileForCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileForeachCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileGlobalCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileIfCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileInfoExistsCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileIncrCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileLappendCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileLassignCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileLindexCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileListCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileLlengthCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileLsetCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileNamespaceCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileNoOp(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileRegexpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileReturnCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileSetCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileStringCmpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileStringEqualCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileStringIndexCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileStringLenCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileStringMatchCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileSwitchCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileUpvarCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileVariableCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclCompileWhileCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); + +MODULE_SCOPE int TclInvertOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileInvertOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclNotOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileNotOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclAddOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileAddOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclMulOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileMulOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclAndOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileAndOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclOrOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileOrOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclXorOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileXorOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclPowOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompilePowOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclLshiftOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileLshiftOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclRshiftOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileRshiftOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclModOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileModOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclNeqOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileNeqOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclStrneqOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileStrneqOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclInOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileInOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclNiOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileNiOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclMinusOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileMinusOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclDivOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileDivOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclLessOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileLessOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclLeqOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileLeqOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclGreaterOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileGreaterOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclGeqOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileGeqOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclEqOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileEqOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); +MODULE_SCOPE int TclStreqOpCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +MODULE_SCOPE int TclCompileStreqOpCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr); /* * Functions defined in generic/tclVar.c and currenttly exported only for use @@ -3475,9 +3332,6 @@ MODULE_SCOPE Tcl_Obj * TclPtrIncrObjVar(Tcl_Interp *interp, const int flags, int index); MODULE_SCOPE int TclPtrObjMakeUpvar(Tcl_Interp *interp, Var *otherPtr, Tcl_Obj *myNamePtr, int myFlags, int index); -MODULE_SCOPE int TclPtrUnsetVar(Tcl_Interp *interp, Var *varPtr, - Var *arrayPtr, Tcl_Obj *part1Ptr, - Tcl_Obj *part2Ptr, const int flags, int index); MODULE_SCOPE void TclInvalidateNsPath(Namespace *nsPtr); /* @@ -3496,8 +3350,6 @@ MODULE_SCOPE int TclCompareObjKeys(void *keyPtr, Tcl_HashEntry *hPtr); MODULE_SCOPE void TclFreeObjEntry(Tcl_HashEntry *hPtr); MODULE_SCOPE unsigned TclHashObjKey(Tcl_HashTable *tablePtr, void *keyPtr); -MODULE_SCOPE int TclFullFinalizationRequested(void); - /* *---------------------------------------------------------------- * Macros used by the Tcl core to create and release Tcl objects. @@ -3524,10 +3376,7 @@ MODULE_SCOPE int TclFullFinalizationRequested(void); */ #ifdef USE_DTRACE -#ifndef _TCLDTRACE_H -typedef const char *TclDTraceStr; #include "tclDTrace.h" -#endif #define TCL_DTRACE_OBJ_CREATE(objPtr) TCL_OBJ_CREATE(objPtr) #define TCL_DTRACE_OBJ_FREE(objPtr) TCL_OBJ_FREE(objPtr) #else /* USE_DTRACE */ @@ -3545,48 +3394,38 @@ typedef const char *TclDTraceStr; # define TclIncrObjsFreed() #endif /* TCL_COMPILE_STATS */ -# define TclAllocObjStorage(objPtr) \ - TclAllocObjStorageEx(NULL, (objPtr)) - -# define TclFreeObjStorage(objPtr) \ - TclFreeObjStorageEx(NULL, (objPtr)) - #ifndef TCL_MEM_DEBUG # define TclNewObj(objPtr) \ - do { \ - TclIncrObjsAllocated(); \ - TclAllocObjStorage(objPtr); \ - (objPtr)->refCount = 0; \ - (objPtr)->bytes = tclEmptyStringRep; \ - (objPtr)->length = 0; \ - (objPtr)->typePtr = NULL; \ - TCL_DTRACE_OBJ_CREATE(objPtr); \ - } while (0) + TclIncrObjsAllocated(); \ + TclAllocObjStorage(objPtr); \ + (objPtr)->refCount = 0; \ + (objPtr)->bytes = tclEmptyStringRep; \ + (objPtr)->length = 0; \ + (objPtr)->typePtr = NULL; \ + TCL_DTRACE_OBJ_CREATE(objPtr) /* * Invalidate the string rep first so we can use the bytes value for our * pointer chain, and signal an obj deletion (as opposed to shimmering) with - * 'length == TCL_STRLEN'. + * 'length == -1'. + * Use empty 'if ; else' to handle use in unbraced outer if/else conditions. */ # define TclDecrRefCount(objPtr) \ - do { \ - if (--(objPtr)->refCount > 0) { \ - break; \ - } \ + if (--(objPtr)->refCount > 0) ; else { \ if (!(objPtr)->typePtr || !(objPtr)->typePtr->freeIntRepProc) { \ - TCL_DTRACE_OBJ_FREE(objPtr); \ - if ((objPtr)->bytes \ - && ((objPtr)->bytes != tclEmptyStringRep)) { \ - ckfree((char *) (objPtr)->bytes); \ - } \ - (objPtr)->length = TCL_STRLEN; \ - TclFreeObjStorage(objPtr); \ - TclIncrObjsFreed(); \ - } else { \ - TclFreeObj(objPtr); \ - } \ - } while (0) + TCL_DTRACE_OBJ_FREE(objPtr); \ + if ((objPtr)->bytes \ + && ((objPtr)->bytes != tclEmptyStringRep)) { \ + ckfree((char *) (objPtr)->bytes); \ + } \ + (objPtr)->length = -1; \ + TclFreeObjStorage(objPtr); \ + TclIncrObjsFreed(); \ + } else { \ + TclFreeObj(objPtr); \ + } \ + } #if defined(PURIFY) @@ -3597,10 +3436,10 @@ typedef const char *TclDTraceStr; * track memory leaks. */ -# define TclAllocObjStorageEx(interp, objPtr) \ +# define TclAllocObjStorage(objPtr) \ (objPtr) = (Tcl_Obj *) Tcl_Alloc(sizeof(Tcl_Obj)) -# define TclFreeObjStorageEx(interp, objPtr) \ +# define TclFreeObjStorage(objPtr) \ ckfree((char *) (objPtr)) #undef USE_THREAD_ALLOC @@ -3620,43 +3459,11 @@ MODULE_SCOPE void TclpSetAllocCache(void *); MODULE_SCOPE void TclpFreeAllocMutex(Tcl_Mutex *mutex); MODULE_SCOPE void TclpFreeAllocCache(void *); -/* - * These macros need to be kept in sync with the code of TclThreadAllocObj() - * and TclThreadFreeObj(). - * - * Note that the optimiser should resolve the case (interp==NULL) at compile - * time. - */ - -# define ALLOC_NOBJHIGH 1200 - -# define TclAllocObjStorageEx(interp, objPtr) \ - do { \ - AllocCache *cachePtr; \ - if (((interp) == NULL) || \ - ((cachePtr = ((Interp *)(interp))->allocCache), \ - (cachePtr->numObjects == 0))) { \ - (objPtr) = TclThreadAllocObj(); \ - } else { \ - (objPtr) = cachePtr->firstObjPtr; \ - cachePtr->firstObjPtr = (objPtr)->internalRep.otherValuePtr; \ - --cachePtr->numObjects; \ - } \ - } while (0) - -# define TclFreeObjStorageEx(interp, objPtr) \ - do { \ - AllocCache *cachePtr; \ - if (((interp) == NULL) || \ - ((cachePtr = ((Interp *)(interp))->allocCache), \ - (cachePtr->numObjects >= ALLOC_NOBJHIGH))) { \ - TclThreadFreeObj(objPtr); \ - } else { \ - (objPtr)->internalRep.otherValuePtr = cachePtr->firstObjPtr; \ - cachePtr->firstObjPtr = objPtr; \ - ++cachePtr->numObjects; \ - } \ - } while (0) +# define TclAllocObjStorage(objPtr) \ + (objPtr) = TclThreadAllocObj() + +# define TclFreeObjStorage(objPtr) \ + TclThreadFreeObj((objPtr)) #else /* not PURIFY or USE_THREAD_ALLOC */ @@ -3672,39 +3479,32 @@ MODULE_SCOPE void TclpFreeAllocCache(void *); MODULE_SCOPE Tcl_Mutex tclObjMutex; #endif -# define TclAllocObjStorageEx(interp, objPtr) \ - do { \ - Tcl_MutexLock(&tclObjMutex); \ - if (tclFreeObjList == NULL) { \ - TclAllocateFreeObjects(); \ - } \ - (objPtr) = tclFreeObjList; \ - tclFreeObjList = (Tcl_Obj *) \ - tclFreeObjList->internalRep.otherValuePtr; \ - Tcl_MutexUnlock(&tclObjMutex); \ - } while (0) - -# define TclFreeObjStorageEx(interp, objPtr) \ - do { \ - Tcl_MutexLock(&tclObjMutex); \ - (objPtr)->internalRep.otherValuePtr = (void *) tclFreeObjList; \ - tclFreeObjList = (objPtr); \ - Tcl_MutexUnlock(&tclObjMutex); \ - } while (0) +# define TclAllocObjStorage(objPtr) \ + Tcl_MutexLock(&tclObjMutex); \ + if (tclFreeObjList == NULL) { \ + TclAllocateFreeObjects(); \ + } \ + (objPtr) = tclFreeObjList; \ + tclFreeObjList = (Tcl_Obj *) \ + tclFreeObjList->internalRep.twoPtrValue.ptr1; \ + Tcl_MutexUnlock(&tclObjMutex) + +# define TclFreeObjStorage(objPtr) \ + Tcl_MutexLock(&tclObjMutex); \ + (objPtr)->internalRep.twoPtrValue.ptr1 = (void *) tclFreeObjList; \ + tclFreeObjList = (objPtr); \ + Tcl_MutexUnlock(&tclObjMutex) #endif #else /* TCL_MEM_DEBUG */ -MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, +MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, CONST char *file, int line); # define TclDbNewObj(objPtr, file, line) \ - do { \ - TclIncrObjsAllocated(); \ - (objPtr) = (Tcl_Obj *) \ - Tcl_DbCkalloc(sizeof(Tcl_Obj), (file), (line)); \ - TclDbInitNewObj((objPtr), (file), (line)); \ - TCL_DTRACE_OBJ_CREATE(objPtr); \ - } while (0) + TclIncrObjsAllocated(); \ + (objPtr) = (Tcl_Obj *) Tcl_DbCkalloc(sizeof(Tcl_Obj), (file), (line)); \ + TclDbInitNewObj((objPtr), (file), (line)); \ + TCL_DTRACE_OBJ_CREATE(objPtr) # define TclNewObj(objPtr) \ TclDbNewObj(objPtr, __FILE__, __LINE__); @@ -3726,7 +3526,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, * is referenced multiple times, it should be as simple an expression as * possible. The ANSI C "prototype" for this macro is: * - * MODULE_SCOPE void TclInitStringRep(Tcl_Obj *objPtr, char *bytePtr, size_t len); + * MODULE_SCOPE void TclInitStringRep(Tcl_Obj *objPtr, char *bytePtr, int len); * * This macro should only be called on an unshared objPtr where * objPtr->typePtr->freeIntRepProc == NULL @@ -3734,14 +3534,15 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, */ #define TclInitStringRep(objPtr, bytePtr, len) \ - if ((len) == 0) { \ - (objPtr)->bytes = tclEmptyStringRep; \ - (objPtr)->length = 0; \ - } else { \ - (objPtr)->bytes = ckalloc((unsigned) ((len) + 1)); \ - memcpy((objPtr)->bytes, (bytePtr), (len)); \ - (objPtr)->bytes[len] = '\0'; \ - (objPtr)->length = (len); \ + if ((len) == 0) { \ + (objPtr)->bytes = tclEmptyStringRep; \ + (objPtr)->length = 0; \ + } else { \ + (objPtr)->bytes = (char *) ckalloc((unsigned) ((len) + 1)); \ + memcpy((void *) (objPtr)->bytes, (void *) (bytePtr), \ + (unsigned) (len)); \ + (objPtr)->bytes[len] = '\0'; \ + (objPtr)->length = (len); \ } /* @@ -3760,8 +3561,8 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, ((objPtr)->bytes? (objPtr)->bytes : Tcl_GetString((objPtr))) #define TclGetStringFromObj(objPtr, lenPtr) \ - ((objPtr)->bytes \ - ? (*(lenPtr) = (objPtr)->length, (objPtr)->bytes) \ + ((objPtr)->bytes \ + ? (*(lenPtr) = (objPtr)->length, (objPtr)->bytes) \ : Tcl_GetStringFromObj((objPtr), (lenPtr))) /* @@ -3775,11 +3576,9 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, */ #define TclFreeIntRep(objPtr) \ - if ((objPtr)->typePtr == NULL) ; else { \ - if ((objPtr)->typePtr->freeIntRepProc != NULL) { \ - (objPtr)->typePtr->freeIntRepProc(objPtr); \ - } \ - (objPtr)->typePtr = NULL; \ + if ((objPtr)->typePtr != NULL && \ + (objPtr)->typePtr->freeIntRepProc != NULL) { \ + (objPtr)->typePtr->freeIntRepProc(objPtr); \ } /* @@ -3792,11 +3591,11 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, */ #define TclInvalidateStringRep(objPtr) \ - if ((objPtr)->bytes == NULL) ; else { \ - if ((objPtr)->bytes != tclEmptyStringRep) { \ - ckfree((char *) (objPtr)->bytes); \ - } \ - (objPtr)->bytes = NULL; \ + if (objPtr->bytes != NULL) { \ + if (objPtr->bytes != tclEmptyStringRep) { \ + ckfree((char *) objPtr->bytes); \ + } \ + objPtr->bytes = NULL; \ } /* @@ -3805,65 +3604,51 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, * growth algorithm as used in tclStringObj.c for growing strings. The ANSI C * "prototype" for this macro is: * - * MODULE_SCOPE void TclGrowTokenArray(Tcl_Token *tokenPtr, size_t used, - * size_t available, size_t append, + * MODULE_SCOPE void TclGrowTokenArray(Tcl_Token *tokenPtr, int used, + * int available, int append, * Tcl_Token *staticPtr); * MODULE_SCOPE void TclGrowParseTokenArray(Tcl_Parse *parsePtr, - * size_t append); + * int append); *---------------------------------------------------------------- */ -/* General tuning for minimum growth in Tcl growth algorithms */ -#ifndef TCL_MIN_GROWTH -# ifdef TCL_GROWTH_MIN_ALLOC - /* Support for any legacy tuners */ -# define TCL_MIN_GROWTH TCL_GROWTH_MIN_ALLOC -# else -# define TCL_MIN_GROWTH 1024 -# endif -#endif - -/* Token growth tuning, default to the general value. */ -#ifndef TCL_MIN_TOKEN_GROWTH -#define TCL_MIN_TOKEN_GROWTH TCL_MIN_GROWTH/sizeof(Tcl_Token) -#endif - #define TCL_MAX_TOKENS (int)(UINT_MAX / sizeof(Tcl_Token)) +#define TCL_MIN_TOKEN_GROWTH 50 #define TclGrowTokenArray(tokenPtr, used, available, append, staticPtr) \ - do { \ - size_t needed = (used) + (append); \ - if (needed > TCL_MAX_TOKENS) { \ - Tcl_Panic("max # of tokens for a Tcl parse (%d) exceeded", \ - TCL_MAX_TOKENS); \ +{ \ + int needed = (used) + (append); \ + if (needed > TCL_MAX_TOKENS) { \ + Tcl_Panic("max # of tokens for a Tcl parse (%d) exceeded", \ + TCL_MAX_TOKENS); \ + } \ + if (needed > (available)) { \ + int allocated = 2 * needed; \ + Tcl_Token *oldPtr = (tokenPtr); \ + Tcl_Token *newPtr; \ + if (oldPtr == (staticPtr)) { \ + oldPtr = NULL; \ } \ - if (needed > (available)) { \ - 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 *) attemptckrealloc((char *) oldPtr, \ + (unsigned int) (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 *) attemptckrealloc((char *) oldPtr, \ + newPtr = (Tcl_Token *) ckrealloc((char *) oldPtr, \ (unsigned int) (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 *) ckrealloc((char *) oldPtr, \ - (unsigned int) (allocated * sizeof(Tcl_Token))); \ - } \ - (available) = allocated; \ - if (oldPtr == NULL) { \ - memcpy(newPtr, staticPtr, \ - (size_t) ((used) * sizeof(Tcl_Token))); \ - } \ - (tokenPtr) = newPtr; \ } \ - } while (0) + (available) = allocated; \ + if (oldPtr == NULL) { \ + memcpy((VOID *) newPtr, (VOID *) staticPtr, \ + (size_t) ((used) * sizeof(Tcl_Token))); \ + } \ + (tokenPtr) = newPtr; \ + } \ +} #define TclGrowParseTokenArray(parsePtr, append) \ TclGrowTokenArray((parsePtr)->tokenPtr, (parsePtr)->numTokens, \ @@ -3883,39 +3668,12 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, */ #define TclUtfToUniChar(str, chPtr) \ - ((((unsigned char) *(str)) < 0xC0) ? \ + ((((unsigned char) *(str)) < 0xC0) ? \ ((*(chPtr) = (Tcl_UniChar) *(str)), 1) \ : Tcl_UtfToUniChar(str, chPtr)) /* *---------------------------------------------------------------- - * Macro counterpart of the Tcl_NumUtfChars() function. To be used in speed- - * -sensitive points where it pays to avoid a function call in the common case - * of counting along a string of all one-byte characters. The ANSI C - * "prototype" for this macro is: - * - * MODULE_SCOPE void TclNumUtfChars(size_t numChars, const char *bytes, - * size_t numBytes); - *---------------------------------------------------------------- - */ - -#define TclNumUtfChars(numChars, bytes, numBytes) \ - do { \ - size_t count, i = (numBytes); \ - unsigned char *str = (unsigned char *) (bytes); \ - while (i && (*str < 0xC0)) { \ - i--; \ - str++; \ - } \ - count = (numBytes) - i; \ - if (i) { \ - count += Tcl_NumUtfChars((bytes) + count, i); \ - } \ - (numChars) = count; \ - } while (0) - -/* - *---------------------------------------------------------------- * Macro that encapsulates the logic that determines when it is safe to * interpret a string as a byte array directly. In summary, the object must be * a byte array and must not have a string representation (as the operations @@ -3930,7 +3688,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, */ #define TclIsPureByteArray(objPtr) \ - (((objPtr)->typePtr==&tclByteArrayType) && ((objPtr)->bytes==NULL)) + (((objPtr)->typePtr==&tclByteArrayType) && ((objPtr)->bytes==NULL)) /* *---------------------------------------------------------------- @@ -3960,14 +3718,12 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, */ #define TclInvalidateNsCmdLookup(nsPtr) \ - do { \ - if ((nsPtr)->numExportPatterns) { \ - (nsPtr)->exportLookupEpoch++; \ - } \ - if ((nsPtr)->commandPathLength) { \ - (nsPtr)->cmdRefEpoch++; \ - } \ - } while (0) + if ((nsPtr)->numExportPatterns) { \ + (nsPtr)->exportLookupEpoch++; \ + } \ + if ((nsPtr)->commandPathLength) { \ + (nsPtr)->cmdRefEpoch++; \ + } /* *---------------------------------------------------------------------- @@ -3977,7 +3733,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, *---------------------------------------------------------------------- */ -MODULE_SCOPE Tcl_PackageInitProc TclTommath_Init; +MODULE_SCOPE int TclTommath_Init(Tcl_Interp *interp); MODULE_SCOPE void TclBNInitBignumFromLong(mp_int *bignum, long initVal); MODULE_SCOPE void TclBNInitBignumFromWideInt(mp_int *bignum, Tcl_WideInt initVal); @@ -3985,22 +3741,6 @@ MODULE_SCOPE void TclBNInitBignumFromWideUInt(mp_int *bignum, Tcl_WideUInt initVal); /* - *---------------------------------------------------------------------- - * - * External (platform specific) initialization routine, these declarations - * explicitly don't use EXTERN since this code does not get compiled into the - * library: - * - *---------------------------------------------------------------------- - */ - -MODULE_SCOPE Tcl_PackageInitProc TclplatformtestInit; -MODULE_SCOPE Tcl_PackageInitProc TclObjTest_Init; -MODULE_SCOPE Tcl_PackageInitProc TclThread_Init; -MODULE_SCOPE Tcl_PackageInitProc Procbodytest_Init; -MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; - -/* *---------------------------------------------------------------- * Macro used by the Tcl core to check whether a pattern has any characters * special to [string match]. The ANSI C "prototype" for this macro is: @@ -4009,8 +3749,7 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; *---------------------------------------------------------------- */ -#define TclMatchIsTrivial(pattern) \ - (strpbrk((pattern), "*[?\\") == NULL) +#define TclMatchIsTrivial(pattern) strpbrk((pattern), "*[?\\") == NULL /* *---------------------------------------------------------------- @@ -4028,12 +3767,10 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; */ #define TclSetIntObj(objPtr, i) \ - do { \ - TclInvalidateStringRep(objPtr); \ - TclFreeIntRep(objPtr); \ - (objPtr)->internalRep.longValue = (long)(i); \ - (objPtr)->typePtr = &tclIntType; \ - } while (0) + TclInvalidateStringRep(objPtr);\ + TclFreeIntRep(objPtr); \ + (objPtr)->internalRep.longValue = (long)(i); \ + (objPtr)->typePtr = &tclIntType #define TclSetLongObj(objPtr, l) \ TclSetIntObj((objPtr), (l)) @@ -4050,21 +3787,17 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; #ifndef NO_WIDE_TYPE #define TclSetWideIntObj(objPtr, w) \ - do { \ - TclInvalidateStringRep(objPtr); \ - TclFreeIntRep(objPtr); \ - (objPtr)->internalRep.wideValue = (Tcl_WideInt)(w); \ - (objPtr)->typePtr = &tclWideIntType; \ - } while (0) + TclInvalidateStringRep(objPtr);\ + TclFreeIntRep(objPtr); \ + (objPtr)->internalRep.wideValue = (Tcl_WideInt)(w); \ + (objPtr)->typePtr = &tclWideIntType #endif #define TclSetDoubleObj(objPtr, d) \ - do { \ - TclInvalidateStringRep(objPtr); \ - TclFreeIntRep(objPtr); \ - (objPtr)->internalRep.doubleValue = (double)(d); \ - (objPtr)->typePtr = &tclDoubleType; \ - } while (0) + TclInvalidateStringRep(objPtr);\ + TclFreeIntRep(objPtr); \ + (objPtr)->internalRep.doubleValue = (double)(d); \ + (objPtr)->typePtr = &tclDoubleType /* *---------------------------------------------------------------- @@ -4077,7 +3810,7 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; * MODULE_SCOPE void TclNewBooleanObj(Tcl_Obj *objPtr, int b); * MODULE_SCOPE void TclNewWideObj(Tcl_Obj *objPtr, Tcl_WideInt w); * MODULE_SCOPE void TclNewDoubleObj(Tcl_Obj *objPtr, double d); - * MODULE_SCOPE void TclNewStringObj(Tcl_Obj *objPtr, char *s, size_t len); + * MODULE_SCOPE void TclNewStringObj(Tcl_Obj *objPtr, char *s, int len); * MODULE_SCOPE void TclNewLiteralStringObj(Tcl_Obj*objPtr, char*sLiteral); * *---------------------------------------------------------------- @@ -4085,15 +3818,13 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; #ifndef TCL_MEM_DEBUG #define TclNewIntObj(objPtr, i) \ - do { \ - TclIncrObjsAllocated(); \ - TclAllocObjStorage(objPtr); \ - (objPtr)->refCount = 0; \ - (objPtr)->bytes = NULL; \ - (objPtr)->internalRep.longValue = (long)(i); \ - (objPtr)->typePtr = &tclIntType; \ - TCL_DTRACE_OBJ_CREATE(objPtr); \ - } while (0) + TclIncrObjsAllocated(); \ + TclAllocObjStorage(objPtr); \ + (objPtr)->refCount = 0; \ + (objPtr)->bytes = NULL; \ + (objPtr)->internalRep.longValue = (long)(i); \ + (objPtr)->typePtr = &tclIntType; \ + TCL_DTRACE_OBJ_CREATE(objPtr) #define TclNewLongObj(objPtr, l) \ TclNewIntObj((objPtr), (l)) @@ -4106,25 +3837,21 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; TclNewIntObj((objPtr), ((b)? 1 : 0)) #define TclNewDoubleObj(objPtr, d) \ - do { \ - TclIncrObjsAllocated(); \ - TclAllocObjStorage(objPtr); \ - (objPtr)->refCount = 0; \ - (objPtr)->bytes = NULL; \ - (objPtr)->internalRep.doubleValue = (double)(d); \ - (objPtr)->typePtr = &tclDoubleType; \ - TCL_DTRACE_OBJ_CREATE(objPtr); \ - } while (0) + TclIncrObjsAllocated(); \ + TclAllocObjStorage(objPtr); \ + (objPtr)->refCount = 0; \ + (objPtr)->bytes = NULL; \ + (objPtr)->internalRep.doubleValue = (double)(d); \ + (objPtr)->typePtr = &tclDoubleType; \ + TCL_DTRACE_OBJ_CREATE(objPtr) #define TclNewStringObj(objPtr, s, len) \ - do { \ - TclIncrObjsAllocated(); \ - TclAllocObjStorage(objPtr); \ - (objPtr)->refCount = 0; \ - TclInitStringRep((objPtr), (s), (len)); \ - (objPtr)->typePtr = NULL; \ - TCL_DTRACE_OBJ_CREATE(objPtr); \ - } while (0) + TclIncrObjsAllocated(); \ + TclAllocObjStorage(objPtr); \ + (objPtr)->refCount = 0; \ + TclInitStringRep((objPtr), (s), (len));\ + (objPtr)->typePtr = NULL; \ + TCL_DTRACE_OBJ_CREATE(objPtr) #else /* TCL_MEM_DEBUG */ #define TclNewIntObj(objPtr, i) \ @@ -4152,21 +3879,6 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; /* *---------------------------------------------------------------- - * Convenience macros for DStrings. - * The ANSI C "prototypes" for these macros are: - * - * MODULE_SCOPE char * TclDStringAppendLiteral(Tcl_DString *dsPtr, - * const char *sLiteral); - * MODULE_SCOPE void TclDStringClear(Tcl_DString *dsPtr); - */ - -#define TclDStringAppendLiteral(dsPtr, sLiteral) \ - Tcl_DStringAppend((dsPtr), (sLiteral), (int) (sizeof(sLiteral "") - 1)) -#define TclDStringClear(dsPtr) \ - Tcl_DStringSetLength((dsPtr), 0) - -/* - *---------------------------------------------------------------- * Macros used by the Tcl core to test for some special double values. * The ANSI C "prototypes" for these macros are: * @@ -4216,8 +3928,8 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; */ #define TclCleanupCommandMacro(cmdPtr) \ - if (--(cmdPtr)->refCount <= 0) { \ - ckfree((char *) (cmdPtr)); \ + if (--(cmdPtr)->refCount <= 0) { \ + ckfree((char *) (cmdPtr));\ } /* @@ -4243,184 +3955,11 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; ((limit).granularityTicker % (limit).timeGranularity == 0)))\ ? 1 : 0))) -/* - * Compile-time assertions: these produce a compile time error if the - * expression is not known to be true at compile time. If the assertion is - * known to be false, the compiler (or optimizer?) will error out with - * "division by zero". If the assertion cannot be evaluated at compile time, - * the compiler will error out with "non-static initializer". - * - * Adapted with permission from - * http://www.pixelbeat.org/programming/gcc/static_assert.html - */ - -#define TCL_CT_ASSERT(e) \ - {enum { ct_assert_value = 1/(!!(e)) };} - -/* - *---------------------------------------------------------------- - * Allocator for small structs (<=sizeof(Tcl_Obj)) using the Tcl_Obj pool. - * Only checked at compile time. - * - * ONLY USE FOR CONSTANT nBytes. - * - * DO NOT LET THEM CROSS THREAD BOUNDARIES - *---------------------------------------------------------------- - */ - -#define TclSmallAlloc(nbytes, memPtr) \ - TclSmallAllocEx(NULL, (nbytes), (memPtr)) - -#define TclSmallFree(memPtr) \ - TclSmallFreeEx(NULL, (memPtr)) - -#ifndef TCL_MEM_DEBUG -#define TclSmallAllocEx(interp, nbytes, memPtr) \ - do { \ - Tcl_Obj *objPtr; \ - TCL_CT_ASSERT((nbytes)<=sizeof(Tcl_Obj)); \ - TclIncrObjsAllocated(); \ - TclAllocObjStorageEx((interp), (objPtr)); \ - memPtr = (ClientData) (objPtr); \ - } while (0) - -#define TclSmallFreeEx(interp, memPtr) \ - do { \ - TclFreeObjStorageEx((interp), (Tcl_Obj *) (memPtr)); \ - TclIncrObjsFreed(); \ - } while (0) - -#else /* TCL_MEM_DEBUG */ -#define TclSmallAllocEx(interp, nbytes, memPtr) \ - do { \ - Tcl_Obj *objPtr; \ - TCL_CT_ASSERT((nbytes)<=sizeof(Tcl_Obj)); \ - TclNewObj(objPtr); \ - memPtr = (ClientData) objPtr; \ - } while (0) - -#define TclSmallFreeEx(interp, memPtr) \ - do { \ - Tcl_Obj *objPtr = (Tcl_Obj *) memPtr; \ - objPtr->bytes = NULL; \ - objPtr->typePtr = NULL; \ - objPtr->refCount = 1; \ - TclDecrRefCount(objPtr); \ - } while (0) -#endif /* TCL_MEM_DEBUG */ - -/* - * Support for Clang Static Analyzer <http://clang-analyzer.llvm.org> - */ - -#if defined(PURIFY) && defined(__clang__) -#if __has_feature(attribute_analyzer_noreturn) && \ - !defined(Tcl_Panic) && defined(Tcl_Panic_TCL_DECLARED) -void Tcl_Panic(const char *, ...) __attribute__((analyzer_noreturn)); -#endif -#if !defined(CLANG_ASSERT) -#include <assert.h> -#define CLANG_ASSERT(x) assert(x) -#endif -#elif !defined(CLANG_ASSERT) -#define CLANG_ASSERT(x) -#endif /* PURIFY && __clang__ */ - -/* - *---------------------------------------------------------------- - * Parameters, structs and macros for the non-recursive engine (NRE) - *---------------------------------------------------------------- - */ - -#define NRE_USE_SMALL_ALLOC 1 /* Only turn off for debugging purposes. */ -#define NRE_ENABLE_ASSERTS 1 - -/* - * This is the main data struct for representing NR commands. It is designed - * to fit in sizeof(Tcl_Obj) in order to exploit the fastest memory allocator - * available. - */ - -typedef struct NRE_callback { - Tcl_NRPostProc *procPtr; - ClientData data[4]; - struct NRE_callback *nextPtr; -} NRE_callback; - -#define TOP_CB(iPtr) (((Interp *)(iPtr))->execEnvPtr->callbackPtr) - -/* - * Inline version of Tcl_NRAddCallback. - */ - -#define TclNRAddCallback(interp,postProcPtr,data0,data1,data2,data3) \ - do { \ - NRE_callback *callbackPtr; \ - TCLNR_ALLOC((interp), (callbackPtr)); \ - callbackPtr->procPtr = (postProcPtr); \ - callbackPtr->data[0] = (ClientData)(data0); \ - callbackPtr->data[1] = (ClientData)(data1); \ - callbackPtr->data[2] = (ClientData)(data2); \ - callbackPtr->data[3] = (ClientData)(data3); \ - callbackPtr->nextPtr = TOP_CB(interp); \ - TOP_CB(interp) = callbackPtr; \ - } while (0) - -#define TclNRDeferCallback(interp,postProcPtr,data0,data1,data2,data3) \ - do { \ - NRE_callback *callbackPtr; \ - TCLNR_ALLOC((interp), (callbackPtr)); \ - callbackPtr->procPtr = (postProcPtr); \ - callbackPtr->data[0] = (ClientData)(data0); \ - callbackPtr->data[1] = (ClientData)(data1); \ - callbackPtr->data[2] = (ClientData)(data2); \ - callbackPtr->data[3] = (ClientData)(data3); \ - callbackPtr->nextPtr = ((Interp *)interp)->deferredCallbacks; \ - ((Interp *)interp)->deferredCallbacks = callbackPtr; \ - } while (0) - -#define TclNRSpliceCallbacks(interp, topPtr) \ - do { \ - NRE_callback *bottomPtr = topPtr; \ - while (bottomPtr->nextPtr) { \ - bottomPtr = bottomPtr->nextPtr; \ - } \ - bottomPtr->nextPtr = TOP_CB(interp); \ - TOP_CB(interp) = topPtr; \ - } while (0) - -#define TclNRSpliceDeferred(interp) \ - if (((Interp *)interp)->deferredCallbacks) { \ - TclNRSpliceCallbacks(interp, ((Interp *)interp)->deferredCallbacks); \ - ((Interp *)interp)->deferredCallbacks = NULL; \ - } - -#if NRE_USE_SMALL_ALLOC -#define TCLNR_ALLOC(interp, ptr) \ - TclSmallAllocEx(interp, sizeof(NRE_callback), (ptr)) -#define TCLNR_FREE(interp, ptr) TclSmallFreeEx((interp), (ptr)) -#else -#define TCLNR_ALLOC(interp, ptr) \ - (ptr = ((ClientData) ckalloc(sizeof(NRE_callback)))) -#define TCLNR_FREE(interp, ptr) ckfree((char *) (ptr)) -#endif - -#if NRE_ENABLE_ASSERTS -#define NRE_ASSERT(expr) assert((expr)) -#else -#define NRE_ASSERT(expr) -#endif #include "tclIntDecls.h" #include "tclIntPlatDecls.h" #include "tclTomMathDecls.h" -#if !defined(USE_TCL_STUBS) && !defined(TCL_MEM_DEBUG) -#define Tcl_AttemptAlloc(size) TclpAlloc(size) -#define Tcl_AttemptRealloc(ptr, size) TclpRealloc((ptr), (size)) -#define Tcl_Free(ptr) TclpFree(ptr) -#endif - #endif /* _TCLINT */ /* |
