⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tclint.h

📁 tcl是工具命令语言
💻 H
📖 第 1 页 / 共 5 页
字号:
 * When an interpreter trace is active (i.e. its associated procedure * is executing), one of the following structures is linked into a list * associated with the interpreter.  The information in the structure * is needed in order for Tcl to behave reasonably if traces are * deleted while traces are active. */typedef struct ActiveInterpTrace {    struct ActiveInterpTrace *nextPtr;				/* Next in list of all active command				 * traces for the interpreter, or NULL				 * if no more. */    Trace *nextTracePtr;	/* Next trace to check after current				 * trace procedure returns;  if this				 * trace gets deleted, must update pointer				 * to avoid using free'd memory. */} ActiveInterpTrace;/* * The structure below defines an entry in the assocData hash table which * is associated with an interpreter. The entry contains a pointer to a * function to call when the interpreter is deleted, and a pointer to * a user-defined piece of data. */typedef struct AssocData {    Tcl_InterpDeleteProc *proc;	/* Proc to call when deleting. */    ClientData clientData;	/* Value to pass to proc. */} AssocData;	/* * The structure below defines a call frame. A call frame defines a naming * context for a procedure call: its local naming scope (for local * variables) and its global naming scope (a namespace, perhaps the global * :: namespace). A call frame can also define the naming context for a * namespace eval or namespace inscope command: the namespace in which the * command's code should execute. The Tcl_CallFrame structures exist only * while procedures or namespace eval/inscope's are being executed, and * provide a kind of Tcl call stack. *  * WARNING!! The structure definition must be kept consistent with the * Tcl_CallFrame structure in tcl.h. If you change one, change the other. */typedef struct CallFrame {    Namespace *nsPtr;		/* Points to the namespace used to resolve				 * commands and global variables. */    int isProcCallFrame;	/* If nonzero, the frame was pushed to				 * execute a Tcl procedure and may have				 * local vars. If 0, the frame was pushed				 * 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 and procedures related to TclHandles, which * are a very lightweight method of preserving enough information * to determine if an arbitrary malloc'd block has been deleted. *---------------------------------------------------------------- */typedef VOID **TclHandle;/* *---------------------------------------------------------------- * 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;/* * These are a thin layer over TclpThreadKeyDataGet and TclpThreadKeyDataSet * when threads are used, or an emulation if there are no threads.  These * are really internal and Tcl clients should use Tcl_GetThreadData. */EXTERN VOID *TclThreadDataKeyGet _ANSI_ARGS_((Tcl_ThreadDataKey *keyPtr));EXTERN void TclThreadDataKeySet _ANSI_ARGS_((Tcl_ThreadDataKey *keyPtr, VOID *data));/* * This is a convenience macro used to initialize a thread local storage ptr. */#define TCL_TSD_INIT(keyPtr)	(ThreadSpecificData *)Tcl_GetThreadData((keyPtr), sizeof(ThreadSpecificData))/* *---------------------------------------------------------------- * Data structures related to bytecode compilation and execution. * These are used primarily in tclCompile.c, tclExecute.c, and * tclBasic.c. *---------------------------------------------------------------- *//* * Forward declaration to prevent errors when the forward references to * Tcl_Parse and CompileEnv are 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,	Tcl_Parse *parsePtr, struct CompileEnv *compEnvPtr));/* * The type of procedure called from the compilation hook point in * SetByteCodeFromAny. */typedef int (CompileHookProc) _ANSI_ARGS_((Tcl_Interp *interp,	struct CompileEnv *compEnvPtr, ClientData clientData));/* * 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 struct ExecEnv {    Tcl_Obj **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. */    Tcl_Obj *errorInfo;    Tcl_Obj *errorCode;} ExecEnv;/* * The definitions for the LiteralTable and LiteralEntry structures. Each * interpreter contains a LiteralTable. It is used to reduce the storage * needed for all the Tcl objects that hold the literals of scripts compiled * by the interpreter. A literal's object is shared by all the ByteCodes * that refer to the literal. Each distinct literal has one LiteralEntry * entry in the LiteralTable. A literal table is a specialized hash table * that is indexed by the literal's string representation, which may contain * null characters. * * Note that we reduce the space needed for literals by sharing literal * objects both within a ByteCode (each ByteCode contains a local * LiteralTable) and across all an interpreter's ByteCodes (with the * interpreter's global LiteralTable). */typedef struct LiteralEntry {    struct LiteralEntry *nextPtr;	/* Points to next entry in this					 * hash bucket or NULL if end of					 * chain. */    Tcl_Obj *objPtr;			/* Points to Tcl object that					 * holds the literal's bytes and					 * length. */    int refCount;			/* If in an interpreter's global					 * literal table, the number of					 * ByteCode structures that share					 * the literal object; the literal					 * entry can be freed when refCount					 * drops to 0. If in a local literal					 * table, -1. */} LiteralEntry;typedef struct LiteralTable {    LiteralEntry **buckets;		/* Pointer to bucket array. Each					 * element points to first entry in					 * bucket's hash chain, or NULL. */    LiteralEntry *staticBuckets[TCL_SMALL_HASH_TABLE];					/* Bucket array used for small					 * tables to avoid mallocs and					 * frees. */    int numBuckets;			/* Total number of buckets allocated					 * at **buckets. */    int numEntries;			/* Total number of entries present					 * in table. */    int rebuildSize;			/* Enlarge table when numEntries					 * gets to be this large. */    int mask;				/* Mask value used in hashing					 * function. */} LiteralTable;/* * The following structure defines for each Tcl interpreter various * statistics-related information about the bytecode compiler and * interpreter's operation in that interpreter. */#ifdef TCL_COMPILE_STATStypedef struct ByteCodeStats {    long numExecutions;		  /* Number of ByteCodes executed. */    long numCompilations;	  /* Number of ByteCodes created. */    long numByteCodesFreed;	  /* Number of ByteCodes destroyed. */    long instructionCount[256];	  /* Number of times each instruction was				   * executed. */    double totalSrcBytes;	  /* Total source bytes ever compiled. */    double totalByteCodeBytes;	  /* Total bytes for all ByteCodes. */    double currentSrcBytes;	  /* Src bytes for all current ByteCodes. */    double currentByteCodeBytes;  /* Code bytes in all current ByteCodes. */    long srcCount[32];		  /* Source size distribution: # of srcs of				   * size [2**(n-1)..2**n), n in [0..32). */    long byteCodeCount[32];	  /* ByteCode size distribution. */    long lifetimeCount[32];	  /* ByteCode lifetime distribution (ms). */        double currentInstBytes;	  /* Instruction bytes-current ByteCodes. */    double currentLitBytes;	  /* Current literal bytes. */    double currentExceptBytes;	  /* Current exception table bytes. */    double currentAuxBytes;	  /* Current auxiliary information bytes. */    double currentCmdMapBytes;	  /* Current src<->code map bytes. */        long numLiteralsCreated;	  /* Total literal objects ever compiled. */    double totalLitStringBytes;	  /* Total string bytes in all literals. */    double currentLitStringBytes; /* String bytes in current literals. */    long literalCount[32];	  /* Distribution of literal string sizes. */} ByteCodeStats;#endif /* TCL_COMPILE_STATS *//* *---------------------------------------------------------------- * 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. */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -