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

📄 tclint.h

📁 CMX990 demonstration board (DE9901)
💻 H
📖 第 1 页 / 共 3 页
字号:
  struct CallFrame *callerPtr;
  /* Value of interp->framePtr when this
   * procedure was invoked (i.e. next 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). */
} CallFrame;

/*
 * 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;

/*
 *----------------------------------------------------------------
 * Data structures related to history.   These are used primarily
 * in tclHistory.c
 *----------------------------------------------------------------
 */

/*
 * 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. */
  struct HistoryRev *nextPtr;	/* Next in chain of revisions to apply, or
				 * NULL for end of list. */
} HistoryRev;

/*
 *----------------------------------------------------------------
 * Data structures related to files.  These are used primarily in
 * tclUnixUtil.c and tclUnixAZ.c.
 *----------------------------------------------------------------
 */

/*
 * The data structure below defines an open file (or connection to
 * a process pipeline) as returned by the "open" command.
 */

typedef struct OpenFile {
  FILE *f;			/* Stdio file to use for reading and/or
				 * writing. */
  FILE *f2;			/* Normally NULL.  In the special case of
				 * a command pipeline with pipes for both
				 * input and output, this is a stdio file
				 * to use for writing to the pipeline. */
  int readable;		/* Non-zero means file may be read. */
  int writable;		/* Non-zero means file may be written. */
  int numPids;		/* If this is a connection to a process
                         * pipeline, gives number of processes
                         * in pidPtr array below;  otherwise it
                         * is 0. */
  int *pidPtr;		/* Pointer to malloc-ed array of child
                         * process ids (numPids of them), or NULL
                         * if this isn't a connection to a process
                         * pipeline. */
  int errorId;		/* File id of file that receives error
                         * output from pipeline.  -1 means not
                         * used (i.e. this is a normal file). */
} OpenFile;

/*
 *----------------------------------------------------------------
 * 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 Command {
  Tcl_CmdProc *proc;		/* Procedure to process command. */
  ClientData clientData;	/* Arbitrary value to pass to proc. */
  Tcl_CmdDeleteProc *deleteProc;
  /* Procedure to invoke when deleting
   * command. */
} Command;

#define CMD_SIZE(nameLength) ((unsigned) sizeof(Command) + nameLength - 3)

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.
   */
  
  char *result;		/* Points to result returned by last
                         * command. */
  Tcl_FreeProc *freeProc;	/* Zero means result is statically allocated.
				 * If non-zero, gives address of procedure
				 * to invoke to free the result.  Must be
				 * freed by Tcl_Eval before executing next
				 * command. */
  int errorLine;		/* When TCL_ERROR is returned, this gives
				 * the line number within the command where
				 * the error occurred (1 means first line). */
  Tcl_HashTable commandTable;	/* Contains all of the commands currently
				 * registered in this interpreter.  Indexed
				 * by strings; values have type (Command *). */
  
  /*
   * Information related to procedures and variables.  See tclProc.c
   * and tclvar.c for usage.
   */
  
  Tcl_HashTable globalTable;	/* Contains all global variables for
				 * interpreter. */
  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. */
  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 being
				 * executed).  NULL means no procedure is
				 * active or "uplevel 0" is being exec'ed. */
  ActiveVarTrace *activeTracePtr;
  /* First in list of active traces for interp,
   * or NULL if no active traces. */
  
  /*
   * Information related to history:
   */
  
  int numEvents;		/* Number of previously-executed commands
				 * to retain. */
  HistoryEvent *events;	/* Array containing numEvents entries
                         * (dynamically allocated). */
  int curEvent;		/* Index into events of place where current
                         * (or most recent) command is recorded. */
  int curEventNum;		/* Event number associated with the slot
				 * given by curEvent. */
  HistoryRev *revPtr;		/* First in list of pending revisions. */
  char *historyFirst;		/* First char. of current command executed
				 * from history module or NULL if none. */
  int revDisables;		/* 0 means history revision OK;  > 0 gives
				 * a count of number of times revision has
				 * been disabled. */
  char *evalFirst;		/* If TCL_RECORD_BOUNDS flag set, Tcl_Eval
				 * sets this field to point to the first
				 * char. of text from which the current
				 * command came.  Otherwise Tcl_Eval sets
				 * this to NULL. */
  char *evalLast;		/* Similar to evalFirst, except points to
				 * last character of current command. */
  
  /*
   * 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. */
  
  /*
   * Information related to files.  See tclUnixAZ.c and tclUnixUtil.c
   * for details.
   */
  
  int numFiles;		/* Number of entries in filePtrArray
                         * below.  0 means array hasn't been
                         * created yet. */
  OpenFile **filePtrArray;	/* Pointer to malloc-ed array of pointers
				 * to information about open files.  Entry
				 * N corresponds to the file with fileno N.
				 * If an entry is NULL then the corresponding
				 * file isn't open.  If filePtrArray is NULL
				 * it means no files have been used, so even
				 * stdin/stdout/stderr entries haven't been
				 * setup yet. */
  /*
   * A cache of compiled regular expressions.  See TclCompileRegexp
   * 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. */
  
  
  /*
   * Miscellaneous information:
   */
  
  int cmdCount;		/* Total number of times a command procedure
                         * has been called for this interpreter. */
  int noEval;			/* Non-zero means no commands should actually
				 * be executed:  just parse only.  Used in
				 * expressions when the result is already
				 * determined. */
  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. */
  Trace *tracePtr;		/* List of traces for this interpreter. */
  char resultSpace[TCL_RESULT_SIZE+1];
  /* Static space for storing small results. */
} Interp;

/*
 * 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.
 */

#define DELETED			1
#define ERR_IN_PROGRESS		2
#define ERR_ALREADY_LOGGED	4
#define ERROR_CODE_SET		8

/*
 *----------------------------------------------------------------
 * Data structures related to command parsing.   These are used in

⌨️ 快捷键说明

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