2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: tclInt.h /main/4 1996/10/04 10:01:56 drk $ */
27 * Declarations of things used internally by the Tcl interpreter.
29 * Copyright (c) 1987-1993 The Regents of the University of California.
30 * Copyright (c) 1994-1996 Sun Microsystems, Inc.
32 * See the file "license.terms" for information on usage and redistribution
33 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
35 * SCCS: @(#) tclInt.h 1.200 96/04/11 17:24:12
42 * Common include files needed by most of the Tcl source files are
43 * included here, so that system-dependent personalizations for the
44 * include files only have to be made in once place. This results
45 * in a few extra includes, but greater modularity. The order of
46 * the three groups of #includes is important. For example, stdio.h
47 * is needed by tcl.h, and the _ANSI_ARGS_ declaration in tcl.h is
48 * needed by stdlib.h in some configurations.
53 #include <sys/types.h> /* for pid_t */
59 #include "tclRegexp.h"
64 # include "../compat/limits.h"
69 # include "../compat/stdlib.h"
74 #include "../compat/string.h"
78 #if defined(__STDC__) || defined(HAS_STDARG)
85 *----------------------------------------------------------------
86 * Data structures related to variables. These are used primarily
88 *----------------------------------------------------------------
92 * The following structure defines a variable trace, which is used to
93 * invoke a specific C procedure whenever certain operations are performed
97 typedef struct VarTrace {
98 Tcl_VarTraceProc *traceProc;/* Procedure to call when operations given
99 * by flags are performed on variable. */
100 ClientData clientData; /* Argument to pass to proc. */
101 int flags; /* What events the trace procedure is
102 * interested in: OR-ed combination of
103 * TCL_TRACE_READS, TCL_TRACE_WRITES, and
104 * TCL_TRACE_UNSETS. */
105 struct VarTrace *nextPtr; /* Next in list of traces associated with
106 * a particular variable. */
110 * When a variable trace is active (i.e. its associated procedure is
111 * executing), one of the following structures is linked into a list
112 * associated with the variable's interpreter. The information in
113 * the structure is needed in order for Tcl to behave reasonably
114 * if traces are deleted while traces are active.
117 typedef struct ActiveVarTrace {
118 struct Var *varPtr; /* Variable that's being traced. */
119 struct ActiveVarTrace *nextPtr;
120 /* Next in list of all active variable
121 * traces for the interpreter, or NULL
123 VarTrace *nextTracePtr; /* Next trace to check after current
124 * trace procedure returns; if this
125 * trace gets deleted, must update pointer
126 * to avoid using free'd memory. */
130 * The following structure describes an enumerative search in progress on
131 * an array variable; this are invoked with options to the "array"
135 typedef struct ArraySearch {
136 int id; /* Integer id used to distinguish among
137 * multiple concurrent searches for the
139 struct Var *varPtr; /* Pointer to array variable that's being
141 Tcl_HashSearch search; /* Info kept by the hash module about
142 * progress through the array. */
143 Tcl_HashEntry *nextEntry; /* Non-null means this is the next element
144 * to be enumerated (it's leftover from
145 * the Tcl_FirstHashEntry call or from
146 * an "array anymore" command). NULL
147 * means must call Tcl_NextHashEntry
148 * to get value to return. */
149 struct ArraySearch *nextPtr;/* Next in list of all active searches
150 * for this variable, or NULL if this is
155 * The structure below defines a variable, which associates a string name
156 * with a string value. Pointers to these structures are kept as the
157 * values of hash table entries, and the name of each variable is stored
162 int valueLength; /* Holds the number of non-null bytes
163 * actually occupied by the variable's
164 * current value in value.string (extra
165 * space is sometimes left for expansion).
166 * For array and global variables this is
168 int valueSpace; /* Total number of bytes of space allocated
169 * at value.string. 0 means there is no
170 * space allocated. */
172 char *string; /* String value of variable, used for scalar
173 * variables and array elements. Malloc-ed. */
174 Tcl_HashTable *tablePtr;/* For array variables, this points to
175 * information about the hash table used
176 * to implement the associative array.
177 * Points to malloc-ed data. */
178 struct Var *upvarPtr; /* If this is a global variable being
179 * referred to in a procedure, or a variable
180 * created by "upvar", this field points to
181 * the record for the higher-level variable. */
183 Tcl_HashEntry *hPtr; /* Hash table entry that refers to this
184 * variable, or NULL if the variable has
185 * been detached from its hash table (e.g.
186 * an array is deleted, but some of its
187 * elements are still referred to in upvars). */
188 int refCount; /* Counts number of active uses of this
189 * variable, not including its main hash
190 * table entry: 1 for each additional variable
191 * whose upVarPtr points here, 1 for each
192 * nested trace active on variable. This
193 * record can't be deleted until refCount
195 VarTrace *tracePtr; /* First in list of all traces set for this
197 ArraySearch *searchPtr; /* First in list of all searches active
198 * for this variable, or NULL if none. */
199 int flags; /* Miscellaneous bits of information about
200 * variable. See below for definitions. */
204 * Flag bits for variables:
206 * VAR_ARRAY - 1 means this is an array variable rather
207 * than a scalar variable.
208 * VAR_UPVAR - 1 means this variable just contains a
209 * pointer to another variable that has the
210 * real value. Variables like this come
211 * about through the "upvar" and "global"
213 * VAR_UNDEFINED - 1 means that the variable is currently
214 * undefined. Undefined variables usually
215 * go away completely, but if an undefined
216 * variable has a trace on it, or if it is
217 * a global variable being used by a procedure,
218 * then it stays around even when undefined.
219 * VAR_TRACE_ACTIVE - 1 means that trace processing is currently
220 * underway for a read or write access, so
221 * new read or write accesses should not cause
222 * trace procedures to be called and the
223 * variable can't be deleted.
228 #define VAR_UNDEFINED 4
229 #define VAR_TRACE_ACTIVE 0x10
232 *----------------------------------------------------------------
233 * Data structures related to procedures. These are used primarily
235 *----------------------------------------------------------------
239 * The structure below defines an argument to a procedure, which
240 * consists of a name and an (optional) default value.
244 struct Arg *nextPtr; /* Next argument for this procedure,
245 * or NULL if this is the last argument. */
246 char *defValue; /* Pointer to arg's default value, or NULL
247 * if no default value. */
248 char name[4]; /* Name of argument starts here. The name
249 * is followed by space for the default,
250 * if there is one. The actual size of this
251 * field will be as large as necessary to
252 * hold both name and default value. THIS
253 * MUST BE THE LAST FIELD IN THE STRUCTURE!! */
257 * The structure below defines a command procedure, which consists of
258 * a collection of Tcl commands plus information about arguments and
262 typedef struct Proc {
263 struct Interp *iPtr; /* Interpreter for which this command
265 int refCount; /* Reference count: 1 if still present
266 * in command table plus 1 for each call
267 * to the procedure that is currently
268 * active. This structure can be freed
269 * when refCount becomes zero. */
270 char *command; /* Command that constitutes the body of
271 * the procedure (dynamically allocated). */
272 Arg *argPtr; /* Pointer to first of procedure's formal
273 * arguments, or NULL if none. */
277 * The structure below defines a command trace. This is used to allow Tcl
278 * clients to find out whenever a command is about to be executed.
281 typedef struct Trace {
282 int level; /* Only trace commands at nesting level
283 * less than or equal to this. */
284 Tcl_CmdTraceProc *proc; /* Procedure to call to trace command. */
285 ClientData clientData; /* Arbitrary value to pass to proc. */
286 struct Trace *nextPtr; /* Next in list of traces for this interp. */
290 * The structure below defines an entry in the assocData hash table which
291 * is associated with an interpreter. The entry contains a pointer to a
292 * function to call when the interpreter is deleted, and a pointer to
293 * a user-defined piece of data.
296 typedef struct AssocData {
297 Tcl_InterpDeleteProc *proc; /* Proc to call when deleting. */
298 ClientData clientData; /* Value to pass to proc. */
302 * The structure below defines a frame, which is a procedure invocation.
303 * These structures exist only while procedures are being executed, and
304 * provide a sort of call stack.
307 typedef struct CallFrame {
308 Tcl_HashTable varTable; /* Hash table containing all of procedure's
309 * local variables. */
310 int level; /* Level of this procedure, for "uplevel"
311 * purposes (i.e. corresponds to nesting of
312 * callerVarPtr's, not callerPtr's). 1 means
313 * outer-most procedure, 0 means top-level. */
314 int argc; /* This and argv below describe name and
315 * arguments for this procedure invocation. */
316 char **argv; /* Array of arguments. */
317 struct CallFrame *callerPtr;
318 /* Value of interp->framePtr when this
319 * procedure was invoked (i.e. next in
320 * stack of all active procedures). */
321 struct CallFrame *callerVarPtr;
322 /* Value of interp->varFramePtr when this
323 * procedure was invoked (i.e. determines
324 * variable scoping within caller; same
325 * as callerPtr unless an "uplevel" command
326 * or something equivalent was active in
331 * The structure below defines one history event (a previously-executed
332 * command that can be re-executed in whole or in part).
336 char *command; /* String containing previously-executed
338 int bytesAvl; /* Total # of bytes available at *event (not
339 * all are necessarily in use now). */
343 *----------------------------------------------------------------
344 * Data structures related to history. These are used primarily
346 *----------------------------------------------------------------
350 * The structure below defines a pending revision to the most recent
351 * history event. Changes are linked together into a list and applied
352 * during the next call to Tcl_RecordHistory. See the comments at the
353 * beginning of tclHistory.c for information on revisions.
356 typedef struct HistoryRev {
357 int firstIndex; /* Index of the first byte to replace in
358 * current history event. */
359 int lastIndex; /* Index of last byte to replace in
360 * current history event. */
361 int newSize; /* Number of bytes in newBytes. */
362 char *newBytes; /* Replacement for the range given by
363 * firstIndex and lastIndex (malloced). */
364 struct HistoryRev *nextPtr; /* Next in chain of revisions to apply, or
365 * NULL for end of list. */
369 *----------------------------------------------------------------
370 * Data structures related to expressions. These are used only in
372 *----------------------------------------------------------------
376 * The data structure below defines a math function (e.g. sin or hypot)
377 * for use in Tcl expressions.
380 #define MAX_MATH_ARGS 5
381 typedef struct MathFunc {
382 int numArgs; /* Number of arguments for function. */
383 Tcl_ValueType argTypes[MAX_MATH_ARGS];
384 /* Acceptable types for each argument. */
385 Tcl_MathProc *proc; /* Procedure that implements this function. */
386 ClientData clientData; /* Additional argument to pass to the function
387 * when invoking it. */
391 *----------------------------------------------------------------
392 * One of the following structures exists for each command in
393 * an interpreter. The Tcl_Command opaque type actually refers
394 * to these structures.
395 *----------------------------------------------------------------
398 typedef struct Command {
399 Tcl_HashEntry *hPtr; /* Pointer to the hash table entry in
400 * interp->commandTable that refers to
401 * this command. Used to get a command's
402 * name from its Tcl_Command handle. NULL
403 * means that the hash table entry has
404 * been removed already (this can happen
405 * if deleteProc causes the command to be
406 * deleted or recreated). */
407 Tcl_CmdProc *proc; /* Procedure to process command. */
408 ClientData clientData; /* Arbitrary value to pass to proc. */
409 Tcl_CmdDeleteProc *deleteProc;
410 /* Procedure to invoke when deleting
412 ClientData deleteData; /* Arbitrary value to pass to deleteProc
413 * (usually the same as clientData). */
414 int deleted; /* Means that the command is in the process
415 * of being deleted (its deleteProc is
416 * currently executing). Any other attempts
417 * to delete the command should be ignored. */
421 *----------------------------------------------------------------
422 * This structure defines an interpreter, which is a collection of
423 * commands plus other state information related to interpreting
424 * commands, such as variable storage. Primary responsibility for
425 * this data structure is in tclBasic.c, but almost every Tcl
426 * source file uses something in here.
427 *----------------------------------------------------------------
430 typedef struct Interp {
433 * Note: the first three fields must match exactly the fields in
434 * a Tcl_Interp struct (see tcl.h). If you change one, be sure to
438 char *result; /* Points to result returned by last
440 Tcl_FreeProc *freeProc; /* Zero means result is statically allocated.
441 * TCL_DYNAMIC means result was allocated with
442 * ckalloc and should be freed with ckfree.
443 * Other values give address of procedure
444 * to invoke to free the result. Must be
445 * freed by Tcl_Eval before executing next
447 int errorLine; /* When TCL_ERROR is returned, this gives
448 * the line number within the command where
449 * the error occurred (1 means first line). */
450 Tcl_HashTable commandTable; /* Contains all of the commands currently
451 * registered in this interpreter. Indexed
452 * by strings; values have type (Command *). */
453 Tcl_HashTable mathFuncTable;/* Contains all of the math functions currently
454 * defined for the interpreter. Indexed by
455 * strings (function names); values have
456 * type (MathFunc *). */
459 * Information related to procedures and variables. See tclProc.c
460 * and tclvar.c for usage.
463 Tcl_HashTable globalTable; /* Contains all global variables for
465 int numLevels; /* Keeps track of how many nested calls to
466 * Tcl_Eval are in progress for this
467 * interpreter. It's used to delay deletion
468 * of the table until all Tcl_Eval invocations
470 int maxNestingDepth; /* If numLevels exceeds this value then Tcl
471 * assumes that infinite recursion has
472 * occurred and it generates an error. */
473 CallFrame *framePtr; /* Points to top-most in stack of all nested
474 * procedure invocations. NULL means there
475 * are no active procedures. */
476 CallFrame *varFramePtr; /* Points to the call frame whose variables
477 * are currently in use (same as framePtr
478 * unless an "uplevel" command is being
479 * executed). NULL means no procedure is
480 * active or "uplevel 0" is being exec'ed. */
481 ActiveVarTrace *activeTracePtr;
482 /* First in list of active traces for interp,
483 * or NULL if no active traces. */
484 int returnCode; /* Completion code to return if current
485 * procedure exits with a TCL_RETURN code. */
486 char *errorInfo; /* Value to store in errorInfo if returnCode
487 * is TCL_ERROR. Malloc'ed, may be NULL */
488 char *errorCode; /* Value to store in errorCode if returnCode
489 * is TCL_ERROR. Malloc'ed, may be NULL */
492 * Information related to history:
495 int numEvents; /* Number of previously-executed commands
497 HistoryEvent *events; /* Array containing numEvents entries
498 * (dynamically allocated). */
499 int curEvent; /* Index into events of place where current
500 * (or most recent) command is recorded. */
501 int curEventNum; /* Event number associated with the slot
502 * given by curEvent. */
503 HistoryRev *revPtr; /* First in list of pending revisions. */
504 char *historyFirst; /* First char. of current command executed
505 * from history module or NULL if none. */
506 int revDisables; /* 0 means history revision OK; > 0 gives
507 * a count of number of times revision has
509 char *evalFirst; /* If TCL_RECORD_BOUNDS flag set, Tcl_Eval
510 * sets this field to point to the first
511 * char. of text from which the current
512 * command came. Otherwise Tcl_Eval sets
514 char *evalLast; /* Similar to evalFirst, except points to
515 * last character of current command. */
518 * Information used by Tcl_AppendResult to keep track of partial
519 * results. See Tcl_AppendResult code for details.
522 char *appendResult; /* Storage space for results generated
523 * by Tcl_AppendResult. Malloc-ed. NULL
524 * means not yet allocated. */
525 int appendAvl; /* Total amount of space available at
527 int appendUsed; /* Number of non-null bytes currently
528 * stored at partialResult. */
531 * A cache of compiled regular expressions. See Tcl_RegExpCompile
532 * in tclUtil.c for details.
535 #define NUM_REGEXPS 5
536 char *patterns[NUM_REGEXPS];/* Strings corresponding to compiled
537 * regular expression patterns. NULL
538 * means that this slot isn't used.
540 int patLengths[NUM_REGEXPS];/* Number of non-null characters in
541 * corresponding entry in patterns.
542 * -1 means entry isn't used. */
543 regexp *regexps[NUM_REGEXPS];
544 /* Compiled forms of above strings. Also
545 * malloc-ed, or NULL if not in use yet. */
548 * Information about packages. Used only in tclPkg.c.
551 Tcl_HashTable packageTable; /* Describes all of the packages loaded
552 * in or available to this interpreter.
553 * Keys are package names, values are
554 * (Package *) pointers. */
555 char *packageUnknown; /* Command to invoke during "package
556 * require" commands for packages that
557 * aren't described in packageTable.
558 * Malloc'ed, may be NULL. */
561 * Information used by Tcl_PrintDouble:
564 char pdFormat[10]; /* Format string used by Tcl_PrintDouble. */
565 int pdPrec; /* Current precision (used to restore the
566 * the tcl_precision variable after a bogus
567 * value has been put into it). */
570 * Miscellaneous information:
573 int cmdCount; /* Total number of times a command procedure
574 * has been called for this interpreter. */
575 int noEval; /* Non-zero means no commands should actually
576 * be executed: just parse only. Used in
577 * expressions when the result is already
579 int evalFlags; /* Flags to control next call to Tcl_Eval.
580 * Normally zero, but may be set before
581 * calling Tcl_Eval. See below for valid
583 char *termPtr; /* Character just after the last one in
584 * a command. Set by Tcl_Eval before
586 char *scriptFile; /* NULL means there is no nested source
587 * command active; otherwise this points to
588 * the name of the file being sourced (it's
589 * not malloc-ed: it points to an argument
590 * to Tcl_EvalFile. */
591 int flags; /* Various flag bits. See below. */
592 Trace *tracePtr; /* List of traces for this interpreter. */
593 Tcl_HashTable *assocData; /* Hash table for associating data with
594 * this interpreter. Cleaned up when
595 * this interpreter is deleted. */
596 char resultSpace[TCL_RESULT_SIZE+1];
597 /* Static space for storing small results. */
601 * EvalFlag bits for Interp structures:
603 * TCL_BRACKET_TERM 1 means that the current script is terminated by
604 * a close bracket rather than the end of the string.
605 * TCL_RECORD_BOUNDS Tells Tcl_Eval to record information in the
606 * evalFirst and evalLast fields for each command
607 * executed directly from the string (top-level
608 * commands and those from command substitution).
609 * TCL_ALLOW_EXCEPTIONS 1 means it's OK for the script to terminate with
610 * a code other than TCL_OK or TCL_ERROR; 0 means
611 * codes other than these should be turned into errors.
614 #define TCL_BRACKET_TERM 1
615 #define TCL_RECORD_BOUNDS 2
616 #define TCL_ALLOW_EXCEPTIONS 4
619 * Flag bits for Interp structures:
621 * DELETED: Non-zero means the interpreter has been deleted:
622 * don't process any more commands for it, and destroy
623 * the structure as soon as all nested invocations of
625 * ERR_IN_PROGRESS: Non-zero means an error unwind is already in progress.
626 * Zero means a command proc has been invoked since last
628 * ERR_ALREADY_LOGGED: Non-zero means information has already been logged
629 * in $errorInfo for the current Tcl_Eval instance,
630 * so Tcl_Eval needn't log it (used to implement the
631 * "error message log" command).
632 * ERROR_CODE_SET: Non-zero means that Tcl_SetErrorCode has been
633 * called to record information for the current
634 * error. Zero means Tcl_Eval must clear the
635 * errorCode variable if an error is returned.
636 * EXPR_INITIALIZED: 1 means initialization specific to expressions has
641 #define ERR_IN_PROGRESS 2
642 #define ERR_ALREADY_LOGGED 4
643 #define ERROR_CODE_SET 8
644 #define EXPR_INITIALIZED 0x10
647 * Default value for the pdPrec and pdFormat fields of interpreters:
650 #define DEFAULT_PD_PREC 6
651 #define DEFAULT_PD_FORMAT "%g"
654 *----------------------------------------------------------------
655 * Data structures related to command parsing. These are used in
656 * tclParse.c and its clients.
657 *----------------------------------------------------------------
661 * The following data structure is used by various parsing procedures
662 * to hold information about where to store the results of parsing
663 * (e.g. the substituted contents of a quoted argument, or the result
664 * of a nested command). At any given time, the space available
665 * for output is fixed, but a procedure may be called to expand the
666 * space available if the current space runs out.
669 typedef struct ParseValue {
670 char *buffer; /* Address of first character in
672 char *next; /* Place to store next character in
674 char *end; /* Address of the last usable character
676 void (*expandProc) _ANSI_ARGS_((struct ParseValue *pvPtr, int needed));
677 /* Procedure to call when space runs out;
678 * it will make more space. */
679 ClientData clientData; /* Arbitrary information for use of
684 * A table used to classify input characters to assist in parsing
685 * Tcl commands. The table should be indexed with a signed character
686 * using the CHAR_TYPE macro. The character may have a negative
690 extern char tclTypeTable[];
691 #define CHAR_TYPE(c) (tclTypeTable+128)[c]
694 * Possible values returned by CHAR_TYPE:
696 * TCL_NORMAL - All characters that don't have special significance
697 * to the Tcl language.
698 * TCL_SPACE - Character is space, tab, or return.
699 * TCL_COMMAND_END - Character is newline or null or semicolon or
701 * TCL_QUOTE - Character is a double-quote.
702 * TCL_OPEN_BRACKET - Character is a "[".
703 * TCL_OPEN_BRACE - Character is a "{".
704 * TCL_CLOSE_BRACE - Character is a "}".
705 * TCL_BACKSLASH - Character is a "\".
706 * TCL_DOLLAR - Character is a "$".
711 #define TCL_COMMAND_END 2
713 #define TCL_OPEN_BRACKET 4
714 #define TCL_OPEN_BRACE 5
715 #define TCL_CLOSE_BRACE 6
716 #define TCL_BACKSLASH 7
720 * Maximum number of levels of nesting permitted in Tcl commands (used
721 * to catch infinite recursion).
724 #define MAX_NESTING_DEPTH 1000
727 * The macro below is used to modify a "char" value (e.g. by casting
728 * it to an unsigned character) so that it can be used safely with
729 * macros such as isspace.
732 #define UCHAR(c) ((unsigned char) (c))
735 * Given a size or address, the macro below "aligns" it to the machine's
736 * memory unit size (e.g. an 8-byte boundary) so that anything can be
737 * placed at the aligned address without fear of an alignment error.
740 #define TCL_ALIGN(x) ((x + 7) & ~7)
743 * For each event source (created with Tcl_CreateEventSource) there
744 * is a structure of the following type:
747 typedef struct TclEventSource {
748 Tcl_EventSetupProc *setupProc; /* This procedure is called by
749 * Tcl_DoOneEvent to set up information
750 * for the wait operation, such as
751 * files to wait for or maximum
753 Tcl_EventCheckProc *checkProc; /* This procedure is called by
754 * Tcl_DoOneEvent after its wait
755 * operation to see what events
756 * are ready and queue them. */
757 ClientData clientData; /* Arbitrary one-word argument to pass
758 * to setupProc and checkProc. */
759 struct TclEventSource *nextPtr; /* Next in list of all event sources
760 * defined for applicaton. */
764 * The following macros are used to specify the runtime platform
765 * setting of the tclPlatform variable.
769 TCL_PLATFORM_UNIX, /* Any Unix-like OS. */
770 TCL_PLATFORM_MAC, /* MacOS. */
771 TCL_PLATFORM_WINDOWS /* Any Microsoft Windows OS. */
775 *----------------------------------------------------------------
776 * Variables shared among Tcl modules but not used by the outside
778 *----------------------------------------------------------------
781 extern Tcl_Time tclBlockTime;
782 extern int tclBlockTimeSet;
783 extern char * tclExecutableName;
784 extern TclEventSource * tclFirstEventSourcePtr;
785 extern Tcl_ChannelType tclFileChannelType;
786 extern char * tclMemDumpFileName;
787 extern TclPlatformType tclPlatform;
790 *----------------------------------------------------------------
791 * Procedures shared among Tcl modules but not used by the outside
793 *----------------------------------------------------------------
797 EXTERN int TclCleanupChildren _ANSI_ARGS_((Tcl_Interp *interp,
798 int numPids, pid_t *pidPtr, Tcl_Channel errorChan));
799 EXTERN int TclCloseFile _ANSI_ARGS_((Tcl_File file));
800 EXTERN char * TclConvertToNative _ANSI_ARGS_((Tcl_Interp *interp,
801 char *name, Tcl_DString *bufferPtr));
802 EXTERN char * TclConvertToNetwork _ANSI_ARGS_((Tcl_Interp *interp,
803 char *name, Tcl_DString *bufferPtr));
804 EXTERN void TclCopyAndCollapse _ANSI_ARGS_((int count, char *src,
806 EXTERN int TclChdir _ANSI_ARGS_((Tcl_Interp *interp,
808 EXTERN void TclClosePipeFile _ANSI_ARGS_((Tcl_File file));
809 EXTERN Tcl_Channel TclCreateCommandChannel _ANSI_ARGS_((
810 Tcl_File readFile, Tcl_File writeFile,
811 Tcl_File errorFile, int numPids, pid_t *pidPtr));
812 EXTERN int TclCreatePipe _ANSI_ARGS_((Tcl_File *readPipe,
813 Tcl_File *writePipe));
814 EXTERN int TclCreatePipeline _ANSI_ARGS_((Tcl_Interp *interp,
815 int argc, char **argv, pid_t **pidArrayPtr,
817 Tcl_File *outPipePtr,
818 Tcl_File *errFilePtr));
819 EXTERN Tcl_File TclCreateTempFile _ANSI_ARGS_((char *contents));
820 EXTERN void TclDeleteVars _ANSI_ARGS_((Interp *iPtr,
821 Tcl_HashTable *tablePtr));
822 EXTERN int TclDoGlob _ANSI_ARGS_((Tcl_Interp *interp,
823 char *separators, Tcl_DString *headPtr,
825 EXTERN void TclExpandParseValue _ANSI_ARGS_((ParseValue *pvPtr,
827 EXTERN void TclExprFloatError _ANSI_ARGS_((Tcl_Interp *interp,
829 EXTERN int TclFindElement _ANSI_ARGS_((Tcl_Interp *interp,
830 char *list, char **elementPtr, char **nextPtr,
831 int *sizePtr, int *bracePtr));
832 EXTERN Proc * TclFindProc _ANSI_ARGS_((Interp *iPtr,
834 EXTERN void TclFreePackageInfo _ANSI_ARGS_((Interp *iPtr));
835 EXTERN char * TclGetCwd _ANSI_ARGS_((Tcl_Interp *interp));
836 EXTERN unsigned long TclGetClicks _ANSI_ARGS_((void));
837 EXTERN char * TclGetExtension _ANSI_ARGS_((char *name));
838 EXTERN void TclGetAndDetachPids _ANSI_ARGS_((Tcl_Interp *interp,
840 EXTERN int TclGetDate _ANSI_ARGS_((char *p,
841 unsigned long now, long zone,
842 unsigned long *timePtr));
843 EXTERN Tcl_Channel TclGetDefaultStdChannel _ANSI_ARGS_((int type));
844 EXTERN char * TclGetEnv _ANSI_ARGS_((char *name));
845 EXTERN int TclGetFrame _ANSI_ARGS_((Tcl_Interp *interp,
846 char *string, CallFrame **framePtrPtr));
847 EXTERN int TclGetOpenMode _ANSI_ARGS_((Tcl_Interp *interp,
848 char *string, int *seekFlagPtr));
849 EXTERN unsigned long TclGetSeconds _ANSI_ARGS_((void));
850 EXTERN void TclGetTime _ANSI_ARGS_((Tcl_Time *time));
851 EXTERN int TclGetTimeZone _ANSI_ARGS_((unsigned long time));
852 EXTERN char * TclGetUserHome _ANSI_ARGS_((char *name,
853 Tcl_DString *bufferPtr));
854 EXTERN int TclGetListIndex _ANSI_ARGS_((Tcl_Interp *interp,
855 char *string, int *indexPtr));
856 EXTERN int TclGetLoadedPackages _ANSI_ARGS_((Tcl_Interp *interp,
858 EXTERN char * TclGetUserHome _ANSI_ARGS_((char *name,
859 Tcl_DString *bufferPtr));
860 EXTERN int TclGuessPackageName _ANSI_ARGS_((char *fileName,
861 Tcl_DString *bufPtr));
862 EXTERN int TclHasPipes _ANSI_ARGS_((void));
863 EXTERN int TclHasSockets _ANSI_ARGS_((Tcl_Interp *interp));
864 EXTERN int TclIdlePending _ANSI_ARGS_((void));
865 EXTERN int TclInterpInit _ANSI_ARGS_((Tcl_Interp *interp));
866 EXTERN Proc * TclIsProc _ANSI_ARGS_((Command *cmdPtr));
867 EXTERN int TclLoadFile _ANSI_ARGS_((Tcl_Interp *interp,
868 char *fileName, char *sym1, char *sym2,
869 Tcl_PackageInitProc **proc1Ptr,
870 Tcl_PackageInitProc **proc2Ptr));
871 EXTERN int TclMakeFileTable _ANSI_ARGS_((Tcl_Interp *interp,
873 EXTERN int TclMatchFiles _ANSI_ARGS_((Tcl_Interp *interp,
874 char *separators, Tcl_DString *dirPtr,
875 char *pattern, char *tail));
876 EXTERN int TclNeedSpace _ANSI_ARGS_((char *start, char *end));
877 EXTERN Tcl_File TclOpenFile _ANSI_ARGS_((char *fname, int mode));
878 EXTERN int TclParseBraces _ANSI_ARGS_((Tcl_Interp *interp,
879 char *string, char **termPtr, ParseValue *pvPtr));
880 EXTERN int TclParseNestedCmd _ANSI_ARGS_((Tcl_Interp *interp,
881 char *string, int flags, char **termPtr,
883 EXTERN int TclParseQuotes _ANSI_ARGS_((Tcl_Interp *interp,
884 char *string, int termChar, int flags,
885 char **termPtr, ParseValue *pvPtr));
886 EXTERN int TclParseWords _ANSI_ARGS_((Tcl_Interp *interp,
887 char *string, int flags, int maxWords,
888 char **termPtr, int *argcPtr, char **argv,
890 EXTERN void TclPlatformExit _ANSI_ARGS_((int status));
891 EXTERN void TclPlatformInit _ANSI_ARGS_((Tcl_Interp *interp));
892 EXTERN char * TclPrecTraceProc _ANSI_ARGS_((ClientData clientData,
893 Tcl_Interp *interp, char *name1, char *name2,
895 EXTERN int TclPreventAliasLoop _ANSI_ARGS_((Tcl_Interp *interp,
896 Tcl_Interp *cmdInterp, char *cmdName,
897 Tcl_CmdProc *proc, ClientData clientData));
898 EXTERN int TclReadFile _ANSI_ARGS_((Tcl_File file,
899 int shouldBlock, char *buf, int toRead));
900 EXTERN int TclSeekFile _ANSI_ARGS_((Tcl_File file,
901 int offset, int whence));
902 EXTERN int TclServiceIdle _ANSI_ARGS_((void));
903 EXTERN void TclSetupEnv _ANSI_ARGS_((Tcl_Interp *interp));
904 EXTERN int TclSockGetPort _ANSI_ARGS_((Tcl_Interp *interp,
905 char *string, char *proto, int *portPtr));
906 EXTERN int TclSockMinimumBuffers _ANSI_ARGS_((int sock,
908 EXTERN int TclSpawnPipeline _ANSI_ARGS_((Tcl_Interp *interp,
909 pid_t *pidPtr, int *numPids, int argc, char **argv,
913 char *intIn, char *finalOut));
914 EXTERN int TclTestChannelCmd _ANSI_ARGS_((ClientData clientData,
915 Tcl_Interp *interp, int argc, char **argv));
916 EXTERN int TclTestChannelEventCmd _ANSI_ARGS_((
917 ClientData clientData, Tcl_Interp *interp,
918 int argc, char **argv));
919 EXTERN int TclUpdateReturnInfo _ANSI_ARGS_((Interp *iPtr));
920 EXTERN int TclWaitForFile _ANSI_ARGS_((Tcl_File file,
921 int mask, int timeout));
922 EXTERN char * TclWordEnd _ANSI_ARGS_((char *start, int nested,
924 EXTERN int TclWriteFile _ANSI_ARGS_((Tcl_File file,
925 int shouldBlock, char *buf, int toWrite));
928 *----------------------------------------------------------------
929 * Command procedures in the generic core:
930 *----------------------------------------------------------------
933 EXTERN int Tcl_AfterCmd _ANSI_ARGS_((ClientData clientData,
934 Tcl_Interp *interp, int argc, char **argv));
935 EXTERN int Tcl_AppendCmd _ANSI_ARGS_((ClientData clientData,
936 Tcl_Interp *interp, int argc, char **argv));
937 EXTERN int Tcl_ArrayCmd _ANSI_ARGS_((ClientData clientData,
938 Tcl_Interp *interp, int argc, char **argv));
939 EXTERN int Tcl_BreakCmd _ANSI_ARGS_((ClientData clientData,
940 Tcl_Interp *interp, int argc, char **argv));
941 EXTERN int Tcl_CaseCmd _ANSI_ARGS_((ClientData clientData,
942 Tcl_Interp *interp, int argc, char **argv));
943 EXTERN int Tcl_CatchCmd _ANSI_ARGS_((ClientData clientData,
944 Tcl_Interp *interp, int argc, char **argv));
945 EXTERN int Tcl_CdCmd _ANSI_ARGS_((ClientData clientData,
946 Tcl_Interp *interp, int argc, char **argv));
947 EXTERN int Tcl_ClockCmd _ANSI_ARGS_((ClientData clientData,
948 Tcl_Interp *interp, int argc, char **argv));
949 EXTERN int Tcl_CloseCmd _ANSI_ARGS_((ClientData clientData,
950 Tcl_Interp *interp, int argc, char **argv));
951 EXTERN int Tcl_ConcatCmd _ANSI_ARGS_((ClientData clientData,
952 Tcl_Interp *interp, int argc, char **argv));
953 EXTERN int Tcl_ContinueCmd _ANSI_ARGS_((ClientData clientData,
954 Tcl_Interp *interp, int argc, char **argv));
955 EXTERN int Tcl_CpCmd _ANSI_ARGS_((ClientData clientData,
956 Tcl_Interp *interp, int argc, char **argv));
957 EXTERN int Tcl_EchoCmd _ANSI_ARGS_((ClientData clientData,
958 Tcl_Interp *interp, int argc, char **argv));
959 EXTERN int Tcl_EofCmd _ANSI_ARGS_((ClientData clientData,
960 Tcl_Interp *interp, int argc, char **argv));
961 EXTERN int Tcl_ErrorCmd _ANSI_ARGS_((ClientData clientData,
962 Tcl_Interp *interp, int argc, char **argv));
963 EXTERN int Tcl_EvalCmd _ANSI_ARGS_((ClientData clientData,
964 Tcl_Interp *interp, int argc, char **argv));
965 EXTERN int Tcl_ExecCmd _ANSI_ARGS_((ClientData clientData,
966 Tcl_Interp *interp, int argc, char **argv));
967 EXTERN int Tcl_ExitCmd _ANSI_ARGS_((ClientData clientData,
968 Tcl_Interp *interp, int argc, char **argv));
969 EXTERN int Tcl_ExprCmd _ANSI_ARGS_((ClientData clientData,
970 Tcl_Interp *interp, int argc, char **argv));
971 EXTERN int Tcl_FblockedCmd _ANSI_ARGS_((ClientData clientData,
972 Tcl_Interp *interp, int argc, char **argv));
973 EXTERN int Tcl_FconfigureCmd _ANSI_ARGS_((ClientData clientData,
974 Tcl_Interp *interp, int argc, char **argv));
975 EXTERN int Tcl_FileCmd _ANSI_ARGS_((ClientData clientData,
976 Tcl_Interp *interp, int argc, char **argv));
977 EXTERN int Tcl_FileEventCmd _ANSI_ARGS_((ClientData clientData,
978 Tcl_Interp *interp, int argc, char **argv));
979 EXTERN int Tcl_FlushCmd _ANSI_ARGS_((ClientData clientData,
980 Tcl_Interp *interp, int argc, char **argv));
981 EXTERN int Tcl_ForCmd _ANSI_ARGS_((ClientData clientData,
982 Tcl_Interp *interp, int argc, char **argv));
983 EXTERN int Tcl_ForeachCmd _ANSI_ARGS_((ClientData clientData,
984 Tcl_Interp *interp, int argc, char **argv));
985 EXTERN int Tcl_FormatCmd _ANSI_ARGS_((ClientData clientData,
986 Tcl_Interp *interp, int argc, char **argv));
987 EXTERN int Tcl_GetsCmd _ANSI_ARGS_((ClientData clientData,
988 Tcl_Interp *interp, int argc, char **argv));
989 EXTERN int Tcl_GlobalCmd _ANSI_ARGS_((ClientData clientData,
990 Tcl_Interp *interp, int argc, char **argv));
991 EXTERN int Tcl_GlobCmd _ANSI_ARGS_((ClientData clientData,
992 Tcl_Interp *interp, int argc, char **argv));
993 EXTERN int Tcl_HistoryCmd _ANSI_ARGS_((ClientData clientData,
994 Tcl_Interp *interp, int argc, char **argv));
995 EXTERN int Tcl_IfCmd _ANSI_ARGS_((ClientData clientData,
996 Tcl_Interp *interp, int argc, char **argv));
997 EXTERN int Tcl_IncrCmd _ANSI_ARGS_((ClientData clientData,
998 Tcl_Interp *interp, int argc, char **argv));
999 EXTERN int Tcl_InfoCmd _ANSI_ARGS_((ClientData clientData,
1000 Tcl_Interp *interp, int argc, char **argv));
1001 EXTERN int Tcl_InterpCmd _ANSI_ARGS_((ClientData clientData,
1002 Tcl_Interp *interp, int argc, char **argv));
1003 EXTERN int Tcl_JoinCmd _ANSI_ARGS_((ClientData clientData,
1004 Tcl_Interp *interp, int argc, char **argv));
1005 EXTERN int Tcl_LappendCmd _ANSI_ARGS_((ClientData clientData,
1006 Tcl_Interp *interp, int argc, char **argv));
1007 EXTERN int Tcl_LindexCmd _ANSI_ARGS_((ClientData clientData,
1008 Tcl_Interp *interp, int argc, char **argv));
1009 EXTERN int Tcl_LinsertCmd _ANSI_ARGS_((ClientData clientData,
1010 Tcl_Interp *interp, int argc, char **argv));
1011 EXTERN int Tcl_LlengthCmd _ANSI_ARGS_((ClientData clientData,
1012 Tcl_Interp *interp, int argc, char **argv));
1013 EXTERN int Tcl_ListCmd _ANSI_ARGS_((ClientData clientData,
1014 Tcl_Interp *interp, int argc, char **argv));
1015 EXTERN int Tcl_LoadCmd _ANSI_ARGS_((ClientData clientData,
1016 Tcl_Interp *interp, int argc, char **argv));
1017 EXTERN int Tcl_LrangeCmd _ANSI_ARGS_((ClientData clientData,
1018 Tcl_Interp *interp, int argc, char **argv));
1019 EXTERN int Tcl_LreplaceCmd _ANSI_ARGS_((ClientData clientData,
1020 Tcl_Interp *interp, int argc, char **argv));
1021 EXTERN int Tcl_LsCmd _ANSI_ARGS_((ClientData clientData,
1022 Tcl_Interp *interp, int argc, char **argv));
1023 EXTERN int Tcl_LsearchCmd _ANSI_ARGS_((ClientData clientData,
1024 Tcl_Interp *interp, int argc, char **argv));
1025 EXTERN int Tcl_LsortCmd _ANSI_ARGS_((ClientData clientData,
1026 Tcl_Interp *interp, int argc, char **argv));
1027 EXTERN int Tcl_MacBeepCmd _ANSI_ARGS_((ClientData clientData,
1028 Tcl_Interp *interp, int argc, char **argv));
1029 EXTERN int Tcl_MacSourceCmd _ANSI_ARGS_((ClientData clientData,
1030 Tcl_Interp *interp, int argc, char **argv));
1031 EXTERN int Tcl_MkdirCmd _ANSI_ARGS_((ClientData clientData,
1032 Tcl_Interp *interp, int argc, char **argv));
1033 EXTERN int Tcl_MvCmd _ANSI_ARGS_((ClientData clientData,
1034 Tcl_Interp *interp, int argc, char **argv));
1035 EXTERN int Tcl_OpenCmd _ANSI_ARGS_((ClientData clientData,
1036 Tcl_Interp *interp, int argc, char **argv));
1037 EXTERN int Tcl_PackageCmd _ANSI_ARGS_((ClientData clientData,
1038 Tcl_Interp *interp, int argc, char **argv));
1039 EXTERN int Tcl_PidCmd _ANSI_ARGS_((ClientData clientData,
1040 Tcl_Interp *interp, int argc, char **argv));
1041 EXTERN int Tcl_ProcCmd _ANSI_ARGS_((ClientData clientData,
1042 Tcl_Interp *interp, int argc, char **argv));
1043 EXTERN int Tcl_PutsCmd _ANSI_ARGS_((ClientData clientData,
1044 Tcl_Interp *interp, int argc, char **argv));
1045 EXTERN int Tcl_PwdCmd _ANSI_ARGS_((ClientData clientData,
1046 Tcl_Interp *interp, int argc, char **argv));
1047 EXTERN int Tcl_ReadCmd _ANSI_ARGS_((ClientData clientData,
1048 Tcl_Interp *interp, int argc, char **argv));
1049 EXTERN int Tcl_RegexpCmd _ANSI_ARGS_((ClientData clientData,
1050 Tcl_Interp *interp, int argc, char **argv));
1051 EXTERN int Tcl_RegsubCmd _ANSI_ARGS_((ClientData clientData,
1052 Tcl_Interp *interp, int argc, char **argv));
1053 EXTERN int Tcl_RenameCmd _ANSI_ARGS_((ClientData clientData,
1054 Tcl_Interp *interp, int argc, char **argv));
1055 EXTERN int Tcl_ReturnCmd _ANSI_ARGS_((ClientData clientData,
1056 Tcl_Interp *interp, int argc, char **argv));
1057 EXTERN int Tcl_RmCmd _ANSI_ARGS_((ClientData clientData,
1058 Tcl_Interp *interp, int argc, char **argv));
1059 EXTERN int Tcl_RmdirCmd _ANSI_ARGS_((ClientData clientData,
1060 Tcl_Interp *interp, int argc, char **argv));
1061 EXTERN int Tcl_ScanCmd _ANSI_ARGS_((ClientData clientData,
1062 Tcl_Interp *interp, int argc, char **argv));
1063 EXTERN int Tcl_SeekCmd _ANSI_ARGS_((ClientData clientData,
1064 Tcl_Interp *interp, int argc, char **argv));
1065 EXTERN int Tcl_SetCmd _ANSI_ARGS_((ClientData clientData,
1066 Tcl_Interp *interp, int argc, char **argv));
1067 EXTERN int Tcl_SplitCmd _ANSI_ARGS_((ClientData clientData,
1068 Tcl_Interp *interp, int argc, char **argv));
1069 EXTERN int Tcl_SocketCmd _ANSI_ARGS_((ClientData clientData,
1070 Tcl_Interp *interp, int argc, char **argv));
1071 EXTERN int Tcl_SourceCmd _ANSI_ARGS_((ClientData clientData,
1072 Tcl_Interp *interp, int argc, char **argv));
1073 EXTERN int Tcl_StringCmd _ANSI_ARGS_((ClientData clientData,
1074 Tcl_Interp *interp, int argc, char **argv));
1075 EXTERN int Tcl_SubstCmd _ANSI_ARGS_((ClientData clientData,
1076 Tcl_Interp *interp, int argc, char **argv));
1077 EXTERN int Tcl_SwitchCmd _ANSI_ARGS_((ClientData clientData,
1078 Tcl_Interp *interp, int argc, char **argv));
1079 EXTERN int Tcl_TellCmd _ANSI_ARGS_((ClientData clientData,
1080 Tcl_Interp *interp, int argc, char **argv));
1081 EXTERN int Tcl_TimeCmd _ANSI_ARGS_((ClientData clientData,
1082 Tcl_Interp *interp, int argc, char **argv));
1083 EXTERN int Tcl_TraceCmd _ANSI_ARGS_((ClientData clientData,
1084 Tcl_Interp *interp, int argc, char **argv));
1085 EXTERN int Tcl_UnsetCmd _ANSI_ARGS_((ClientData clientData,
1086 Tcl_Interp *interp, int argc, char **argv));
1087 EXTERN int Tcl_UpdateCmd _ANSI_ARGS_((ClientData clientData,
1088 Tcl_Interp *interp, int argc, char **argv));
1089 EXTERN int Tcl_UplevelCmd _ANSI_ARGS_((ClientData clientData,
1090 Tcl_Interp *interp, int argc, char **argv));
1091 EXTERN int Tcl_UpvarCmd _ANSI_ARGS_((ClientData clientData,
1092 Tcl_Interp *interp, int argc, char **argv));
1093 EXTERN int Tcl_VwaitCmd _ANSI_ARGS_((ClientData clientData,
1094 Tcl_Interp *interp, int argc, char **argv));
1095 EXTERN int Tcl_WhileCmd _ANSI_ARGS_((ClientData clientData,
1096 Tcl_Interp *interp, int argc, char **argv));
1097 EXTERN int TclUnsupported0Cmd _ANSI_ARGS_((ClientData clientData,
1098 Tcl_Interp *interp, int argc, char **argv));
1100 #endif /* _TCLINT */