📄 tclint.h
字号:
* to execute a namespace command and var * references are treated as references to * namespace vars; varTablePtr and * compiledLocals are ignored. */ int objc; /* This and objv below describe the * arguments for this procedure call. */ Tcl_Obj *CONST *objv; /* Array of argument objects. */ struct CallFrame *callerPtr; /* Value of interp->framePtr when this * procedure was invoked (i.e. next higher * in stack of all active procedures). */ struct CallFrame *callerVarPtr; /* Value of interp->varFramePtr when this * procedure was invoked (i.e. determines * variable scoping within caller). Same * as callerPtr unless an "uplevel" command * or something equivalent was active in * the caller). */ int level; /* Level of this procedure, for "uplevel" * purposes (i.e. corresponds to nesting of * callerVarPtr's, not callerPtr's). 1 for * outermost procedure, 0 for top-level. */ Proc *procPtr; /* Points to the structure defining the * called procedure. Used to get information * such as the number of compiled local * variables (local variables assigned * entries ["slots"] in the compiledLocals * array below). */ Tcl_HashTable *varTablePtr; /* Hash table containing local variables not * recognized by the compiler, or created at * execution time through, e.g., upvar. * Initially NULL and created if needed. */ int numCompiledLocals; /* Count of local variables recognized by * the compiler including arguments. */ Var* compiledLocals; /* Points to the array of local variables * recognized by the compiler. The compiler * emits code that refers to these variables * using an index into this array. */} CallFrame;/* *---------------------------------------------------------------- * Data structures related to history. These are used primarily * in tclHistory.c *---------------------------------------------------------------- *//* * The structure below defines one history event (a previously-executed * command that can be re-executed in whole or in part). */typedef struct { char *command; /* String containing previously-executed * command. */ int bytesAvl; /* Total # of bytes available at *event (not * all are necessarily in use now). */} HistoryEvent;/* * The structure below defines a pending revision to the most recent * history event. Changes are linked together into a list and applied * during the next call to Tcl_RecordHistory. See the comments at the * beginning of tclHistory.c for information on revisions. */typedef struct HistoryRev { int firstIndex; /* Index of the first byte to replace in * current history event. */ int lastIndex; /* Index of last byte to replace in * current history event. */ int newSize; /* Number of bytes in newBytes. */ char *newBytes; /* Replacement for the range given by * firstIndex and lastIndex (malloced). */ struct HistoryRev *nextPtr; /* Next in chain of revisions to apply, or * NULL for end of list. */} HistoryRev;/* *---------------------------------------------------------------- * Data structures related to expressions. These are used only in * tclExpr.c. *---------------------------------------------------------------- *//* * The data structure below defines a math function (e.g. sin or hypot) * for use in Tcl expressions. */#define MAX_MATH_ARGS 5typedef struct MathFunc { int builtinFuncIndex; /* If this is a builtin math function, its * index in the array of builtin functions. * (tclCompilation.h lists these indices.) * The value is -1 if this is a new function * defined by Tcl_CreateMathFunc. The value * is also -1 if a builtin function is * replaced by a Tcl_CreateMathFunc call. */ int numArgs; /* Number of arguments for function. */ Tcl_ValueType argTypes[MAX_MATH_ARGS]; /* Acceptable types for each argument. */ Tcl_MathProc *proc; /* Procedure that implements this function. * NULL if isBuiltinFunc is 1. */ ClientData clientData; /* Additional argument to pass to the * function when invoking it. NULL if * isBuiltinFunc is 1. */} MathFunc;/* *---------------------------------------------------------------- * Data structures related to bytecode compilation and execution. * These are used primarily in tclCompile.c, tclExecute.c, and * tclBasic.c. *---------------------------------------------------------------- *//* * Forward declaration to prevent an error when the forward reference to * CompileEnv is encountered in the procedure type CompileProc declared * below. */struct CompileEnv;/* * The type of procedures called by the Tcl bytecode compiler to compile * commands. Pointers to these procedures are kept in the Command structure * describing each command. When a CompileProc returns, the interpreter's * result is set to error information, if any. In addition, the CompileProc * returns an integer value, which is one of the following: * * TCL_OK Compilation completed normally. * TCL_ERROR Compilation failed because of an error; * the interpreter's result describes what went wrong. * TCL_OUT_LINE_COMPILE Compilation failed because, e.g., the command is * too complex for effective inline compilation. The * CompileProc believes the command is legal but * should be compiled "out of line" by emitting code * to invoke its command procedure at runtime. */#define TCL_OUT_LINE_COMPILE (TCL_CONTINUE + 1)typedef int (CompileProc) _ANSI_ARGS_((Tcl_Interp *interp, char *string, char *lastChar, int compileFlags, struct CompileEnv *compEnvPtr));/* * The data structure defining the execution environment for ByteCode's. * There is one ExecEnv structure per Tcl interpreter. It holds the * evaluation stack that holds command operands and results. The stack grows * towards increasing addresses. The "stackTop" member is cached by * TclExecuteByteCode in a local variable: it must be set before calling * TclExecuteByteCode and will be restored by TclExecuteByteCode before it * returns. */typedef union StackItem { Tcl_Obj *o; /* Stack item as a pointer to a Tcl_Obj. */ int i; /* Stack item as an integer. */ VOID *p; /* Stack item as an arbitrary pointer. */} StackItem;typedef struct ExecEnv { StackItem *stackPtr; /* Points to the first item in the * evaluation stack on the heap. */ int stackTop; /* Index of current top of stack; -1 when * the stack is empty. */ int stackEnd; /* Index of last usable item in stack. */} ExecEnv;/* *---------------------------------------------------------------- * Data structures related to commands. *---------------------------------------------------------------- *//* * An imported command is created in an namespace when it imports a "real" * command from another namespace. An imported command has a Command * structure that points (via its ClientData value) to the "real" Command * structure in the source namespace's command table. The real command * records all the imported commands that refer to it in a list of ImportRef * structures so that they can be deleted when the real command is deleted. */typedef struct ImportRef { struct Command *importedCmdPtr; /* Points to the imported command created in * an importing namespace; this command * redirects its invocations to the "real" * command. */ struct ImportRef *nextPtr; /* Next element on the linked list of * imported commands that refer to the * "real" command. The real command deletes * these imported commands on this list when * it is deleted. */} ImportRef;/* * Data structure used as the ClientData of imported commands: commands * created in an namespace when it imports a "real" command from another * namespace. */typedef struct ImportedCmdData { struct Command *realCmdPtr; /* "Real" command that this imported command * refers to. */ struct Command *selfPtr; /* Pointer to this imported command. Needed * only when deleting it in order to remove * it from the real command's linked list of * imported commands that refer to it. */} ImportedCmdData;/* * A Command structure exists for each command in a namespace. The * Tcl_Command opaque type actually refers to these structures. */typedef struct Command { Tcl_HashEntry *hPtr; /* Pointer to the hash table entry that * refers to this command. The hash table is * either a namespace's command table or an * interpreter's hidden command table. This * pointer is used to get a command's name * from its Tcl_Command handle. NULL means * that the hash table entry has been * removed already (this can happen if * deleteProc causes the command to be * deleted or recreated). */ Namespace *nsPtr; /* Points to the namespace containing this * command. */ int refCount; /* 1 if in command hashtable plus 1 for each * reference from a CmdName Tcl object * representing a command's name in a * ByteCode instruction sequence. This * structure can be freed when refCount * becomes zero. */ int cmdEpoch; /* Incremented to invalidate any references * that point to this command when it is * renamed, deleted, hidden, or exposed. */ CompileProc *compileProc; /* Procedure called to compile command. NULL * if no compile proc exists for command. */ Tcl_ObjCmdProc *objProc; /* Object-based command procedure. */ ClientData objClientData; /* Arbitrary value passed to object proc. */ Tcl_CmdProc *proc; /* String-based command procedure. */ ClientData clientData; /* Arbitrary value passed to string proc. */ Tcl_CmdDeleteProc *deleteProc; /* Procedure invoked when deleting command * to, e.g., free all client data. */ ClientData deleteData; /* Arbitrary value passed to deleteProc. */ int deleted; /* Means that the command is in the process * of being deleted (its deleteProc is * currently executing). Other attempts to * delete the command should be ignored. */ ImportRef *importRefPtr; /* List of each imported Command created in * another namespace when this command is * imported. These imported commands * redirect invocations back to this * command. The list is used to remove all * those imported commands when deleting * this "real" command. */} Command;/* *---------------------------------------------------------------- * Data structures related to name resolution procedures. *---------------------------------------------------------------- *//* * The interpreter keeps a linked list of name resolution schemes. * The scheme for a namespace is consulted first, followed by the * list of schemes in an interpreter, followed by the default * name resolution in Tcl. Schemes are added/removed from the * interpreter's list by calling Tcl_AddInterpResolver and * Tcl_RemoveInterpResolver. */typedef struct ResolverScheme { char *name; /* Name identifying this scheme. */ Tcl_ResolveCmdProc *cmdResProc; /* Procedure handling command name * resolution. */ Tcl_ResolveVarProc *varResProc; /* Procedure handling variable name * resolution for variables that * can only be handled at runtime. */ Tcl_ResolveCompiledVarProc *compiledVarResProc; /* Procedure handling variable name * resolution at compile time. */ struct ResolverScheme *nextPtr; /* Pointer to next record in linked list. */} ResolverScheme;/* *---------------------------------------------------------------- * 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 tclBasic.c, but almost every Tcl * source file uses something in here. *---------------------------------------------------------------- */typedef struct Interp { /* * Note: the first three fields must match exactly the fields in * a Tcl_Interp struct (see tcl.h). If you change one, be sure to * change the other. * * The interpreter's result is held in both the string and the * objResultPtr fields. These fields hold, respectively, the result's * string or object value. The interpreter's result is always in the * result field if that is non-empty, otherwise it is in objResultPtr. * The two fields are kept consistent unless some C code sets * interp->result directly. Programs should not access result and * objResultPtr directly; instead, they should always get and set the * result using procedures such as Tcl_SetObjResult, Tcl_GetObjResult, * and Tcl_GetStringResult. See the SetResult man page for details. */ char *result; /* If the last command returned a string * result, this points to it. Should not be * accessed directly; see comment above. */ Tcl_FreeProc *freeProc; /* Zero means a string result is statically
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -