📄 tclint.h
字号:
* allocated. TCL_DYNAMIC means string * result was allocated with ckalloc and * should be freed with ckfree. Other values * give address of procedure to invoke to * free the string result. Tcl_Eval must * free it before executing next command. */ int errorLine; /* When TCL_ERROR is returned, this gives * the line number in the command where the * error occurred (1 means first line). */ Tcl_Obj *objResultPtr; /* If the last command returned an object * result, this points to it. Should not be * accessed directly; see comment above. */ Namespace *globalNsPtr; /* The interpreter's global namespace. */ Tcl_HashTable mathFuncTable;/* Contains all the math functions currently * defined for the interpreter. Indexed by * strings (function names); values have * type (MathFunc *). */ /* * Information related to procedures and variables. See tclProc.c * and tclvar.c for usage. */ int numLevels; /* Keeps track of how many nested calls to * Tcl_Eval are in progress for this * interpreter. It's used to delay deletion * of the table until all Tcl_Eval * invocations are completed. */ int maxNestingDepth; /* If numLevels exceeds this value then Tcl * assumes that infinite recursion has * occurred and it generates an error. */ CallFrame *framePtr; /* Points to top-most in stack of all nested * procedure invocations. NULL means there * are no active procedures. */ CallFrame *varFramePtr; /* Points to the call frame whose variables * are currently in use (same as framePtr * unless an "uplevel" command is * executing). NULL means no procedure is * active or "uplevel 0" is executing. */ ActiveVarTrace *activeTracePtr; /* First in list of active traces for * interp, or NULL if no active traces. */ int returnCode; /* Completion code to return if current * procedure exits with TCL_RETURN code. */ char *errorInfo; /* Value to store in errorInfo if returnCode * is TCL_ERROR. Malloc'ed, may be NULL */ char *errorCode; /* Value to store in errorCode if returnCode * is TCL_ERROR. Malloc'ed, may be NULL */ /* * Information used by Tcl_AppendResult to keep track of partial * results. See Tcl_AppendResult code for details. */ char *appendResult; /* Storage space for results generated * by Tcl_AppendResult. Malloc-ed. NULL * means not yet allocated. */ int appendAvl; /* Total amount of space available at * partialResult. */ int appendUsed; /* Number of non-null bytes currently * stored at partialResult. */ /* * A cache of compiled regular expressions. See Tcl_RegExpCompile * in tclUtil.c for details. */#define NUM_REGEXPS 5 char *patterns[NUM_REGEXPS];/* Strings corresponding to compiled * regular expression patterns. NULL * means that this slot isn't used. * Malloc-ed. */ int patLengths[NUM_REGEXPS];/* Number of non-null characters in * corresponding entry in patterns. * -1 means entry isn't used. */ regexp *regexps[NUM_REGEXPS]; /* Compiled forms of above strings. Also * malloc-ed, or NULL if not in use yet. */ /* * Information about packages. Used only in tclPkg.c. */ Tcl_HashTable packageTable; /* Describes all of the packages loaded * in or available to this interpreter. * Keys are package names, values are * (Package *) pointers. */ char *packageUnknown; /* Command to invoke during "package * require" commands for packages that * aren't described in packageTable. * Malloc'ed, may be NULL. */ /* * Miscellaneous information: */ int cmdCount; /* Total number of times a command procedure * has been called for this interpreter. */ int evalFlags; /* Flags to control next call to Tcl_Eval. * Normally zero, but may be set before * calling Tcl_Eval. See below for valid * values. */ int termOffset; /* Offset of character just after last one * compiled or executed by Tcl_EvalObj. */ int compileEpoch; /* Holds the current "compilation epoch" * for this interpreter. This is * incremented to invalidate existing * ByteCodes when, e.g., a command with a * compile procedure is redefined. */ Proc *compiledProcPtr; /* If a procedure is being compiled, a * pointer to its Proc structure; otherwise, * this is NULL. Set by ObjInterpProc in * tclProc.c and used by tclCompile.c to * process local variables appropriately. */ ResolverScheme *resolverPtr; /* Linked list of name resolution schemes * added to this interpreter. Schemes * are added/removed by calling * Tcl_AddInterpResolver and * Tcl_RemoveInterpResolver. */ char *scriptFile; /* NULL means there is no nested source * command active; otherwise this points to * the name of the file being sourced (it's * not malloc-ed: it points to an argument * to Tcl_EvalFile. */ int flags; /* Various flag bits. See below. */ long randSeed; /* Seed used for rand() function. */ Trace *tracePtr; /* List of traces for this interpreter. */ Tcl_HashTable *assocData; /* Hash table for associating data with * this interpreter. Cleaned up when * this interpreter is deleted. */ struct ExecEnv *execEnvPtr; /* Execution environment for Tcl bytecode * execution. Contains a pointer to the * Tcl evaluation stack. */ Tcl_Obj *emptyObjPtr; /* Points to an object holding an empty * string. Returned by Tcl_ObjSetVar2 when * variable traces change a variable in a * gross way. */ char resultSpace[TCL_RESULT_SIZE+1]; /* Static space holding small results. */} Interp;/* * EvalFlag bits for Interp structures: * * TCL_BRACKET_TERM 1 means that the current script is terminated by * a close bracket rather than the end of the string. * TCL_ALLOW_EXCEPTIONS 1 means it's OK for the script to terminate with * a code other than TCL_OK or TCL_ERROR; 0 means * codes other than these should be turned into errors. */#define TCL_BRACKET_TERM 1#define TCL_ALLOW_EXCEPTIONS 4/* * Flag bits for Interp structures: * * DELETED: Non-zero means the interpreter has been deleted: * don't process any more commands for it, and destroy * the structure as soon as all nested invocations of * Tcl_Eval are done. * ERR_IN_PROGRESS: Non-zero means an error unwind is already in * progress. Zero means a command proc has been * invoked since last error occured. * ERR_ALREADY_LOGGED: Non-zero means information has already been logged * in $errorInfo for the current Tcl_Eval instance, * so Tcl_Eval needn't log it (used to implement the * "error message log" command). * ERROR_CODE_SET: Non-zero means that Tcl_SetErrorCode has been * called to record information for the current * error. Zero means Tcl_Eval must clear the * errorCode variable if an error is returned. * EXPR_INITIALIZED: Non-zero means initialization specific to * expressions has been carried out. * DONT_COMPILE_CMDS_INLINE: Non-zero means that the bytecode compiler * should not compile any commands into an inline * sequence of instructions. This is set 1, for * example, when command traces are requested. * RAND_SEED_INITIALIZED: Non-zero means that the randSeed value of the * interp has not be initialized. This is set 1 * when we first use the rand() or srand() functions. * SAFE_INTERP: Non zero means that the current interp is a * safe interp (ie it has only the safe commands * installed, less priviledge than a regular interp). */#define DELETED 1#define ERR_IN_PROGRESS 2#define ERR_ALREADY_LOGGED 4#define ERROR_CODE_SET 8#define EXPR_INITIALIZED 0x10#define DONT_COMPILE_CMDS_INLINE 0x20#define RAND_SEED_INITIALIZED 0x40#define SAFE_INTERP 0x80/* *---------------------------------------------------------------- * Data structures related to command parsing. These are used in * tclParse.c and its clients. *---------------------------------------------------------------- *//* * The following data structure is used by various parsing procedures * to hold information about where to store the results of parsing * (e.g. the substituted contents of a quoted argument, or the result * of a nested command). At any given time, the space available * for output is fixed, but a procedure may be called to expand the * space available if the current space runs out. */typedef struct ParseValue { char *buffer; /* Address of first character in * output buffer. */ char *next; /* Place to store next character in * output buffer. */ char *end; /* Address of the last usable character * in the buffer. */ void (*expandProc) _ANSI_ARGS_((struct ParseValue *pvPtr, int needed)); /* Procedure to call when space runs out; * it will make more space. */ ClientData clientData; /* Arbitrary information for use of * expandProc. */} ParseValue;/* * A table used to classify input characters to assist in parsing * Tcl commands. The table should be indexed with a signed character * using the CHAR_TYPE macro. The character may have a negative * value. The CHAR_TYPE macro takes a pointer to a signed character * and a pointer to the last character in the source string. If the * src pointer is pointing at the terminating null of the string, * CHAR_TYPE returns TCL_COMMAND_END. */extern unsigned char tclTypeTable[];#define CHAR_TYPE(src,last) \ (((src)==(last))?TCL_COMMAND_END:(tclTypeTable)[(int)(*(src) + 128)])/* * Possible values returned by CHAR_TYPE. Note that except for TCL_DOLLAR, * these are all one byte values with a single bit set 1. This means these * values may be bit-or'ed together (except for TCL_DOLLAR) to quickly test * whether a character is one of several different kinds of characters. * * TCL_NORMAL - All characters that don't have special significance * to the Tcl language. * TCL_SPACE - Character is space, tab, or return. * TCL_COMMAND_END - Character is newline or semicolon or close-bracket * or terminating null. * TCL_QUOTE - Character is a double-quote. * TCL_OPEN_BRACKET - Character is a "[". * TCL_OPEN_BRACE - Character is a "{". * TCL_CLOSE_BRACE - Character is a "}". * TCL_BACKSLASH - Character is a "\". * TCL_DOLLAR - Character is a "$". */#define TCL_NORMAL 0x01#define TCL_SPACE 0x02#define TCL_COMMAND_END 0x04#define TCL_QUOTE 0x08#define TCL_OPEN_BRACKET 0x10#define TCL_OPEN_BRACE 0x20#define TCL_CLOSE_BRACE 0x40#define TCL_BACKSLASH 0x80#define TCL_DOLLAR 0x00/* * Maximum number of levels of nesting permitted in Tcl commands (used * to catch infinite recursion). */#define MAX_NESTING_DEPTH 1000/* * 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. */#define UCHAR(c) ((unsigned char) (c))/* * This macro is used to determine the offset needed to safely allocate any * data structure in memory. Given a starting offset or size, it "rounds up" * or "aligns" the offset to the next 8-byte boundary so that any data * structure can be placed at the resulting offset without fear of an * alignment error. * * WARNING!! DO NOT USE THIS MACRO TO ALIGN POINTERS: it will produce * the wrong result on platforms that allocate addresses that are divisible * by 4 or 2. Only use it for offsets or sizes. */#define TCL_ALIGN(x) (((int)(x) + 7) & ~7)/* * The following macros are used to specify the runtime platform * setting of the tclPlatform variable. */typedef enum { TCL_PLATFORM_UNIX, /* Any Unix-like OS. */ TCL_PLATFORM_MAC, /* MacOS. */ TCL_PLATFORM_WINDOWS /* Any Microsoft Windows OS. */} TclPlatformType;/* * Flags for TclInvoke: * * TCL_INVOKE_HIDDEN Invoke a hidden command; if not set, * invokes an exposed command. * TCL_INVOKE_NO_UNKNOWN If set, "unknown" is not invoked if * the command to be invoked is not found. * Only has an effect if invoking an exposed * command, i.e. if TCL_INVOKE_HIDDEN is not * also set. */#define TCL_INVOKE_HIDDEN (1<<0)#define TCL_INVOKE_NO_UNKNOWN (1<<1)/* * The structure used as the internal representation of Tcl list * objects. This is an array of pointers to the element objects. This array
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -