home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume25 / tcl / part23 < prev    next >
Encoding:
Text File  |  1991-11-15  |  33.9 KB  |  872 lines

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