home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 May / PCWorld_2002-05_cd.bin / Software / TemaCD / activetcltk / ActiveTcl8.3.4.1-8.win32-ix86.exe / ActiveTcl8.3.4.1-win32-ix86 / include / tclInt.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-22  |  89.6 KB  |  2,223 lines

  1. /*
  2.  * tclInt.h --
  3.  *
  4.  *    Declarations of things used internally by the Tcl interpreter.
  5.  *
  6.  * Copyright (c) 1987-1993 The Regents of the University of California.
  7.  * Copyright (c) 1993-1997 Lucent Technologies.
  8.  * Copyright (c) 1994-1998 Sun Microsystems, Inc.
  9.  * Copyright (c) 1998-1999 by Scriptics Corporation.
  10.  *
  11.  * See the file "license.terms" for information on usage and redistribution
  12.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  13.  *
  14.  * RCS: @(#) $Id: tclInt.h,v 1.42.2.3 2001/10/19 23:47:57 hobbs Exp $
  15.  */
  16.  
  17. #ifndef _TCLINT
  18. #define _TCLINT
  19.  
  20. /*
  21.  * Common include files needed by most of the Tcl source files are
  22.  * included here, so that system-dependent personalizations for the
  23.  * include files only have to be made in once place.  This results
  24.  * in a few extra includes, but greater modularity.  The order of
  25.  * the three groups of #includes is important.    For example, stdio.h
  26.  * is needed by tcl.h, and the _ANSI_ARGS_ declaration in tcl.h is
  27.  * needed by stdlib.h in some configurations.
  28.  */
  29.  
  30. #include <stdio.h>
  31.  
  32. #ifndef _TCL
  33. #include "tcl.h"
  34. #endif
  35.  
  36. #include <ctype.h>
  37. #ifdef NO_LIMITS_H
  38. #   include "../compat/limits.h"
  39. #else
  40. #   include <limits.h>
  41. #endif
  42. #ifdef NO_STDLIB_H
  43. #   include "../compat/stdlib.h"
  44. #else
  45. #   include <stdlib.h>
  46. #endif
  47. #ifdef NO_STRING_H
  48. #include "../compat/string.h"
  49. #else
  50. #include <string.h>
  51. #endif
  52.  
  53. #undef TCL_STORAGE_CLASS
  54. #ifdef BUILD_tcl
  55. # define TCL_STORAGE_CLASS DLLEXPORT
  56. #else
  57. # ifdef USE_TCL_STUBS
  58. #  define TCL_STORAGE_CLASS
  59. # else
  60. #  define TCL_STORAGE_CLASS DLLIMPORT
  61. # endif
  62. #endif
  63.  
  64. /*
  65.  * The following procedures allow namespaces to be customized to
  66.  * support special name resolution rules for commands/variables.
  67.  * 
  68.  */
  69.  
  70. struct Tcl_ResolvedVarInfo;
  71.  
  72. typedef Tcl_Var (Tcl_ResolveRuntimeVarProc) _ANSI_ARGS_((
  73.     Tcl_Interp* interp, struct Tcl_ResolvedVarInfo *vinfoPtr));
  74.  
  75. typedef void (Tcl_ResolveVarDeleteProc) _ANSI_ARGS_((
  76.     struct Tcl_ResolvedVarInfo *vinfoPtr));
  77.  
  78. /*
  79.  * The following structure encapsulates the routines needed to resolve a
  80.  * variable reference at runtime.  Any variable specific state will typically
  81.  * be appended to this structure.
  82.  */
  83.  
  84.  
  85. typedef struct Tcl_ResolvedVarInfo {
  86.     Tcl_ResolveRuntimeVarProc *fetchProc;
  87.     Tcl_ResolveVarDeleteProc *deleteProc;
  88. } Tcl_ResolvedVarInfo;
  89.  
  90.  
  91.  
  92. typedef int (Tcl_ResolveCompiledVarProc) _ANSI_ARGS_((
  93.     Tcl_Interp* interp, char* name, int length,
  94.     Tcl_Namespace *context, Tcl_ResolvedVarInfo **rPtr));
  95.  
  96. typedef int (Tcl_ResolveVarProc) _ANSI_ARGS_((
  97.     Tcl_Interp* interp, char* name, Tcl_Namespace *context,
  98.     int flags, Tcl_Var *rPtr));
  99.  
  100. typedef int (Tcl_ResolveCmdProc) _ANSI_ARGS_((Tcl_Interp* interp,
  101.     char* name, Tcl_Namespace *context, int flags,
  102.     Tcl_Command *rPtr));
  103.  
  104. typedef struct Tcl_ResolverInfo {
  105.     Tcl_ResolveCmdProc *cmdResProc;    /* Procedure handling command name
  106.                      * resolution. */
  107.     Tcl_ResolveVarProc *varResProc;    /* Procedure handling variable name
  108.                      * resolution for variables that
  109.                      * can only be handled at runtime. */
  110.     Tcl_ResolveCompiledVarProc *compiledVarResProc;
  111.                     /* Procedure handling variable name
  112.                      * resolution at compile time. */
  113. } Tcl_ResolverInfo;
  114.  
  115. /*
  116.  *----------------------------------------------------------------
  117.  * Data structures related to namespaces.
  118.  *----------------------------------------------------------------
  119.  */
  120.  
  121. /*
  122.  * The structure below defines a namespace.
  123.  * Note: the first five fields must match exactly the fields in a
  124.  * Tcl_Namespace structure (see tcl.h). If you change one, be sure to
  125.  * change the other.
  126.  */
  127.  
  128. typedef struct Namespace {
  129.     char *name;             /* The namespace's simple (unqualified)
  130.                   * name. This contains no ::'s. The name of
  131.                   * the global namespace is "" although "::"
  132.                   * is an synonym. */
  133.     char *fullName;         /* The namespace's fully qualified name.
  134.                   * This starts with ::. */
  135.     ClientData clientData;     /* An arbitrary value associated with this
  136.                   * namespace. */
  137.     Tcl_NamespaceDeleteProc *deleteProc;
  138.                  /* Procedure invoked when deleting the
  139.                   * namespace to, e.g., free clientData. */
  140.     struct Namespace *parentPtr; /* Points to the namespace that contains
  141.                   * this one. NULL if this is the global
  142.                   * namespace. */
  143.     Tcl_HashTable childTable;     /* Contains any child namespaces. Indexed
  144.                   * by strings; values have type
  145.                   * (Namespace *). */
  146.     long nsId;             /* Unique id for the namespace. */
  147.     Tcl_Interp *interp;         /* The interpreter containing this
  148.                   * namespace. */
  149.     int flags;             /* OR-ed combination of the namespace
  150.                   * status flags NS_DYING and NS_DEAD
  151.                   * listed below. */
  152.     int activationCount;     /* Number of "activations" or active call
  153.                   * frames for this namespace that are on
  154.                   * the Tcl call stack. The namespace won't
  155.                   * be freed until activationCount becomes
  156.                   * zero. */
  157.     int refCount;         /* Count of references by namespaceName *
  158.                   * objects. The namespace can't be freed
  159.                   * until refCount becomes zero. */
  160.     Tcl_HashTable cmdTable;     /* Contains all the commands currently
  161.                   * registered in the namespace. Indexed by
  162.                   * strings; values have type (Command *).
  163.                   * Commands imported by Tcl_Import have
  164.                   * Command structures that point (via an
  165.                   * ImportedCmdRef structure) to the
  166.                   * Command structure in the source
  167.                   * namespace's command table. */
  168.     Tcl_HashTable varTable;     /* Contains all the (global) variables
  169.                   * currently in this namespace. Indexed
  170.                   * by strings; values have type (Var *). */
  171.     char **exportArrayPtr;     /* Points to an array of string patterns
  172.                   * specifying which commands are exported.
  173.                   * A pattern may include "string match"
  174.                   * style wildcard characters to specify
  175.                   * multiple commands; however, no namespace
  176.                   * qualifiers are allowed. NULL if no
  177.                   * export patterns are registered. */
  178.     int numExportPatterns;     /* Number of export patterns currently
  179.                   * registered using "namespace export". */
  180.     int maxExportPatterns;     /* Mumber of export patterns for which
  181.                   * space is currently allocated. */
  182.     int cmdRefEpoch;         /* Incremented if a newly added command
  183.                   * shadows a command for which this
  184.                   * namespace has already cached a Command *
  185.                   * pointer; this causes all its cached
  186.                   * Command* pointers to be invalidated. */
  187.     int resolverEpoch;         /* Incremented whenever the name resolution
  188.                   * rules change for this namespace; this
  189.                   * invalidates all byte codes compiled in
  190.                   * the namespace, causing the code to be
  191.                   * recompiled under the new rules. */
  192.     Tcl_ResolveCmdProc *cmdResProc;
  193.                  /* If non-null, this procedure overrides
  194.                   * the usual command resolution mechanism
  195.                   * in Tcl.  This procedure is invoked
  196.                   * within Tcl_FindCommand to resolve all
  197.                   * command references within the namespace. */
  198.     Tcl_ResolveVarProc *varResProc;
  199.                  /* If non-null, this procedure overrides
  200.                   * the usual variable resolution mechanism
  201.                   * in Tcl.  This procedure is invoked
  202.                   * within Tcl_FindNamespaceVar to resolve all
  203.                   * variable references within the namespace
  204.                   * at runtime. */
  205.     Tcl_ResolveCompiledVarProc *compiledVarResProc;
  206.                  /* If non-null, this procedure overrides
  207.                   * the usual variable resolution mechanism
  208.                   * in Tcl.  This procedure is invoked
  209.                   * within LookupCompiledLocal to resolve
  210.                   * variable references within the namespace
  211.                   * at compile time. */
  212. } Namespace;
  213.  
  214. /*
  215.  * Flags used to represent the status of a namespace:
  216.  *
  217.  * NS_DYING -    1 means Tcl_DeleteNamespace has been called to delete the
  218.  *        namespace but there are still active call frames on the Tcl
  219.  *        stack that refer to the namespace. When the last call frame
  220.  *        referring to it has been popped, it's variables and command
  221.  *        will be destroyed and it will be marked "dead" (NS_DEAD).
  222.  *        The namespace can no longer be looked up by name.
  223.  * NS_DEAD -    1 means Tcl_DeleteNamespace has been called to delete the
  224.  *        namespace and no call frames still refer to it. Its
  225.  *        variables and command have already been destroyed. This bit
  226.  *        allows the namespace resolution code to recognize that the
  227.  *        namespace is "deleted". When the last namespaceName object
  228.  *        in any byte code code unit that refers to the namespace has
  229.  *        been freed (i.e., when the namespace's refCount is 0), the
  230.  *        namespace's storage will be freed.
  231.  */
  232.  
  233. #define NS_DYING    0x01
  234. #define NS_DEAD        0x02
  235.  
  236. /*
  237.  * Flag passed to TclGetNamespaceForQualName to have it create all namespace
  238.  * components of a namespace-qualified name that cannot be found. The new
  239.  * namespaces are created within their specified parent. Note that this
  240.  * flag's value must not conflict with the values of the flags
  241.  * TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY, and FIND_ONLY_NS (defined in
  242.  * tclNamesp.c).
  243.  */
  244.  
  245. #define CREATE_NS_IF_UNKNOWN 0x800
  246.  
  247. /*
  248.  *----------------------------------------------------------------
  249.  * Data structures related to variables.   These are used primarily
  250.  * in tclVar.c
  251.  *----------------------------------------------------------------
  252.  */
  253.  
  254. /*
  255.  * The following structure defines a variable trace, which is used to
  256.  * invoke a specific C procedure whenever certain operations are performed
  257.  * on a variable.
  258.  */
  259.  
  260. typedef struct VarTrace {
  261.     Tcl_VarTraceProc *traceProc;/* Procedure to call when operations given
  262.                  * by flags are performed on variable. */
  263.     ClientData clientData;    /* Argument to pass to proc. */
  264.     int flags;            /* What events the trace procedure is
  265.                  * interested in:  OR-ed combination of
  266.                  * TCL_TRACE_READS, TCL_TRACE_WRITES,
  267.                  * TCL_TRACE_UNSETS and TCL_TRACE_ARRAY. */
  268.     struct VarTrace *nextPtr;    /* Next in list of traces associated with
  269.                  * a particular variable. */
  270. } VarTrace;
  271.  
  272. /*
  273.  * When a variable trace is active (i.e. its associated procedure is
  274.  * executing), one of the following structures is linked into a list
  275.  * associated with the variable's interpreter.    The information in
  276.  * the structure is needed in order for Tcl to behave reasonably
  277.  * if traces are deleted while traces are active.
  278.  */
  279.  
  280. typedef struct ActiveVarTrace {
  281.     struct Var *varPtr;        /* Variable that's being traced. */
  282.     struct ActiveVarTrace *nextPtr;
  283.                 /* Next in list of all active variable
  284.                  * traces for the interpreter, or NULL
  285.                  * if no more. */
  286.     VarTrace *nextTracePtr;    /* Next trace to check after current
  287.                  * trace procedure returns;  if this
  288.                  * trace gets deleted, must update pointer
  289.                  * to avoid using free'd memory. */
  290. } ActiveVarTrace;
  291.  
  292. /*
  293.  * The following structure describes an enumerative search in progress on
  294.  * an array variable;  this are invoked with options to the "array"
  295.  * command.
  296.  */
  297.  
  298. typedef struct ArraySearch {
  299.     int id;            /* Integer id used to distinguish among
  300.                  * multiple concurrent searches for the
  301.                  * same array. */
  302.     struct Var *varPtr;        /* Pointer to array variable that's being
  303.                  * searched. */
  304.     Tcl_HashSearch search;    /* Info kept by the hash module about
  305.                  * progress through the array. */
  306.     Tcl_HashEntry *nextEntry;    /* Non-null means this is the next element
  307.                  * to be enumerated (it's leftover from
  308.                  * the Tcl_FirstHashEntry call or from
  309.                  * an "array anymore" command).     NULL
  310.                  * means must call Tcl_NextHashEntry
  311.                  * to get value to return. */
  312.     struct ArraySearch *nextPtr;/* Next in list of all active searches
  313.                  * for this variable, or NULL if this is
  314.                  * the last one. */
  315. } ArraySearch;
  316.  
  317. /*
  318.  * The structure below defines a variable, which associates a string name
  319.  * with a Tcl_Obj value. These structures are kept in procedure call frames
  320.  * (for local variables recognized by the compiler) or in the heap (for
  321.  * global variables and any variable not known to the compiler). For each
  322.  * Var structure in the heap, a hash table entry holds the variable name and
  323.  * a pointer to the Var structure.
  324.  */
  325.  
  326. typedef struct Var {
  327.     union {
  328.     Tcl_Obj *objPtr;    /* The variable's object value. Used for 
  329.                  * scalar variables and array elements. */
  330.     Tcl_HashTable *tablePtr;/* For array variables, this points to
  331.                  * information about the hash table used
  332.                  * to implement the associative array. 
  333.                  * Points to malloc-ed data. */
  334.     struct Var *linkPtr;    /* If this is a global variable being
  335.                  * referred to in a procedure, or a variable
  336.                  * created by "upvar", this field points to
  337.                  * the referenced variable's Var struct. */
  338.     } value;
  339.     char *name;            /* NULL if the variable is in a hashtable,
  340.                  * otherwise points to the variable's
  341.                  * name. It is used, e.g., by TclLookupVar
  342.                  * and "info locals". The storage for the
  343.                  * characters of the name is not owned by
  344.                  * the Var and must not be freed when
  345.                  * freeing the Var. */
  346.     Namespace *nsPtr;        /* Points to the namespace that contains
  347.                  * this variable or NULL if the variable is
  348.                  * a local variable in a Tcl procedure. */
  349.     Tcl_HashEntry *hPtr;    /* If variable is in a hashtable, either the
  350.                  * hash table entry that refers to this
  351.                  * variable or NULL if the variable has been
  352.                  * detached from its hash table (e.g. an
  353.                  * array is deleted, but some of its
  354.                  * elements are still referred to in
  355.                  * upvars). NULL if the variable is not in a
  356.                  * hashtable. This is used to delete an
  357.                  * variable from its hashtable if it is no
  358.                  * longer needed. */
  359.     int refCount;        /* Counts number of active uses of this
  360.                  * variable, not including its entry in the
  361.                  * call frame or the hash table: 1 for each
  362.                  * additional variable whose linkPtr points
  363.                  * here, 1 for each nested trace active on
  364.                  * variable, and 1 if the variable is a 
  365.                  * namespace variable. This record can't be
  366.                  * deleted until refCount becomes 0. */
  367.     VarTrace *tracePtr;        /* First in list of all traces set for this
  368.                  * variable. */
  369.     ArraySearch *searchPtr;    /* First in list of all searches active
  370.                  * for this variable, or NULL if none. */
  371.     int flags;            /* Miscellaneous bits of information about
  372.                  * variable. See below for definitions. */
  373. } Var;
  374.  
  375. /*
  376.  * Flag bits for variables. The first three (VAR_SCALAR, VAR_ARRAY, and
  377.  * VAR_LINK) are mutually exclusive and give the "type" of the variable.
  378.  * VAR_UNDEFINED is independent of the variable's type. 
  379.  *
  380.  * VAR_SCALAR -            1 means this is a scalar variable and not
  381.  *                an array or link. The "objPtr" field points
  382.  *                to the variable's value, a Tcl object.
  383.  * VAR_ARRAY -            1 means this is an array variable rather
  384.  *                than a scalar variable or link. The
  385.  *                "tablePtr" field points to the array's
  386.  *                hashtable for its elements.
  387.  * VAR_LINK -            1 means this Var structure contains a
  388.  *                pointer to another Var structure that
  389.  *                either has the real value or is itself
  390.  *                another VAR_LINK pointer. Variables like
  391.  *                this come about through "upvar" and "global"
  392.  *                commands, or through references to variables
  393.  *                in enclosing namespaces.
  394.  * VAR_UNDEFINED -        1 means that the variable is in the process
  395.  *                of being deleted. An undefined variable
  396.  *                logically does not exist and survives only
  397.  *                while it has a trace, or if it is a global
  398.  *                variable currently being used by some
  399.  *                procedure.
  400.  * VAR_IN_HASHTABLE -        1 means this variable is in a hashtable and
  401.  *                the Var structure is malloced. 0 if it is
  402.  *                a local variable that was assigned a slot
  403.  *                in a procedure frame by    the compiler so the
  404.  *                Var storage is part of the call frame.
  405.  * VAR_TRACE_ACTIVE -        1 means that trace processing is currently
  406.  *                underway for a read or write access, so
  407.  *                new read or write accesses should not cause
  408.  *                trace procedures to be called and the
  409.  *                variable can't be deleted.
  410.  * VAR_ARRAY_ELEMENT -        1 means that this variable is an array
  411.  *                element, so it is not legal for it to be
  412.  *                an array itself (the VAR_ARRAY flag had
  413.  *                better not be set).
  414.  * VAR_NAMESPACE_VAR -        1 means that this variable was declared
  415.  *                as a namespace variable. This flag ensures
  416.  *                it persists until its namespace is
  417.  *                destroyed or until the variable is unset;
  418.  *                it will persist even if it has not been
  419.  *                initialized and is marked undefined.
  420.  *                The variable's refCount is incremented to
  421.  *                reflect the "reference" from its namespace.
  422.  *
  423.  * The following additional flags are used with the CompiledLocal type
  424.  * defined below:
  425.  *
  426.  * VAR_ARGUMENT -        1 means that this variable holds a procedure
  427.  *                argument. 
  428.  * VAR_TEMPORARY -        1 if the local variable is an anonymous
  429.  *                temporary variable. Temporaries have a NULL
  430.  *                name.
  431.  * VAR_RESOLVED -        1 if name resolution has been done for this
  432.  *                variable.
  433.  */
  434.  
  435. #define VAR_SCALAR        0x1
  436. #define VAR_ARRAY        0x2
  437. #define VAR_LINK        0x4
  438. #define VAR_UNDEFINED        0x8
  439. #define VAR_IN_HASHTABLE    0x10
  440. #define VAR_TRACE_ACTIVE    0x20
  441. #define VAR_ARRAY_ELEMENT    0x40
  442. #define VAR_NAMESPACE_VAR    0x80
  443.  
  444. #define VAR_ARGUMENT        0x100
  445. #define VAR_TEMPORARY        0x200
  446. #define VAR_RESOLVED        0x400    
  447.  
  448. /*
  449.  * Macros to ensure that various flag bits are set properly for variables.
  450.  * The ANSI C "prototypes" for these macros are:
  451.  *
  452.  * EXTERN void    TclSetVarScalar _ANSI_ARGS_((Var *varPtr));
  453.  * EXTERN void    TclSetVarArray _ANSI_ARGS_((Var *varPtr));
  454.  * EXTERN void    TclSetVarLink _ANSI_ARGS_((Var *varPtr));
  455.  * EXTERN void    TclSetVarArrayElement _ANSI_ARGS_((Var *varPtr));
  456.  * EXTERN void    TclSetVarUndefined _ANSI_ARGS_((Var *varPtr));
  457.  * EXTERN void    TclClearVarUndefined _ANSI_ARGS_((Var *varPtr));
  458.  */
  459.  
  460. #define TclSetVarScalar(varPtr) \
  461.     (varPtr)->flags = ((varPtr)->flags & ~(VAR_ARRAY|VAR_LINK)) | VAR_SCALAR
  462.  
  463. #define TclSetVarArray(varPtr) \
  464.     (varPtr)->flags = ((varPtr)->flags & ~(VAR_SCALAR|VAR_LINK)) | VAR_ARRAY
  465.  
  466. #define TclSetVarLink(varPtr) \
  467.     (varPtr)->flags = ((varPtr)->flags & ~(VAR_SCALAR|VAR_ARRAY)) | VAR_LINK
  468.  
  469. #define TclSetVarArrayElement(varPtr) \
  470.     (varPtr)->flags = ((varPtr)->flags & ~VAR_ARRAY) | VAR_ARRAY_ELEMENT
  471.  
  472. #define TclSetVarUndefined(varPtr) \
  473.     (varPtr)->flags |= VAR_UNDEFINED
  474.  
  475. #define TclClearVarUndefined(varPtr) \
  476.     (varPtr)->flags &= ~VAR_UNDEFINED
  477.  
  478. /*
  479.  * Macros to read various flag bits of variables.
  480.  * The ANSI C "prototypes" for these macros are:
  481.  *
  482.  * EXTERN int    TclIsVarScalar _ANSI_ARGS_((Var *varPtr));
  483.  * EXTERN int    TclIsVarLink _ANSI_ARGS_((Var *varPtr));
  484.  * EXTERN int    TclIsVarArray _ANSI_ARGS_((Var *varPtr));
  485.  * EXTERN int    TclIsVarUndefined _ANSI_ARGS_((Var *varPtr));
  486.  * EXTERN int    TclIsVarArrayElement _ANSI_ARGS_((Var *varPtr));
  487.  * EXTERN int    TclIsVarTemporary _ANSI_ARGS_((Var *varPtr));
  488.  * EXTERN int    TclIsVarArgument _ANSI_ARGS_((Var *varPtr));
  489.  * EXTERN int    TclIsVarResolved _ANSI_ARGS_((Var *varPtr));
  490.  */
  491.     
  492. #define TclIsVarScalar(varPtr) \
  493.     ((varPtr)->flags & VAR_SCALAR)
  494.  
  495. #define TclIsVarLink(varPtr) \
  496.     ((varPtr)->flags & VAR_LINK)
  497.  
  498. #define TclIsVarArray(varPtr) \
  499.     ((varPtr)->flags & VAR_ARRAY)
  500.  
  501. #define TclIsVarUndefined(varPtr) \
  502.     ((varPtr)->flags & VAR_UNDEFINED)
  503.  
  504. #define TclIsVarArrayElement(varPtr) \
  505.     ((varPtr)->flags & VAR_ARRAY_ELEMENT)
  506.  
  507. #define TclIsVarTemporary(varPtr) \
  508.     ((varPtr)->flags & VAR_TEMPORARY)
  509.     
  510. #define TclIsVarArgument(varPtr) \
  511.     ((varPtr)->flags & VAR_ARGUMENT)
  512.     
  513. #define TclIsVarResolved(varPtr) \
  514.     ((varPtr)->flags & VAR_RESOLVED)
  515.  
  516. /*
  517.  *----------------------------------------------------------------
  518.  * Data structures related to procedures.  These are used primarily
  519.  * in tclProc.c, tclCompile.c, and tclExecute.c.
  520.  *----------------------------------------------------------------
  521.  */
  522.  
  523. /*
  524.  * Forward declaration to prevent an error when the forward reference to
  525.  * Command is encountered in the Proc and ImportRef types declared below.
  526.  */
  527.  
  528. struct Command;
  529.  
  530. /*
  531.  * The variable-length structure below describes a local variable of a
  532.  * procedure that was recognized by the compiler. These variables have a
  533.  * name, an element in the array of compiler-assigned local variables in the
  534.  * procedure's call frame, and various other items of information. If the
  535.  * local variable is a formal argument, it may also have a default value.
  536.  * The compiler can't recognize local variables whose names are
  537.  * expressions (these names are only known at runtime when the expressions
  538.  * are evaluated) or local variables that are created as a result of an
  539.  * "upvar" or "uplevel" command. These other local variables are kept
  540.  * separately in a hash table in the call frame.
  541.  */
  542.  
  543. typedef struct CompiledLocal {
  544.     struct CompiledLocal *nextPtr;
  545.                 /* Next compiler-recognized local variable
  546.                  * for this procedure, or NULL if this is
  547.                  * the last local. */
  548.     int nameLength;        /* The number of characters in local
  549.                  * variable's name. Used to speed up
  550.                  * variable lookups. */
  551.     int frameIndex;        /* Index in the array of compiler-assigned
  552.                  * variables in the procedure call frame. */
  553.     int flags;            /* Flag bits for the local variable. Same as
  554.                  * the flags for the Var structure above,
  555.                  * although only VAR_SCALAR, VAR_ARRAY, 
  556.                  * VAR_LINK, VAR_ARGUMENT, VAR_TEMPORARY, and
  557.                  * VAR_RESOLVED make sense. */
  558.     Tcl_Obj *defValuePtr;    /* Pointer to the default value of an
  559.                  * argument, if any. NULL if not an argument
  560.                  * or, if an argument, no default value. */
  561.     Tcl_ResolvedVarInfo *resolveInfo;
  562.                 /* Customized variable resolution info
  563.                  * supplied by the Tcl_ResolveCompiledVarProc
  564.                  * associated with a namespace. Each variable
  565.                  * is marked by a unique ClientData tag
  566.                  * during compilation, and that same tag
  567.                  * is used to find the variable at runtime. */
  568.     char name[4];        /* Name of the local variable starts here.
  569.                  * If the name is NULL, this will just be
  570.                  * '\0'. The actual size of this field will
  571.                  * be large enough to hold the name. MUST
  572.                  * BE THE LAST FIELD IN THE STRUCTURE! */
  573. } CompiledLocal;
  574.  
  575. /*
  576.  * The structure below defines a command procedure, which consists of a
  577.  * collection of Tcl commands plus information about arguments and other
  578.  * local variables recognized at compile time.
  579.  */
  580.  
  581. typedef struct Proc {
  582.     struct Interp *iPtr;      /* Interpreter for which this command
  583.                    * is defined. */
  584.     int refCount;          /* Reference count: 1 if still present
  585.                    * in command table plus 1 for each call
  586.                    * to the procedure that is currently
  587.                    * active. This structure can be freed
  588.                    * when refCount becomes zero. */
  589.     struct Command *cmdPtr;      /* Points to the Command structure for
  590.                    * this procedure. This is used to get
  591.                    * the namespace in which to execute
  592.                    * the procedure. */
  593.     Tcl_Obj *bodyPtr;          /* Points to the ByteCode object for
  594.                    * procedure's body command. */
  595.     int numArgs;          /* Number of formal parameters. */
  596.     int numCompiledLocals;      /* Count of local variables recognized by
  597.                    * the compiler including arguments and
  598.                    * temporaries. */
  599.     CompiledLocal *firstLocalPtr; /* Pointer to first of the procedure's
  600.                    * compiler-allocated local variables, or
  601.                    * NULL if none. The first numArgs entries
  602.                    * in this list describe the procedure's
  603.                    * formal arguments. */
  604.     CompiledLocal *lastLocalPtr;  /* Pointer to the last allocated local
  605.                    * variable or NULL if none. This has
  606.                    * frame index (numCompiledLocals-1). */
  607. } Proc;
  608.  
  609. /*
  610.  * The structure below defines a command trace.     This is used to allow Tcl
  611.  * clients to find out whenever a command is about to be executed.
  612.  */
  613.  
  614. typedef struct Trace {
  615.     int level;            /* Only trace commands at nesting level
  616.                  * less than or equal to this. */
  617.     Tcl_CmdTraceProc *proc;    /* Procedure to call to trace command. */
  618.     ClientData clientData;    /* Arbitrary value to pass to proc. */
  619.     struct Trace *nextPtr;    /* Next in list of traces for this interp. */
  620. } Trace;
  621.  
  622. /*
  623.  * The structure below defines an entry in the assocData hash table which
  624.  * is associated with an interpreter. The entry contains a pointer to a
  625.  * function to call when the interpreter is deleted, and a pointer to
  626.  * a user-defined piece of data.
  627.  */
  628.  
  629. typedef struct AssocData {
  630.     Tcl_InterpDeleteProc *proc;    /* Proc to call when deleting. */
  631.     ClientData clientData;    /* Value to pass to proc. */
  632. } AssocData;    
  633.  
  634. /*
  635.  * The structure below defines a call frame. A call frame defines a naming
  636.  * context for a procedure call: its local naming scope (for local
  637.  * variables) and its global naming scope (a namespace, perhaps the global
  638.  * :: namespace). A call frame can also define the naming context for a
  639.  * namespace eval or namespace inscope command: the namespace in which the
  640.  * command's code should execute. The Tcl_CallFrame structures exist only
  641.  * while procedures or namespace eval/inscope's are being executed, and
  642.  * provide a kind of Tcl call stack.
  643.  * 
  644.  * WARNING!! The structure definition must be kept consistent with the
  645.  * Tcl_CallFrame structure in tcl.h. If you change one, change the other.
  646.  */
  647.  
  648. typedef struct CallFrame {
  649.     Namespace *nsPtr;        /* Points to the namespace used to resolve
  650.                  * commands and global variables. */
  651.     int isProcCallFrame;    /* If nonzero, the frame was pushed to
  652.                  * execute a Tcl procedure and may have
  653.                  * local vars. If 0, the frame was pushed
  654.                  * to execute a namespace command and var
  655.                  * references are treated as references to
  656.                  * namespace vars; varTablePtr and
  657.                  * compiledLocals are ignored. */
  658.     int objc;            /* This and objv below describe the
  659.                  * arguments for this procedure call. */
  660.     Tcl_Obj *CONST *objv;    /* Array of argument objects. */
  661.     struct CallFrame *callerPtr;
  662.                 /* Value of interp->framePtr when this
  663.                  * procedure was invoked (i.e. next higher
  664.                  * in stack of all active procedures). */
  665.     struct CallFrame *callerVarPtr;
  666.                 /* Value of interp->varFramePtr when this
  667.                  * procedure was invoked (i.e. determines
  668.                  * variable scoping within caller). Same
  669.                  * as callerPtr unless an "uplevel" command
  670.                  * or something equivalent was active in
  671.                  * the caller). */
  672.     int level;            /* Level of this procedure, for "uplevel"
  673.                  * purposes (i.e. corresponds to nesting of
  674.                  * callerVarPtr's, not callerPtr's). 1 for
  675.                  * outermost procedure, 0 for top-level. */
  676.     Proc *procPtr;        /* Points to the structure defining the
  677.                  * called procedure. Used to get information
  678.                  * such as the number of compiled local
  679.                  * variables (local variables assigned
  680.                  * entries ["slots"] in the compiledLocals
  681.                  * array below). */
  682.     Tcl_HashTable *varTablePtr;    /* Hash table containing local variables not
  683.                  * recognized by the compiler, or created at
  684.                  * execution time through, e.g., upvar.
  685.                  * Initially NULL and created if needed. */
  686.     int numCompiledLocals;    /* Count of local variables recognized by
  687.                  * the compiler including arguments. */
  688.     Var* compiledLocals;    /* Points to the array of local variables
  689.                  * recognized by the compiler. The compiler
  690.                  * emits code that refers to these variables
  691.                  * using an index into this array. */
  692. } CallFrame;
  693.  
  694. /*
  695.  *----------------------------------------------------------------
  696.  * Data structures and procedures related to TclHandles, which
  697.  * are a very lightweight method of preserving enough information
  698.  * to determine if an arbitrary malloc'd block has been deleted.
  699.  *----------------------------------------------------------------
  700.  */
  701.  
  702. typedef VOID **TclHandle;
  703.  
  704. EXTERN TclHandle    TclHandleCreate _ANSI_ARGS_((VOID *ptr));
  705. EXTERN void        TclHandleFree _ANSI_ARGS_((TclHandle handle));
  706. EXTERN TclHandle    TclHandlePreserve _ANSI_ARGS_((TclHandle handle));
  707. EXTERN void        TclHandleRelease _ANSI_ARGS_((TclHandle handle)); 
  708.  
  709. /*
  710.  *----------------------------------------------------------------
  711.  * Data structures related to history.     These are used primarily
  712.  * in tclHistory.c
  713.  *----------------------------------------------------------------
  714.  */
  715.  
  716. /*
  717.  * The structure below defines one history event (a previously-executed
  718.  * command that can be re-executed in whole or in part).
  719.  */
  720.  
  721. typedef struct {
  722.     char *command;        /* String containing previously-executed
  723.                  * command. */
  724.     int bytesAvl;        /* Total # of bytes available at *event (not
  725.                  * all are necessarily in use now). */
  726. } HistoryEvent;
  727.  
  728. /*
  729.  * The structure below defines a pending revision to the most recent
  730.  * history event.  Changes are linked together into a list and applied
  731.  * during the next call to Tcl_RecordHistory.  See the comments at the
  732.  * beginning of tclHistory.c for information on revisions.
  733.  */
  734.  
  735. typedef struct HistoryRev {
  736.     int firstIndex;        /* Index of the first byte to replace in
  737.                  * current history event. */
  738.     int lastIndex;        /* Index of last byte to replace in
  739.                  * current history event. */
  740.     int newSize;        /* Number of bytes in newBytes. */
  741.     char *newBytes;        /* Replacement for the range given by
  742.                  * firstIndex and lastIndex (malloced). */
  743.     struct HistoryRev *nextPtr;    /* Next in chain of revisions to apply, or
  744.                  * NULL for end of list. */
  745. } HistoryRev;
  746.  
  747. /*
  748.  *----------------------------------------------------------------
  749.  * Data structures related to expressions.  These are used only in
  750.  * tclExpr.c.
  751.  *----------------------------------------------------------------
  752.  */
  753.  
  754. /*
  755.  * The data structure below defines a math function (e.g. sin or hypot)
  756.  * for use in Tcl expressions.
  757.  */
  758.  
  759. #define MAX_MATH_ARGS 5
  760. typedef struct MathFunc {
  761.     int builtinFuncIndex;    /* If this is a builtin math function, its
  762.                  * index in the array of builtin functions.
  763.                  * (tclCompilation.h lists these indices.)
  764.                  * The value is -1 if this is a new function
  765.                  * defined by Tcl_CreateMathFunc. The value
  766.                  * is also -1 if a builtin function is
  767.                  * replaced by a Tcl_CreateMathFunc call. */
  768.     int numArgs;        /* Number of arguments for function. */
  769.     Tcl_ValueType argTypes[MAX_MATH_ARGS];
  770.                 /* Acceptable types for each argument. */
  771.     Tcl_MathProc *proc;        /* Procedure that implements this function.
  772.                  * NULL if isBuiltinFunc is 1. */
  773.     ClientData clientData;    /* Additional argument to pass to the
  774.                  * function when invoking it. NULL if
  775.                  * isBuiltinFunc is 1. */
  776. } MathFunc;
  777.  
  778. /*
  779.  * These are a thin layer over TclpThreadKeyDataGet and TclpThreadKeyDataSet
  780.  * when threads are used, or an emulation if there are no threads.  These
  781.  * are really internal and Tcl clients should use Tcl_GetThreadData.
  782.  */
  783.  
  784. EXTERN VOID *TclThreadDataKeyGet _ANSI_ARGS_((Tcl_ThreadDataKey *keyPtr));
  785. EXTERN void TclThreadDataKeySet _ANSI_ARGS_((Tcl_ThreadDataKey *keyPtr, VOID *data));
  786.  
  787. /*
  788.  * This is a convenience macro used to initialize a thread local storage ptr.
  789.  */
  790. #define TCL_TSD_INIT(keyPtr)    (ThreadSpecificData *)Tcl_GetThreadData((keyPtr), sizeof(ThreadSpecificData))
  791.  
  792.  
  793. /*
  794.  *----------------------------------------------------------------
  795.  * Data structures related to bytecode compilation and execution.
  796.  * These are used primarily in tclCompile.c, tclExecute.c, and
  797.  * tclBasic.c.
  798.  *----------------------------------------------------------------
  799.  */
  800.  
  801. /*
  802.  * Forward declaration to prevent errors when the forward references to
  803.  * Tcl_Parse and CompileEnv are encountered in the procedure type
  804.  * CompileProc declared below.
  805.  */
  806.  
  807. struct CompileEnv;
  808.  
  809. /*
  810.  * The type of procedures called by the Tcl bytecode compiler to compile
  811.  * commands. Pointers to these procedures are kept in the Command structure
  812.  * describing each command. When a CompileProc returns, the interpreter's
  813.  * result is set to error information, if any. In addition, the CompileProc
  814.  * returns an integer value, which is one of the following:
  815.  *
  816.  * TCL_OK        Compilation completed normally.
  817.  * TCL_ERROR        Compilation failed because of an error;
  818.  *            the interpreter's result describes what went wrong.
  819.  * TCL_OUT_LINE_COMPILE    Compilation failed because, e.g., the command is
  820.  *            too complex for effective inline compilation. The
  821.  *            CompileProc believes the command is legal but 
  822.  *            should be compiled "out of line" by emitting code
  823.  *            to invoke its command procedure at runtime.
  824.  */
  825.  
  826. #define TCL_OUT_LINE_COMPILE    (TCL_CONTINUE + 1)
  827.  
  828. typedef int (CompileProc) _ANSI_ARGS_((Tcl_Interp *interp,
  829.     Tcl_Parse *parsePtr, struct CompileEnv *compEnvPtr));
  830.  
  831. /*
  832.  * The type of procedure called from the compilation hook point in
  833.  * SetByteCodeFromAny.
  834.  */
  835.  
  836. typedef int (CompileHookProc) _ANSI_ARGS_((Tcl_Interp *interp,
  837.     struct CompileEnv *compEnvPtr, ClientData clientData));
  838.  
  839. /*
  840.  * The data structure defining the execution environment for ByteCode's.
  841.  * There is one ExecEnv structure per Tcl interpreter. It holds the
  842.  * evaluation stack that holds command operands and results. The stack grows
  843.  * towards increasing addresses. The "stackTop" member is cached by
  844.  * TclExecuteByteCode in a local variable: it must be set before calling
  845.  * TclExecuteByteCode and will be restored by TclExecuteByteCode before it
  846.  * returns.
  847.  */
  848.  
  849. typedef struct ExecEnv {
  850.     Tcl_Obj **stackPtr;        /* Points to the first item in the
  851.                  * evaluation stack on the heap. */
  852.     int stackTop;        /* Index of current top of stack; -1 when
  853.                  * the stack is empty. */
  854.     int stackEnd;        /* Index of last usable item in stack. */
  855. } ExecEnv;
  856.  
  857. /*
  858.  * The definitions for the LiteralTable and LiteralEntry structures. Each
  859.  * interpreter contains a LiteralTable. It is used to reduce the storage
  860.  * needed for all the Tcl objects that hold the literals of scripts compiled
  861.  * by the interpreter. A literal's object is shared by all the ByteCodes
  862.  * that refer to the literal. Each distinct literal has one LiteralEntry
  863.  * entry in the LiteralTable. A literal table is a specialized hash table
  864.  * that is indexed by the literal's string representation, which may contain
  865.  * null characters.
  866.  *
  867.  * Note that we reduce the space needed for literals by sharing literal
  868.  * objects both within a ByteCode (each ByteCode contains a local
  869.  * LiteralTable) and across all an interpreter's ByteCodes (with the
  870.  * interpreter's global LiteralTable).
  871.  */
  872.  
  873. typedef struct LiteralEntry {
  874.     struct LiteralEntry *nextPtr;    /* Points to next entry in this
  875.                      * hash bucket or NULL if end of
  876.                      * chain. */
  877.     Tcl_Obj *objPtr;            /* Points to Tcl object that
  878.                      * holds the literal's bytes and
  879.                      * length. */
  880.     int refCount;            /* If in an interpreter's global
  881.                      * literal table, the number of
  882.                      * ByteCode structures that share
  883.                      * the literal object; the literal
  884.                      * entry can be freed when refCount
  885.                      * drops to 0. If in a local literal
  886.                      * table, -1. */
  887. } LiteralEntry;
  888.  
  889. typedef struct LiteralTable {
  890.     LiteralEntry **buckets;        /* Pointer to bucket array. Each
  891.                      * element points to first entry in
  892.                      * bucket's hash chain, or NULL. */
  893.     LiteralEntry *staticBuckets[TCL_SMALL_HASH_TABLE];
  894.                     /* Bucket array used for small
  895.                      * tables to avoid mallocs and
  896.                      * frees. */
  897.     int numBuckets;            /* Total number of buckets allocated
  898.                      * at **buckets. */
  899.     int numEntries;            /* Total number of entries present
  900.                      * in table. */
  901.     int rebuildSize;            /* Enlarge table when numEntries
  902.                      * gets to be this large. */
  903.     int mask;                /* Mask value used in hashing
  904.                      * function. */
  905. } LiteralTable;
  906.  
  907. /*
  908.  * The following structure defines for each Tcl interpreter various
  909.  * statistics-related information about the bytecode compiler and
  910.  * interpreter's operation in that interpreter.
  911.  */
  912.  
  913. #ifdef TCL_COMPILE_STATS
  914. typedef struct ByteCodeStats {
  915.     long numExecutions;          /* Number of ByteCodes executed. */
  916.     long numCompilations;      /* Number of ByteCodes created. */
  917.     long numByteCodesFreed;      /* Number of ByteCodes destroyed. */
  918.     long instructionCount[256];      /* Number of times each instruction was
  919.                    * executed. */
  920.  
  921.     double totalSrcBytes;      /* Total source bytes ever compiled. */
  922.     double totalByteCodeBytes;      /* Total bytes for all ByteCodes. */
  923.     double currentSrcBytes;      /* Src bytes for all current ByteCodes. */
  924.     double currentByteCodeBytes;  /* Code bytes in all current ByteCodes. */
  925.  
  926.     long srcCount[32];          /* Source size distribution: # of srcs of
  927.                    * size [2**(n-1)..2**n), n in [0..32). */
  928.     long byteCodeCount[32];      /* ByteCode size distribution. */
  929.     long lifetimeCount[32];      /* ByteCode lifetime distribution (ms). */
  930.     
  931.     double currentInstBytes;      /* Instruction bytes-current ByteCodes. */
  932.     double currentLitBytes;      /* Current literal bytes. */
  933.     double currentExceptBytes;      /* Current exception table bytes. */
  934.     double currentAuxBytes;      /* Current auxiliary information bytes. */
  935.     double currentCmdMapBytes;      /* Current src<->code map bytes. */
  936.     
  937.     long numLiteralsCreated;      /* Total literal objects ever compiled. */
  938.     double totalLitStringBytes;      /* Total string bytes in all literals. */
  939.     double currentLitStringBytes; /* String bytes in current literals. */
  940.     long literalCount[32];      /* Distribution of literal string sizes. */
  941. } ByteCodeStats;
  942. #endif /* TCL_COMPILE_STATS */
  943.  
  944. /*
  945.  *----------------------------------------------------------------
  946.  * Data structures related to commands.
  947.  *----------------------------------------------------------------
  948.  */
  949.  
  950. /*
  951.  * An imported command is created in an namespace when it imports a "real"
  952.  * command from another namespace. An imported command has a Command
  953.  * structure that points (via its ClientData value) to the "real" Command
  954.  * structure in the source namespace's command table. The real command
  955.  * records all the imported commands that refer to it in a list of ImportRef
  956.  * structures so that they can be deleted when the real command is deleted.  */
  957.  
  958. typedef struct ImportRef {
  959.     struct Command *importedCmdPtr;
  960.                 /* Points to the imported command created in
  961.                  * an importing namespace; this command
  962.                  * redirects its invocations to the "real"
  963.                  * command. */
  964.     struct ImportRef *nextPtr;    /* Next element on the linked list of
  965.                  * imported commands that refer to the
  966.                  * "real" command. The real command deletes
  967.                  * these imported commands on this list when
  968.                  * it is deleted. */
  969. } ImportRef;
  970.  
  971. /*
  972.  * Data structure used as the ClientData of imported commands: commands
  973.  * created in an namespace when it imports a "real" command from another
  974.  * namespace.
  975.  */
  976.  
  977. typedef struct ImportedCmdData {
  978.     struct Command *realCmdPtr;    /* "Real" command that this imported command
  979.                  * refers to. */
  980.     struct Command *selfPtr;    /* Pointer to this imported command. Needed
  981.                  * only when deleting it in order to remove
  982.                  * it from the real command's linked list of
  983.                  * imported commands that refer to it. */
  984. } ImportedCmdData;
  985.  
  986. /*
  987.  * A Command structure exists for each command in a namespace. The
  988.  * Tcl_Command opaque type actually refers to these structures.
  989.  */
  990.  
  991. typedef struct Command {
  992.     Tcl_HashEntry *hPtr;    /* Pointer to the hash table entry that
  993.                  * refers to this command. The hash table is
  994.                  * either a namespace's command table or an
  995.                  * interpreter's hidden command table. This
  996.                  * pointer is used to get a command's name
  997.                  * from its Tcl_Command handle. NULL means
  998.                  * that the hash table entry has been
  999.                  * removed already (this can happen if
  1000.                  * deleteProc causes the command to be
  1001.                  * deleted or recreated). */
  1002.     Namespace *nsPtr;        /* Points to the namespace containing this
  1003.                  * command. */
  1004.     int refCount;        /* 1 if in command hashtable plus 1 for each
  1005.                  * reference from a CmdName Tcl object
  1006.                  * representing a command's name in a
  1007.                  * ByteCode instruction sequence. This
  1008.                  * structure can be freed when refCount
  1009.                  * becomes zero. */
  1010.     int cmdEpoch;        /* Incremented to invalidate any references
  1011.                  * that point to this command when it is
  1012.                  * renamed, deleted, hidden, or exposed. */
  1013.     CompileProc *compileProc;    /* Procedure called to compile command. NULL
  1014.                  * if no compile proc exists for command. */
  1015.     Tcl_ObjCmdProc *objProc;    /* Object-based command procedure. */
  1016.     ClientData objClientData;    /* Arbitrary value passed to object proc. */
  1017.     Tcl_CmdProc *proc;        /* String-based command procedure. */
  1018.     ClientData clientData;    /* Arbitrary value passed to string proc. */
  1019.     Tcl_CmdDeleteProc *deleteProc;
  1020.                 /* Procedure invoked when deleting command
  1021.                  * to, e.g., free all client data. */
  1022.     ClientData deleteData;    /* Arbitrary value passed to deleteProc. */
  1023.     int deleted;        /* Means that the command is in the process
  1024.                  * of being deleted (its deleteProc is
  1025.                  * currently executing). Other attempts to
  1026.                  * delete the command should be ignored. */
  1027.     ImportRef *importRefPtr;    /* List of each imported Command created in
  1028.                  * another namespace when this command is
  1029.                  * imported. These imported commands
  1030.                  * redirect invocations back to this
  1031.                  * command. The list is used to remove all
  1032.                  * those imported commands when deleting
  1033.                  * this "real" command. */
  1034. } Command;
  1035.  
  1036. /*
  1037.  *----------------------------------------------------------------
  1038.  * Data structures related to name resolution procedures.
  1039.  *----------------------------------------------------------------
  1040.  */
  1041.  
  1042. /*
  1043.  * The interpreter keeps a linked list of name resolution schemes.
  1044.  * The scheme for a namespace is consulted first, followed by the
  1045.  * list of schemes in an interpreter, followed by the default
  1046.  * name resolution in Tcl.  Schemes are added/removed from the
  1047.  * interpreter's list by calling Tcl_AddInterpResolver and
  1048.  * Tcl_RemoveInterpResolver.
  1049.  */
  1050.  
  1051. typedef struct ResolverScheme {
  1052.     char *name;            /* Name identifying this scheme. */
  1053.     Tcl_ResolveCmdProc *cmdResProc;
  1054.                 /* Procedure handling command name
  1055.                  * resolution. */
  1056.     Tcl_ResolveVarProc *varResProc;
  1057.                 /* Procedure handling variable name
  1058.                  * resolution for variables that
  1059.                  * can only be handled at runtime. */
  1060.     Tcl_ResolveCompiledVarProc *compiledVarResProc;
  1061.                 /* Procedure handling variable name
  1062.                  * resolution at compile time. */
  1063.  
  1064.     struct ResolverScheme *nextPtr;
  1065.                 /* Pointer to next record in linked list. */
  1066. } ResolverScheme;
  1067.  
  1068. /*
  1069.  *----------------------------------------------------------------
  1070.  * This structure defines an interpreter, which is a collection of
  1071.  * commands plus other state information related to interpreting
  1072.  * commands, such as variable storage. Primary responsibility for
  1073.  * this data structure is in tclBasic.c, but almost every Tcl
  1074.  * source file uses something in here.
  1075.  *----------------------------------------------------------------
  1076.  */
  1077.  
  1078. typedef struct Interp {
  1079.  
  1080.     /*
  1081.      * Note:  the first three fields must match exactly the fields in
  1082.      * a Tcl_Interp struct (see tcl.h).     If you change one, be sure to
  1083.      * change the other.
  1084.      *
  1085.      * The interpreter's result is held in both the string and the
  1086.      * objResultPtr fields. These fields hold, respectively, the result's
  1087.      * string or object value. The interpreter's result is always in the
  1088.      * result field if that is non-empty, otherwise it is in objResultPtr.
  1089.      * The two fields are kept consistent unless some C code sets
  1090.      * interp->result directly. Programs should not access result and
  1091.      * objResultPtr directly; instead, they should always get and set the
  1092.      * result using procedures such as Tcl_SetObjResult, Tcl_GetObjResult,
  1093.      * and Tcl_GetStringResult. See the SetResult man page for details.
  1094.      */
  1095.  
  1096.     char *result;        /* If the last command returned a string
  1097.                  * result, this points to it. Should not be
  1098.                  * accessed directly; see comment above. */
  1099.     Tcl_FreeProc *freeProc;    /* Zero means a string result is statically
  1100.                  * allocated. TCL_DYNAMIC means string
  1101.                  * result was allocated with ckalloc and
  1102.                  * should be freed with ckfree. Other values
  1103.                  * give address of procedure to invoke to
  1104.                  * free the string result. Tcl_Eval must
  1105.                  * free it before executing next command. */
  1106.     int errorLine;        /* When TCL_ERROR is returned, this gives
  1107.                  * the line number in the command where the
  1108.                  * error occurred (1 means first line). */
  1109.     struct TclStubs *stubTable;
  1110.                 /* Pointer to the exported Tcl stub table.
  1111.                  * On previous versions of Tcl this is a
  1112.                  * pointer to the objResultPtr or a pointer
  1113.                  * to a buckets array in a hash table. We
  1114.                  * therefore have to do some careful checking
  1115.                  * before we can use this. */
  1116.  
  1117.     TclHandle handle;        /* Handle used to keep track of when this
  1118.                  * interp is deleted. */
  1119.  
  1120.     Namespace *globalNsPtr;    /* The interpreter's global namespace. */
  1121.     Tcl_HashTable *hiddenCmdTablePtr;
  1122.                 /* Hash table used by tclBasic.c to keep
  1123.                  * track of hidden commands on a per-interp
  1124.                  * basis. */
  1125.     ClientData interpInfo;    /* Information used by tclInterp.c to keep
  1126.                  * track of master/slave interps on
  1127.                  * a per-interp basis. */
  1128.     Tcl_HashTable mathFuncTable;/* Contains all the math functions currently
  1129.                  * defined for the interpreter.     Indexed by
  1130.                  * strings (function names); values have
  1131.                  * type (MathFunc *). */
  1132.  
  1133.  
  1134.  
  1135.     /*
  1136.      * Information related to procedures and variables. See tclProc.c
  1137.      * and tclvar.c for usage.
  1138.      */
  1139.  
  1140.     int numLevels;        /* Keeps track of how many nested calls to
  1141.                  * Tcl_Eval are in progress for this
  1142.                  * interpreter.     It's used to delay deletion
  1143.                  * of the table until all Tcl_Eval
  1144.                  * invocations are completed. */
  1145.     int maxNestingDepth;    /* If numLevels exceeds this value then Tcl
  1146.                  * assumes that infinite recursion has
  1147.                  * occurred and it generates an error. */
  1148.     CallFrame *framePtr;    /* Points to top-most in stack of all nested
  1149.                  * procedure invocations.  NULL means there
  1150.                  * are no active procedures. */
  1151.     CallFrame *varFramePtr;    /* Points to the call frame whose variables
  1152.                  * are currently in use (same as framePtr
  1153.                  * unless an "uplevel" command is
  1154.                  * executing). NULL means no procedure is
  1155.                  * active or "uplevel 0" is executing. */
  1156.     ActiveVarTrace *activeTracePtr;
  1157.                 /* First in list of active traces for
  1158.                  * interp, or NULL if no active traces. */
  1159.     int returnCode;        /* Completion code to return if current
  1160.                  * procedure exits with TCL_RETURN code. */
  1161.     char *errorInfo;        /* Value to store in errorInfo if returnCode
  1162.                  * is TCL_ERROR.  Malloc'ed, may be NULL */
  1163.     char *errorCode;        /* Value to store in errorCode if returnCode
  1164.                  * is TCL_ERROR.  Malloc'ed, may be NULL */
  1165.  
  1166.     /*
  1167.      * Information used by Tcl_AppendResult to keep track of partial
  1168.      * results.     See Tcl_AppendResult code for details.
  1169.      */
  1170.  
  1171.     char *appendResult;        /* Storage space for results generated
  1172.                  * by Tcl_AppendResult.     Malloc-ed.  NULL
  1173.                  * means not yet allocated. */
  1174.     int appendAvl;        /* Total amount of space available at
  1175.                  * partialResult. */
  1176.     int appendUsed;        /* Number of non-null bytes currently
  1177.                  * stored at partialResult. */
  1178.  
  1179.     /*
  1180.      * Information about packages.  Used only in tclPkg.c.
  1181.      */
  1182.  
  1183.     Tcl_HashTable packageTable;    /* Describes all of the packages loaded
  1184.                  * in or available to this interpreter.
  1185.                  * Keys are package names, values are
  1186.                  * (Package *) pointers. */
  1187.     char *packageUnknown;    /* Command to invoke during "package
  1188.                  * require" commands for packages that
  1189.                  * aren't described in packageTable. 
  1190.                  * Malloc'ed, may be NULL. */
  1191.  
  1192.     /*
  1193.      * Miscellaneous information:
  1194.      */
  1195.  
  1196.     int cmdCount;        /* Total number of times a command procedure
  1197.                  * has been called for this interpreter. */
  1198.     int evalFlags;        /* Flags to control next call to Tcl_Eval.
  1199.                  * Normally zero, but may be set before
  1200.                  * calling Tcl_Eval.  See below for valid
  1201.                  * values. */
  1202.     int termOffset;        /* Offset of character just after last one
  1203.                  * compiled or executed by Tcl_EvalObj. */
  1204.     LiteralTable literalTable;    /* Contains LiteralEntry's describing all
  1205.                  * Tcl objects holding literals of scripts
  1206.                  * compiled by the interpreter. Indexed by
  1207.                  * the string representations of literals.
  1208.                  * Used to avoid creating duplicate
  1209.                  * objects. */
  1210.     int compileEpoch;        /* Holds the current "compilation epoch"
  1211.                  * for this interpreter. This is
  1212.                  * incremented to invalidate existing
  1213.                  * ByteCodes when, e.g., a command with a
  1214.                  * compile procedure is redefined. */
  1215.     Proc *compiledProcPtr;    /* If a procedure is being compiled, a
  1216.                  * pointer to its Proc structure; otherwise,
  1217.                  * this is NULL. Set by ObjInterpProc in
  1218.                  * tclProc.c and used by tclCompile.c to
  1219.                  * process local variables appropriately. */
  1220.     ResolverScheme *resolverPtr;
  1221.                 /* Linked list of name resolution schemes
  1222.                  * added to this interpreter.  Schemes
  1223.                  * are added/removed by calling
  1224.                  * Tcl_AddInterpResolvers and
  1225.                  * Tcl_RemoveInterpResolver. */
  1226.     char *scriptFile;        /* NULL means there is no nested source
  1227.                  * command active;  otherwise this points to
  1228.                  * the name of the file being sourced (it's
  1229.                  * not malloc-ed:  it points to an argument
  1230.                  * to Tcl_EvalFile. */
  1231.     int flags;            /* Various flag bits.  See below. */
  1232.     long randSeed;        /* Seed used for rand() function. */
  1233.     Trace *tracePtr;        /* List of traces for this interpreter. */
  1234.     Tcl_HashTable *assocData;    /* Hash table for associating data with
  1235.                  * this interpreter. Cleaned up when
  1236.                  * this interpreter is deleted. */
  1237.     struct ExecEnv *execEnvPtr;    /* Execution environment for Tcl bytecode
  1238.                  * execution. Contains a pointer to the
  1239.                  * Tcl evaluation stack. */
  1240.     Tcl_Obj *emptyObjPtr;    /* Points to an object holding an empty
  1241.                  * string. Returned by Tcl_ObjSetVar2 when
  1242.                  * variable traces change a variable in a
  1243.                  * gross way. */
  1244.     char resultSpace[TCL_RESULT_SIZE+1];
  1245.                 /* Static space holding small results. */
  1246.     Tcl_Obj *objResultPtr;    /* If the last command returned an object
  1247.                  * result, this points to it. Should not be
  1248.                  * accessed directly; see comment above. */
  1249.     Tcl_ThreadId threadId;    /* ID of thread that owns the interpreter */
  1250.  
  1251.     /*
  1252.      * Statistical information about the bytecode compiler and interpreter's
  1253.      * operation.
  1254.      */
  1255.  
  1256. #ifdef TCL_COMPILE_STATS
  1257.     ByteCodeStats stats;    /* Holds compilation and execution
  1258.                  * statistics for this interpreter. */
  1259. #endif /* TCL_COMPILE_STATS */      
  1260. } Interp;
  1261.  
  1262. /*
  1263.  * EvalFlag bits for Interp structures:
  1264.  *
  1265.  * TCL_BRACKET_TERM    1 means that the current script is terminated by
  1266.  *            a close bracket rather than the end of the string.
  1267.  * TCL_ALLOW_EXCEPTIONS    1 means it's OK for the script to terminate with
  1268.  *            a code other than TCL_OK or TCL_ERROR;    0 means
  1269.  *            codes other than these should be turned into errors.
  1270.  */
  1271.  
  1272. #define TCL_BRACKET_TERM      1
  1273. #define TCL_ALLOW_EXCEPTIONS      4
  1274.  
  1275. /*
  1276.  * Flag bits for Interp structures:
  1277.  *
  1278.  * DELETED:        Non-zero means the interpreter has been deleted:
  1279.  *            don't process any more commands for it, and destroy
  1280.  *            the structure as soon as all nested invocations of
  1281.  *            Tcl_Eval are done.
  1282.  * ERR_IN_PROGRESS:    Non-zero means an error unwind is already in
  1283.  *            progress. Zero means a command proc has been
  1284.  *            invoked since last error occured.
  1285.  * ERR_ALREADY_LOGGED:    Non-zero means information has already been logged
  1286.  *            in $errorInfo for the current Tcl_Eval instance,
  1287.  *            so Tcl_Eval needn't log it (used to implement the
  1288.  *            "error message log" command).
  1289.  * ERROR_CODE_SET:    Non-zero means that Tcl_SetErrorCode has been
  1290.  *            called to record information for the current
  1291.  *            error.    Zero means Tcl_Eval must clear the
  1292.  *            errorCode variable if an error is returned.
  1293.  * EXPR_INITIALIZED:    Non-zero means initialization specific to
  1294.  *            expressions has    been carried out.
  1295.  * DONT_COMPILE_CMDS_INLINE: Non-zero means that the bytecode compiler
  1296.  *            should not compile any commands into an inline
  1297.  *            sequence of instructions. This is set 1, for
  1298.  *            example, when command traces are requested.
  1299.  * RAND_SEED_INITIALIZED: Non-zero means that the randSeed value of the
  1300.  *            interp has not be initialized.    This is set 1
  1301.  *            when we first use the rand() or srand() functions.
  1302.  * SAFE_INTERP:        Non zero means that the current interp is a
  1303.  *            safe interp (ie it has only the safe commands
  1304.  *            installed, less priviledge than a regular interp).
  1305.  * USE_EVAL_DIRECT:    Non-zero means don't use the compiler or byte-code
  1306.  *            interpreter; instead, have Tcl_EvalObj call
  1307.  *            Tcl_EvalEx. Used primarily for testing the
  1308.  *            new parser.
  1309.  */
  1310.  
  1311. #define DELETED                    1
  1312. #define ERR_IN_PROGRESS                2
  1313. #define ERR_ALREADY_LOGGED            4
  1314. #define ERROR_CODE_SET                8
  1315. #define EXPR_INITIALIZED         0x10
  1316. #define DONT_COMPILE_CMDS_INLINE     0x20
  1317. #define RAND_SEED_INITIALIZED         0x40
  1318. #define SAFE_INTERP             0x80
  1319. #define USE_EVAL_DIRECT            0x100
  1320.  
  1321. /*
  1322.  *----------------------------------------------------------------
  1323.  * Data structures related to command parsing. These are used in
  1324.  * tclParse.c and its clients.
  1325.  *----------------------------------------------------------------
  1326.  */
  1327.  
  1328. /*
  1329.  * The following data structure is used by various parsing procedures
  1330.  * to hold information about where to store the results of parsing
  1331.  * (e.g. the substituted contents of a quoted argument, or the result
  1332.  * of a nested command).  At any given time, the space available
  1333.  * for output is fixed, but a procedure may be called to expand the
  1334.  * space available if the current space runs out.
  1335.  */
  1336.  
  1337. typedef struct ParseValue {
  1338.     char *buffer;        /* Address of first character in
  1339.                  * output buffer. */
  1340.     char *next;            /* Place to store next character in
  1341.                  * output buffer. */
  1342.     char *end;            /* Address of the last usable character
  1343.                  * in the buffer. */
  1344.     void (*expandProc) _ANSI_ARGS_((struct ParseValue *pvPtr, int needed));
  1345.                 /* Procedure to call when space runs out;
  1346.                  * it will make more space. */
  1347.     ClientData clientData;    /* Arbitrary information for use of
  1348.                  * expandProc. */
  1349. } ParseValue;
  1350.  
  1351.  
  1352. /*
  1353.  * Maximum number of levels of nesting permitted in Tcl commands (used
  1354.  * to catch infinite recursion).
  1355.  */
  1356.  
  1357. #define MAX_NESTING_DEPTH    1000
  1358.  
  1359. /*
  1360.  * The macro below is used to modify a "char" value (e.g. by casting
  1361.  * it to an unsigned character) so that it can be used safely with
  1362.  * macros such as isspace.
  1363.  */
  1364.  
  1365. #define UCHAR(c) ((unsigned char) (c))
  1366.  
  1367. /*
  1368.  * This macro is used to determine the offset needed to safely allocate any
  1369.  * data structure in memory. Given a starting offset or size, it "rounds up"
  1370.  * or "aligns" the offset to the next 8-byte boundary so that any data
  1371.  * structure can be placed at the resulting offset without fear of an
  1372.  * alignment error.
  1373.  *
  1374.  * WARNING!! DO NOT USE THIS MACRO TO ALIGN POINTERS: it will produce
  1375.  * the wrong result on platforms that allocate addresses that are divisible
  1376.  * by 4 or 2. Only use it for offsets or sizes.
  1377.  */
  1378.  
  1379. #define TCL_ALIGN(x) (((int)(x) + 7) & ~7)
  1380.  
  1381. /*
  1382.  * The following macros are used to specify the runtime platform
  1383.  * setting of the tclPlatform variable.
  1384.  */
  1385.  
  1386. typedef enum {
  1387.     TCL_PLATFORM_UNIX,        /* Any Unix-like OS. */
  1388.     TCL_PLATFORM_MAC,        /* MacOS. */
  1389.     TCL_PLATFORM_WINDOWS    /* Any Microsoft Windows OS. */
  1390. } TclPlatformType;
  1391.  
  1392. /*
  1393.  * Flags for TclInvoke:
  1394.  *
  1395.  * TCL_INVOKE_HIDDEN        Invoke a hidden command; if not set,
  1396.  *                invokes an exposed command.
  1397.  * TCL_INVOKE_NO_UNKNOWN    If set, "unknown" is not invoked if
  1398.  *                the command to be invoked is not found.
  1399.  *                Only has an effect if invoking an exposed
  1400.  *                command, i.e. if TCL_INVOKE_HIDDEN is not
  1401.  *                also set.
  1402.  * TCL_INVOKE_NO_TRACEBACK    Does not record traceback information if
  1403.  *                the invoked command returns an error.  Used
  1404.  *                if the caller plans on recording its own
  1405.  *                traceback information.
  1406.  */
  1407.  
  1408. #define    TCL_INVOKE_HIDDEN    (1<<0)
  1409. #define TCL_INVOKE_NO_UNKNOWN    (1<<1)
  1410. #define TCL_INVOKE_NO_TRACEBACK    (1<<2)
  1411.  
  1412. /*
  1413.  * The structure used as the internal representation of Tcl list
  1414.  * objects. This is an array of pointers to the element objects. This array
  1415.  * is grown (reallocated and copied) as necessary to hold all the list's
  1416.  * element pointers. The array might contain more slots than currently used
  1417.  * to hold all element pointers. This is done to make append operations
  1418.  * faster.
  1419.  */
  1420.  
  1421. typedef struct List {
  1422.     int maxElemCount;        /* Total number of element array slots. */
  1423.     int elemCount;        /* Current number of list elements. */
  1424.     Tcl_Obj **elements;        /* Array of pointers to element objects. */
  1425. } List;
  1426.  
  1427.  
  1428. /*
  1429.  * The following types are used for getting and storing platform-specific
  1430.  * file attributes in tclFCmd.c and the various platform-versions of
  1431.  * that file. This is done to have as much common code as possible
  1432.  * in the file attributes code. For more information about the callbacks,
  1433.  * see TclFileAttrsCmd in tclFCmd.c.
  1434.  */
  1435.  
  1436. typedef int (TclGetFileAttrProc) _ANSI_ARGS_((Tcl_Interp *interp,
  1437.     int objIndex, CONST char *fileName, Tcl_Obj **attrObjPtrPtr));
  1438. typedef int (TclSetFileAttrProc) _ANSI_ARGS_((Tcl_Interp *interp,
  1439.     int objIndex, CONST char *fileName, Tcl_Obj *attrObjPtr));
  1440.  
  1441. typedef struct TclFileAttrProcs {
  1442.     TclGetFileAttrProc *getProc;    /* The procedure for getting attrs. */
  1443.     TclSetFileAttrProc *setProc;    /* The procedure for setting attrs. */
  1444. } TclFileAttrProcs;
  1445.  
  1446. /*
  1447.  * Opaque handle used in pipeline routines to encapsulate platform-dependent
  1448.  * state. 
  1449.  */
  1450.  
  1451. typedef struct TclFile_ *TclFile;
  1452.     
  1453. /*
  1454.  *----------------------------------------------------------------
  1455.  * Data structures related to hooking 'TclStat(...)' and
  1456.  * 'TclAccess(...)'.
  1457.  *----------------------------------------------------------------
  1458.  */
  1459.  
  1460. typedef int (TclStatProc_) _ANSI_ARGS_((CONST char *path, struct stat *buf));
  1461. typedef int (TclAccessProc_) _ANSI_ARGS_((CONST char *path, int mode));
  1462. typedef Tcl_Channel (TclOpenFileChannelProc_) _ANSI_ARGS_((Tcl_Interp *interp,
  1463.     char *fileName, char *modeString,
  1464.     int permissions));
  1465.  
  1466. typedef int (*TclCmdProcType) _ANSI_ARGS_((ClientData clientData,
  1467.     Tcl_Interp *interp, int argc, char *argv[]));
  1468. typedef int (*TclObjCmdProcType) _ANSI_ARGS_((ClientData clientData,
  1469.     Tcl_Interp *interp, int objc, struct Tcl_Obj * CONST objv[]));
  1470.  
  1471. /*
  1472.  * Opaque names for platform specific types.
  1473.  */
  1474.  
  1475. typedef struct TclpTime_t_ *TclpTime_t;
  1476.  
  1477. /* 
  1478.  * The following structure is used to pass glob type data amongst
  1479.  * the various glob routines and TclpMatchFilesTypes.  Currently
  1480.  * most of the fields are ignored.  However they will be used in
  1481.  * a future release to implement glob's ability to find files
  1482.  * of particular types/permissions/etc only.
  1483.  */
  1484. typedef struct GlobTypeData {
  1485.     /* Corresponds to bcdpfls as in 'find -t' */
  1486.     int type;
  1487.     /* Corresponds to file permissions */
  1488.     int perm;
  1489.     /* Acceptable mac type */
  1490.     Tcl_Obj* macType;
  1491.     /* Acceptable mac creator */
  1492.     Tcl_Obj* macCreator;
  1493. } GlobTypeData;
  1494.  
  1495. /*
  1496.  * type and permission definitions for glob command
  1497.  */
  1498. #define TCL_GLOB_TYPE_BLOCK        (1<<0)
  1499. #define TCL_GLOB_TYPE_CHAR        (1<<1)
  1500. #define TCL_GLOB_TYPE_DIR        (1<<2)
  1501. #define TCL_GLOB_TYPE_PIPE        (1<<3)
  1502. #define TCL_GLOB_TYPE_FILE        (1<<4)
  1503. #define TCL_GLOB_TYPE_LINK        (1<<5)
  1504. #define TCL_GLOB_TYPE_SOCK        (1<<6)
  1505.  
  1506. #define TCL_GLOB_PERM_RONLY        (1<<0)
  1507. #define TCL_GLOB_PERM_HIDDEN        (1<<1)
  1508. #define TCL_GLOB_PERM_R            (1<<2)
  1509. #define TCL_GLOB_PERM_W            (1<<3)
  1510. #define TCL_GLOB_PERM_X            (1<<4)
  1511.  
  1512. /*
  1513.  *----------------------------------------------------------------
  1514.  * Variables shared among Tcl modules but not used by the outside world.
  1515.  *----------------------------------------------------------------
  1516.  */
  1517.  
  1518. extern Tcl_Time            tclBlockTime;
  1519. extern int            tclBlockTimeSet;
  1520. extern char *            tclExecutableName;
  1521. extern char *            tclNativeExecutableName;
  1522. extern char *            tclDefaultEncodingDir;
  1523. extern Tcl_ChannelType        tclFileChannelType;
  1524. extern char *            tclMemDumpFileName;
  1525. extern TclPlatformType        tclPlatform;
  1526. extern char *            tclpFileAttrStrings[];
  1527. extern CONST TclFileAttrProcs    tclpFileAttrProcs[];
  1528.  
  1529. /*
  1530.  * Variables denoting the Tcl object types defined in the core.
  1531.  */
  1532.  
  1533. extern Tcl_ObjType    tclBooleanType;
  1534. extern Tcl_ObjType    tclByteArrayType;
  1535. extern Tcl_ObjType    tclByteCodeType;
  1536. extern Tcl_ObjType    tclDoubleType;
  1537. extern Tcl_ObjType    tclIntType;
  1538. extern Tcl_ObjType    tclListType;
  1539. extern Tcl_ObjType    tclProcBodyType;
  1540. extern Tcl_ObjType    tclStringType;
  1541.  
  1542. /*
  1543.  * The head of the list of free Tcl objects, and the total number of Tcl
  1544.  * objects ever allocated and freed.
  1545.  */
  1546.  
  1547. extern Tcl_Obj *    tclFreeObjList;
  1548.  
  1549. #ifdef TCL_COMPILE_STATS
  1550. extern long        tclObjsAlloced;
  1551. extern long        tclObjsFreed;
  1552. #define TCL_MAX_SHARED_OBJ_STATS 5
  1553. extern long        tclObjsShared[TCL_MAX_SHARED_OBJ_STATS];
  1554. #endif /* TCL_COMPILE_STATS */
  1555.  
  1556. /*
  1557.  * Pointer to a heap-allocated string of length zero that the Tcl core uses
  1558.  * as the value of an empty string representation for an object. This value
  1559.  * is shared by all new objects allocated by Tcl_NewObj.
  1560.  */
  1561.  
  1562. extern char *        tclEmptyStringRep;
  1563.  
  1564. /*
  1565.  *----------------------------------------------------------------
  1566.  * Procedures shared among Tcl modules but not used by the outside
  1567.  * world:
  1568.  *----------------------------------------------------------------
  1569.  */
  1570.  
  1571. EXTERN int        TclAccess _ANSI_ARGS_((CONST char *path,
  1572.                 int mode));
  1573. EXTERN int        TclAccessDeleteProc _ANSI_ARGS_((TclAccessProc_ *proc));
  1574. EXTERN int        TclAccessInsertProc _ANSI_ARGS_((TclAccessProc_ *proc));
  1575. EXTERN void        TclAllocateFreeObjects _ANSI_ARGS_((void));
  1576. EXTERN int        TclArraySet _ANSI_ARGS_((Tcl_Interp *interp,
  1577.                 Tcl_Obj *arrayNameObj, Tcl_Obj *arrayElemObj));
  1578. EXTERN int        TclCheckBadOctal _ANSI_ARGS_((Tcl_Interp *interp,
  1579.                 char *value));
  1580. EXTERN int        TclCleanupChildren _ANSI_ARGS_((Tcl_Interp *interp,
  1581.                 int numPids, Tcl_Pid *pidPtr,
  1582.                 Tcl_Channel errorChan));
  1583. EXTERN void        TclCleanupCommand _ANSI_ARGS_((Command *cmdPtr));
  1584. EXTERN int        TclCopyChannel _ANSI_ARGS_((Tcl_Interp *interp,
  1585.                 Tcl_Channel inChan, Tcl_Channel outChan,
  1586.                 int toRead, Tcl_Obj *cmdPtr));
  1587. /*
  1588.  * TclCreatePipeline unofficially exported for use by BLT.
  1589.  */
  1590. EXTERN int        TclCreatePipeline _ANSI_ARGS_((Tcl_Interp *interp,
  1591.                 int argc, char **argv, Tcl_Pid **pidArrayPtr,
  1592.                 TclFile *inPipePtr, TclFile *outPipePtr,
  1593.                 TclFile *errFilePtr));
  1594. EXTERN int        TclCreateProc _ANSI_ARGS_((Tcl_Interp *interp,
  1595.                 Namespace *nsPtr, char *procName,
  1596.                 Tcl_Obj *argsPtr, Tcl_Obj *bodyPtr,
  1597.                 Proc **procPtrPtr));
  1598. EXTERN void        TclDeleteCompiledLocalVars _ANSI_ARGS_((
  1599.                 Interp *iPtr, CallFrame *framePtr));
  1600. EXTERN void        TclDeleteVars _ANSI_ARGS_((Interp *iPtr,
  1601.                 Tcl_HashTable *tablePtr));
  1602. EXTERN int        TclDoGlob _ANSI_ARGS_((Tcl_Interp *interp,
  1603.                 char *separators, Tcl_DString *headPtr,
  1604.                 char *tail, GlobTypeData *types));
  1605. EXTERN void        TclDumpMemoryInfo _ANSI_ARGS_((FILE *outFile));
  1606. EXTERN void        TclExpandTokenArray _ANSI_ARGS_((
  1607.                 Tcl_Parse *parsePtr));
  1608. EXTERN void        TclExprFloatError _ANSI_ARGS_((Tcl_Interp *interp,
  1609.                 double value));
  1610. EXTERN int        TclFileAttrsCmd _ANSI_ARGS_((Tcl_Interp *interp,
  1611.                 int objc, Tcl_Obj *CONST objv[]));
  1612. EXTERN int        TclFileCopyCmd _ANSI_ARGS_((Tcl_Interp *interp, 
  1613.                 int argc, char **argv)) ;
  1614. EXTERN int        TclFileDeleteCmd _ANSI_ARGS_((Tcl_Interp *interp,
  1615.                 int argc, char **argv));
  1616. EXTERN int        TclFileMakeDirsCmd _ANSI_ARGS_((Tcl_Interp *interp,
  1617.                 int argc, char **argv)) ;
  1618. EXTERN int        TclFileRenameCmd _ANSI_ARGS_((Tcl_Interp *interp,
  1619.                 int argc, char **argv)) ;
  1620. EXTERN void        TclFinalizeAllocSubsystem _ANSI_ARGS_((void));
  1621. EXTERN void        TclFinalizeCompExecEnv _ANSI_ARGS_((void));
  1622. EXTERN void        TclFinalizeCompilation _ANSI_ARGS_((void));
  1623. EXTERN void        TclFinalizeEncodingSubsystem _ANSI_ARGS_((void));
  1624. EXTERN void        TclFinalizeEnvironment _ANSI_ARGS_((void));
  1625. EXTERN void        TclFinalizeExecution _ANSI_ARGS_((void));
  1626. EXTERN void        TclFinalizeIOSubsystem _ANSI_ARGS_((void));
  1627. EXTERN void        TclFinalizeLoad _ANSI_ARGS_((void));
  1628. EXTERN void        TclFinalizeMemorySubsystem _ANSI_ARGS_((void));
  1629. EXTERN void        TclFinalizeNotifier _ANSI_ARGS_((void));
  1630. EXTERN void        TclFinalizeAsync _ANSI_ARGS_((void));
  1631. EXTERN void        TclFinalizeSynchronization _ANSI_ARGS_((void));
  1632. EXTERN void        TclFinalizeThreadData _ANSI_ARGS_((void));
  1633. EXTERN void        TclFindEncodings _ANSI_ARGS_((CONST char *argv0));
  1634. EXTERN Proc *        TclFindProc _ANSI_ARGS_((Interp *iPtr,
  1635.                 char *procName));
  1636. EXTERN int        TclFormatInt _ANSI_ARGS_((char *buffer, long n));
  1637. EXTERN void        TclFreePackageInfo _ANSI_ARGS_((Interp *iPtr));
  1638. EXTERN int        TclGetDate _ANSI_ARGS_((char *p,
  1639.                 unsigned long now, long zone,
  1640.                 unsigned long *timePtr));
  1641. EXTERN Tcl_Obj *    TclGetElementOfIndexedArray _ANSI_ARGS_((
  1642.                 Tcl_Interp *interp, int localIndex,
  1643.                 Tcl_Obj *elemPtr, int leaveErrorMsg));
  1644. EXTERN char *        TclGetExtension _ANSI_ARGS_((char *name));
  1645. EXTERN int        TclGetFrame _ANSI_ARGS_((Tcl_Interp *interp,
  1646.                 char *string, CallFrame **framePtrPtr));
  1647. EXTERN TclCmdProcType    TclGetInterpProc _ANSI_ARGS_((void));
  1648. EXTERN int        TclGetIntForIndex _ANSI_ARGS_((Tcl_Interp *interp,
  1649.                 Tcl_Obj *objPtr, int endValue, int *indexPtr));
  1650. EXTERN Tcl_Obj *    TclGetIndexedScalar _ANSI_ARGS_((Tcl_Interp *interp,
  1651.                 int localIndex, int leaveErrorMsg));
  1652. EXTERN int        TclGetLong _ANSI_ARGS_((Tcl_Interp *interp,
  1653.                 char *string, long *longPtr));
  1654. EXTERN int        TclGetLoadedPackages _ANSI_ARGS_((
  1655.                 Tcl_Interp *interp, char *targetName));
  1656. EXTERN int        TclGetNamespaceForQualName _ANSI_ARGS_((
  1657.                 Tcl_Interp *interp, char *qualName,
  1658.                 Namespace *cxtNsPtr, int flags,
  1659.                 Namespace **nsPtrPtr, Namespace **altNsPtrPtr,
  1660.                 Namespace **actualCxtPtrPtr,
  1661.                 char **simpleNamePtr));
  1662. EXTERN TclObjCmdProcType TclGetObjInterpProc _ANSI_ARGS_((void));
  1663. EXTERN int        TclGetOpenMode _ANSI_ARGS_((Tcl_Interp *interp,
  1664.                 char *string, int *seekFlagPtr));
  1665. EXTERN Tcl_Command    TclGetOriginalCommand _ANSI_ARGS_((
  1666.                 Tcl_Command command));
  1667. EXTERN int        TclGlob _ANSI_ARGS_((Tcl_Interp *interp,
  1668.                 char *pattern, char *unquotedPrefix, 
  1669.                 int globFlags, GlobTypeData* types));
  1670. EXTERN int        TclGlobalInvoke _ANSI_ARGS_((Tcl_Interp *interp,
  1671.                 int argc, char **argv, int flags));
  1672. EXTERN int        TclGuessPackageName _ANSI_ARGS_((char *fileName,
  1673.                 Tcl_DString *bufPtr));
  1674. EXTERN int        TclHideUnsafeCommands _ANSI_ARGS_((
  1675.                 Tcl_Interp *interp));
  1676. EXTERN int        TclInExit _ANSI_ARGS_((void));
  1677. EXTERN Tcl_Obj *    TclIncrElementOfIndexedArray _ANSI_ARGS_((
  1678.                 Tcl_Interp *interp, int localIndex,
  1679.                 Tcl_Obj *elemPtr, long incrAmount));
  1680. EXTERN Tcl_Obj *    TclIncrIndexedScalar _ANSI_ARGS_((
  1681.                 Tcl_Interp *interp, int localIndex,
  1682.                 long incrAmount));
  1683. EXTERN Tcl_Obj *    TclIncrVar2 _ANSI_ARGS_((Tcl_Interp *interp,
  1684.                 Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr,
  1685.                 long incrAmount, int flags));
  1686. EXTERN void        TclInitAlloc _ANSI_ARGS_((void));
  1687. EXTERN void        TclInitCompiledLocals _ANSI_ARGS_((
  1688.                 Tcl_Interp *interp, CallFrame *framePtr,
  1689.                 Namespace *nsPtr));
  1690. EXTERN void        TclInitDbCkalloc _ANSI_ARGS_((void));
  1691. EXTERN void        TclInitEncodingSubsystem _ANSI_ARGS_((void));
  1692. EXTERN void        TclInitIOSubsystem _ANSI_ARGS_((void));
  1693. EXTERN void        TclInitNamespaceSubsystem _ANSI_ARGS_((void));
  1694. EXTERN void        TclInitNotifier _ANSI_ARGS_((void));
  1695. EXTERN void        TclInitObjSubsystem _ANSI_ARGS_((void));
  1696. EXTERN void        TclInitSubsystems _ANSI_ARGS_((CONST char *argv0));
  1697. EXTERN int        TclInvoke _ANSI_ARGS_((Tcl_Interp *interp,
  1698.                 int argc, char **argv, int flags));
  1699. EXTERN int        TclInvokeObjectCommand _ANSI_ARGS_((
  1700.                 ClientData clientData, Tcl_Interp *interp,
  1701.                 int argc, char **argv));
  1702. EXTERN int        TclInvokeStringCommand _ANSI_ARGS_((
  1703.                 ClientData clientData, Tcl_Interp *interp,
  1704.                 int objc, Tcl_Obj *CONST objv[]));
  1705. EXTERN int        TclIsLocalScalar _ANSI_ARGS_((CONST char *src,
  1706.                 int len));
  1707. EXTERN Proc *        TclIsProc _ANSI_ARGS_((Command *cmdPtr));
  1708. EXTERN Var *        TclLookupVar _ANSI_ARGS_((Tcl_Interp *interp,
  1709.                 char *part1, char *part2, int flags, char *msg,
  1710.                 int createPart1, int createPart2,
  1711.                 Var **arrayPtrPtr));
  1712. EXTERN int        TclMathInProgress _ANSI_ARGS_((void));
  1713. EXTERN int        TclNeedSpace _ANSI_ARGS_((char *start, char *end));
  1714. EXTERN Tcl_Obj *    TclNewProcBodyObj _ANSI_ARGS_((Proc *procPtr));
  1715. EXTERN int        TclObjCommandComplete _ANSI_ARGS_((Tcl_Obj *cmdPtr));
  1716. EXTERN int        TclObjInterpProc _ANSI_ARGS_((ClientData clientData,
  1717.                 Tcl_Interp *interp, int objc,
  1718.                 Tcl_Obj *CONST objv[]));
  1719. EXTERN int        TclObjInvoke _ANSI_ARGS_((Tcl_Interp *interp,
  1720.                 int objc, Tcl_Obj *CONST objv[], int flags));
  1721. EXTERN int        TclObjInvokeGlobal _ANSI_ARGS_((Tcl_Interp *interp,
  1722.                 int objc, Tcl_Obj *CONST objv[], int flags));
  1723. EXTERN int        TclOpenFileChannelDeleteProc _ANSI_ARGS_((
  1724.                 TclOpenFileChannelProc_ *proc));
  1725. EXTERN int        TclOpenFileChannelInsertProc _ANSI_ARGS_((
  1726.                 TclOpenFileChannelProc_ *proc));
  1727. EXTERN int        TclpAccess _ANSI_ARGS_((CONST char *filename,
  1728.                 int mode));
  1729. EXTERN char *        TclpAlloc _ANSI_ARGS_((unsigned int size));
  1730. EXTERN int        TclpCheckStackSpace _ANSI_ARGS_((void));
  1731. EXTERN int        TclpCopyFile _ANSI_ARGS_((CONST char *source,
  1732.                 CONST char *dest));
  1733. EXTERN int        TclpCopyDirectory _ANSI_ARGS_((CONST char *source,
  1734.                 CONST char *dest, Tcl_DString *errorPtr));
  1735. EXTERN int        TclpCreateDirectory _ANSI_ARGS_((CONST char *path));
  1736. EXTERN int        TclpDeleteFile _ANSI_ARGS_((CONST char *path));
  1737. EXTERN void        TclpExit _ANSI_ARGS_((int status));
  1738. EXTERN void        TclpFinalizeCondition _ANSI_ARGS_((
  1739.                 Tcl_Condition *condPtr));
  1740. EXTERN void        TclpFinalizeMutex _ANSI_ARGS_((Tcl_Mutex *mutexPtr));
  1741. EXTERN void        TclpFinalizeThreadData _ANSI_ARGS_((
  1742.                 Tcl_ThreadDataKey *keyPtr));
  1743. EXTERN void        TclpFinalizeThreadDataKey _ANSI_ARGS_((
  1744.                 Tcl_ThreadDataKey *keyPtr));
  1745. EXTERN char *        TclpFindExecutable _ANSI_ARGS_((
  1746.                 CONST char *argv0));
  1747. EXTERN int        TclpFindVariable _ANSI_ARGS_((CONST char *name,
  1748.                 int *lengthPtr));
  1749. EXTERN void        TclpFree _ANSI_ARGS_((char *ptr));
  1750. EXTERN unsigned long    TclpGetClicks _ANSI_ARGS_((void));
  1751. EXTERN Tcl_Channel    TclpGetDefaultStdChannel _ANSI_ARGS_((int type));
  1752. EXTERN unsigned long    TclpGetSeconds _ANSI_ARGS_((void));
  1753. EXTERN void        TclpGetTime _ANSI_ARGS_((Tcl_Time *time));
  1754. EXTERN int        TclpGetTimeZone _ANSI_ARGS_((unsigned long time));
  1755. EXTERN char *        TclpGetUserHome _ANSI_ARGS_((CONST char *name,
  1756.                 Tcl_DString *bufferPtr));
  1757. EXTERN int        TclpHasSockets _ANSI_ARGS_((Tcl_Interp *interp));
  1758. EXTERN void        TclpInitLibraryPath _ANSI_ARGS_((CONST char *argv0));
  1759. EXTERN void        TclpInitLock _ANSI_ARGS_((void));
  1760. EXTERN void        TclpInitPlatform _ANSI_ARGS_((void));
  1761. EXTERN void        TclpInitUnlock _ANSI_ARGS_((void));
  1762. EXTERN int        TclpListVolumes _ANSI_ARGS_((Tcl_Interp *interp));
  1763. EXTERN void        TclpMasterLock _ANSI_ARGS_((void));
  1764. EXTERN void        TclpMasterUnlock _ANSI_ARGS_((void));
  1765. EXTERN int        TclpMatchFiles _ANSI_ARGS_((Tcl_Interp *interp,
  1766.                 char *separators, Tcl_DString *dirPtr,
  1767.                 char *pattern, char *tail));
  1768. EXTERN Tcl_Channel    TclpOpenFileChannel _ANSI_ARGS_((Tcl_Interp *interp,
  1769.                 char *fileName, char *modeString,
  1770.                 int permissions));
  1771. EXTERN char *        TclpReadlink _ANSI_ARGS_((CONST char *fileName,
  1772.                 Tcl_DString *linkPtr));
  1773. EXTERN char *        TclpRealloc _ANSI_ARGS_((char *ptr,
  1774.                 unsigned int size));
  1775. EXTERN void        TclpReleaseFile _ANSI_ARGS_((TclFile file));
  1776. EXTERN int        TclpRemoveDirectory _ANSI_ARGS_((CONST char *path,
  1777.                 int recursive, Tcl_DString *errorPtr));
  1778. EXTERN int        TclpRenameFile _ANSI_ARGS_((CONST char *source,
  1779.                 CONST char *dest));
  1780. EXTERN void        TclpSetInitialEncodings _ANSI_ARGS_((void));
  1781. EXTERN void        TclpSetVariables _ANSI_ARGS_((Tcl_Interp *interp));
  1782. EXTERN VOID *        TclpSysAlloc _ANSI_ARGS_((long size, int isBin));
  1783. EXTERN void        TclpSysFree _ANSI_ARGS_((VOID *ptr));
  1784. EXTERN VOID *        TclpSysRealloc _ANSI_ARGS_((VOID *cp,
  1785.                 unsigned int size));
  1786. EXTERN void        TclpUnloadFile _ANSI_ARGS_((ClientData clientData));
  1787. EXTERN char *        TclPrecTraceProc _ANSI_ARGS_((ClientData clientData,
  1788.                 Tcl_Interp *interp, char *name1, char *name2,
  1789.                 int flags));
  1790. EXTERN int        TclPreventAliasLoop _ANSI_ARGS_((Tcl_Interp *interp,
  1791.                 Tcl_Interp *cmdInterp, Tcl_Command cmd));
  1792. EXTERN void        TclProcCleanupProc _ANSI_ARGS_((Proc *procPtr));
  1793. EXTERN int        TclProcCompileProc _ANSI_ARGS_((Tcl_Interp *interp,
  1794.                 Proc *procPtr, Tcl_Obj *bodyPtr, Namespace *nsPtr,
  1795.                 CONST char *description, CONST char *procName));
  1796. EXTERN void        TclProcDeleteProc _ANSI_ARGS_((ClientData clientData));
  1797. EXTERN int        TclProcInterpProc _ANSI_ARGS_((ClientData clientData,
  1798.                 Tcl_Interp *interp, int argc, char **argv));
  1799. EXTERN VOID *        TclpThreadDataKeyGet _ANSI_ARGS_((
  1800.                 Tcl_ThreadDataKey *keyPtr));
  1801. EXTERN void        TclpThreadDataKeyInit _ANSI_ARGS_((
  1802.                 Tcl_ThreadDataKey *keyPtr));
  1803. EXTERN void        TclpThreadDataKeySet _ANSI_ARGS_((
  1804.                 Tcl_ThreadDataKey *keyPtr, VOID *data));
  1805. EXTERN void        TclpThreadExit _ANSI_ARGS_((int status));
  1806. EXTERN void        TclRememberCondition _ANSI_ARGS_((Tcl_Condition *mutex));
  1807. EXTERN void        TclRememberDataKey _ANSI_ARGS_((Tcl_ThreadDataKey *mutex));
  1808. EXTERN void        TclRememberMutex _ANSI_ARGS_((Tcl_Mutex *mutex));
  1809. EXTERN int        TclRenameCommand _ANSI_ARGS_((Tcl_Interp *interp,
  1810.                 char *oldName, char *newName)) ;
  1811. EXTERN void        TclResetShadowedCmdRefs _ANSI_ARGS_((
  1812.                 Tcl_Interp *interp, Command *newCmdPtr));
  1813. EXTERN int        TclServiceIdle _ANSI_ARGS_((void));
  1814. EXTERN Tcl_Obj *    TclSetElementOfIndexedArray _ANSI_ARGS_((
  1815.                 Tcl_Interp *interp, int localIndex,
  1816.                 Tcl_Obj *elemPtr, Tcl_Obj *objPtr,
  1817.                 int leaveErrorMsg));
  1818. EXTERN Tcl_Obj *    TclSetIndexedScalar _ANSI_ARGS_((Tcl_Interp *interp,
  1819.                 int localIndex, Tcl_Obj *objPtr,
  1820.                 int leaveErrorMsg));
  1821. EXTERN char *        TclSetPreInitScript _ANSI_ARGS_((char *string));
  1822. EXTERN void        TclSetupEnv _ANSI_ARGS_((Tcl_Interp *interp));
  1823. EXTERN int        TclSockGetPort _ANSI_ARGS_((Tcl_Interp *interp,
  1824.                 char *string, char *proto, int *portPtr));
  1825. EXTERN int        TclSockMinimumBuffers _ANSI_ARGS_((int sock,
  1826.                 int size));
  1827. EXTERN int        TclStat _ANSI_ARGS_((CONST char *path,
  1828.                 struct stat *buf));
  1829. EXTERN int        TclStatDeleteProc _ANSI_ARGS_((TclStatProc_ *proc));
  1830. EXTERN int        TclStatInsertProc _ANSI_ARGS_((TclStatProc_ *proc));
  1831. EXTERN void        TclTeardownNamespace _ANSI_ARGS_((Namespace *nsPtr));
  1832. EXTERN void        TclTransferResult _ANSI_ARGS_((Tcl_Interp *sourceInterp,
  1833.                 int result, Tcl_Interp *targetInterp));
  1834. EXTERN int        TclUpdateReturnInfo _ANSI_ARGS_((Interp *iPtr));
  1835.  
  1836. /*
  1837.  *----------------------------------------------------------------
  1838.  * Command procedures in the generic core:
  1839.  *----------------------------------------------------------------
  1840.  */
  1841.  
  1842. EXTERN int    Tcl_AfterObjCmd _ANSI_ARGS_((ClientData clientData,
  1843.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1844. EXTERN int    Tcl_AppendObjCmd _ANSI_ARGS_((ClientData clientData,
  1845.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1846. EXTERN int    Tcl_ArrayObjCmd _ANSI_ARGS_((ClientData clientData,
  1847.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1848. EXTERN int    Tcl_BinaryObjCmd _ANSI_ARGS_((ClientData clientData,
  1849.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1850. EXTERN int    Tcl_BreakObjCmd _ANSI_ARGS_((ClientData clientData,
  1851.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1852. EXTERN int    Tcl_CaseObjCmd _ANSI_ARGS_((ClientData clientData,
  1853.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1854. EXTERN int    Tcl_CatchObjCmd _ANSI_ARGS_((ClientData clientData,
  1855.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1856. EXTERN int    Tcl_CdObjCmd _ANSI_ARGS_((ClientData clientData,
  1857.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1858. EXTERN int    Tcl_ClockObjCmd _ANSI_ARGS_((ClientData clientData,
  1859.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1860. EXTERN int    Tcl_CloseObjCmd _ANSI_ARGS_((ClientData clientData,
  1861.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1862. EXTERN int    Tcl_ConcatObjCmd _ANSI_ARGS_((ClientData clientData,
  1863.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1864. EXTERN int    Tcl_ContinueObjCmd _ANSI_ARGS_((ClientData clientData,
  1865.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1866. EXTERN int    Tcl_EncodingObjCmd _ANSI_ARGS_((ClientData clientData,
  1867.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1868. EXTERN int    Tcl_EofObjCmd _ANSI_ARGS_((ClientData clientData,
  1869.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1870. EXTERN int    Tcl_ErrorObjCmd _ANSI_ARGS_((ClientData clientData,
  1871.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1872. EXTERN int    Tcl_EvalObjCmd _ANSI_ARGS_((ClientData clientData,
  1873.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1874. EXTERN int    Tcl_ExecObjCmd _ANSI_ARGS_((ClientData clientData,
  1875.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1876. EXTERN int    Tcl_ExitObjCmd _ANSI_ARGS_((ClientData clientData,
  1877.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1878. EXTERN int    Tcl_ExprObjCmd _ANSI_ARGS_((ClientData clientData,
  1879.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1880. EXTERN int    Tcl_FblockedObjCmd _ANSI_ARGS_((ClientData clientData,
  1881.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1882. EXTERN int    Tcl_FconfigureObjCmd _ANSI_ARGS_((ClientData clientData,
  1883.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1884. EXTERN int    Tcl_FcopyObjCmd _ANSI_ARGS_((ClientData dummy,
  1885.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1886. EXTERN int    Tcl_FileObjCmd _ANSI_ARGS_((ClientData dummy,
  1887.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1888. EXTERN int    Tcl_FileEventObjCmd _ANSI_ARGS_((ClientData clientData,
  1889.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1890. EXTERN int    Tcl_FlushObjCmd _ANSI_ARGS_((ClientData clientData,
  1891.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1892. EXTERN int    Tcl_ForObjCmd _ANSI_ARGS_((ClientData clientData,
  1893.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1894. EXTERN int    Tcl_ForeachObjCmd _ANSI_ARGS_((ClientData clientData,
  1895.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1896. EXTERN int    Tcl_FormatObjCmd _ANSI_ARGS_((ClientData dummy,
  1897.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1898. EXTERN int    Tcl_GetsObjCmd _ANSI_ARGS_((ClientData clientData,
  1899.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1900. EXTERN int    Tcl_GlobalObjCmd _ANSI_ARGS_((ClientData clientData,
  1901.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1902. EXTERN int    Tcl_GlobObjCmd _ANSI_ARGS_((ClientData clientData,
  1903.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1904. EXTERN int    Tcl_IfObjCmd _ANSI_ARGS_((ClientData clientData,
  1905.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1906. EXTERN int    Tcl_IncrObjCmd _ANSI_ARGS_((ClientData clientData,
  1907.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1908. EXTERN int    Tcl_InfoObjCmd _ANSI_ARGS_((ClientData clientData,
  1909.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1910. EXTERN int    Tcl_InterpObjCmd _ANSI_ARGS_((ClientData clientData,
  1911.             Tcl_Interp *interp, int argc, Tcl_Obj *CONST objv[]));
  1912. EXTERN int    Tcl_JoinObjCmd _ANSI_ARGS_((ClientData clientData,
  1913.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1914. EXTERN int    Tcl_LappendObjCmd _ANSI_ARGS_((ClientData clientData,
  1915.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1916. EXTERN int    Tcl_LindexObjCmd _ANSI_ARGS_((ClientData clientData,
  1917.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1918. EXTERN int    Tcl_LinsertObjCmd _ANSI_ARGS_((ClientData clientData,
  1919.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1920. EXTERN int    Tcl_LlengthObjCmd _ANSI_ARGS_((ClientData clientData,
  1921.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1922. EXTERN int    Tcl_ListObjCmd _ANSI_ARGS_((ClientData clientData,
  1923.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1924. EXTERN int    Tcl_LoadObjCmd _ANSI_ARGS_((ClientData clientData,
  1925.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1926. EXTERN int    Tcl_LrangeObjCmd _ANSI_ARGS_((ClientData clientData,
  1927.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1928. EXTERN int    Tcl_LreplaceObjCmd _ANSI_ARGS_((ClientData clientData,
  1929.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1930. EXTERN int    Tcl_LsearchObjCmd _ANSI_ARGS_((ClientData clientData,
  1931.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1932. EXTERN int    Tcl_LsortObjCmd _ANSI_ARGS_((ClientData clientData,
  1933.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1934. EXTERN int    Tcl_NamespaceObjCmd _ANSI_ARGS_((ClientData clientData,
  1935.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1936. EXTERN int    Tcl_OpenObjCmd _ANSI_ARGS_((ClientData clientData,
  1937.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1938. EXTERN int    Tcl_PackageObjCmd _ANSI_ARGS_((ClientData clientData,
  1939.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1940. EXTERN int    Tcl_PidObjCmd _ANSI_ARGS_((ClientData clientData,
  1941.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1942. EXTERN int    Tcl_PutsObjCmd _ANSI_ARGS_((ClientData clientData,
  1943.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1944. EXTERN int    Tcl_PwdObjCmd _ANSI_ARGS_((ClientData clientData,
  1945.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1946. EXTERN int    Tcl_ReadObjCmd _ANSI_ARGS_((ClientData clientData,
  1947.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1948. EXTERN int    Tcl_RegexpObjCmd _ANSI_ARGS_((ClientData clientData,
  1949.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1950. EXTERN int    Tcl_RegsubObjCmd _ANSI_ARGS_((ClientData clientData,
  1951.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1952. EXTERN int    Tcl_RenameObjCmd _ANSI_ARGS_((ClientData clientData,
  1953.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1954. EXTERN int    Tcl_ReturnObjCmd _ANSI_ARGS_((ClientData clientData,
  1955.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1956. EXTERN int    Tcl_ScanObjCmd _ANSI_ARGS_((ClientData clientData,
  1957.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1958. EXTERN int    Tcl_SeekObjCmd _ANSI_ARGS_((ClientData clientData,
  1959.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1960. EXTERN int    Tcl_SetObjCmd _ANSI_ARGS_((ClientData clientData,
  1961.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1962. EXTERN int    Tcl_SplitObjCmd _ANSI_ARGS_((ClientData clientData,
  1963.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1964. EXTERN int    Tcl_SocketObjCmd _ANSI_ARGS_((ClientData clientData,
  1965.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1966. EXTERN int    Tcl_SourceObjCmd _ANSI_ARGS_((ClientData clientData,
  1967.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1968. EXTERN int    Tcl_StringObjCmd _ANSI_ARGS_((ClientData clientData,
  1969.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1970. EXTERN int    Tcl_SubstObjCmd _ANSI_ARGS_((ClientData clientData,
  1971.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1972. EXTERN int    Tcl_SwitchObjCmd _ANSI_ARGS_((ClientData clientData,
  1973.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1974. EXTERN int    Tcl_TellObjCmd _ANSI_ARGS_((ClientData clientData,
  1975.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1976. EXTERN int    Tcl_TimeObjCmd _ANSI_ARGS_((ClientData clientData,
  1977.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1978. EXTERN int    Tcl_TraceObjCmd _ANSI_ARGS_((ClientData clientData,
  1979.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1980. EXTERN int    Tcl_UnsetObjCmd _ANSI_ARGS_((ClientData clientData,
  1981.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1982. EXTERN int    Tcl_UpdateObjCmd _ANSI_ARGS_((ClientData clientData,
  1983.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1984. EXTERN int    Tcl_UplevelObjCmd _ANSI_ARGS_((ClientData clientData,
  1985.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1986. EXTERN int    Tcl_UpvarObjCmd _ANSI_ARGS_((ClientData clientData,
  1987.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1988. EXTERN int    Tcl_VariableObjCmd _ANSI_ARGS_((ClientData clientData,
  1989.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1990. EXTERN int    Tcl_VwaitObjCmd _ANSI_ARGS_((ClientData clientData,
  1991.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1992. EXTERN int    Tcl_WhileObjCmd _ANSI_ARGS_((ClientData clientData,
  1993.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  1994.  
  1995. /*
  1996.  *----------------------------------------------------------------
  1997.  * Command procedures found only in the Mac version of the core:
  1998.  *----------------------------------------------------------------
  1999.  */
  2000.  
  2001. #ifdef MAC_TCL
  2002. EXTERN int    Tcl_EchoCmd _ANSI_ARGS_((ClientData clientData,
  2003.             Tcl_Interp *interp, int argc, char **argv));
  2004. EXTERN int    Tcl_LsObjCmd _ANSI_ARGS_((ClientData clientData,
  2005.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  2006. EXTERN int    Tcl_BeepObjCmd _ANSI_ARGS_((ClientData clientData,
  2007.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  2008. EXTERN int    Tcl_MacSourceObjCmd _ANSI_ARGS_((ClientData clientData,
  2009.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  2010. EXTERN int    Tcl_ResourceObjCmd _ANSI_ARGS_((ClientData clientData,
  2011.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  2012. #endif
  2013.  
  2014. /*
  2015.  *----------------------------------------------------------------
  2016.  * Compilation procedures for commands in the generic core:
  2017.  *----------------------------------------------------------------
  2018.  */
  2019.  
  2020. EXTERN int    TclCompileBreakCmd _ANSI_ARGS_((Tcl_Interp *interp,
  2021.             Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
  2022. EXTERN int    TclCompileCatchCmd _ANSI_ARGS_((Tcl_Interp *interp,
  2023.             Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
  2024. EXTERN int    TclCompileContinueCmd _ANSI_ARGS_((Tcl_Interp *interp,
  2025.             Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
  2026. EXTERN int    TclCompileExprCmd _ANSI_ARGS_((Tcl_Interp *interp,
  2027.             Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
  2028. EXTERN int    TclCompileForCmd _ANSI_ARGS_((Tcl_Interp *interp,
  2029.             Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
  2030. EXTERN int    TclCompileForeachCmd _ANSI_ARGS_((Tcl_Interp *interp,
  2031.             Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
  2032. EXTERN int    TclCompileIfCmd _ANSI_ARGS_((Tcl_Interp *interp,
  2033.             Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
  2034. EXTERN int    TclCompileIncrCmd _ANSI_ARGS_((Tcl_Interp *interp,
  2035.             Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
  2036. EXTERN int    TclCompileSetCmd _ANSI_ARGS_((Tcl_Interp *interp,
  2037.             Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
  2038. EXTERN int    TclCompileWhileCmd _ANSI_ARGS_((Tcl_Interp *interp,
  2039.             Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
  2040.  
  2041. /*
  2042.  *----------------------------------------------------------------
  2043.  * Macros used by the Tcl core to create and release Tcl objects.
  2044.  * TclNewObj(objPtr) creates a new object denoting an empty string.
  2045.  * TclDecrRefCount(objPtr) decrements the object's reference count,
  2046.  * and frees the object if its reference count is zero.
  2047.  * These macros are inline versions of Tcl_NewObj() and
  2048.  * Tcl_DecrRefCount(). Notice that the names differ in not having
  2049.  * a "_" after the "Tcl". Notice also that these macros reference
  2050.  * their argument more than once, so you should avoid calling them
  2051.  * with an expression that is expensive to compute or has
  2052.  * side effects. The ANSI C "prototypes" for these macros are:
  2053.  *
  2054.  * EXTERN void    TclNewObj _ANSI_ARGS_((Tcl_Obj *objPtr));
  2055.  * EXTERN void    TclDecrRefCount _ANSI_ARGS_((Tcl_Obj *objPtr));
  2056.  *----------------------------------------------------------------
  2057.  */
  2058.  
  2059. #ifdef TCL_COMPILE_STATS
  2060. #  define TclIncrObjsAllocated() \
  2061.     tclObjsAlloced++
  2062. #  define TclIncrObjsFreed() \
  2063.     tclObjsFreed++
  2064. #else
  2065. #  define TclIncrObjsAllocated()
  2066. #  define TclIncrObjsFreed()
  2067. #endif /* TCL_COMPILE_STATS */
  2068.  
  2069. #ifdef TCL_MEM_DEBUG
  2070. #  define TclNewObj(objPtr) \
  2071.     (objPtr) = (Tcl_Obj *) \
  2072.      Tcl_DbCkalloc(sizeof(Tcl_Obj), __FILE__, __LINE__); \
  2073.     (objPtr)->refCount = 0; \
  2074.     (objPtr)->bytes    = tclEmptyStringRep; \
  2075.     (objPtr)->length   = 0; \
  2076.     (objPtr)->typePtr  = NULL; \
  2077.     TclIncrObjsAllocated()
  2078.      
  2079. #  define TclDbNewObj(objPtr, file, line) \
  2080.     (objPtr) = (Tcl_Obj *) Tcl_DbCkalloc(sizeof(Tcl_Obj), (file), (line)); \
  2081.     (objPtr)->refCount = 0; \
  2082.     (objPtr)->bytes    = tclEmptyStringRep; \
  2083.     (objPtr)->length   = 0; \
  2084.     (objPtr)->typePtr  = NULL; \
  2085.     TclIncrObjsAllocated()
  2086.      
  2087. #  define TclDecrRefCount(objPtr) \
  2088.     if (--(objPtr)->refCount <= 0) { \
  2089.     if ((objPtr)->refCount < -1) \
  2090.         panic("Reference count for %lx was negative: %s line %d", \
  2091.           (objPtr), __FILE__, __LINE__); \
  2092.     if (((objPtr)->bytes != NULL) \
  2093.         && ((objPtr)->bytes != tclEmptyStringRep)) { \
  2094.         ckfree((char *) (objPtr)->bytes); \
  2095.     } \
  2096.     if (((objPtr)->typePtr != NULL) \
  2097.         && ((objPtr)->typePtr->freeIntRepProc != NULL)) { \
  2098.         (objPtr)->typePtr->freeIntRepProc(objPtr); \
  2099.     } \
  2100.     ckfree((char *) (objPtr)); \
  2101.     TclIncrObjsFreed(); \
  2102.     }
  2103.  
  2104. #elif defined(PURIFY)
  2105.  
  2106. /*
  2107.  * The PURIFY mode is like the regular mode, but instead of doing block
  2108.  * Tcl_Obj allocation and keeping a freed list for efficiency, it always
  2109.  * allocates and frees a single Tcl_Obj so that tools like Purify can
  2110.  * better track memory leaks
  2111.  */
  2112.  
  2113. #  define TclNewObj(objPtr) \
  2114.     (objPtr) = (Tcl_Obj *) Tcl_Ckalloc(sizeof(Tcl_Obj)); \
  2115.     (objPtr)->refCount = 0; \
  2116.     (objPtr)->bytes    = tclEmptyStringRep; \
  2117.     (objPtr)->length   = 0; \
  2118.     (objPtr)->typePtr  = NULL; \
  2119.     TclIncrObjsAllocated();
  2120.  
  2121. #  define TclDecrRefCount(objPtr) \
  2122.     if (--(objPtr)->refCount <= 0) { \
  2123.     if (((objPtr)->bytes != NULL) \
  2124.         && ((objPtr)->bytes != tclEmptyStringRep)) { \
  2125.         ckfree((char *) (objPtr)->bytes); \
  2126.     } \
  2127.     if (((objPtr)->typePtr != NULL) \
  2128.         && ((objPtr)->typePtr->freeIntRepProc != NULL)) { \
  2129.         (objPtr)->typePtr->freeIntRepProc(objPtr); \
  2130.     } \
  2131.     ckfree((char *) (objPtr)); \
  2132.     TclIncrObjsFreed(); \
  2133.     }
  2134.  
  2135. #else /* not TCL_MEM_DEBUG */
  2136.  
  2137. #ifdef TCL_THREADS
  2138. extern Tcl_Mutex tclObjMutex;
  2139. #endif
  2140.  
  2141. #  define TclNewObj(objPtr) \
  2142.     Tcl_MutexLock(&tclObjMutex); \
  2143.     if (tclFreeObjList == NULL) { \
  2144.     TclAllocateFreeObjects(); \
  2145.     } \
  2146.     (objPtr) = tclFreeObjList; \
  2147.     tclFreeObjList = (Tcl_Obj *) \
  2148.     tclFreeObjList->internalRep.otherValuePtr; \
  2149.     (objPtr)->refCount = 0; \
  2150.     (objPtr)->bytes    = tclEmptyStringRep; \
  2151.     (objPtr)->length   = 0; \
  2152.     (objPtr)->typePtr  = NULL; \
  2153.     TclIncrObjsAllocated(); \
  2154.     Tcl_MutexUnlock(&tclObjMutex)
  2155.  
  2156. #  define TclDecrRefCount(objPtr) \
  2157.     if (--(objPtr)->refCount <= 0) { \
  2158.     if (((objPtr)->bytes != NULL) \
  2159.         && ((objPtr)->bytes != tclEmptyStringRep)) { \
  2160.         ckfree((char *) (objPtr)->bytes); \
  2161.     } \
  2162.     if (((objPtr)->typePtr != NULL) \
  2163.         && ((objPtr)->typePtr->freeIntRepProc != NULL)) { \
  2164.         (objPtr)->typePtr->freeIntRepProc(objPtr); \
  2165.     } \
  2166.     Tcl_MutexLock(&tclObjMutex); \
  2167.     (objPtr)->internalRep.otherValuePtr = (VOID *) tclFreeObjList; \
  2168.     tclFreeObjList = (objPtr); \
  2169.     TclIncrObjsFreed(); \
  2170.     Tcl_MutexUnlock(&tclObjMutex); \
  2171.     }
  2172. #endif /* TCL_MEM_DEBUG */
  2173.  
  2174. /*
  2175.  *----------------------------------------------------------------
  2176.  * Macro used by the Tcl core to set a Tcl_Obj's string representation
  2177.  * to a copy of the "len" bytes starting at "bytePtr". This code
  2178.  * works even if the byte array contains NULLs as long as the length
  2179.  * is correct. Because "len" is referenced multiple times, it should
  2180.  * be as simple an expression as possible. The ANSI C "prototype" for
  2181.  * this macro is:
  2182.  *
  2183.  * EXTERN void    TclInitStringRep _ANSI_ARGS_((Tcl_Obj *objPtr,
  2184.  *            char *bytePtr, int len));
  2185.  *----------------------------------------------------------------
  2186.  */
  2187.  
  2188. #define TclInitStringRep(objPtr, bytePtr, len) \
  2189.     if ((len) == 0) { \
  2190.     (objPtr)->bytes     = tclEmptyStringRep; \
  2191.     (objPtr)->length = 0; \
  2192.     } else { \
  2193.     (objPtr)->bytes = (char *) ckalloc((unsigned) ((len) + 1)); \
  2194.     memcpy((VOID *) (objPtr)->bytes, (VOID *) (bytePtr), \
  2195.         (unsigned) (len)); \
  2196.     (objPtr)->bytes[len] = '\0'; \
  2197.     (objPtr)->length = (len); \
  2198.     }
  2199.  
  2200. /*
  2201.  *----------------------------------------------------------------
  2202.  * Macro used by the Tcl core to get the string representation's
  2203.  * byte array pointer from a Tcl_Obj. This is an inline version
  2204.  * of Tcl_GetString(). The macro's expression result is the string
  2205.  * rep's byte pointer which might be NULL. The bytes referenced by 
  2206.  * this pointer must not be modified by the caller.
  2207.  * The ANSI C "prototype" for this macro is:
  2208.  *
  2209.  * EXTERN char *  TclGetString _ANSI_ARGS_((Tcl_Obj *objPtr));
  2210.  *----------------------------------------------------------------
  2211.  */
  2212.  
  2213. #define TclGetString(objPtr) \
  2214.     ((objPtr)->bytes? (objPtr)->bytes : Tcl_GetString((objPtr)))
  2215.  
  2216. #include "tclIntDecls.h"
  2217.  
  2218. # undef TCL_STORAGE_CLASS
  2219. # define TCL_STORAGE_CLASS DLLIMPORT
  2220.  
  2221. #endif /* _TCLINT */
  2222.  
  2223.