Annotation of micropolis/src/tcl/tclint.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * tclInt.h --
        !             3:  *
        !             4:  *     Declarations of things used internally by the Tcl interpreter.
        !             5:  *
        !             6:  * Copyright 1987-1991 Regents of the University of California
        !             7:  * Permission to use, copy, modify, and distribute this
        !             8:  * software and its documentation for any purpose and without
        !             9:  * fee is hereby granted, provided that the above copyright
        !            10:  * notice appear in all copies.  The University of California
        !            11:  * makes no representations about the suitability of this
        !            12:  * software for any purpose.  It is provided "as is" without
        !            13:  * express or implied warranty.
        !            14:  *
        !            15:  * $Header: /user6/ouster/tcl/RCS/tclInt.h,v 1.69 92/06/21 14:09:23 ouster Exp $ SPRITE (Berkeley)
        !            16:  */
        !            17: 
        !            18: #ifndef _TCLINT
        !            19: #define _TCLINT
        !            20: 
        !            21: /*
        !            22:  * Common include files needed by most of the Tcl source files are
        !            23:  * included here, so that system-dependent personalizations for the
        !            24:  * include files only have to be made in once place.  This results
        !            25:  * in a few extra includes, but greater modularity.  The order of
        !            26:  * the three groups of #includes is important.  For example, stdio.h
        !            27:  * is needed by tcl.h, and the _ANSI_ARGS_ declaration in tcl.h is
        !            28:  * needed by stdlib.h in some configurations.
        !            29:  */
        !            30: 
        !            31: #include <stdio.h>
        !            32: #include <unistd.h>
        !            33: 
        !            34: #ifndef _TCL
        !            35: #include "tcl.h"
        !            36: #endif
        !            37: #ifndef _TCLHASH
        !            38: #include "tclhash.h"
        !            39: #endif
        !            40: #ifndef _REGEXP
        !            41: #include "regexp.h"
        !            42: #endif
        !            43: 
        !            44: /*
        !            45:  * Macro to use instead of "void" for arguments that must have
        !            46:  * type "void *" in ANSI C;  maps them to type "char *" in
        !            47:  * non-ANSI systems.  This macro may be used in some of the include
        !            48:  * files below, which is why it is defined here.
        !            49:  */
        !            50: 
        !            51: #ifndef VOID
        !            52: #   ifdef __STDC__
        !            53: #       define VOID void
        !            54: #   else
        !            55: #       define VOID char
        !            56: #   endif
        !            57: #endif
        !            58: 
        !            59: #include <ctype.h>
        !            60: #include <stdlib.h>
        !            61: #include <string.h>
        !            62: //#include <varargs.h>
        !            63: #include <stdarg.h>
        !            64: 
        !            65: /*
        !            66:  * At present (12/91) not all stdlib.h implementations declare strtod.
        !            67:  * The declaration below is here to ensure that it's declared, so that
        !            68:  * the compiler won't take the default approach of assuming it returns
        !            69:  * an int.  There's no ANSI prototype for it because there would end
        !            70:  * up being too many conflicts with slightly-different prototypes.
        !            71:  */
        !            72: 
        !            73: extern double strtod();
        !            74: 
        !            75: /*
        !            76:  *----------------------------------------------------------------
        !            77:  * Data structures related to variables.   These are used primarily
        !            78:  * in tclVar.c
        !            79:  *----------------------------------------------------------------
        !            80:  */
        !            81: 
        !            82: /*
        !            83:  * The following structure defines a variable trace, which is used to
        !            84:  * invoke a specific C procedure whenever certain operations are performed
        !            85:  * on a variable.
        !            86:  */
        !            87: 
        !            88: typedef struct VarTrace {
        !            89:     Tcl_VarTraceProc *traceProc;/* Procedure to call when operations given
        !            90:                                 * by flags are performed on variable. */
        !            91:     ClientData clientData;     /* Argument to pass to proc. */
        !            92:     int flags;                 /* What events the trace procedure is
        !            93:                                 * interested in:  OR-ed combination of
        !            94:                                 * TCL_TRACE_READS, TCL_TRACE_WRITES, and
        !            95:                                 * TCL_TRACE_UNSETS. */
        !            96:     struct VarTrace *nextPtr;  /* Next in list of traces associated with
        !            97:                                 * a particular variable. */
        !            98: } VarTrace;
        !            99: 
        !           100: /*
        !           101:  * When a variable trace is active (i.e. its associated procedure is
        !           102:  * executing), one of the following structures is linked into a list
        !           103:  * associated with the variable's interpreter.  The information in
        !           104:  * the structure is needed in order for Tcl to behave reasonably
        !           105:  * if traces are deleted while traces are active.
        !           106:  */
        !           107: 
        !           108: typedef struct ActiveVarTrace {
        !           109:     struct ActiveVarTrace *nextPtr;
        !           110:                                /* Next in list of all active variable
        !           111:                                 * traces for the interpreter, or NULL
        !           112:                                 * if no more. */
        !           113:     VarTrace *nextTracePtr;    /* Next trace to check after current
        !           114:                                 * trace procedure returns;  if this
        !           115:                                 * trace gets deleted, must update pointer
        !           116:                                 * to avoid using free'd memory. */
        !           117: } ActiveVarTrace;
        !           118: 
        !           119: /*
        !           120:  * The following structure describes an enumerative search in progress on
        !           121:  * an array variable;  this are invoked with options to the "array"
        !           122:  * command.
        !           123:  */
        !           124: 
        !           125: typedef struct ArraySearch {
        !           126:     int id;                    /* Integer id used to distinguish among
        !           127:                                 * multiple concurrent searches for the
        !           128:                                 * same array. */
        !           129:     struct Var *varPtr;                /* Pointer to array variable that's being
        !           130:                                 * searched. */
        !           131:     Tcl_HashSearch search;     /* Info kept by the hash module about
        !           132:                                 * progress through the array. */
        !           133:     Tcl_HashEntry *nextEntry;  /* Non-null means this is the next element
        !           134:                                 * to be enumerated (it's leftover from
        !           135:                                 * the Tcl_FirstHashEntry call or from
        !           136:                                 * an "array anymore" command).  NULL
        !           137:                                 * means must call Tcl_NextHashEntry
        !           138:                                 * to get value to return. */
        !           139:     struct ArraySearch *nextPtr;/* Next in list of all active searches
        !           140:                                 * for this variable, or NULL if this is
        !           141:                                 * the last one. */
        !           142: } ArraySearch;
        !           143: 
        !           144: /*
        !           145:  * The structure below defines a variable, which associates a string name
        !           146:  * with a string value.  Pointers to these structures are kept as the
        !           147:  * values of hash table entries, and the name of each variable is stored
        !           148:  * in the hash entry.
        !           149:  */
        !           150: 
        !           151: typedef struct Var {
        !           152:     int valueLength;           /* Holds the number of non-null bytes
        !           153:                                 * actually occupied by the variable's
        !           154:                                 * current value in value.string (extra
        !           155:                                 * space is sometimes left for expansion).
        !           156:                                 * For array and global variables this is
        !           157:                                 * meaningless. */
        !           158:     int valueSpace;            /* Total number of bytes of space allocated
        !           159:                                 * at value. */
        !           160:     int upvarUses;             /* Counts number of times variable is
        !           161:                                 * is referenced via global or upvar variables
        !           162:                                 * (i.e. how many variables have "upvarPtr"
        !           163:                                 * pointing to this variable).  Variable
        !           164:                                 * can't be deleted until this count reaches
        !           165:                                 * 0. */
        !           166:     VarTrace *tracePtr;                /* First in list of all traces set for this
        !           167:                                 * variable. */
        !           168:     ArraySearch *searchPtr;    /* First in list of all searches active
        !           169:                                 * for this variable, or NULL if none. */
        !           170:     int flags;                 /* Miscellaneous bits of information about
        !           171:                                 * variable.  See below for definitions. */
        !           172:     union {
        !           173:        char string[4];         /* String value of variable.  The actual
        !           174:                                 * length of this field is given by the
        !           175:                                 * valueSpace field above. */
        !           176:        Tcl_HashTable *tablePtr;/* For array variables, this points to
        !           177:                                 * information about the hash table used
        !           178:                                 * to implement the associative array. 
        !           179:                                 * Points to malloc-ed data. */
        !           180:        Tcl_HashEntry *upvarPtr;
        !           181:                                /* If this is a global variable being
        !           182:                                 * referred to in a procedure, or a variable
        !           183:                                 * created by "upvar", this field points to
        !           184:                                 * the hash table entry for the higher-level
        !           185:                                 * variable. */
        !           186:     } value;                   /* MUST BE LAST FIELD IN STRUCTURE!!! */
        !           187: } Var;
        !           188: 
        !           189: /*
        !           190:  * Flag bits for variables:
        !           191:  *
        !           192:  * VAR_ARRAY   -               1 means this is an array variable rather
        !           193:  *                             than a scalar variable.
        !           194:  * VAR_UPVAR -                         1 means this variable just contains a
        !           195:  *                             pointer to another variable that has the
        !           196:  *                             real value.  Variables like this come
        !           197:  *                             about through the "upvar" and "global"
        !           198:  *                             commands.
        !           199:  * VAR_UNDEFINED -             1 means that the variable is currently
        !           200:  *                             undefined.  Undefined variables usually
        !           201:  *                             go away completely, but if an undefined
        !           202:  *                             variable has a trace on it, or if it is
        !           203:  *                             a global variable being used by a procedure,
        !           204:  *                             then it stays around even when undefined.
        !           205:  * VAR_ELEMENT_ACTIVE -                Used only in array variables;  1 means that
        !           206:  *                             an element of the array is currently being
        !           207:  *                             manipulated in some way, so that it isn't
        !           208:  *                             safe to delete the whole array.
        !           209:  * VAR_TRACE_ACTIVE -          1 means that trace processing is currently
        !           210:  *                             underway for a read or write access, so
        !           211:  *                             new read or write accesses should not cause
        !           212:  *                             trace procedures to be called and the
        !           213:  *                             variable can't be deleted.
        !           214:  */
        !           215: 
        !           216: #define VAR_ARRAY              1
        !           217: #define VAR_UPVAR              2
        !           218: #define VAR_UNDEFINED          4
        !           219: #define VAR_ELEMENT_ACTIVE     0x10
        !           220: #define VAR_TRACE_ACTIVE       0x20
        !           221: #define VAR_SEARCHES_POSSIBLE  0x40
        !           222: 
        !           223: /*
        !           224:  *----------------------------------------------------------------
        !           225:  * Data structures related to procedures.   These are used primarily
        !           226:  * in tclProc.c
        !           227:  *----------------------------------------------------------------
        !           228:  */
        !           229: 
        !           230: /*
        !           231:  * The structure below defines an argument to a procedure, which
        !           232:  * consists of a name and an (optional) default value.
        !           233:  */
        !           234: 
        !           235: typedef struct Arg {
        !           236:     struct Arg *nextPtr;       /* Next argument for this procedure,
        !           237:                                 * or NULL if this is the last argument. */
        !           238:     char *defValue;            /* Pointer to arg's default value, or NULL
        !           239:                                 * if no default value. */
        !           240:     char name[4];              /* Name of argument starts here.  The name
        !           241:                                 * is followed by space for the default,
        !           242:                                 * if there is one.  The actual size of this
        !           243:                                 * field will be as large as necessary to
        !           244:                                 * hold both name and default value.  THIS
        !           245:                                 * MUST BE THE LAST FIELD IN THE STRUCTURE!! */
        !           246: } Arg;
        !           247: 
        !           248: /*
        !           249:  * The structure below defines a command procedure, which consists of
        !           250:  * a collection of Tcl commands plus information about arguments and
        !           251:  * variables.
        !           252:  */
        !           253: 
        !           254: typedef struct Proc {
        !           255:     struct Interp *iPtr;       /* Interpreter for which this command
        !           256:                                 * is defined. */
        !           257:     char *command;             /* Command that constitutes the body of
        !           258:                                 * the procedure (dynamically allocated). */
        !           259:     Arg *argPtr;               /* Pointer to first of procedure's formal
        !           260:                                 * arguments, or NULL if none. */
        !           261: } Proc;
        !           262: 
        !           263: /*
        !           264:  * The structure below defines a command trace.  This is used to allow Tcl
        !           265:  * clients to find out whenever a command is about to be executed.
        !           266:  */
        !           267: 
        !           268: typedef struct Trace {
        !           269:     int level;                 /* Only trace commands at nesting level
        !           270:                                 * less than or equal to this. */
        !           271:     Tcl_CmdTraceProc *proc;    /* Procedure to call to trace command. */
        !           272:     ClientData clientData;     /* Arbitrary value to pass to proc. */
        !           273:     struct Trace *nextPtr;     /* Next in list of traces for this interp. */
        !           274: } Trace;
        !           275: 
        !           276: /*
        !           277:  * The structure below defines a frame, which is a procedure invocation.
        !           278:  * These structures exist only while procedures are being executed, and
        !           279:  * provide a sort of call stack.
        !           280:  */
        !           281: 
        !           282: typedef struct CallFrame {
        !           283:     Tcl_HashTable varTable;    /* Hash table containing all of procedure's
        !           284:                                 * local variables. */
        !           285:     int level;                 /* Level of this procedure, for "uplevel"
        !           286:                                 * purposes (i.e. corresponds to nesting of
        !           287:                                 * callerVarPtr's, not callerPtr's).  1 means
        !           288:                                 * outer-most procedure, 0 means top-level. */
        !           289:     int argc;                  /* This and argv below describe name and
        !           290:                                 * arguments for this procedure invocation. */
        !           291:     char **argv;               /* Array of arguments. */
        !           292:     struct CallFrame *callerPtr;
        !           293:                                /* Value of interp->framePtr when this
        !           294:                                 * procedure was invoked (i.e. next in
        !           295:                                 * stack of all active procedures). */
        !           296:     struct CallFrame *callerVarPtr;
        !           297:                                /* Value of interp->varFramePtr when this
        !           298:                                 * procedure was invoked (i.e. determines
        !           299:                                 * variable scoping within caller;  same
        !           300:                                 * as callerPtr unless an "uplevel" command
        !           301:                                 * or something equivalent was active in
        !           302:                                 * the caller). */
        !           303: } CallFrame;
        !           304: 
        !           305: /*
        !           306:  * The structure below defines one history event (a previously-executed
        !           307:  * command that can be re-executed in whole or in part).
        !           308:  */
        !           309: 
        !           310: typedef struct {
        !           311:     char *command;             /* String containing previously-executed
        !           312:                                 * command. */
        !           313:     int bytesAvl;              /* Total # of bytes available at *event (not
        !           314:                                 * all are necessarily in use now). */
        !           315: } HistoryEvent;
        !           316: 
        !           317: /*
        !           318:  *----------------------------------------------------------------
        !           319:  * Data structures related to history.   These are used primarily
        !           320:  * in tclHistory.c
        !           321:  *----------------------------------------------------------------
        !           322:  */
        !           323: 
        !           324: /*
        !           325:  * The structure below defines a pending revision to the most recent
        !           326:  * history event.  Changes are linked together into a list and applied
        !           327:  * during the next call to Tcl_RecordHistory.  See the comments at the
        !           328:  * beginning of tclHistory.c for information on revisions.
        !           329:  */
        !           330: 
        !           331: typedef struct HistoryRev {
        !           332:     int firstIndex;            /* Index of the first byte to replace in
        !           333:                                 * current history event. */
        !           334:     int lastIndex;             /* Index of last byte to replace in
        !           335:                                 * current history event. */
        !           336:     int newSize;               /* Number of bytes in newBytes. */
        !           337:     char *newBytes;            /* Replacement for the range given by
        !           338:                                 * firstIndex and lastIndex. */
        !           339:     struct HistoryRev *nextPtr;        /* Next in chain of revisions to apply, or
        !           340:                                 * NULL for end of list. */
        !           341: } HistoryRev;
        !           342: 
        !           343: /*
        !           344:  *----------------------------------------------------------------
        !           345:  * Data structures related to files.  These are used primarily in
        !           346:  * tclUnixUtil.c and tclUnixAZ.c.
        !           347:  *----------------------------------------------------------------
        !           348:  */
        !           349: 
        !           350: /*
        !           351:  * The data structure below defines an open file (or connection to
        !           352:  * a process pipeline) as returned by the "open" command.
        !           353:  */
        !           354: 
        !           355: typedef struct OpenFile {
        !           356:     FILE *f;                   /* Stdio file to use for reading and/or
        !           357:                                 * writing. */
        !           358:     FILE *f2;                  /* Normally NULL.  In the special case of
        !           359:                                 * a command pipeline with pipes for both
        !           360:                                 * input and output, this is a stdio file
        !           361:                                 * to use for writing to the pipeline. */
        !           362:     int readable;              /* Non-zero means file may be read. */
        !           363:     int writable;              /* Non-zero means file may be written. */
        !           364:     int numPids;               /* If this is a connection to a process
        !           365:                                 * pipeline, gives number of processes
        !           366:                                 * in pidPtr array below;  otherwise it
        !           367:                                 * is 0. */
        !           368:     int *pidPtr;               /* Pointer to malloc-ed array of child
        !           369:                                 * process ids (numPids of them), or NULL
        !           370:                                 * if this isn't a connection to a process
        !           371:                                 * pipeline. */
        !           372:     int errorId;               /* File id of file that receives error
        !           373:                                 * output from pipeline.  -1 means not
        !           374:                                 * used (i.e. this is a normal file). */
        !           375: } OpenFile;
        !           376: 
        !           377: /*
        !           378:  *----------------------------------------------------------------
        !           379:  * This structure defines an interpreter, which is a collection of
        !           380:  * commands plus other state information related to interpreting
        !           381:  * commands, such as variable storage.  Primary responsibility for
        !           382:  * this data structure is in tclBasic.c, but almost every Tcl
        !           383:  * source file uses something in here.
        !           384:  *----------------------------------------------------------------
        !           385:  */
        !           386: 
        !           387: typedef struct Command {
        !           388:     Tcl_CmdProc *proc;         /* Procedure to process command. */
        !           389:     ClientData clientData;     /* Arbitrary value to pass to proc. */
        !           390:     Tcl_CmdDeleteProc *deleteProc;
        !           391:                                /* Procedure to invoke when deleting
        !           392:                                 * command. */
        !           393: } Command;
        !           394: 
        !           395: #define CMD_SIZE(nameLength) ((unsigned) sizeof(Command) + nameLength - 3)
        !           396: 
        !           397: typedef struct Interp {
        !           398: 
        !           399:     /*
        !           400:      * Note:  the first three fields must match exactly the fields in
        !           401:      * a Tcl_Interp struct (see tcl.h).  If you change one, be sure to
        !           402:      * change the other.
        !           403:      */
        !           404: 
        !           405:     char *result;              /* Points to result returned by last
        !           406:                                 * command. */
        !           407:     Tcl_FreeProc *freeProc;    /* Zero means result is statically allocated.
        !           408:                                 * If non-zero, gives address of procedure
        !           409:                                 * to invoke to free the result.  Must be
        !           410:                                 * freed by Tcl_Eval before executing next
        !           411:                                 * command. */
        !           412:     int errorLine;             /* When TCL_ERROR is returned, this gives
        !           413:                                 * the line number within the command where
        !           414:                                 * the error occurred (1 means first line). */
        !           415:     Tcl_HashTable commandTable;        /* Contains all of the commands currently
        !           416:                                 * registered in this interpreter.  Indexed
        !           417:                                 * by strings; values have type (Command *). */
        !           418: 
        !           419:     /*
        !           420:      * Information related to procedures and variables.  See tclProc.c
        !           421:      * and tclvar.c for usage.
        !           422:      */
        !           423: 
        !           424:     Tcl_HashTable globalTable; /* Contains all global variables for
        !           425:                                 * interpreter. */
        !           426:     int numLevels;             /* Keeps track of how many nested calls to
        !           427:                                 * Tcl_Eval are in progress for this
        !           428:                                 * interpreter.  It's used to delay deletion
        !           429:                                 * of the table until all Tcl_Eval invocations
        !           430:                                 * are completed. */
        !           431:     CallFrame *framePtr;       /* Points to top-most in stack of all nested
        !           432:                                 * procedure invocations.  NULL means there
        !           433:                                 * are no active procedures. */
        !           434:     CallFrame *varFramePtr;    /* Points to the call frame whose variables
        !           435:                                 * are currently in use (same as framePtr
        !           436:                                 * unless an "uplevel" command is being
        !           437:                                 * executed).  NULL means no procedure is
        !           438:                                 * active or "uplevel 0" is being exec'ed. */
        !           439:     ActiveVarTrace *activeTracePtr;
        !           440:                                /* First in list of active traces for interp,
        !           441:                                 * or NULL if no active traces. */
        !           442: 
        !           443:     /*
        !           444:      * Information related to history:
        !           445:      */
        !           446: 
        !           447:     int numEvents;             /* Number of previously-executed commands
        !           448:                                 * to retain. */
        !           449:     HistoryEvent *events;      /* Array containing numEvents entries
        !           450:                                 * (dynamically allocated). */
        !           451:     int curEvent;              /* Index into events of place where current
        !           452:                                 * (or most recent) command is recorded. */
        !           453:     int curEventNum;           /* Event number associated with the slot
        !           454:                                 * given by curEvent. */
        !           455:     HistoryRev *revPtr;                /* First in list of pending revisions. */
        !           456:     char *historyFirst;                /* First char. of current command executed
        !           457:                                 * from history module or NULL if none. */
        !           458:     int revDisables;           /* 0 means history revision OK;  > 0 gives
        !           459:                                 * a count of number of times revision has
        !           460:                                 * been disabled. */
        !           461:     char *evalFirst;           /* If TCL_RECORD_BOUNDS flag set, Tcl_Eval
        !           462:                                 * sets this field to point to the first
        !           463:                                 * char. of text from which the current
        !           464:                                 * command came.  Otherwise Tcl_Eval sets
        !           465:                                 * this to NULL. */
        !           466:     char *evalLast;            /* Similar to evalFirst, except points to
        !           467:                                 * last character of current command. */
        !           468: 
        !           469:     /*
        !           470:      * Information used by Tcl_AppendResult to keep track of partial
        !           471:      * results.  See Tcl_AppendResult code for details.
        !           472:      */
        !           473: 
        !           474:     char *appendResult;                /* Storage space for results generated
        !           475:                                 * by Tcl_AppendResult.  Malloc-ed.  NULL
        !           476:                                 * means not yet allocated. */
        !           477:     int appendAvl;             /* Total amount of space available at
        !           478:                                 * partialResult. */
        !           479:     int appendUsed;            /* Number of non-null bytes currently
        !           480:                                 * stored at partialResult. */
        !           481: 
        !           482:     /*
        !           483:      * Information related to files.  See tclUnixAZ.c and tclUnixUtil.c
        !           484:      * for details.
        !           485:      */
        !           486: 
        !           487:     int numFiles;              /* Number of entries in filePtrArray
        !           488:                                 * below.  0 means array hasn't been
        !           489:                                 * created yet. */
        !           490:     OpenFile **filePtrArray;   /* Pointer to malloc-ed array of pointers
        !           491:                                 * to information about open files.  Entry
        !           492:                                 * N corresponds to the file with fileno N.
        !           493:                                 * If an entry is NULL then the corresponding
        !           494:                                 * file isn't open.  If filePtrArray is NULL
        !           495:                                 * it means no files have been used, so even
        !           496:                                 * stdin/stdout/stderr entries haven't been
        !           497:                                 * setup yet. */
        !           498:     /*
        !           499:      * A cache of compiled regular expressions.  See TclCompileRegexp
        !           500:      * in tclUtil.c for details.
        !           501:      */
        !           502: 
        !           503: #define NUM_REGEXPS 5
        !           504:     char *patterns[NUM_REGEXPS];/* Strings corresponding to compiled
        !           505:                                 * regular expression patterns.  NULL
        !           506:                                 * means that this slot isn't used.
        !           507:                                 * Malloc-ed. */
        !           508:     int patLengths[NUM_REGEXPS];/* Number of non-null characters in
        !           509:                                 * corresponding entry in patterns.
        !           510:                                 * -1 means entry isn't used. */
        !           511:     regexp *regexps[NUM_REGEXPS];
        !           512:                                /* Compiled forms of above strings.  Also
        !           513:                                 * malloc-ed, or NULL if not in use yet. */
        !           514: 
        !           515: 
        !           516:     /*
        !           517:      * Miscellaneous information:
        !           518:      */
        !           519: 
        !           520:     int cmdCount;              /* Total number of times a command procedure
        !           521:                                 * has been called for this interpreter. */
        !           522:     int noEval;                        /* Non-zero means no commands should actually
        !           523:                                 * be executed:  just parse only.  Used in
        !           524:                                 * expressions when the result is already
        !           525:                                 * determined. */
        !           526:     char *scriptFile;          /* NULL means there is no nested source
        !           527:                                 * command active;  otherwise this points to
        !           528:                                 * the name of the file being sourced (it's
        !           529:                                 * not malloc-ed:  it points to an argument
        !           530:                                 * to Tcl_EvalFile. */
        !           531:     int flags;                 /* Various flag bits.  See below. */
        !           532:     Trace *tracePtr;           /* List of traces for this interpreter. */
        !           533:     char resultSpace[TCL_RESULT_SIZE+1];
        !           534:                                /* Static space for storing small results. */
        !           535: } Interp;
        !           536: 
        !           537: /*
        !           538:  * Flag bits for Interp structures:
        !           539:  *
        !           540:  * DELETED:            Non-zero means the interpreter has been deleted:
        !           541:  *                     don't process any more commands for it, and destroy
        !           542:  *                     the structure as soon as all nested invocations of
        !           543:  *                     Tcl_Eval are done.
        !           544:  * ERR_IN_PROGRESS:    Non-zero means an error unwind is already in progress.
        !           545:  *                     Zero means a command proc has been invoked since last
        !           546:  *                     error occured.
        !           547:  * ERR_ALREADY_LOGGED: Non-zero means information has already been logged
        !           548:  *                     in $errorInfo for the current Tcl_Eval instance,
        !           549:  *                     so Tcl_Eval needn't log it (used to implement the
        !           550:  *                     "error message log" command).
        !           551:  * ERROR_CODE_SET:     Non-zero means that Tcl_SetErrorCode has been
        !           552:  *                     called to record information for the current
        !           553:  *                     error.  Zero means Tcl_Eval must clear the
        !           554:  *                     errorCode variable if an error is returned.
        !           555:  */
        !           556: 
        !           557: #define DELETED                        1
        !           558: #define ERR_IN_PROGRESS                2
        !           559: #define ERR_ALREADY_LOGGED     4
        !           560: #define ERROR_CODE_SET         8
        !           561: 
        !           562: /*
        !           563:  *----------------------------------------------------------------
        !           564:  * Data structures related to command parsing.   These are used in
        !           565:  * tclParse.c and its clients.
        !           566:  *----------------------------------------------------------------
        !           567:  */
        !           568: 
        !           569: /*
        !           570:  * The following data structure is used by various parsing procedures
        !           571:  * to hold information about where to store the results of parsing
        !           572:  * (e.g. the substituted contents of a quoted argument, or the result
        !           573:  * of a nested command).  At any given time, the space available
        !           574:  * for output is fixed, but a procedure may be called to expand the
        !           575:  * space available if the current space runs out.
        !           576:  */
        !           577: 
        !           578: typedef struct ParseValue {
        !           579:     char *buffer;              /* Address of first character in
        !           580:                                 * output buffer. */
        !           581:     char *next;                        /* Place to store next character in
        !           582:                                 * output buffer. */
        !           583:     char *end;                 /* Address of the last usable character
        !           584:                                 * in the buffer. */
        !           585:     void (*expandProc) _ANSI_ARGS_((struct ParseValue *pvPtr, int needed));
        !           586:                                /* Procedure to call when space runs out;
        !           587:                                 * it will make more space. */
        !           588:     ClientData clientData;     /* Arbitrary information for use of
        !           589:                                 * expandProc. */
        !           590: } ParseValue;
        !           591: 
        !           592: /*
        !           593:  * A table used to classify input characters to assist in parsing
        !           594:  * Tcl commands.  The table should be indexed with a signed character
        !           595:  * using the CHAR_TYPE macro.  The character may have a negative
        !           596:  * value.
        !           597:  */
        !           598: 
        !           599: extern char tclTypeTable[];
        !           600: #define CHAR_TYPE(c) (tclTypeTable+128)[c]
        !           601: 
        !           602: /*
        !           603:  * Possible values returned by CHAR_TYPE:
        !           604:  *
        !           605:  * TCL_NORMAL -                All characters that don't have special significance
        !           606:  *                     to the Tcl language.
        !           607:  * TCL_SPACE -         Character is space, tab, or return.
        !           608:  * TCL_COMMAND_END -   Character is newline or null or semicolon or
        !           609:  *                     close-bracket.
        !           610:  * TCL_QUOTE -         Character is a double-quote.
        !           611:  * TCL_OPEN_BRACKET -  Character is a "[".
        !           612:  * TCL_OPEN_BRACE -    Character is a "{".
        !           613:  * TCL_CLOSE_BRACE -   Character is a "}".
        !           614:  * TCL_BACKSLASH -     Character is a "\".
        !           615:  * TCL_DOLLAR -                Character is a "$".
        !           616:  */
        !           617: 
        !           618: #define TCL_NORMAL             0
        !           619: #define TCL_SPACE              1
        !           620: #define TCL_COMMAND_END                2
        !           621: #define TCL_QUOTE              3
        !           622: #define TCL_OPEN_BRACKET       4
        !           623: #define TCL_OPEN_BRACE         5
        !           624: #define TCL_CLOSE_BRACE                6
        !           625: #define TCL_BACKSLASH          7
        !           626: #define TCL_DOLLAR             8
        !           627: 
        !           628: /*
        !           629:  * Additional flags passed to Tcl_Eval.  See tcl.h for other flags to
        !           630:  * Tcl_Eval;  these ones are only used internally by Tcl.
        !           631:  *
        !           632:  * TCL_RECORD_BOUNDS   Tells Tcl_Eval to record information in the
        !           633:  *                     evalFirst and evalLast fields for each command
        !           634:  *                     executed directly from the string (top-level
        !           635:  *                     commands and those from command substitution).
        !           636:  */
        !           637: 
        !           638: #define TCL_RECORD_BOUNDS      0x100
        !           639: 
        !           640: /*
        !           641:  * Maximum number of levels of nesting permitted in Tcl commands.
        !           642:  */
        !           643: 
        !           644: #define MAX_NESTING_DEPTH      100
        !           645: 
        !           646: /*
        !           647:  * Variables shared among Tcl modules but not used by the outside
        !           648:  * world:
        !           649:  */
        !           650: 
        !           651: extern char *          tclRegexpError;
        !           652: 
        !           653: /*
        !           654:  *----------------------------------------------------------------
        !           655:  * Procedures shared among Tcl modules but not used by the outside
        !           656:  * world:
        !           657:  *----------------------------------------------------------------
        !           658:  */
        !           659: 
        !           660: extern void            panic();
        !           661: extern regexp *                TclCompileRegexp _ANSI_ARGS_((Tcl_Interp *interp,
        !           662:                            char *string));
        !           663: extern void            TclCopyAndCollapse _ANSI_ARGS_((int count, char *src,
        !           664:                            char *dst));
        !           665: extern void            TclDeleteVars _ANSI_ARGS_((Interp *iPtr,
        !           666:                            Tcl_HashTable *tablePtr));
        !           667: extern void            TclExpandParseValue _ANSI_ARGS_((ParseValue *pvPtr,
        !           668:                            int needed));
        !           669: extern int             TclFindElement _ANSI_ARGS_((Tcl_Interp *interp,
        !           670:                            char *list, char **elementPtr, char **nextPtr,
        !           671:                            int *sizePtr, int *bracePtr));
        !           672: extern Proc *          TclFindProc _ANSI_ARGS_((Interp *iPtr,
        !           673:                            char *procName));
        !           674: extern int             TclGetFrame _ANSI_ARGS_((Tcl_Interp *interp,
        !           675:                            char *string, CallFrame **framePtrPtr));
        !           676: extern int             TclGetListIndex _ANSI_ARGS_((Tcl_Interp *interp,
        !           677:                            char *string, int *indexPtr));
        !           678: extern int             TclGetOpenFile _ANSI_ARGS_((Tcl_Interp *interp,
        !           679:                            char *string, OpenFile **filePtrPtr));
        !           680: extern Proc *          TclIsProc _ANSI_ARGS_((Command *cmdPtr));
        !           681: extern void            TclMakeFileTable _ANSI_ARGS_((Interp *iPtr,
        !           682:                            int index));
        !           683: extern int             TclParseBraces _ANSI_ARGS_((Tcl_Interp *interp,
        !           684:                            char *string, char **termPtr, ParseValue *pvPtr));
        !           685: extern int             TclParseNestedCmd _ANSI_ARGS_((Tcl_Interp *interp,
        !           686:                            char *string, int flags, char **termPtr,
        !           687:                            ParseValue *pvPtr));
        !           688: extern int             TclParseQuotes _ANSI_ARGS_((Tcl_Interp *interp,
        !           689:                            char *string, int termChar, int flags,
        !           690:                            char **termPtr, ParseValue *pvPtr));
        !           691: extern int             TclParseWords _ANSI_ARGS_((Tcl_Interp *interp,
        !           692:                            char *string, int flags, int maxWords,
        !           693:                            char **termPtr, int *argcPtr, char **argv,
        !           694:                            ParseValue *pvPtr));
        !           695: extern void            TclSetupEnv _ANSI_ARGS_((Tcl_Interp *interp));
        !           696: extern char *          TclWordEnd _ANSI_ARGS_((char *start, int nested));
        !           697: 
        !           698: /*
        !           699:  *----------------------------------------------------------------
        !           700:  * Command procedures in the generic core:
        !           701:  *----------------------------------------------------------------
        !           702:  */
        !           703: 
        !           704: extern int     Tcl_AppendCmd _ANSI_ARGS_((ClientData clientData,
        !           705:                    Tcl_Interp *interp, int argc, char **argv));
        !           706: extern int     Tcl_ArrayCmd _ANSI_ARGS_((ClientData clientData,
        !           707:                    Tcl_Interp *interp, int argc, char **argv));
        !           708: extern int     Tcl_BreakCmd _ANSI_ARGS_((ClientData clientData,
        !           709:                    Tcl_Interp *interp, int argc, char **argv));
        !           710: extern int     Tcl_CaseCmd _ANSI_ARGS_((ClientData clientData,
        !           711:                    Tcl_Interp *interp, int argc, char **argv));
        !           712: extern int     Tcl_CatchCmd _ANSI_ARGS_((ClientData clientData,
        !           713:                    Tcl_Interp *interp, int argc, char **argv));
        !           714: extern int     Tcl_ConcatCmd _ANSI_ARGS_((ClientData clientData,
        !           715:                    Tcl_Interp *interp, int argc, char **argv));
        !           716: extern int     Tcl_ContinueCmd _ANSI_ARGS_((ClientData clientData,
        !           717:                    Tcl_Interp *interp, int argc, char **argv));
        !           718: extern int     Tcl_ErrorCmd _ANSI_ARGS_((ClientData clientData,
        !           719:                    Tcl_Interp *interp, int argc, char **argv));
        !           720: extern int     Tcl_EvalCmd _ANSI_ARGS_((ClientData clientData,
        !           721:                    Tcl_Interp *interp, int argc, char **argv));
        !           722: extern int     Tcl_ExprCmd _ANSI_ARGS_((ClientData clientData,
        !           723:                    Tcl_Interp *interp, int argc, char **argv));
        !           724: extern int     Tcl_ForCmd _ANSI_ARGS_((ClientData clientData,
        !           725:                    Tcl_Interp *interp, int argc, char **argv));
        !           726: extern int     Tcl_ForeachCmd _ANSI_ARGS_((ClientData clientData,
        !           727:                    Tcl_Interp *interp, int argc, char **argv));
        !           728: extern int     Tcl_FormatCmd _ANSI_ARGS_((ClientData clientData,
        !           729:                    Tcl_Interp *interp, int argc, char **argv));
        !           730: extern int     Tcl_GlobalCmd _ANSI_ARGS_((ClientData clientData,
        !           731:                    Tcl_Interp *interp, int argc, char **argv));
        !           732: extern int     Tcl_HistoryCmd _ANSI_ARGS_((ClientData clientData,
        !           733:                    Tcl_Interp *interp, int argc, char **argv));
        !           734: extern int     Tcl_IfCmd _ANSI_ARGS_((ClientData clientData,
        !           735:                    Tcl_Interp *interp, int argc, char **argv));
        !           736: extern int     Tcl_IncrCmd _ANSI_ARGS_((ClientData clientData,
        !           737:                    Tcl_Interp *interp, int argc, char **argv));
        !           738: extern int     Tcl_InfoCmd _ANSI_ARGS_((ClientData clientData,
        !           739:                    Tcl_Interp *interp, int argc, char **argv));
        !           740: extern int     Tcl_JoinCmd _ANSI_ARGS_((ClientData clientData,
        !           741:                    Tcl_Interp *interp, int argc, char **argv));
        !           742: extern int     Tcl_LappendCmd _ANSI_ARGS_((ClientData clientData,
        !           743:                    Tcl_Interp *interp, int argc, char **argv));
        !           744: extern int     Tcl_LindexCmd _ANSI_ARGS_((ClientData clientData,
        !           745:                    Tcl_Interp *interp, int argc, char **argv));
        !           746: extern int     Tcl_LinsertCmd _ANSI_ARGS_((ClientData clientData,
        !           747:                    Tcl_Interp *interp, int argc, char **argv));
        !           748: extern int     Tcl_LlengthCmd _ANSI_ARGS_((ClientData clientData,
        !           749:                    Tcl_Interp *interp, int argc, char **argv));
        !           750: extern int     Tcl_ListCmd _ANSI_ARGS_((ClientData clientData,
        !           751:                    Tcl_Interp *interp, int argc, char **argv));
        !           752: extern int     Tcl_LrangeCmd _ANSI_ARGS_((ClientData clientData,
        !           753:                    Tcl_Interp *interp, int argc, char **argv));
        !           754: extern int     Tcl_LreplaceCmd _ANSI_ARGS_((ClientData clientData,
        !           755:                    Tcl_Interp *interp, int argc, char **argv));
        !           756: extern int     Tcl_LsearchCmd _ANSI_ARGS_((ClientData clientData,
        !           757:                    Tcl_Interp *interp, int argc, char **argv));
        !           758: extern int     Tcl_LsortCmd _ANSI_ARGS_((ClientData clientData,
        !           759:                    Tcl_Interp *interp, int argc, char **argv));
        !           760: extern int     Tcl_ProcCmd _ANSI_ARGS_((ClientData clientData,
        !           761:                    Tcl_Interp *interp, int argc, char **argv));
        !           762: extern int     Tcl_RegexpCmd _ANSI_ARGS_((ClientData clientData,
        !           763:                    Tcl_Interp *interp, int argc, char **argv));
        !           764: extern int     Tcl_RegsubCmd _ANSI_ARGS_((ClientData clientData,
        !           765:                    Tcl_Interp *interp, int argc, char **argv));
        !           766: extern int     Tcl_RenameCmd _ANSI_ARGS_((ClientData clientData,
        !           767:                    Tcl_Interp *interp, int argc, char **argv));
        !           768: extern int     Tcl_ReturnCmd _ANSI_ARGS_((ClientData clientData,
        !           769:                    Tcl_Interp *interp, int argc, char **argv));
        !           770: extern int     Tcl_ScanCmd _ANSI_ARGS_((ClientData clientData,
        !           771:                    Tcl_Interp *interp, int argc, char **argv));
        !           772: extern int     Tcl_SetCmd _ANSI_ARGS_((ClientData clientData,
        !           773:                    Tcl_Interp *interp, int argc, char **argv));
        !           774: extern int     Tcl_SplitCmd _ANSI_ARGS_((ClientData clientData,
        !           775:                    Tcl_Interp *interp, int argc, char **argv));
        !           776: extern int     Tcl_StringCmd _ANSI_ARGS_((ClientData clientData,
        !           777:                    Tcl_Interp *interp, int argc, char **argv));
        !           778: extern int     Tcl_TraceCmd _ANSI_ARGS_((ClientData clientData,
        !           779:                    Tcl_Interp *interp, int argc, char **argv));
        !           780: extern int     Tcl_UnsetCmd _ANSI_ARGS_((ClientData clientData,
        !           781:                    Tcl_Interp *interp, int argc, char **argv));
        !           782: extern int     Tcl_UplevelCmd _ANSI_ARGS_((ClientData clientData,
        !           783:                    Tcl_Interp *interp, int argc, char **argv));
        !           784: extern int     Tcl_UpvarCmd _ANSI_ARGS_((ClientData clientData,
        !           785:                    Tcl_Interp *interp, int argc, char **argv));
        !           786: extern int     Tcl_WhileCmd _ANSI_ARGS_((ClientData clientData,
        !           787:                    Tcl_Interp *interp, int argc, char **argv));
        !           788: extern int     Tcl_Cmd _ANSI_ARGS_((ClientData clientData,
        !           789:                    Tcl_Interp *interp, int argc, char **argv));
        !           790: extern int     Tcl_Cmd _ANSI_ARGS_((ClientData clientData,
        !           791:                    Tcl_Interp *interp, int argc, char **argv));
        !           792: 
        !           793: /*
        !           794:  *----------------------------------------------------------------
        !           795:  * Command procedures in the UNIX core:
        !           796:  *----------------------------------------------------------------
        !           797:  */
        !           798: 
        !           799: extern int     Tcl_CdCmd _ANSI_ARGS_((ClientData clientData,
        !           800:                    Tcl_Interp *interp, int argc, char **argv));
        !           801: extern int     Tcl_CloseCmd _ANSI_ARGS_((ClientData clientData,
        !           802:                    Tcl_Interp *interp, int argc, char **argv));
        !           803: extern int     Tcl_EofCmd _ANSI_ARGS_((ClientData clientData,
        !           804:                    Tcl_Interp *interp, int argc, char **argv));
        !           805: extern int     Tcl_ExecCmd _ANSI_ARGS_((ClientData clientData,
        !           806:                    Tcl_Interp *interp, int argc, char **argv));
        !           807: extern int     Tcl_ExitCmd _ANSI_ARGS_((ClientData clientData,
        !           808:                    Tcl_Interp *interp, int argc, char **argv));
        !           809: extern int     Tcl_FileCmd _ANSI_ARGS_((ClientData clientData,
        !           810:                    Tcl_Interp *interp, int argc, char **argv));
        !           811: extern int     Tcl_FlushCmd _ANSI_ARGS_((ClientData clientData,
        !           812:                    Tcl_Interp *interp, int argc, char **argv));
        !           813: extern int     Tcl_GetsCmd _ANSI_ARGS_((ClientData clientData,
        !           814:                    Tcl_Interp *interp, int argc, char **argv));
        !           815: extern int     Tcl_GlobCmd _ANSI_ARGS_((ClientData clientData,
        !           816:                    Tcl_Interp *interp, int argc, char **argv));
        !           817: extern int     Tcl_OpenCmd _ANSI_ARGS_((ClientData clientData,
        !           818:                    Tcl_Interp *interp, int argc, char **argv));
        !           819: extern int     Tcl_PutsCmd _ANSI_ARGS_((ClientData clientData,
        !           820:                    Tcl_Interp *interp, int argc, char **argv));
        !           821: extern int     Tcl_PwdCmd _ANSI_ARGS_((ClientData clientData,
        !           822:                    Tcl_Interp *interp, int argc, char **argv));
        !           823: extern int     Tcl_ReadCmd _ANSI_ARGS_((ClientData clientData,
        !           824:                    Tcl_Interp *interp, int argc, char **argv));
        !           825: extern int     Tcl_SeekCmd _ANSI_ARGS_((ClientData clientData,
        !           826:                    Tcl_Interp *interp, int argc, char **argv));
        !           827: extern int     Tcl_SourceCmd _ANSI_ARGS_((ClientData clientData,
        !           828:                    Tcl_Interp *interp, int argc, char **argv));
        !           829: extern int     Tcl_TellCmd _ANSI_ARGS_((ClientData clientData,
        !           830:                    Tcl_Interp *interp, int argc, char **argv));
        !           831: extern int     Tcl_TimeCmd _ANSI_ARGS_((ClientData clientData,
        !           832:                    Tcl_Interp *interp, int argc, char **argv));
        !           833: 
        !           834: #endif /* _TCLINT */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.