os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/generic/tclInt.h
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/generic/tclInt.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,2540 @@
1.4 +/*
1.5 + * tclInt.h --
1.6 + *
1.7 + * Declarations of things used internally by the Tcl interpreter.
1.8 + *
1.9 + * Copyright (c) 1987-1993 The Regents of the University of California.
1.10 + * Copyright (c) 1993-1997 Lucent Technologies.
1.11 + * Copyright (c) 1994-1998 Sun Microsystems, Inc.
1.12 + * Copyright (c) 1998-1999 by Scriptics Corporation.
1.13 + * Copyright (c) 2001, 2002 by Kevin B. Kenny. All rights reserved.
1.14 + * Portions Copyright (c) 2007 Nokia Corporation and/or its subsidiaries. All rights reserved.
1.15 + *
1.16 + * See the file "license.terms" for information on usage and redistribution
1.17 + * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1.18 + *
1.19 + * RCS: @(#) $Id: tclInt.h,v 1.118.2.28 2007/05/10 21:32:17 dgp Exp $
1.20 + */
1.21 +
1.22 +#ifndef _TCLINT
1.23 +#define _TCLINT
1.24 +
1.25 +/*
1.26 + * Common include files needed by most of the Tcl source files are
1.27 + * included here, so that system-dependent personalizations for the
1.28 + * include files only have to be made in once place. This results
1.29 + * in a few extra includes, but greater modularity. The order of
1.30 + * the three groups of #includes is important. For example, stdio.h
1.31 + * is needed by tcl.h, and the _ANSI_ARGS_ declaration in tcl.h is
1.32 + * needed by stdlib.h in some configurations.
1.33 + */
1.34 +
1.35 +#ifndef _TCL
1.36 +#include "tcl.h"
1.37 +#endif
1.38 +
1.39 +#include <stdio.h>
1.40 +
1.41 +#include <ctype.h>
1.42 +#ifdef NO_LIMITS_H
1.43 +# include "../compat/limits.h"
1.44 +#else
1.45 +# include <limits.h>
1.46 +#endif
1.47 +#ifdef NO_STDLIB_H
1.48 +# include "../compat/stdlib.h"
1.49 +#else
1.50 +# include <stdlib.h>
1.51 +#endif
1.52 +#ifdef NO_STRING_H
1.53 +#include "../compat/string.h"
1.54 +#else
1.55 +#include <string.h>
1.56 +#endif
1.57 +
1.58 +/*
1.59 + * Ensure WORDS_BIGENDIAN is defined correcly:
1.60 + * Needs to happen here in addition to configure to work with fat compiles on
1.61 + * Darwin (where configure runs only once for multiple architectures).
1.62 + */
1.63 +
1.64 +#ifdef HAVE_SYS_TYPES_H
1.65 +# include <sys/types.h>
1.66 +#endif
1.67 +#ifdef HAVE_SYS_PARAM_H
1.68 +# include <sys/param.h>
1.69 +#endif
1.70 +#ifdef BYTE_ORDER
1.71 +# ifdef BIG_ENDIAN
1.72 +# if BYTE_ORDER == BIG_ENDIAN
1.73 +# undef WORDS_BIGENDIAN
1.74 +# define WORDS_BIGENDIAN
1.75 +# endif
1.76 +# endif
1.77 +# ifdef LITTLE_ENDIAN
1.78 +# if BYTE_ORDER == LITTLE_ENDIAN
1.79 +# undef WORDS_BIGENDIAN
1.80 +# endif
1.81 +# endif
1.82 +#endif
1.83 +
1.84 +/*
1.85 + * Used to tag functions that are only to be visible within the module being
1.86 + * built and not outside it (where this is supported by the linker).
1.87 + */
1.88 +
1.89 +#ifndef MODULE_SCOPE
1.90 +# ifdef __cplusplus
1.91 +# define MODULE_SCOPE extern "C"
1.92 +# else
1.93 +# define MODULE_SCOPE extern
1.94 +# endif
1.95 +#endif
1.96 +
1.97 +#undef TCL_STORAGE_CLASS
1.98 +#ifdef BUILD_tcl
1.99 +# define TCL_STORAGE_CLASS DLLEXPORT
1.100 +#else
1.101 +# ifdef USE_TCL_STUBS
1.102 +# define TCL_STORAGE_CLASS
1.103 +# else
1.104 +# define TCL_STORAGE_CLASS DLLIMPORT
1.105 +# endif
1.106 +#endif
1.107 +
1.108 +/*
1.109 + * The following procedures allow namespaces to be customized to
1.110 + * support special name resolution rules for commands/variables.
1.111 + *
1.112 + */
1.113 +
1.114 +struct Tcl_ResolvedVarInfo;
1.115 +
1.116 +typedef Tcl_Var (Tcl_ResolveRuntimeVarProc) _ANSI_ARGS_((
1.117 + Tcl_Interp* interp, struct Tcl_ResolvedVarInfo *vinfoPtr));
1.118 +
1.119 +typedef void (Tcl_ResolveVarDeleteProc) _ANSI_ARGS_((
1.120 + struct Tcl_ResolvedVarInfo *vinfoPtr));
1.121 +
1.122 +/*
1.123 + * The following structure encapsulates the routines needed to resolve a
1.124 + * variable reference at runtime. Any variable specific state will typically
1.125 + * be appended to this structure.
1.126 + */
1.127 +
1.128 +
1.129 +typedef struct Tcl_ResolvedVarInfo {
1.130 + Tcl_ResolveRuntimeVarProc *fetchProc;
1.131 + Tcl_ResolveVarDeleteProc *deleteProc;
1.132 +} Tcl_ResolvedVarInfo;
1.133 +
1.134 +
1.135 +
1.136 +typedef int (Tcl_ResolveCompiledVarProc) _ANSI_ARGS_((
1.137 + Tcl_Interp* interp, CONST84 char* name, int length,
1.138 + Tcl_Namespace *context, Tcl_ResolvedVarInfo **rPtr));
1.139 +
1.140 +typedef int (Tcl_ResolveVarProc) _ANSI_ARGS_((
1.141 + Tcl_Interp* interp, CONST84 char* name, Tcl_Namespace *context,
1.142 + int flags, Tcl_Var *rPtr));
1.143 +
1.144 +typedef int (Tcl_ResolveCmdProc) _ANSI_ARGS_((Tcl_Interp* interp,
1.145 + CONST84 char* name, Tcl_Namespace *context, int flags,
1.146 + Tcl_Command *rPtr));
1.147 +
1.148 +typedef struct Tcl_ResolverInfo {
1.149 + Tcl_ResolveCmdProc *cmdResProc; /* Procedure handling command name
1.150 + * resolution. */
1.151 + Tcl_ResolveVarProc *varResProc; /* Procedure handling variable name
1.152 + * resolution for variables that
1.153 + * can only be handled at runtime. */
1.154 + Tcl_ResolveCompiledVarProc *compiledVarResProc;
1.155 + /* Procedure handling variable name
1.156 + * resolution at compile time. */
1.157 +} Tcl_ResolverInfo;
1.158 +
1.159 +/*
1.160 + *----------------------------------------------------------------
1.161 + * Data structures related to namespaces.
1.162 + *----------------------------------------------------------------
1.163 + */
1.164 +
1.165 +/*
1.166 + * The structure below defines a namespace.
1.167 + * Note: the first five fields must match exactly the fields in a
1.168 + * Tcl_Namespace structure (see tcl.h). If you change one, be sure to
1.169 + * change the other.
1.170 + */
1.171 +
1.172 +typedef struct Namespace {
1.173 + char *name; /* The namespace's simple (unqualified)
1.174 + * name. This contains no ::'s. The name of
1.175 + * the global namespace is "" although "::"
1.176 + * is an synonym. */
1.177 + char *fullName; /* The namespace's fully qualified name.
1.178 + * This starts with ::. */
1.179 + ClientData clientData; /* An arbitrary value associated with this
1.180 + * namespace. */
1.181 + Tcl_NamespaceDeleteProc *deleteProc;
1.182 + /* Procedure invoked when deleting the
1.183 + * namespace to, e.g., free clientData. */
1.184 + struct Namespace *parentPtr; /* Points to the namespace that contains
1.185 + * this one. NULL if this is the global
1.186 + * namespace. */
1.187 + Tcl_HashTable childTable; /* Contains any child namespaces. Indexed
1.188 + * by strings; values have type
1.189 + * (Namespace *). */
1.190 + long nsId; /* Unique id for the namespace. */
1.191 + Tcl_Interp *interp; /* The interpreter containing this
1.192 + * namespace. */
1.193 + int flags; /* OR-ed combination of the namespace
1.194 + * status flags NS_DYING and NS_DEAD
1.195 + * listed below. */
1.196 + int activationCount; /* Number of "activations" or active call
1.197 + * frames for this namespace that are on
1.198 + * the Tcl call stack. The namespace won't
1.199 + * be freed until activationCount becomes
1.200 + * zero. */
1.201 + int refCount; /* Count of references by namespaceName *
1.202 + * objects. The namespace can't be freed
1.203 + * until refCount becomes zero. */
1.204 + Tcl_HashTable cmdTable; /* Contains all the commands currently
1.205 + * registered in the namespace. Indexed by
1.206 + * strings; values have type (Command *).
1.207 + * Commands imported by Tcl_Import have
1.208 + * Command structures that point (via an
1.209 + * ImportedCmdRef structure) to the
1.210 + * Command structure in the source
1.211 + * namespace's command table. */
1.212 + Tcl_HashTable varTable; /* Contains all the (global) variables
1.213 + * currently in this namespace. Indexed
1.214 + * by strings; values have type (Var *). */
1.215 + char **exportArrayPtr; /* Points to an array of string patterns
1.216 + * specifying which commands are exported.
1.217 + * A pattern may include "string match"
1.218 + * style wildcard characters to specify
1.219 + * multiple commands; however, no namespace
1.220 + * qualifiers are allowed. NULL if no
1.221 + * export patterns are registered. */
1.222 + int numExportPatterns; /* Number of export patterns currently
1.223 + * registered using "namespace export". */
1.224 + int maxExportPatterns; /* Mumber of export patterns for which
1.225 + * space is currently allocated. */
1.226 + int cmdRefEpoch; /* Incremented if a newly added command
1.227 + * shadows a command for which this
1.228 + * namespace has already cached a Command *
1.229 + * pointer; this causes all its cached
1.230 + * Command* pointers to be invalidated. */
1.231 + int resolverEpoch; /* Incremented whenever (a) the name resolution
1.232 + * rules change for this namespace or (b) a
1.233 + * newly added command shadows a command that
1.234 + * is compiled to bytecodes.
1.235 + * This invalidates all byte codes compiled
1.236 + * in the namespace, causing the code to be
1.237 + * recompiled under the new rules.*/
1.238 + Tcl_ResolveCmdProc *cmdResProc;
1.239 + /* If non-null, this procedure overrides
1.240 + * the usual command resolution mechanism
1.241 + * in Tcl. This procedure is invoked
1.242 + * within Tcl_FindCommand to resolve all
1.243 + * command references within the namespace. */
1.244 + Tcl_ResolveVarProc *varResProc;
1.245 + /* If non-null, this procedure overrides
1.246 + * the usual variable resolution mechanism
1.247 + * in Tcl. This procedure is invoked
1.248 + * within Tcl_FindNamespaceVar to resolve all
1.249 + * variable references within the namespace
1.250 + * at runtime. */
1.251 + Tcl_ResolveCompiledVarProc *compiledVarResProc;
1.252 + /* If non-null, this procedure overrides
1.253 + * the usual variable resolution mechanism
1.254 + * in Tcl. This procedure is invoked
1.255 + * within LookupCompiledLocal to resolve
1.256 + * variable references within the namespace
1.257 + * at compile time. */
1.258 +} Namespace;
1.259 +
1.260 +/*
1.261 + * Flags used to represent the status of a namespace:
1.262 + *
1.263 + * NS_DYING - 1 means Tcl_DeleteNamespace has been called to delete the
1.264 + * namespace but there are still active call frames on the Tcl
1.265 + * stack that refer to the namespace. When the last call frame
1.266 + * referring to it has been popped, it's variables and command
1.267 + * will be destroyed and it will be marked "dead" (NS_DEAD).
1.268 + * The namespace can no longer be looked up by name.
1.269 + * NS_DEAD - 1 means Tcl_DeleteNamespace has been called to delete the
1.270 + * namespace and no call frames still refer to it. Its
1.271 + * variables and command have already been destroyed. This bit
1.272 + * allows the namespace resolution code to recognize that the
1.273 + * namespace is "deleted". When the last namespaceName object
1.274 + * in any byte code code unit that refers to the namespace has
1.275 + * been freed (i.e., when the namespace's refCount is 0), the
1.276 + * namespace's storage will be freed.
1.277 + * NS_KILLED 1 means that TclTeardownNamespace has already been called on
1.278 + * this namespace and it should not be called again [Bug 1355942]
1.279 + */
1.280 +
1.281 +#define NS_DYING 0x01
1.282 +#define NS_DEAD 0x02
1.283 +#define NS_KILLED 0x04
1.284 +
1.285 +/*
1.286 + * Flag passed to TclGetNamespaceForQualName to have it create all namespace
1.287 + * components of a namespace-qualified name that cannot be found. The new
1.288 + * namespaces are created within their specified parent. Note that this
1.289 + * flag's value must not conflict with the values of the flags
1.290 + * TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY, and FIND_ONLY_NS (defined in
1.291 + * tclNamesp.c).
1.292 + */
1.293 +
1.294 +#define CREATE_NS_IF_UNKNOWN 0x800
1.295 +
1.296 +/*
1.297 + *----------------------------------------------------------------
1.298 + * Data structures related to variables. These are used primarily
1.299 + * in tclVar.c
1.300 + *----------------------------------------------------------------
1.301 + */
1.302 +
1.303 +/*
1.304 + * The following structure defines a variable trace, which is used to
1.305 + * invoke a specific C procedure whenever certain operations are performed
1.306 + * on a variable.
1.307 + */
1.308 +
1.309 +typedef struct VarTrace {
1.310 + Tcl_VarTraceProc *traceProc;/* Procedure to call when operations given
1.311 + * by flags are performed on variable. */
1.312 + ClientData clientData; /* Argument to pass to proc. */
1.313 + int flags; /* What events the trace procedure is
1.314 + * interested in: OR-ed combination of
1.315 + * TCL_TRACE_READS, TCL_TRACE_WRITES,
1.316 + * TCL_TRACE_UNSETS and TCL_TRACE_ARRAY. */
1.317 + struct VarTrace *nextPtr; /* Next in list of traces associated with
1.318 + * a particular variable. */
1.319 +} VarTrace;
1.320 +
1.321 +/*
1.322 + * The following structure defines a command trace, which is used to
1.323 + * invoke a specific C procedure whenever certain operations are performed
1.324 + * on a command.
1.325 + */
1.326 +
1.327 +typedef struct CommandTrace {
1.328 + Tcl_CommandTraceProc *traceProc;/* Procedure to call when operations given
1.329 + * by flags are performed on command. */
1.330 + ClientData clientData; /* Argument to pass to proc. */
1.331 + int flags; /* What events the trace procedure is
1.332 + * interested in: OR-ed combination of
1.333 + * TCL_TRACE_RENAME, TCL_TRACE_DELETE. */
1.334 + struct CommandTrace *nextPtr; /* Next in list of traces associated with
1.335 + * a particular command. */
1.336 + int refCount; /* Used to ensure this structure is
1.337 + * not deleted too early. Keeps track
1.338 + * of how many pieces of code have
1.339 + * a pointer to this structure. */
1.340 +} CommandTrace;
1.341 +
1.342 +/*
1.343 + * When a command trace is active (i.e. its associated procedure is
1.344 + * executing), one of the following structures is linked into a list
1.345 + * associated with the command's interpreter. The information in
1.346 + * the structure is needed in order for Tcl to behave reasonably
1.347 + * if traces are deleted while traces are active.
1.348 + */
1.349 +
1.350 +typedef struct ActiveCommandTrace {
1.351 + struct Command *cmdPtr; /* Command that's being traced. */
1.352 + struct ActiveCommandTrace *nextPtr;
1.353 + /* Next in list of all active command
1.354 + * traces for the interpreter, or NULL
1.355 + * if no more. */
1.356 + CommandTrace *nextTracePtr; /* Next trace to check after current
1.357 + * trace procedure returns; if this
1.358 + * trace gets deleted, must update pointer
1.359 + * to avoid using free'd memory. */
1.360 + int reverseScan; /* Boolean set true when the traces
1.361 + * are scanning in reverse order. */
1.362 +} ActiveCommandTrace;
1.363 +
1.364 +/*
1.365 + * When a variable trace is active (i.e. its associated procedure is
1.366 + * executing), one of the following structures is linked into a list
1.367 + * associated with the variable's interpreter. The information in
1.368 + * the structure is needed in order for Tcl to behave reasonably
1.369 + * if traces are deleted while traces are active.
1.370 + */
1.371 +
1.372 +typedef struct ActiveVarTrace {
1.373 + struct Var *varPtr; /* Variable that's being traced. */
1.374 + struct ActiveVarTrace *nextPtr;
1.375 + /* Next in list of all active variable
1.376 + * traces for the interpreter, or NULL
1.377 + * if no more. */
1.378 + VarTrace *nextTracePtr; /* Next trace to check after current
1.379 + * trace procedure returns; if this
1.380 + * trace gets deleted, must update pointer
1.381 + * to avoid using free'd memory. */
1.382 +} ActiveVarTrace;
1.383 +
1.384 +/*
1.385 + * The following structure describes an enumerative search in progress on
1.386 + * an array variable; this are invoked with options to the "array"
1.387 + * command.
1.388 + */
1.389 +
1.390 +typedef struct ArraySearch {
1.391 + int id; /* Integer id used to distinguish among
1.392 + * multiple concurrent searches for the
1.393 + * same array. */
1.394 + struct Var *varPtr; /* Pointer to array variable that's being
1.395 + * searched. */
1.396 + Tcl_HashSearch search; /* Info kept by the hash module about
1.397 + * progress through the array. */
1.398 + Tcl_HashEntry *nextEntry; /* Non-null means this is the next element
1.399 + * to be enumerated (it's leftover from
1.400 + * the Tcl_FirstHashEntry call or from
1.401 + * an "array anymore" command). NULL
1.402 + * means must call Tcl_NextHashEntry
1.403 + * to get value to return. */
1.404 + struct ArraySearch *nextPtr;/* Next in list of all active searches
1.405 + * for this variable, or NULL if this is
1.406 + * the last one. */
1.407 +} ArraySearch;
1.408 +
1.409 +/*
1.410 + * The structure below defines a variable, which associates a string name
1.411 + * with a Tcl_Obj value. These structures are kept in procedure call frames
1.412 + * (for local variables recognized by the compiler) or in the heap (for
1.413 + * global variables and any variable not known to the compiler). For each
1.414 + * Var structure in the heap, a hash table entry holds the variable name and
1.415 + * a pointer to the Var structure.
1.416 + */
1.417 +
1.418 +typedef struct Var {
1.419 + union {
1.420 + Tcl_Obj *objPtr; /* The variable's object value. Used for
1.421 + * scalar variables and array elements. */
1.422 + Tcl_HashTable *tablePtr;/* For array variables, this points to
1.423 + * information about the hash table used
1.424 + * to implement the associative array.
1.425 + * Points to malloc-ed data. */
1.426 + struct Var *linkPtr; /* If this is a global variable being
1.427 + * referred to in a procedure, or a variable
1.428 + * created by "upvar", this field points to
1.429 + * the referenced variable's Var struct. */
1.430 + } value;
1.431 + char *name; /* NULL if the variable is in a hashtable,
1.432 + * otherwise points to the variable's
1.433 + * name. It is used, e.g., by TclLookupVar
1.434 + * and "info locals". The storage for the
1.435 + * characters of the name is not owned by
1.436 + * the Var and must not be freed when
1.437 + * freeing the Var. */
1.438 + Namespace *nsPtr; /* Points to the namespace that contains
1.439 + * this variable or NULL if the variable is
1.440 + * a local variable in a Tcl procedure. */
1.441 + Tcl_HashEntry *hPtr; /* If variable is in a hashtable, either the
1.442 + * hash table entry that refers to this
1.443 + * variable or NULL if the variable has been
1.444 + * detached from its hash table (e.g. an
1.445 + * array is deleted, but some of its
1.446 + * elements are still referred to in
1.447 + * upvars). NULL if the variable is not in a
1.448 + * hashtable. This is used to delete an
1.449 + * variable from its hashtable if it is no
1.450 + * longer needed. */
1.451 + int refCount; /* Counts number of active uses of this
1.452 + * variable, not including its entry in the
1.453 + * call frame or the hash table: 1 for each
1.454 + * additional variable whose linkPtr points
1.455 + * here, 1 for each nested trace active on
1.456 + * variable, and 1 if the variable is a
1.457 + * namespace variable. This record can't be
1.458 + * deleted until refCount becomes 0. */
1.459 + VarTrace *tracePtr; /* First in list of all traces set for this
1.460 + * variable. */
1.461 + ArraySearch *searchPtr; /* First in list of all searches active
1.462 + * for this variable, or NULL if none. */
1.463 + int flags; /* Miscellaneous bits of information about
1.464 + * variable. See below for definitions. */
1.465 +} Var;
1.466 +
1.467 +/*
1.468 + * Flag bits for variables. The first three (VAR_SCALAR, VAR_ARRAY, and
1.469 + * VAR_LINK) are mutually exclusive and give the "type" of the variable.
1.470 + * VAR_UNDEFINED is independent of the variable's type.
1.471 + *
1.472 + * VAR_SCALAR - 1 means this is a scalar variable and not
1.473 + * an array or link. The "objPtr" field points
1.474 + * to the variable's value, a Tcl object.
1.475 + * VAR_ARRAY - 1 means this is an array variable rather
1.476 + * than a scalar variable or link. The
1.477 + * "tablePtr" field points to the array's
1.478 + * hashtable for its elements.
1.479 + * VAR_LINK - 1 means this Var structure contains a
1.480 + * pointer to another Var structure that
1.481 + * either has the real value or is itself
1.482 + * another VAR_LINK pointer. Variables like
1.483 + * this come about through "upvar" and "global"
1.484 + * commands, or through references to variables
1.485 + * in enclosing namespaces.
1.486 + * VAR_UNDEFINED - 1 means that the variable is in the process
1.487 + * of being deleted. An undefined variable
1.488 + * logically does not exist and survives only
1.489 + * while it has a trace, or if it is a global
1.490 + * variable currently being used by some
1.491 + * procedure.
1.492 + * VAR_IN_HASHTABLE - 1 means this variable is in a hashtable and
1.493 + * the Var structure is malloced. 0 if it is
1.494 + * a local variable that was assigned a slot
1.495 + * in a procedure frame by the compiler so the
1.496 + * Var storage is part of the call frame.
1.497 + * VAR_TRACE_ACTIVE - 1 means that trace processing is currently
1.498 + * underway for a read or write access, so
1.499 + * new read or write accesses should not cause
1.500 + * trace procedures to be called and the
1.501 + * variable can't be deleted.
1.502 + * VAR_ARRAY_ELEMENT - 1 means that this variable is an array
1.503 + * element, so it is not legal for it to be
1.504 + * an array itself (the VAR_ARRAY flag had
1.505 + * better not be set).
1.506 + * VAR_NAMESPACE_VAR - 1 means that this variable was declared
1.507 + * as a namespace variable. This flag ensures
1.508 + * it persists until its namespace is
1.509 + * destroyed or until the variable is unset;
1.510 + * it will persist even if it has not been
1.511 + * initialized and is marked undefined.
1.512 + * The variable's refCount is incremented to
1.513 + * reflect the "reference" from its namespace.
1.514 + *
1.515 + * The following additional flags are used with the CompiledLocal type
1.516 + * defined below:
1.517 + *
1.518 + * VAR_ARGUMENT - 1 means that this variable holds a procedure
1.519 + * argument.
1.520 + * VAR_TEMPORARY - 1 if the local variable is an anonymous
1.521 + * temporary variable. Temporaries have a NULL
1.522 + * name.
1.523 + * VAR_RESOLVED - 1 if name resolution has been done for this
1.524 + * variable.
1.525 + */
1.526 +
1.527 +#define VAR_SCALAR 0x1
1.528 +#define VAR_ARRAY 0x2
1.529 +#define VAR_LINK 0x4
1.530 +#define VAR_UNDEFINED 0x8
1.531 +#define VAR_IN_HASHTABLE 0x10
1.532 +#define VAR_TRACE_ACTIVE 0x20
1.533 +#define VAR_ARRAY_ELEMENT 0x40
1.534 +#define VAR_NAMESPACE_VAR 0x80
1.535 +
1.536 +#define VAR_ARGUMENT 0x100
1.537 +#define VAR_TEMPORARY 0x200
1.538 +#define VAR_RESOLVED 0x400
1.539 +
1.540 +/*
1.541 + * Macros to ensure that various flag bits are set properly for variables.
1.542 + * The ANSI C "prototypes" for these macros are:
1.543 + *
1.544 + * EXTERN void TclSetVarScalar _ANSI_ARGS_((Var *varPtr));
1.545 + * EXTERN void TclSetVarArray _ANSI_ARGS_((Var *varPtr));
1.546 + * EXTERN void TclSetVarLink _ANSI_ARGS_((Var *varPtr));
1.547 + * EXTERN void TclSetVarArrayElement _ANSI_ARGS_((Var *varPtr));
1.548 + * EXTERN void TclSetVarUndefined _ANSI_ARGS_((Var *varPtr));
1.549 + * EXTERN void TclClearVarUndefined _ANSI_ARGS_((Var *varPtr));
1.550 + */
1.551 +
1.552 +#define TclSetVarScalar(varPtr) \
1.553 + (varPtr)->flags = ((varPtr)->flags & ~(VAR_ARRAY|VAR_LINK)) | VAR_SCALAR
1.554 +
1.555 +#define TclSetVarArray(varPtr) \
1.556 + (varPtr)->flags = ((varPtr)->flags & ~(VAR_SCALAR|VAR_LINK)) | VAR_ARRAY
1.557 +
1.558 +#define TclSetVarLink(varPtr) \
1.559 + (varPtr)->flags = ((varPtr)->flags & ~(VAR_SCALAR|VAR_ARRAY)) | VAR_LINK
1.560 +
1.561 +#define TclSetVarArrayElement(varPtr) \
1.562 + (varPtr)->flags = ((varPtr)->flags & ~VAR_ARRAY) | VAR_ARRAY_ELEMENT
1.563 +
1.564 +#define TclSetVarUndefined(varPtr) \
1.565 + (varPtr)->flags |= VAR_UNDEFINED
1.566 +
1.567 +#define TclClearVarUndefined(varPtr) \
1.568 + (varPtr)->flags &= ~VAR_UNDEFINED
1.569 +
1.570 +/*
1.571 + * Macros to read various flag bits of variables.
1.572 + * The ANSI C "prototypes" for these macros are:
1.573 + *
1.574 + * EXTERN int TclIsVarScalar _ANSI_ARGS_((Var *varPtr));
1.575 + * EXTERN int TclIsVarLink _ANSI_ARGS_((Var *varPtr));
1.576 + * EXTERN int TclIsVarArray _ANSI_ARGS_((Var *varPtr));
1.577 + * EXTERN int TclIsVarUndefined _ANSI_ARGS_((Var *varPtr));
1.578 + * EXTERN int TclIsVarArrayElement _ANSI_ARGS_((Var *varPtr));
1.579 + * EXTERN int TclIsVarTemporary _ANSI_ARGS_((Var *varPtr));
1.580 + * EXTERN int TclIsVarArgument _ANSI_ARGS_((Var *varPtr));
1.581 + * EXTERN int TclIsVarResolved _ANSI_ARGS_((Var *varPtr));
1.582 + */
1.583 +
1.584 +#define TclIsVarScalar(varPtr) \
1.585 + ((varPtr)->flags & VAR_SCALAR)
1.586 +
1.587 +#define TclIsVarLink(varPtr) \
1.588 + ((varPtr)->flags & VAR_LINK)
1.589 +
1.590 +#define TclIsVarArray(varPtr) \
1.591 + ((varPtr)->flags & VAR_ARRAY)
1.592 +
1.593 +#define TclIsVarUndefined(varPtr) \
1.594 + ((varPtr)->flags & VAR_UNDEFINED)
1.595 +
1.596 +#define TclIsVarArrayElement(varPtr) \
1.597 + ((varPtr)->flags & VAR_ARRAY_ELEMENT)
1.598 +
1.599 +#define TclIsVarTemporary(varPtr) \
1.600 + ((varPtr)->flags & VAR_TEMPORARY)
1.601 +
1.602 +#define TclIsVarArgument(varPtr) \
1.603 + ((varPtr)->flags & VAR_ARGUMENT)
1.604 +
1.605 +#define TclIsVarResolved(varPtr) \
1.606 + ((varPtr)->flags & VAR_RESOLVED)
1.607 +
1.608 +/*
1.609 + *----------------------------------------------------------------
1.610 + * Data structures related to procedures. These are used primarily
1.611 + * in tclProc.c, tclCompile.c, and tclExecute.c.
1.612 + *----------------------------------------------------------------
1.613 + */
1.614 +
1.615 +/*
1.616 + * Forward declaration to prevent an error when the forward reference to
1.617 + * Command is encountered in the Proc and ImportRef types declared below.
1.618 + */
1.619 +
1.620 +struct Command;
1.621 +
1.622 +/*
1.623 + * The variable-length structure below describes a local variable of a
1.624 + * procedure that was recognized by the compiler. These variables have a
1.625 + * name, an element in the array of compiler-assigned local variables in the
1.626 + * procedure's call frame, and various other items of information. If the
1.627 + * local variable is a formal argument, it may also have a default value.
1.628 + * The compiler can't recognize local variables whose names are
1.629 + * expressions (these names are only known at runtime when the expressions
1.630 + * are evaluated) or local variables that are created as a result of an
1.631 + * "upvar" or "uplevel" command. These other local variables are kept
1.632 + * separately in a hash table in the call frame.
1.633 + */
1.634 +
1.635 +typedef struct CompiledLocal {
1.636 + struct CompiledLocal *nextPtr;
1.637 + /* Next compiler-recognized local variable
1.638 + * for this procedure, or NULL if this is
1.639 + * the last local. */
1.640 + int nameLength; /* The number of characters in local
1.641 + * variable's name. Used to speed up
1.642 + * variable lookups. */
1.643 + int frameIndex; /* Index in the array of compiler-assigned
1.644 + * variables in the procedure call frame. */
1.645 + int flags; /* Flag bits for the local variable. Same as
1.646 + * the flags for the Var structure above,
1.647 + * although only VAR_SCALAR, VAR_ARRAY,
1.648 + * VAR_LINK, VAR_ARGUMENT, VAR_TEMPORARY, and
1.649 + * VAR_RESOLVED make sense. */
1.650 + Tcl_Obj *defValuePtr; /* Pointer to the default value of an
1.651 + * argument, if any. NULL if not an argument
1.652 + * or, if an argument, no default value. */
1.653 + Tcl_ResolvedVarInfo *resolveInfo;
1.654 + /* Customized variable resolution info
1.655 + * supplied by the Tcl_ResolveCompiledVarProc
1.656 + * associated with a namespace. Each variable
1.657 + * is marked by a unique ClientData tag
1.658 + * during compilation, and that same tag
1.659 + * is used to find the variable at runtime. */
1.660 + char name[4]; /* Name of the local variable starts here.
1.661 + * If the name is NULL, this will just be
1.662 + * '\0'. The actual size of this field will
1.663 + * be large enough to hold the name. MUST
1.664 + * BE THE LAST FIELD IN THE STRUCTURE! */
1.665 +} CompiledLocal;
1.666 +
1.667 +/*
1.668 + * The structure below defines a command procedure, which consists of a
1.669 + * collection of Tcl commands plus information about arguments and other
1.670 + * local variables recognized at compile time.
1.671 + */
1.672 +
1.673 +typedef struct Proc {
1.674 + struct Interp *iPtr; /* Interpreter for which this command
1.675 + * is defined. */
1.676 + int refCount; /* Reference count: 1 if still present
1.677 + * in command table plus 1 for each call
1.678 + * to the procedure that is currently
1.679 + * active. This structure can be freed
1.680 + * when refCount becomes zero. */
1.681 + struct Command *cmdPtr; /* Points to the Command structure for
1.682 + * this procedure. This is used to get
1.683 + * the namespace in which to execute
1.684 + * the procedure. */
1.685 + Tcl_Obj *bodyPtr; /* Points to the ByteCode object for
1.686 + * procedure's body command. */
1.687 + int numArgs; /* Number of formal parameters. */
1.688 + int numCompiledLocals; /* Count of local variables recognized by
1.689 + * the compiler including arguments and
1.690 + * temporaries. */
1.691 + CompiledLocal *firstLocalPtr; /* Pointer to first of the procedure's
1.692 + * compiler-allocated local variables, or
1.693 + * NULL if none. The first numArgs entries
1.694 + * in this list describe the procedure's
1.695 + * formal arguments. */
1.696 + CompiledLocal *lastLocalPtr; /* Pointer to the last allocated local
1.697 + * variable or NULL if none. This has
1.698 + * frame index (numCompiledLocals-1). */
1.699 +} Proc;
1.700 +
1.701 +/*
1.702 + * The structure below defines a command trace. This is used to allow Tcl
1.703 + * clients to find out whenever a command is about to be executed.
1.704 + */
1.705 +
1.706 +typedef struct Trace {
1.707 + int level; /* Only trace commands at nesting level
1.708 + * less than or equal to this. */
1.709 + Tcl_CmdObjTraceProc *proc; /* Procedure to call to trace command. */
1.710 + ClientData clientData; /* Arbitrary value to pass to proc. */
1.711 + struct Trace *nextPtr; /* Next in list of traces for this interp. */
1.712 + int flags; /* Flags governing the trace - see
1.713 + * Tcl_CreateObjTrace for details */
1.714 + Tcl_CmdObjTraceDeleteProc* delProc;
1.715 + /* Procedure to call when trace is deleted */
1.716 +} Trace;
1.717 +
1.718 +/*
1.719 + * When an interpreter trace is active (i.e. its associated procedure
1.720 + * is executing), one of the following structures is linked into a list
1.721 + * associated with the interpreter. The information in the structure
1.722 + * is needed in order for Tcl to behave reasonably if traces are
1.723 + * deleted while traces are active.
1.724 + */
1.725 +
1.726 +typedef struct ActiveInterpTrace {
1.727 + struct ActiveInterpTrace *nextPtr;
1.728 + /* Next in list of all active command
1.729 + * traces for the interpreter, or NULL
1.730 + * if no more. */
1.731 + Trace *nextTracePtr; /* Next trace to check after current
1.732 + * trace procedure returns; if this
1.733 + * trace gets deleted, must update pointer
1.734 + * to avoid using free'd memory. */
1.735 + int reverseScan; /* Boolean set true when the traces
1.736 + * are scanning in reverse order. */
1.737 +} ActiveInterpTrace;
1.738 +
1.739 +/*
1.740 + * The structure below defines an entry in the assocData hash table which
1.741 + * is associated with an interpreter. The entry contains a pointer to a
1.742 + * function to call when the interpreter is deleted, and a pointer to
1.743 + * a user-defined piece of data.
1.744 + */
1.745 +
1.746 +typedef struct AssocData {
1.747 + Tcl_InterpDeleteProc *proc; /* Proc to call when deleting. */
1.748 + ClientData clientData; /* Value to pass to proc. */
1.749 +} AssocData;
1.750 +
1.751 +/*
1.752 + * The structure below defines a call frame. A call frame defines a naming
1.753 + * context for a procedure call: its local naming scope (for local
1.754 + * variables) and its global naming scope (a namespace, perhaps the global
1.755 + * :: namespace). A call frame can also define the naming context for a
1.756 + * namespace eval or namespace inscope command: the namespace in which the
1.757 + * command's code should execute. The Tcl_CallFrame structures exist only
1.758 + * while procedures or namespace eval/inscope's are being executed, and
1.759 + * provide a kind of Tcl call stack.
1.760 + *
1.761 + * WARNING!! The structure definition must be kept consistent with the
1.762 + * Tcl_CallFrame structure in tcl.h. If you change one, change the other.
1.763 + */
1.764 +
1.765 +typedef struct CallFrame {
1.766 + Namespace *nsPtr; /* Points to the namespace used to resolve
1.767 + * commands and global variables. */
1.768 + int isProcCallFrame; /* If nonzero, the frame was pushed to
1.769 + * execute a Tcl procedure and may have
1.770 + * local vars. If 0, the frame was pushed
1.771 + * to execute a namespace command and var
1.772 + * references are treated as references to
1.773 + * namespace vars; varTablePtr and
1.774 + * compiledLocals are ignored. */
1.775 + int objc; /* This and objv below describe the
1.776 + * arguments for this procedure call. */
1.777 + Tcl_Obj *CONST *objv; /* Array of argument objects. */
1.778 + struct CallFrame *callerPtr;
1.779 + /* Value of interp->framePtr when this
1.780 + * procedure was invoked (i.e. next higher
1.781 + * in stack of all active procedures). */
1.782 + struct CallFrame *callerVarPtr;
1.783 + /* Value of interp->varFramePtr when this
1.784 + * procedure was invoked (i.e. determines
1.785 + * variable scoping within caller). Same
1.786 + * as callerPtr unless an "uplevel" command
1.787 + * or something equivalent was active in
1.788 + * the caller). */
1.789 + int level; /* Level of this procedure, for "uplevel"
1.790 + * purposes (i.e. corresponds to nesting of
1.791 + * callerVarPtr's, not callerPtr's). 1 for
1.792 + * outermost procedure, 0 for top-level. */
1.793 + Proc *procPtr; /* Points to the structure defining the
1.794 + * called procedure. Used to get information
1.795 + * such as the number of compiled local
1.796 + * variables (local variables assigned
1.797 + * entries ["slots"] in the compiledLocals
1.798 + * array below). */
1.799 + Tcl_HashTable *varTablePtr; /* Hash table containing local variables not
1.800 + * recognized by the compiler, or created at
1.801 + * execution time through, e.g., upvar.
1.802 + * Initially NULL and created if needed. */
1.803 + int numCompiledLocals; /* Count of local variables recognized by
1.804 + * the compiler including arguments. */
1.805 + Var* compiledLocals; /* Points to the array of local variables
1.806 + * recognized by the compiler. The compiler
1.807 + * emits code that refers to these variables
1.808 + * using an index into this array. */
1.809 +} CallFrame;
1.810 +
1.811 +#ifdef TCL_TIP280
1.812 +/*
1.813 + * TIP #280
1.814 + * The structure below defines a command frame. A command frame
1.815 + * provides location information for all commands executing a tcl
1.816 + * script (source, eval, uplevel, procedure bodies, ...). The runtime
1.817 + * structure essentially contains the stack trace as it would be if
1.818 + * the currently executing command were to throw an error.
1.819 + *
1.820 + * For commands where it makes sense it refers to the associated
1.821 + * CallFrame as well.
1.822 + *
1.823 + * The structures are chained in a single list, with the top of the
1.824 + * stack anchored in the Interp structure.
1.825 + *
1.826 + * Instances can be allocated on the C stack, or the heap, the former
1.827 + * making cleanup a bit simpler.
1.828 + */
1.829 +
1.830 +typedef struct CmdFrame {
1.831 + /* General data. Always available. */
1.832 +
1.833 + int type; /* Values see below */
1.834 + int level; /* #Frames in stack, prevent O(n) scan of list */
1.835 + int* line; /* Lines the words of the command start on */
1.836 + int nline;
1.837 +
1.838 + CallFrame* framePtr; /* Procedure activation record, may be NULL */
1.839 + struct CmdFrame* nextPtr; /* Link to calling frame */
1.840 +
1.841 + /* Data needed for Eval vs TEBC
1.842 + *
1.843 + * EXECUTION CONTEXTS and usage of CmdFrame
1.844 + *
1.845 + * Field TEBC EvalEx EvalObjEx
1.846 + * ======= ==== ====== =========
1.847 + * level yes yes yes
1.848 + * type BC/PREBC SRC/EVAL EVAL_LIST
1.849 + * line0 yes yes yes
1.850 + * framePtr yes yes yes
1.851 + * ======= ==== ====== =========
1.852 + *
1.853 + * ======= ==== ====== ========= union data
1.854 + * line1 - yes -
1.855 + * line3 - yes -
1.856 + * path - yes -
1.857 + * ------- ---- ------ ---------
1.858 + * codePtr yes - -
1.859 + * pc yes - -
1.860 + * ======= ==== ====== =========
1.861 + *
1.862 + * ======= ==== ====== ========= | union cmd
1.863 + * listPtr - - yes |
1.864 + * ------- ---- ------ --------- |
1.865 + * cmd yes yes - |
1.866 + * cmdlen yes yes - |
1.867 + * ------- ---- ------ --------- |
1.868 + */
1.869 +
1.870 + union {
1.871 + struct {
1.872 + Tcl_Obj* path; /* Path of the sourced file the command
1.873 + * is in. */
1.874 + } eval;
1.875 + struct {
1.876 + CONST void* codePtr; /* Byte code currently executed */
1.877 + CONST char* pc; /* and instruction pointer. */
1.878 + } tebc;
1.879 + } data;
1.880 +
1.881 + union {
1.882 + struct {
1.883 + CONST char* cmd; /* The executed command, if possible */
1.884 + int len; /* And its length */
1.885 + } str;
1.886 + Tcl_Obj* listPtr; /* Tcl_EvalObjEx, cmd list */
1.887 + } cmd;
1.888 +
1.889 +} CmdFrame;
1.890 +
1.891 +/* The following macros define the allowed values for the type field
1.892 + * of the CmdFrame structure above. Some of the values occur only in
1.893 + * the extended location data referenced via the 'baseLocPtr'.
1.894 + *
1.895 + * TCL_LOCATION_EVAL : Frame is for a script evaluated by EvalEx.
1.896 + * TCL_LOCATION_EVAL_LIST : Frame is for a script evaluated by the list
1.897 + * optimization path of EvalObjEx.
1.898 + * TCL_LOCATION_BC : Frame is for bytecode.
1.899 + * TCL_LOCATION_PREBC : Frame is for precompiled bytecode.
1.900 + * TCL_LOCATION_SOURCE : Frame is for a script evaluated by EvalEx,
1.901 + * from a sourced file.
1.902 + * TCL_LOCATION_PROC : Frame is for bytecode of a procedure.
1.903 + *
1.904 + * A TCL_LOCATION_BC type in a frame can be overridden by _SOURCE and
1.905 + * _PROC types, per the context of the byte code in execution.
1.906 + */
1.907 +
1.908 +#define TCL_LOCATION_EVAL (0) /* Location in a dynamic eval script */
1.909 +#define TCL_LOCATION_EVAL_LIST (1) /* Location in a dynamic eval script, list-path */
1.910 +#define TCL_LOCATION_BC (2) /* Location in byte code */
1.911 +#define TCL_LOCATION_PREBC (3) /* Location in precompiled byte code, no location */
1.912 +#define TCL_LOCATION_SOURCE (4) /* Location in a file */
1.913 +#define TCL_LOCATION_PROC (5) /* Location in a dynamic proc */
1.914 +
1.915 +#define TCL_LOCATION_LAST (6) /* Number of values in the enum */
1.916 +#endif
1.917 +
1.918 +/*
1.919 + *----------------------------------------------------------------
1.920 + * Data structures and procedures related to TclHandles, which
1.921 + * are a very lightweight method of preserving enough information
1.922 + * to determine if an arbitrary malloc'd block has been deleted.
1.923 + *----------------------------------------------------------------
1.924 + */
1.925 +
1.926 +typedef VOID **TclHandle;
1.927 +
1.928 +/*
1.929 + *----------------------------------------------------------------
1.930 + * Data structures related to expressions. These are used only in
1.931 + * tclExpr.c.
1.932 + *----------------------------------------------------------------
1.933 + */
1.934 +
1.935 +/*
1.936 + * The data structure below defines a math function (e.g. sin or hypot)
1.937 + * for use in Tcl expressions.
1.938 + */
1.939 +
1.940 +#define MAX_MATH_ARGS 5
1.941 +typedef struct MathFunc {
1.942 + int builtinFuncIndex; /* If this is a builtin math function, its
1.943 + * index in the array of builtin functions.
1.944 + * (tclCompilation.h lists these indices.)
1.945 + * The value is -1 if this is a new function
1.946 + * defined by Tcl_CreateMathFunc. The value
1.947 + * is also -1 if a builtin function is
1.948 + * replaced by a Tcl_CreateMathFunc call. */
1.949 + int numArgs; /* Number of arguments for function. */
1.950 + Tcl_ValueType argTypes[MAX_MATH_ARGS];
1.951 + /* Acceptable types for each argument. */
1.952 + Tcl_MathProc *proc; /* Procedure that implements this function.
1.953 + * NULL if isBuiltinFunc is 1. */
1.954 + ClientData clientData; /* Additional argument to pass to the
1.955 + * function when invoking it. NULL if
1.956 + * isBuiltinFunc is 1. */
1.957 +} MathFunc;
1.958 +
1.959 +/*
1.960 + * These are a thin layer over TclpThreadKeyDataGet and TclpThreadKeyDataSet
1.961 + * when threads are used, or an emulation if there are no threads. These
1.962 + * are really internal and Tcl clients should use Tcl_GetThreadData.
1.963 + */
1.964 +
1.965 +EXTERN VOID *TclThreadDataKeyGet _ANSI_ARGS_((Tcl_ThreadDataKey *keyPtr));
1.966 +EXTERN void TclThreadDataKeySet _ANSI_ARGS_((Tcl_ThreadDataKey *keyPtr, VOID *data));
1.967 +
1.968 +/*
1.969 + * This is a convenience macro used to initialize a thread local storage ptr.
1.970 + */
1.971 +#define TCL_TSD_INIT(keyPtr) (ThreadSpecificData *)Tcl_GetThreadData((keyPtr), sizeof(ThreadSpecificData))
1.972 +
1.973 +
1.974 +/*
1.975 + *----------------------------------------------------------------
1.976 + * Data structures related to bytecode compilation and execution.
1.977 + * These are used primarily in tclCompile.c, tclExecute.c, and
1.978 + * tclBasic.c.
1.979 + *----------------------------------------------------------------
1.980 + */
1.981 +
1.982 +/*
1.983 + * Forward declaration to prevent errors when the forward references to
1.984 + * Tcl_Parse and CompileEnv are encountered in the procedure type
1.985 + * CompileProc declared below.
1.986 + */
1.987 +
1.988 +struct CompileEnv;
1.989 +
1.990 +/*
1.991 + * The type of procedures called by the Tcl bytecode compiler to compile
1.992 + * commands. Pointers to these procedures are kept in the Command structure
1.993 + * describing each command. When a CompileProc returns, the interpreter's
1.994 + * result is set to error information, if any. In addition, the CompileProc
1.995 + * returns an integer value, which is one of the following:
1.996 + *
1.997 + * TCL_OK Compilation completed normally.
1.998 + * TCL_ERROR Compilation failed because of an error;
1.999 + * the interpreter's result describes what went wrong.
1.1000 + * TCL_OUT_LINE_COMPILE Compilation failed because, e.g., the command is
1.1001 + * too complex for effective inline compilation. The
1.1002 + * CompileProc believes the command is legal but
1.1003 + * should be compiled "out of line" by emitting code
1.1004 + * to invoke its command procedure at runtime.
1.1005 + */
1.1006 +
1.1007 +#define TCL_OUT_LINE_COMPILE (TCL_CONTINUE + 1)
1.1008 +
1.1009 +typedef int (CompileProc) _ANSI_ARGS_((Tcl_Interp *interp,
1.1010 + Tcl_Parse *parsePtr, struct CompileEnv *compEnvPtr));
1.1011 +
1.1012 +/*
1.1013 + * The type of procedure called from the compilation hook point in
1.1014 + * SetByteCodeFromAny.
1.1015 + */
1.1016 +
1.1017 +typedef int (CompileHookProc) _ANSI_ARGS_((Tcl_Interp *interp,
1.1018 + struct CompileEnv *compEnvPtr, ClientData clientData));
1.1019 +
1.1020 +/*
1.1021 + * The data structure defining the execution environment for ByteCode's.
1.1022 + * There is one ExecEnv structure per Tcl interpreter. It holds the
1.1023 + * evaluation stack that holds command operands and results. The stack grows
1.1024 + * towards increasing addresses. The "stackTop" member is cached by
1.1025 + * TclExecuteByteCode in a local variable: it must be set before calling
1.1026 + * TclExecuteByteCode and will be restored by TclExecuteByteCode before it
1.1027 + * returns.
1.1028 + */
1.1029 +
1.1030 +typedef struct ExecEnv {
1.1031 + Tcl_Obj **stackPtr; /* Points to the first item in the
1.1032 + * evaluation stack on the heap. */
1.1033 + int stackTop; /* Index of current top of stack; -1 when
1.1034 + * the stack is empty. */
1.1035 + int stackEnd; /* Index of last usable item in stack. */
1.1036 + Tcl_Obj *errorInfo;
1.1037 + Tcl_Obj *errorCode;
1.1038 +} ExecEnv;
1.1039 +
1.1040 +/*
1.1041 + * The definitions for the LiteralTable and LiteralEntry structures. Each
1.1042 + * interpreter contains a LiteralTable. It is used to reduce the storage
1.1043 + * needed for all the Tcl objects that hold the literals of scripts compiled
1.1044 + * by the interpreter. A literal's object is shared by all the ByteCodes
1.1045 + * that refer to the literal. Each distinct literal has one LiteralEntry
1.1046 + * entry in the LiteralTable. A literal table is a specialized hash table
1.1047 + * that is indexed by the literal's string representation, which may contain
1.1048 + * null characters.
1.1049 + *
1.1050 + * Note that we reduce the space needed for literals by sharing literal
1.1051 + * objects both within a ByteCode (each ByteCode contains a local
1.1052 + * LiteralTable) and across all an interpreter's ByteCodes (with the
1.1053 + * interpreter's global LiteralTable).
1.1054 + */
1.1055 +
1.1056 +typedef struct LiteralEntry {
1.1057 + struct LiteralEntry *nextPtr; /* Points to next entry in this
1.1058 + * hash bucket or NULL if end of
1.1059 + * chain. */
1.1060 + Tcl_Obj *objPtr; /* Points to Tcl object that
1.1061 + * holds the literal's bytes and
1.1062 + * length. */
1.1063 + int refCount; /* If in an interpreter's global
1.1064 + * literal table, the number of
1.1065 + * ByteCode structures that share
1.1066 + * the literal object; the literal
1.1067 + * entry can be freed when refCount
1.1068 + * drops to 0. If in a local literal
1.1069 + * table, -1. */
1.1070 +} LiteralEntry;
1.1071 +
1.1072 +typedef struct LiteralTable {
1.1073 + LiteralEntry **buckets; /* Pointer to bucket array. Each
1.1074 + * element points to first entry in
1.1075 + * bucket's hash chain, or NULL. */
1.1076 + LiteralEntry *staticBuckets[TCL_SMALL_HASH_TABLE];
1.1077 + /* Bucket array used for small
1.1078 + * tables to avoid mallocs and
1.1079 + * frees. */
1.1080 + int numBuckets; /* Total number of buckets allocated
1.1081 + * at **buckets. */
1.1082 + int numEntries; /* Total number of entries present
1.1083 + * in table. */
1.1084 + int rebuildSize; /* Enlarge table when numEntries
1.1085 + * gets to be this large. */
1.1086 + int mask; /* Mask value used in hashing
1.1087 + * function. */
1.1088 +} LiteralTable;
1.1089 +
1.1090 +/*
1.1091 + * The following structure defines for each Tcl interpreter various
1.1092 + * statistics-related information about the bytecode compiler and
1.1093 + * interpreter's operation in that interpreter.
1.1094 + */
1.1095 +
1.1096 +#ifdef TCL_COMPILE_STATS
1.1097 +typedef struct ByteCodeStats {
1.1098 + long numExecutions; /* Number of ByteCodes executed. */
1.1099 + long numCompilations; /* Number of ByteCodes created. */
1.1100 + long numByteCodesFreed; /* Number of ByteCodes destroyed. */
1.1101 + long instructionCount[256]; /* Number of times each instruction was
1.1102 + * executed. */
1.1103 +
1.1104 + double totalSrcBytes; /* Total source bytes ever compiled. */
1.1105 + double totalByteCodeBytes; /* Total bytes for all ByteCodes. */
1.1106 + double currentSrcBytes; /* Src bytes for all current ByteCodes. */
1.1107 + double currentByteCodeBytes; /* Code bytes in all current ByteCodes. */
1.1108 +
1.1109 + long srcCount[32]; /* Source size distribution: # of srcs of
1.1110 + * size [2**(n-1)..2**n), n in [0..32). */
1.1111 + long byteCodeCount[32]; /* ByteCode size distribution. */
1.1112 + long lifetimeCount[32]; /* ByteCode lifetime distribution (ms). */
1.1113 +
1.1114 + double currentInstBytes; /* Instruction bytes-current ByteCodes. */
1.1115 + double currentLitBytes; /* Current literal bytes. */
1.1116 + double currentExceptBytes; /* Current exception table bytes. */
1.1117 + double currentAuxBytes; /* Current auxiliary information bytes. */
1.1118 + double currentCmdMapBytes; /* Current src<->code map bytes. */
1.1119 +
1.1120 + long numLiteralsCreated; /* Total literal objects ever compiled. */
1.1121 + double totalLitStringBytes; /* Total string bytes in all literals. */
1.1122 + double currentLitStringBytes; /* String bytes in current literals. */
1.1123 + long literalCount[32]; /* Distribution of literal string sizes. */
1.1124 +} ByteCodeStats;
1.1125 +#endif /* TCL_COMPILE_STATS */
1.1126 +
1.1127 +/*
1.1128 + *----------------------------------------------------------------
1.1129 + * Data structures related to commands.
1.1130 + *----------------------------------------------------------------
1.1131 + */
1.1132 +
1.1133 +/*
1.1134 + * An imported command is created in an namespace when it imports a "real"
1.1135 + * command from another namespace. An imported command has a Command
1.1136 + * structure that points (via its ClientData value) to the "real" Command
1.1137 + * structure in the source namespace's command table. The real command
1.1138 + * records all the imported commands that refer to it in a list of ImportRef
1.1139 + * structures so that they can be deleted when the real command is deleted. */
1.1140 +
1.1141 +typedef struct ImportRef {
1.1142 + struct Command *importedCmdPtr;
1.1143 + /* Points to the imported command created in
1.1144 + * an importing namespace; this command
1.1145 + * redirects its invocations to the "real"
1.1146 + * command. */
1.1147 + struct ImportRef *nextPtr; /* Next element on the linked list of
1.1148 + * imported commands that refer to the
1.1149 + * "real" command. The real command deletes
1.1150 + * these imported commands on this list when
1.1151 + * it is deleted. */
1.1152 +} ImportRef;
1.1153 +
1.1154 +/*
1.1155 + * Data structure used as the ClientData of imported commands: commands
1.1156 + * created in an namespace when it imports a "real" command from another
1.1157 + * namespace.
1.1158 + */
1.1159 +
1.1160 +typedef struct ImportedCmdData {
1.1161 + struct Command *realCmdPtr; /* "Real" command that this imported command
1.1162 + * refers to. */
1.1163 + struct Command *selfPtr; /* Pointer to this imported command. Needed
1.1164 + * only when deleting it in order to remove
1.1165 + * it from the real command's linked list of
1.1166 + * imported commands that refer to it. */
1.1167 +} ImportedCmdData;
1.1168 +
1.1169 +/*
1.1170 + * A Command structure exists for each command in a namespace. The
1.1171 + * Tcl_Command opaque type actually refers to these structures.
1.1172 + */
1.1173 +
1.1174 +typedef struct Command {
1.1175 + Tcl_HashEntry *hPtr; /* Pointer to the hash table entry that
1.1176 + * refers to this command. The hash table is
1.1177 + * either a namespace's command table or an
1.1178 + * interpreter's hidden command table. This
1.1179 + * pointer is used to get a command's name
1.1180 + * from its Tcl_Command handle. NULL means
1.1181 + * that the hash table entry has been
1.1182 + * removed already (this can happen if
1.1183 + * deleteProc causes the command to be
1.1184 + * deleted or recreated). */
1.1185 + Namespace *nsPtr; /* Points to the namespace containing this
1.1186 + * command. */
1.1187 + int refCount; /* 1 if in command hashtable plus 1 for each
1.1188 + * reference from a CmdName Tcl object
1.1189 + * representing a command's name in a
1.1190 + * ByteCode instruction sequence. This
1.1191 + * structure can be freed when refCount
1.1192 + * becomes zero. */
1.1193 + int cmdEpoch; /* Incremented to invalidate any references
1.1194 + * that point to this command when it is
1.1195 + * renamed, deleted, hidden, or exposed. */
1.1196 + CompileProc *compileProc; /* Procedure called to compile command. NULL
1.1197 + * if no compile proc exists for command. */
1.1198 + Tcl_ObjCmdProc *objProc; /* Object-based command procedure. */
1.1199 + ClientData objClientData; /* Arbitrary value passed to object proc. */
1.1200 + Tcl_CmdProc *proc; /* String-based command procedure. */
1.1201 + ClientData clientData; /* Arbitrary value passed to string proc. */
1.1202 + Tcl_CmdDeleteProc *deleteProc;
1.1203 + /* Procedure invoked when deleting command
1.1204 + * to, e.g., free all client data. */
1.1205 + ClientData deleteData; /* Arbitrary value passed to deleteProc. */
1.1206 + int flags; /* Miscellaneous bits of information about
1.1207 + * command. See below for definitions. */
1.1208 + ImportRef *importRefPtr; /* List of each imported Command created in
1.1209 + * another namespace when this command is
1.1210 + * imported. These imported commands
1.1211 + * redirect invocations back to this
1.1212 + * command. The list is used to remove all
1.1213 + * those imported commands when deleting
1.1214 + * this "real" command. */
1.1215 + CommandTrace *tracePtr; /* First in list of all traces set for this
1.1216 + * command. */
1.1217 +} Command;
1.1218 +
1.1219 +/*
1.1220 + * Flag bits for commands.
1.1221 + *
1.1222 + * CMD_IS_DELETED - Means that the command is in the process
1.1223 + * of being deleted (its deleteProc is
1.1224 + * currently executing). Other attempts to
1.1225 + * delete the command should be ignored.
1.1226 + * CMD_TRACE_ACTIVE - 1 means that trace processing is currently
1.1227 + * underway for a rename/delete change.
1.1228 + * See the two flags below for which is
1.1229 + * currently being processed.
1.1230 + * CMD_HAS_EXEC_TRACES - 1 means that this command has at least
1.1231 + * one execution trace (as opposed to simple
1.1232 + * delete/rename traces) in its tracePtr list.
1.1233 + * TCL_TRACE_RENAME - A rename trace is in progress. Further
1.1234 + * recursive renames will not be traced.
1.1235 + * TCL_TRACE_DELETE - A delete trace is in progress. Further
1.1236 + * recursive deletes will not be traced.
1.1237 + * (these last two flags are defined in tcl.h)
1.1238 + */
1.1239 +#define CMD_IS_DELETED 0x1
1.1240 +#define CMD_TRACE_ACTIVE 0x2
1.1241 +#define CMD_HAS_EXEC_TRACES 0x4
1.1242 +
1.1243 +/*
1.1244 + *----------------------------------------------------------------
1.1245 + * Data structures related to name resolution procedures.
1.1246 + *----------------------------------------------------------------
1.1247 + */
1.1248 +
1.1249 +/*
1.1250 + * The interpreter keeps a linked list of name resolution schemes.
1.1251 + * The scheme for a namespace is consulted first, followed by the
1.1252 + * list of schemes in an interpreter, followed by the default
1.1253 + * name resolution in Tcl. Schemes are added/removed from the
1.1254 + * interpreter's list by calling Tcl_AddInterpResolver and
1.1255 + * Tcl_RemoveInterpResolver.
1.1256 + */
1.1257 +
1.1258 +typedef struct ResolverScheme {
1.1259 + char *name; /* Name identifying this scheme. */
1.1260 + Tcl_ResolveCmdProc *cmdResProc;
1.1261 + /* Procedure handling command name
1.1262 + * resolution. */
1.1263 + Tcl_ResolveVarProc *varResProc;
1.1264 + /* Procedure handling variable name
1.1265 + * resolution for variables that
1.1266 + * can only be handled at runtime. */
1.1267 + Tcl_ResolveCompiledVarProc *compiledVarResProc;
1.1268 + /* Procedure handling variable name
1.1269 + * resolution at compile time. */
1.1270 +
1.1271 + struct ResolverScheme *nextPtr;
1.1272 + /* Pointer to next record in linked list. */
1.1273 +} ResolverScheme;
1.1274 +
1.1275 +#ifdef TCL_TIP268
1.1276 +/*
1.1277 + * TIP #268.
1.1278 + * Values for the selection mode, i.e the package require preferences.
1.1279 + */
1.1280 +
1.1281 +enum PkgPreferOptions {
1.1282 + PKG_PREFER_LATEST, PKG_PREFER_STABLE
1.1283 +};
1.1284 +#endif
1.1285 +
1.1286 +/*
1.1287 + *----------------------------------------------------------------
1.1288 + * This structure defines an interpreter, which is a collection of
1.1289 + * commands plus other state information related to interpreting
1.1290 + * commands, such as variable storage. Primary responsibility for
1.1291 + * this data structure is in tclBasic.c, but almost every Tcl
1.1292 + * source file uses something in here.
1.1293 + *----------------------------------------------------------------
1.1294 + */
1.1295 +
1.1296 +typedef struct Interp {
1.1297 +
1.1298 + /*
1.1299 + * Note: the first three fields must match exactly the fields in
1.1300 + * a Tcl_Interp struct (see tcl.h). If you change one, be sure to
1.1301 + * change the other.
1.1302 + *
1.1303 + * The interpreter's result is held in both the string and the
1.1304 + * objResultPtr fields. These fields hold, respectively, the result's
1.1305 + * string or object value. The interpreter's result is always in the
1.1306 + * result field if that is non-empty, otherwise it is in objResultPtr.
1.1307 + * The two fields are kept consistent unless some C code sets
1.1308 + * interp->result directly. Programs should not access result and
1.1309 + * objResultPtr directly; instead, they should always get and set the
1.1310 + * result using procedures such as Tcl_SetObjResult, Tcl_GetObjResult,
1.1311 + * and Tcl_GetStringResult. See the SetResult man page for details.
1.1312 + */
1.1313 +
1.1314 + char *result; /* If the last command returned a string
1.1315 + * result, this points to it. Should not be
1.1316 + * accessed directly; see comment above. */
1.1317 + Tcl_FreeProc *freeProc; /* Zero means a string result is statically
1.1318 + * allocated. TCL_DYNAMIC means string
1.1319 + * result was allocated with ckalloc and
1.1320 + * should be freed with ckfree. Other values
1.1321 + * give address of procedure to invoke to
1.1322 + * free the string result. Tcl_Eval must
1.1323 + * free it before executing next command. */
1.1324 + int errorLine; /* When TCL_ERROR is returned, this gives
1.1325 + * the line number in the command where the
1.1326 + * error occurred (1 means first line). */
1.1327 + struct TclStubs *stubTable;
1.1328 + /* Pointer to the exported Tcl stub table.
1.1329 + * On previous versions of Tcl this is a
1.1330 + * pointer to the objResultPtr or a pointer
1.1331 + * to a buckets array in a hash table. We
1.1332 + * therefore have to do some careful checking
1.1333 + * before we can use this. */
1.1334 +
1.1335 + TclHandle handle; /* Handle used to keep track of when this
1.1336 + * interp is deleted. */
1.1337 +
1.1338 + Namespace *globalNsPtr; /* The interpreter's global namespace. */
1.1339 + Tcl_HashTable *hiddenCmdTablePtr;
1.1340 + /* Hash table used by tclBasic.c to keep
1.1341 + * track of hidden commands on a per-interp
1.1342 + * basis. */
1.1343 + ClientData interpInfo; /* Information used by tclInterp.c to keep
1.1344 + * track of master/slave interps on
1.1345 + * a per-interp basis. */
1.1346 + Tcl_HashTable mathFuncTable;/* Contains all the math functions currently
1.1347 + * defined for the interpreter. Indexed by
1.1348 + * strings (function names); values have
1.1349 + * type (MathFunc *). */
1.1350 +
1.1351 +
1.1352 +
1.1353 + /*
1.1354 + * Information related to procedures and variables. See tclProc.c
1.1355 + * and tclVar.c for usage.
1.1356 + */
1.1357 +
1.1358 + int numLevels; /* Keeps track of how many nested calls to
1.1359 + * Tcl_Eval are in progress for this
1.1360 + * interpreter. It's used to delay deletion
1.1361 + * of the table until all Tcl_Eval
1.1362 + * invocations are completed. */
1.1363 + int maxNestingDepth; /* If numLevels exceeds this value then Tcl
1.1364 + * assumes that infinite recursion has
1.1365 + * occurred and it generates an error. */
1.1366 + CallFrame *framePtr; /* Points to top-most in stack of all nested
1.1367 + * procedure invocations. NULL means there
1.1368 + * are no active procedures. */
1.1369 + CallFrame *varFramePtr; /* Points to the call frame whose variables
1.1370 + * are currently in use (same as framePtr
1.1371 + * unless an "uplevel" command is
1.1372 + * executing). NULL means no procedure is
1.1373 + * active or "uplevel 0" is executing. */
1.1374 + ActiveVarTrace *activeVarTracePtr;
1.1375 + /* First in list of active traces for
1.1376 + * interp, or NULL if no active traces. */
1.1377 + int returnCode; /* Completion code to return if current
1.1378 + * procedure exits with TCL_RETURN code. */
1.1379 + char *errorInfo; /* Value to store in errorInfo if returnCode
1.1380 + * is TCL_ERROR. Malloc'ed, may be NULL */
1.1381 + char *errorCode; /* Value to store in errorCode if returnCode
1.1382 + * is TCL_ERROR. Malloc'ed, may be NULL */
1.1383 +
1.1384 + /*
1.1385 + * Information used by Tcl_AppendResult to keep track of partial
1.1386 + * results. See Tcl_AppendResult code for details.
1.1387 + */
1.1388 +
1.1389 + char *appendResult; /* Storage space for results generated
1.1390 + * by Tcl_AppendResult. Malloc-ed. NULL
1.1391 + * means not yet allocated. */
1.1392 + int appendAvl; /* Total amount of space available at
1.1393 + * partialResult. */
1.1394 + int appendUsed; /* Number of non-null bytes currently
1.1395 + * stored at partialResult. */
1.1396 +
1.1397 + /*
1.1398 + * Information about packages. Used only in tclPkg.c.
1.1399 + */
1.1400 +
1.1401 + Tcl_HashTable packageTable; /* Describes all of the packages loaded
1.1402 + * in or available to this interpreter.
1.1403 + * Keys are package names, values are
1.1404 + * (Package *) pointers. */
1.1405 + char *packageUnknown; /* Command to invoke during "package
1.1406 + * require" commands for packages that
1.1407 + * aren't described in packageTable.
1.1408 + * Malloc'ed, may be NULL. */
1.1409 +
1.1410 + /*
1.1411 + * Miscellaneous information:
1.1412 + */
1.1413 +
1.1414 + int cmdCount; /* Total number of times a command procedure
1.1415 + * has been called for this interpreter. */
1.1416 + int evalFlags; /* Flags to control next call to Tcl_Eval.
1.1417 + * Normally zero, but may be set before
1.1418 + * calling Tcl_Eval. See below for valid
1.1419 + * values. */
1.1420 + int termOffset; /* Offset of character just after last one
1.1421 + * compiled or executed by Tcl_EvalObj. */
1.1422 + LiteralTable literalTable; /* Contains LiteralEntry's describing all
1.1423 + * Tcl objects holding literals of scripts
1.1424 + * compiled by the interpreter. Indexed by
1.1425 + * the string representations of literals.
1.1426 + * Used to avoid creating duplicate
1.1427 + * objects. */
1.1428 + int compileEpoch; /* Holds the current "compilation epoch"
1.1429 + * for this interpreter. This is
1.1430 + * incremented to invalidate existing
1.1431 + * ByteCodes when, e.g., a command with a
1.1432 + * compile procedure is redefined. */
1.1433 + Proc *compiledProcPtr; /* If a procedure is being compiled, a
1.1434 + * pointer to its Proc structure; otherwise,
1.1435 + * this is NULL. Set by ObjInterpProc in
1.1436 + * tclProc.c and used by tclCompile.c to
1.1437 + * process local variables appropriately. */
1.1438 + ResolverScheme *resolverPtr;
1.1439 + /* Linked list of name resolution schemes
1.1440 + * added to this interpreter. Schemes
1.1441 + * are added/removed by calling
1.1442 + * Tcl_AddInterpResolvers and
1.1443 + * Tcl_RemoveInterpResolver. */
1.1444 + Tcl_Obj *scriptFile; /* NULL means there is no nested source
1.1445 + * command active; otherwise this points to
1.1446 + * pathPtr of the file being sourced. */
1.1447 + int flags; /* Various flag bits. See below. */
1.1448 + long randSeed; /* Seed used for rand() function. */
1.1449 + Trace *tracePtr; /* List of traces for this interpreter. */
1.1450 + Tcl_HashTable *assocData; /* Hash table for associating data with
1.1451 + * this interpreter. Cleaned up when
1.1452 + * this interpreter is deleted. */
1.1453 + struct ExecEnv *execEnvPtr; /* Execution environment for Tcl bytecode
1.1454 + * execution. Contains a pointer to the
1.1455 + * Tcl evaluation stack. */
1.1456 + Tcl_Obj *emptyObjPtr; /* Points to an object holding an empty
1.1457 + * string. Returned by Tcl_ObjSetVar2 when
1.1458 + * variable traces change a variable in a
1.1459 + * gross way. */
1.1460 + char resultSpace[TCL_RESULT_SIZE+1];
1.1461 + /* Static space holding small results. */
1.1462 + Tcl_Obj *objResultPtr; /* If the last command returned an object
1.1463 + * result, this points to it. Should not be
1.1464 + * accessed directly; see comment above. */
1.1465 + Tcl_ThreadId threadId; /* ID of thread that owns the interpreter */
1.1466 +
1.1467 + ActiveCommandTrace *activeCmdTracePtr;
1.1468 + /* First in list of active command traces for
1.1469 + * interp, or NULL if no active traces. */
1.1470 + ActiveInterpTrace *activeInterpTracePtr;
1.1471 + /* First in list of active traces for
1.1472 + * interp, or NULL if no active traces. */
1.1473 +
1.1474 + int tracesForbiddingInline; /* Count of traces (in the list headed by
1.1475 + * tracePtr) that forbid inline bytecode
1.1476 + * compilation */
1.1477 +#ifdef TCL_TIP280
1.1478 + /* TIP #280 */
1.1479 + CmdFrame* cmdFramePtr; /* Points to the command frame containing
1.1480 + * the location information for the current
1.1481 + * command. */
1.1482 + CONST CmdFrame* invokeCmdFramePtr; /* Points to the command frame which is the
1.1483 + * invoking context of the bytecode compiler.
1.1484 + * NULL when the byte code compiler is not
1.1485 + * active */
1.1486 + int invokeWord; /* Index of the word in the command which
1.1487 + * is getting compiled. */
1.1488 + Tcl_HashTable* linePBodyPtr;
1.1489 + /* This table remembers for each
1.1490 + * statically defined procedure the
1.1491 + * location information for its
1.1492 + * body. It is keyed by the address of
1.1493 + * the Proc structure for a procedure.
1.1494 + */
1.1495 + Tcl_HashTable* lineBCPtr;
1.1496 + /* This table remembers for each
1.1497 + * ByteCode object the location
1.1498 + * information for its body. It is
1.1499 + * keyed by the address of the Proc
1.1500 + * structure for a procedure.
1.1501 + */
1.1502 +#endif
1.1503 +#ifdef TCL_TIP268
1.1504 + /*
1.1505 + * TIP #268.
1.1506 + * The currently active selection mode,
1.1507 + * i.e the package require preferences.
1.1508 + */
1.1509 +
1.1510 + int packagePrefer; /* Current package selection mode. */
1.1511 +#endif
1.1512 + /*
1.1513 + * Statistical information about the bytecode compiler and interpreter's
1.1514 + * operation.
1.1515 + */
1.1516 +
1.1517 +#ifdef TCL_COMPILE_STATS
1.1518 + ByteCodeStats stats; /* Holds compilation and execution
1.1519 + * statistics for this interpreter. */
1.1520 +#endif /* TCL_COMPILE_STATS */
1.1521 +} Interp;
1.1522 +
1.1523 +/*
1.1524 + * EvalFlag bits for Interp structures:
1.1525 + *
1.1526 + * TCL_BRACKET_TERM 1 means that the current script is terminated by
1.1527 + * a close bracket rather than the end of the string.
1.1528 + * TCL_ALLOW_EXCEPTIONS 1 means it's OK for the script to terminate with
1.1529 + * a code other than TCL_OK or TCL_ERROR; 0 means
1.1530 + * codes other than these should be turned into errors.
1.1531 + */
1.1532 +
1.1533 +#define TCL_BRACKET_TERM 1
1.1534 +#define TCL_ALLOW_EXCEPTIONS 4
1.1535 +#ifdef TCL_TIP280
1.1536 +#define TCL_EVAL_FILE 2
1.1537 +#define TCL_EVAL_CTX 8
1.1538 +#endif
1.1539 +
1.1540 +/*
1.1541 + * Flag bits for Interp structures:
1.1542 + *
1.1543 + * DELETED: Non-zero means the interpreter has been deleted:
1.1544 + * don't process any more commands for it, and destroy
1.1545 + * the structure as soon as all nested invocations of
1.1546 + * Tcl_Eval are done.
1.1547 + * ERR_IN_PROGRESS: Non-zero means an error unwind is already in
1.1548 + * progress. Zero means a command proc has been
1.1549 + * invoked since last error occured.
1.1550 + * ERR_ALREADY_LOGGED: Non-zero means information has already been logged
1.1551 + * in $errorInfo for the current Tcl_Eval instance,
1.1552 + * so Tcl_Eval needn't log it (used to implement the
1.1553 + * "error message log" command).
1.1554 + * ERROR_CODE_SET: Non-zero means that Tcl_SetErrorCode has been
1.1555 + * called to record information for the current
1.1556 + * error. Zero means Tcl_Eval must clear the
1.1557 + * errorCode variable if an error is returned.
1.1558 + * EXPR_INITIALIZED: Non-zero means initialization specific to
1.1559 + * expressions has been carried out.
1.1560 + * DONT_COMPILE_CMDS_INLINE: Non-zero means that the bytecode compiler
1.1561 + * should not compile any commands into an inline
1.1562 + * sequence of instructions. This is set 1, for
1.1563 + * example, when command traces are requested.
1.1564 + * RAND_SEED_INITIALIZED: Non-zero means that the randSeed value of the
1.1565 + * interp has not be initialized. This is set 1
1.1566 + * when we first use the rand() or srand() functions.
1.1567 + * SAFE_INTERP: Non zero means that the current interp is a
1.1568 + * safe interp (ie it has only the safe commands
1.1569 + * installed, less priviledge than a regular interp).
1.1570 + * USE_EVAL_DIRECT: Non-zero means don't use the compiler or byte-code
1.1571 + * interpreter; instead, have Tcl_EvalObj call
1.1572 + * Tcl_EvalEx. Used primarily for testing the
1.1573 + * new parser.
1.1574 + * INTERP_TRACE_IN_PROGRESS: Non-zero means that an interp trace is currently
1.1575 + * active; so no further trace callbacks should be
1.1576 + * invoked.
1.1577 + */
1.1578 +
1.1579 +#define DELETED 1
1.1580 +#define ERR_IN_PROGRESS 2
1.1581 +#define ERR_ALREADY_LOGGED 4
1.1582 +#define ERROR_CODE_SET 8
1.1583 +#define EXPR_INITIALIZED 0x10
1.1584 +#define DONT_COMPILE_CMDS_INLINE 0x20
1.1585 +#define RAND_SEED_INITIALIZED 0x40
1.1586 +#define SAFE_INTERP 0x80
1.1587 +#define USE_EVAL_DIRECT 0x100
1.1588 +#define INTERP_TRACE_IN_PROGRESS 0x200
1.1589 +
1.1590 +/*
1.1591 + * Maximum number of levels of nesting permitted in Tcl commands (used
1.1592 + * to catch infinite recursion).
1.1593 + */
1.1594 +
1.1595 +#define MAX_NESTING_DEPTH 1000
1.1596 +
1.1597 +/*
1.1598 + * The macro below is used to modify a "char" value (e.g. by casting
1.1599 + * it to an unsigned character) so that it can be used safely with
1.1600 + * macros such as isspace.
1.1601 + */
1.1602 +
1.1603 +#define UCHAR(c) ((unsigned char) (c))
1.1604 +
1.1605 +/*
1.1606 + * This macro is used to determine the offset needed to safely allocate any
1.1607 + * data structure in memory. Given a starting offset or size, it "rounds up"
1.1608 + * or "aligns" the offset to the next 8-byte boundary so that any data
1.1609 + * structure can be placed at the resulting offset without fear of an
1.1610 + * alignment error.
1.1611 + *
1.1612 + * WARNING!! DO NOT USE THIS MACRO TO ALIGN POINTERS: it will produce
1.1613 + * the wrong result on platforms that allocate addresses that are divisible
1.1614 + * by 4 or 2. Only use it for offsets or sizes.
1.1615 + */
1.1616 +
1.1617 +#define TCL_ALIGN(x) (((int)(x) + 7) & ~7)
1.1618 +
1.1619 +/*
1.1620 + * The following enum values are used to specify the runtime platform
1.1621 + * setting of the tclPlatform variable.
1.1622 + */
1.1623 +
1.1624 +typedef enum {
1.1625 + TCL_PLATFORM_UNIX, /* Any Unix-like OS. */
1.1626 + TCL_PLATFORM_MAC, /* MacOS. */
1.1627 + TCL_PLATFORM_WINDOWS /* Any Microsoft Windows OS. */
1.1628 +} TclPlatformType;
1.1629 +
1.1630 +/*
1.1631 + * The following enum values are used to indicate the translation
1.1632 + * of a Tcl channel. Declared here so that each platform can define
1.1633 + * TCL_PLATFORM_TRANSLATION to the native translation on that platform
1.1634 + */
1.1635 +
1.1636 +typedef enum TclEolTranslation {
1.1637 + TCL_TRANSLATE_AUTO, /* Eol == \r, \n and \r\n. */
1.1638 + TCL_TRANSLATE_CR, /* Eol == \r. */
1.1639 + TCL_TRANSLATE_LF, /* Eol == \n. */
1.1640 + TCL_TRANSLATE_CRLF /* Eol == \r\n. */
1.1641 +} TclEolTranslation;
1.1642 +
1.1643 +/*
1.1644 + * Flags for TclInvoke:
1.1645 + *
1.1646 + * TCL_INVOKE_HIDDEN Invoke a hidden command; if not set,
1.1647 + * invokes an exposed command.
1.1648 + * TCL_INVOKE_NO_UNKNOWN If set, "unknown" is not invoked if
1.1649 + * the command to be invoked is not found.
1.1650 + * Only has an effect if invoking an exposed
1.1651 + * command, i.e. if TCL_INVOKE_HIDDEN is not
1.1652 + * also set.
1.1653 + * TCL_INVOKE_NO_TRACEBACK Does not record traceback information if
1.1654 + * the invoked command returns an error. Used
1.1655 + * if the caller plans on recording its own
1.1656 + * traceback information.
1.1657 + */
1.1658 +
1.1659 +#define TCL_INVOKE_HIDDEN (1<<0)
1.1660 +#define TCL_INVOKE_NO_UNKNOWN (1<<1)
1.1661 +#define TCL_INVOKE_NO_TRACEBACK (1<<2)
1.1662 +
1.1663 +/*
1.1664 + * The structure used as the internal representation of Tcl list
1.1665 + * objects. This is an array of pointers to the element objects. This array
1.1666 + * is grown (reallocated and copied) as necessary to hold all the list's
1.1667 + * element pointers. The array might contain more slots than currently used
1.1668 + * to hold all element pointers. This is done to make append operations
1.1669 + * faster.
1.1670 + */
1.1671 +
1.1672 +typedef struct List {
1.1673 + int maxElemCount; /* Total number of element array slots. */
1.1674 + int elemCount; /* Current number of list elements. */
1.1675 + Tcl_Obj **elements; /* Array of pointers to element objects. */
1.1676 +} List;
1.1677 +
1.1678 +
1.1679 +/*
1.1680 + * The following types are used for getting and storing platform-specific
1.1681 + * file attributes in tclFCmd.c and the various platform-versions of
1.1682 + * that file. This is done to have as much common code as possible
1.1683 + * in the file attributes code. For more information about the callbacks,
1.1684 + * see TclFileAttrsCmd in tclFCmd.c.
1.1685 + */
1.1686 +
1.1687 +typedef int (TclGetFileAttrProc) _ANSI_ARGS_((Tcl_Interp *interp,
1.1688 + int objIndex, Tcl_Obj *fileName, Tcl_Obj **attrObjPtrPtr));
1.1689 +typedef int (TclSetFileAttrProc) _ANSI_ARGS_((Tcl_Interp *interp,
1.1690 + int objIndex, Tcl_Obj *fileName, Tcl_Obj *attrObjPtr));
1.1691 +
1.1692 +typedef struct TclFileAttrProcs {
1.1693 + TclGetFileAttrProc *getProc; /* The procedure for getting attrs. */
1.1694 + TclSetFileAttrProc *setProc; /* The procedure for setting attrs. */
1.1695 +} TclFileAttrProcs;
1.1696 +
1.1697 +/*
1.1698 + * Opaque handle used in pipeline routines to encapsulate platform-dependent
1.1699 + * state.
1.1700 + */
1.1701 +
1.1702 +typedef struct TclFile_ *TclFile;
1.1703 +
1.1704 +/*
1.1705 + * Opaque names for platform specific types.
1.1706 + */
1.1707 +
1.1708 +typedef struct TclpTime_t_ *TclpTime_t;
1.1709 +typedef struct TclpTime_t_ *CONST TclpTime_t_CONST;
1.1710 +
1.1711 +/*
1.1712 + * The "globParameters" argument of the function TclGlob is an
1.1713 + * or'ed combination of the following values:
1.1714 + */
1.1715 +
1.1716 +#define TCL_GLOBMODE_NO_COMPLAIN 1
1.1717 +#define TCL_GLOBMODE_JOIN 2
1.1718 +#define TCL_GLOBMODE_DIR 4
1.1719 +#define TCL_GLOBMODE_TAILS 8
1.1720 +
1.1721 +/*
1.1722 + *----------------------------------------------------------------
1.1723 + * Data structures related to obsolete filesystem hooks
1.1724 + *----------------------------------------------------------------
1.1725 + */
1.1726 +
1.1727 +typedef int (TclStatProc_) _ANSI_ARGS_((CONST char *path, struct stat *buf));
1.1728 +typedef int (TclAccessProc_) _ANSI_ARGS_((CONST char *path, int mode));
1.1729 +typedef Tcl_Channel (TclOpenFileChannelProc_) _ANSI_ARGS_((Tcl_Interp *interp,
1.1730 + CONST char *fileName, CONST char *modeString,
1.1731 + int permissions));
1.1732 +
1.1733 +
1.1734 +/*
1.1735 + *----------------------------------------------------------------
1.1736 + * Data structures related to procedures
1.1737 + *----------------------------------------------------------------
1.1738 + */
1.1739 +
1.1740 +typedef Tcl_CmdProc *TclCmdProcType;
1.1741 +typedef Tcl_ObjCmdProc *TclObjCmdProcType;
1.1742 +
1.1743 +/*
1.1744 + *----------------------------------------------------------------
1.1745 + * Variables shared among Tcl modules but not used by the outside world.
1.1746 + *----------------------------------------------------------------
1.1747 + */
1.1748 +
1.1749 +extern Tcl_Time tclBlockTime;
1.1750 +extern int tclBlockTimeSet;
1.1751 +extern char * tclExecutableName;
1.1752 +extern char * tclNativeExecutableName;
1.1753 +extern char * tclDefaultEncodingDir;
1.1754 +extern Tcl_ChannelType tclFileChannelType;
1.1755 +extern char * tclMemDumpFileName;
1.1756 +extern TclPlatformType tclPlatform;
1.1757 +extern Tcl_NotifierProcs tclOriginalNotifier;
1.1758 +
1.1759 +/*
1.1760 + * Variables denoting the Tcl object types defined in the core.
1.1761 + */
1.1762 +
1.1763 +extern Tcl_ObjType tclBooleanType;
1.1764 +extern Tcl_ObjType tclByteArrayType;
1.1765 +extern Tcl_ObjType tclByteCodeType;
1.1766 +extern Tcl_ObjType tclDoubleType;
1.1767 +extern Tcl_ObjType tclEndOffsetType;
1.1768 +extern Tcl_ObjType tclIntType;
1.1769 +extern Tcl_ObjType tclListType;
1.1770 +extern Tcl_ObjType tclProcBodyType;
1.1771 +extern Tcl_ObjType tclStringType;
1.1772 +extern Tcl_ObjType tclArraySearchType;
1.1773 +extern Tcl_ObjType tclIndexType;
1.1774 +extern Tcl_ObjType tclNsNameType;
1.1775 +extern Tcl_ObjType tclWideIntType;
1.1776 +
1.1777 +/*
1.1778 + * Variables denoting the hash key types defined in the core.
1.1779 + */
1.1780 +
1.1781 +extern Tcl_HashKeyType tclArrayHashKeyType;
1.1782 +extern Tcl_HashKeyType tclOneWordHashKeyType;
1.1783 +extern Tcl_HashKeyType tclStringHashKeyType;
1.1784 +extern Tcl_HashKeyType tclObjHashKeyType;
1.1785 +
1.1786 +/*
1.1787 + * The head of the list of free Tcl objects, and the total number of Tcl
1.1788 + * objects ever allocated and freed.
1.1789 + */
1.1790 +
1.1791 +extern Tcl_Obj * tclFreeObjList;
1.1792 +
1.1793 +#ifdef TCL_COMPILE_STATS
1.1794 +extern long tclObjsAlloced;
1.1795 +extern long tclObjsFreed;
1.1796 +#define TCL_MAX_SHARED_OBJ_STATS 5
1.1797 +extern long tclObjsShared[TCL_MAX_SHARED_OBJ_STATS];
1.1798 +#endif /* TCL_COMPILE_STATS */
1.1799 +
1.1800 +/*
1.1801 + * Pointer to a heap-allocated string of length zero that the Tcl core uses
1.1802 + * as the value of an empty string representation for an object. This value
1.1803 + * is shared by all new objects allocated by Tcl_NewObj.
1.1804 + */
1.1805 +
1.1806 +extern char * tclEmptyStringRep;
1.1807 +extern char tclEmptyString;
1.1808 +
1.1809 +/*
1.1810 + *----------------------------------------------------------------
1.1811 + * Procedures shared among Tcl modules but not used by the outside
1.1812 + * world:
1.1813 + *----------------------------------------------------------------
1.1814 + */
1.1815 +
1.1816 +#ifdef TCL_TIP280
1.1817 +EXTERN void TclAdvanceLines _ANSI_ARGS_((int* line, CONST char* start,
1.1818 + CONST char* end));
1.1819 +#endif
1.1820 +EXTERN int TclArraySet _ANSI_ARGS_((Tcl_Interp *interp,
1.1821 + Tcl_Obj *arrayNameObj, Tcl_Obj *arrayElemObj));
1.1822 +EXTERN int TclCheckBadOctal _ANSI_ARGS_((Tcl_Interp *interp,
1.1823 + CONST char *value));
1.1824 +EXTERN void TclDeleteNamespaceVars _ANSI_ARGS_((Namespace *nsPtr));
1.1825 +
1.1826 +#ifdef TCL_TIP280
1.1827 +EXTERN int TclEvalObjEx _ANSI_ARGS_((Tcl_Interp *interp,
1.1828 + register Tcl_Obj *objPtr,
1.1829 + int flags,
1.1830 + CONST CmdFrame* invoker,
1.1831 + int word));
1.1832 +#endif
1.1833 +
1.1834 +EXTERN void TclExpandTokenArray _ANSI_ARGS_((
1.1835 + Tcl_Parse *parsePtr));
1.1836 +EXTERN int TclFileAttrsCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.1837 + int objc, Tcl_Obj *CONST objv[]));
1.1838 +EXTERN int TclFileCopyCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.1839 + int objc, Tcl_Obj *CONST objv[])) ;
1.1840 +EXTERN int TclFileDeleteCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.1841 + int objc, Tcl_Obj *CONST objv[]));
1.1842 +EXTERN int TclFileMakeDirsCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.1843 + int objc, Tcl_Obj *CONST objv[])) ;
1.1844 +EXTERN int TclFileRenameCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.1845 + int objc, Tcl_Obj *CONST objv[])) ;
1.1846 +EXTERN void TclFinalizeAllocSubsystem _ANSI_ARGS_((void));
1.1847 +EXTERN void TclFinalizeAsync _ANSI_ARGS_((void));
1.1848 +EXTERN void TclFinalizeCompilation _ANSI_ARGS_((void));
1.1849 +EXTERN void TclFinalizeEncodingSubsystem _ANSI_ARGS_((void));
1.1850 +EXTERN void TclFinalizeEnvironment _ANSI_ARGS_((void));
1.1851 +EXTERN void TclFinalizeExecution _ANSI_ARGS_((void));
1.1852 +EXTERN void TclFinalizeIOSubsystem _ANSI_ARGS_((void));
1.1853 +EXTERN void TclFinalizeFilesystem _ANSI_ARGS_((void));
1.1854 +EXTERN void TclResetFilesystem _ANSI_ARGS_((void));
1.1855 +EXTERN void TclFinalizeLoad _ANSI_ARGS_((void));
1.1856 +EXTERN void TclFinalizeLock _ANSI_ARGS_((void));
1.1857 +EXTERN void TclFinalizeMemorySubsystem _ANSI_ARGS_((void));
1.1858 +EXTERN void TclFinalizeNotifier _ANSI_ARGS_((void));
1.1859 +EXTERN void TclFinalizeObjects _ANSI_ARGS_((void));
1.1860 +EXTERN void TclFinalizePreserve _ANSI_ARGS_((void));
1.1861 +EXTERN void TclFinalizeSynchronization _ANSI_ARGS_((void));
1.1862 +EXTERN void TclFinalizeThreadAlloc _ANSI_ARGS_((void));
1.1863 +EXTERN void TclFinalizeThreadData _ANSI_ARGS_((void));
1.1864 +EXTERN int TclGetEncodingFromObj _ANSI_ARGS_((Tcl_Interp *interp,
1.1865 + Tcl_Obj *objPtr, Tcl_Encoding *encodingPtr));
1.1866 +#ifdef TCL_TIP280
1.1867 +EXTERN void TclGetSrcInfoForPc _ANSI_ARGS_((CmdFrame* cfPtr));
1.1868 +#endif
1.1869 +EXTERN int TclGlob _ANSI_ARGS_((Tcl_Interp *interp,
1.1870 + char *pattern, Tcl_Obj *unquotedPrefix,
1.1871 + int globFlags, Tcl_GlobTypeData* types));
1.1872 +EXTERN void TclInitAlloc _ANSI_ARGS_((void));
1.1873 +EXTERN void TclInitDbCkalloc _ANSI_ARGS_((void));
1.1874 +EXTERN void TclInitEncodingSubsystem _ANSI_ARGS_((void));
1.1875 +EXTERN void TclInitIOSubsystem _ANSI_ARGS_((void));
1.1876 +EXTERN void TclInitNamespaceSubsystem _ANSI_ARGS_((void));
1.1877 +EXTERN void TclInitNotifier _ANSI_ARGS_((void));
1.1878 +EXTERN void TclInitObjSubsystem _ANSI_ARGS_((void));
1.1879 +EXTERN void TclInitSubsystems _ANSI_ARGS_((CONST char *argv0));
1.1880 +EXTERN int TclIsLocalScalar _ANSI_ARGS_((CONST char *src,
1.1881 + int len));
1.1882 +EXTERN int TclJoinThread _ANSI_ARGS_((Tcl_ThreadId id,
1.1883 + int* result));
1.1884 +EXTERN Tcl_Obj * TclLindexList _ANSI_ARGS_((Tcl_Interp* interp,
1.1885 + Tcl_Obj* listPtr,
1.1886 + Tcl_Obj* argPtr ));
1.1887 +EXTERN Tcl_Obj * TclLindexFlat _ANSI_ARGS_((Tcl_Interp* interp,
1.1888 + Tcl_Obj* listPtr,
1.1889 + int indexCount,
1.1890 + Tcl_Obj *CONST indexArray[]
1.1891 + ));
1.1892 +EXTERN Tcl_Obj * TclLsetList _ANSI_ARGS_((Tcl_Interp* interp,
1.1893 + Tcl_Obj* listPtr,
1.1894 + Tcl_Obj* indexPtr,
1.1895 + Tcl_Obj* valuePtr
1.1896 + ));
1.1897 +EXTERN Tcl_Obj * TclLsetFlat _ANSI_ARGS_((Tcl_Interp* interp,
1.1898 + Tcl_Obj* listPtr,
1.1899 + int indexCount,
1.1900 + Tcl_Obj *CONST indexArray[],
1.1901 + Tcl_Obj* valuePtr
1.1902 + ));
1.1903 +EXTERN int TclParseBackslash _ANSI_ARGS_((CONST char *src,
1.1904 + int numBytes, int *readPtr, char *dst));
1.1905 +EXTERN int TclParseHex _ANSI_ARGS_((CONST char *src, int numBytes,
1.1906 + Tcl_UniChar *resultPtr));
1.1907 +EXTERN int TclParseInteger _ANSI_ARGS_((CONST char *string,
1.1908 + int numBytes));
1.1909 +EXTERN int TclParseWhiteSpace _ANSI_ARGS_((CONST char *src,
1.1910 + int numBytes, Tcl_Parse *parsePtr, char *typePtr));
1.1911 +#ifdef TCL_TIP280
1.1912 +EXTERN int TclWordKnownAtCompileTime _ANSI_ARGS_((Tcl_Token* token));
1.1913 +#endif
1.1914 +EXTERN int TclpObjAccess _ANSI_ARGS_((Tcl_Obj *filename,
1.1915 + int mode));
1.1916 +EXTERN int TclpObjLstat _ANSI_ARGS_((Tcl_Obj *pathPtr,
1.1917 + Tcl_StatBuf *buf));
1.1918 +EXTERN int TclpCheckStackSpace _ANSI_ARGS_((void));
1.1919 +EXTERN Tcl_Obj* TclpTempFileName _ANSI_ARGS_((void));
1.1920 +EXTERN Tcl_Obj* TclNewFSPathObj _ANSI_ARGS_((Tcl_Obj *dirPtr,
1.1921 + CONST char *addStrRep, int len));
1.1922 +EXTERN int TclpDeleteFile _ANSI_ARGS_((CONST char *path));
1.1923 +EXTERN void TclpFinalizeCondition _ANSI_ARGS_((
1.1924 + Tcl_Condition *condPtr));
1.1925 +EXTERN void TclpFinalizeMutex _ANSI_ARGS_((Tcl_Mutex *mutexPtr));
1.1926 +EXTERN void TclpFinalizePipes _ANSI_ARGS_((void));
1.1927 +EXTERN void TclpFinalizeSockets _ANSI_ARGS_((void));
1.1928 +EXTERN void TclpFinalizeThreadData _ANSI_ARGS_((
1.1929 + Tcl_ThreadDataKey *keyPtr));
1.1930 +EXTERN void TclpFinalizeThreadDataKey _ANSI_ARGS_((
1.1931 + Tcl_ThreadDataKey *keyPtr));
1.1932 +EXTERN char * TclpFindExecutable _ANSI_ARGS_((
1.1933 + CONST char *argv0));
1.1934 +EXTERN int TclpFindVariable _ANSI_ARGS_((CONST char *name,
1.1935 + int *lengthPtr));
1.1936 +EXTERN int TclpInitLibraryPath _ANSI_ARGS_((CONST char *argv0));
1.1937 +EXTERN void TclpInitLock _ANSI_ARGS_((void));
1.1938 +EXTERN void TclpInitPlatform _ANSI_ARGS_((void));
1.1939 +EXTERN void TclpInitUnlock _ANSI_ARGS_((void));
1.1940 +EXTERN int TclpLoadFile _ANSI_ARGS_((Tcl_Interp *interp,
1.1941 + Tcl_Obj *pathPtr,
1.1942 + CONST char *sym1, CONST char *sym2,
1.1943 + Tcl_PackageInitProc **proc1Ptr,
1.1944 + Tcl_PackageInitProc **proc2Ptr,
1.1945 + ClientData *clientDataPtr,
1.1946 + Tcl_FSUnloadFileProc **unloadProcPtr));
1.1947 +EXTERN Tcl_Obj* TclpObjListVolumes _ANSI_ARGS_((void));
1.1948 +EXTERN void TclpMasterLock _ANSI_ARGS_((void));
1.1949 +EXTERN void TclpMasterUnlock _ANSI_ARGS_((void));
1.1950 +EXTERN int TclpMatchFiles _ANSI_ARGS_((Tcl_Interp *interp,
1.1951 + char *separators, Tcl_DString *dirPtr,
1.1952 + char *pattern, char *tail));
1.1953 +EXTERN int TclpObjNormalizePath _ANSI_ARGS_((Tcl_Interp *interp,
1.1954 + Tcl_Obj *pathPtr, int nextCheckpoint));
1.1955 +EXTERN int TclpObjCreateDirectory _ANSI_ARGS_((Tcl_Obj *pathPtr));
1.1956 +EXTERN void TclpNativeJoinPath _ANSI_ARGS_((Tcl_Obj *prefix,
1.1957 + char *joining));
1.1958 +EXTERN Tcl_Obj* TclpNativeSplitPath _ANSI_ARGS_((Tcl_Obj *pathPtr,
1.1959 + int *lenPtr));
1.1960 +EXTERN Tcl_PathType TclpGetNativePathType _ANSI_ARGS_((Tcl_Obj *pathObjPtr,
1.1961 + int *driveNameLengthPtr, Tcl_Obj **driveNameRef));
1.1962 +EXTERN int TclCrossFilesystemCopy _ANSI_ARGS_((Tcl_Interp *interp,
1.1963 + Tcl_Obj *source, Tcl_Obj *target));
1.1964 +EXTERN int TclpObjDeleteFile _ANSI_ARGS_((Tcl_Obj *pathPtr));
1.1965 +EXTERN int TclpObjCopyDirectory _ANSI_ARGS_((Tcl_Obj *srcPathPtr,
1.1966 + Tcl_Obj *destPathPtr, Tcl_Obj **errorPtr));
1.1967 +EXTERN int TclpObjCopyFile _ANSI_ARGS_((Tcl_Obj *srcPathPtr,
1.1968 + Tcl_Obj *destPathPtr));
1.1969 +EXTERN int TclpObjRemoveDirectory _ANSI_ARGS_((Tcl_Obj *pathPtr,
1.1970 + int recursive, Tcl_Obj **errorPtr));
1.1971 +EXTERN int TclpObjRenameFile _ANSI_ARGS_((Tcl_Obj *srcPathPtr,
1.1972 + Tcl_Obj *destPathPtr));
1.1973 +EXTERN int TclpMatchInDirectory _ANSI_ARGS_((Tcl_Interp *interp,
1.1974 + Tcl_Obj *resultPtr, Tcl_Obj *pathPtr,
1.1975 + CONST char *pattern, Tcl_GlobTypeData *types));
1.1976 +EXTERN Tcl_Obj* TclpObjGetCwd _ANSI_ARGS_((Tcl_Interp *interp));
1.1977 +EXTERN Tcl_FSDupInternalRepProc TclNativeDupInternalRep;
1.1978 +EXTERN Tcl_Obj* TclpObjLink _ANSI_ARGS_((Tcl_Obj *pathPtr,
1.1979 + Tcl_Obj *toPtr, int linkType));
1.1980 +EXTERN int TclpObjChdir _ANSI_ARGS_((Tcl_Obj *pathPtr));
1.1981 +EXTERN Tcl_Obj* TclFileDirname _ANSI_ARGS_((Tcl_Interp *interp,
1.1982 + Tcl_Obj*pathPtr));
1.1983 +EXTERN int TclpObjStat _ANSI_ARGS_((Tcl_Obj *pathPtr, Tcl_StatBuf *buf));
1.1984 +EXTERN Tcl_Channel TclpOpenFileChannel _ANSI_ARGS_((Tcl_Interp *interp,
1.1985 + Tcl_Obj *pathPtr, int mode,
1.1986 + int permissions));
1.1987 +EXTERN void TclpPanic _ANSI_ARGS_(TCL_VARARGS(CONST char *,
1.1988 + format));
1.1989 +EXTERN char * TclpReadlink _ANSI_ARGS_((CONST char *fileName,
1.1990 + Tcl_DString *linkPtr));
1.1991 +EXTERN void TclpReleaseFile _ANSI_ARGS_((TclFile file));
1.1992 +EXTERN void TclpSetVariables _ANSI_ARGS_((Tcl_Interp *interp));
1.1993 +EXTERN void TclpUnloadFile _ANSI_ARGS_((Tcl_LoadHandle loadHandle));
1.1994 +EXTERN VOID * TclpThreadDataKeyGet _ANSI_ARGS_((
1.1995 + Tcl_ThreadDataKey *keyPtr));
1.1996 +EXTERN void TclpThreadDataKeyInit _ANSI_ARGS_((
1.1997 + Tcl_ThreadDataKey *keyPtr));
1.1998 +EXTERN void TclpThreadDataKeySet _ANSI_ARGS_((
1.1999 + Tcl_ThreadDataKey *keyPtr, VOID *data));
1.2000 +EXTERN int TclpThreadCreate _ANSI_ARGS_((
1.2001 + Tcl_ThreadId *idPtr,
1.2002 + Tcl_ThreadCreateProc proc,
1.2003 + ClientData clientData,
1.2004 + int stackSize, int flags));
1.2005 +EXTERN void TclpThreadExit _ANSI_ARGS_((int status));
1.2006 +EXTERN void TclRememberCondition _ANSI_ARGS_((Tcl_Condition *mutex));
1.2007 +EXTERN void TclRememberDataKey _ANSI_ARGS_((Tcl_ThreadDataKey *mutex));
1.2008 +EXTERN VOID TclRememberJoinableThread _ANSI_ARGS_((Tcl_ThreadId id));
1.2009 +EXTERN void TclRememberMutex _ANSI_ARGS_((Tcl_Mutex *mutex));
1.2010 +EXTERN VOID TclSignalExitThread _ANSI_ARGS_((Tcl_ThreadId id,
1.2011 + int result));
1.2012 +EXTERN void TclTransferResult _ANSI_ARGS_((Tcl_Interp *sourceInterp,
1.2013 + int result, Tcl_Interp *targetInterp));
1.2014 +EXTERN Tcl_Obj* TclpNativeToNormalized
1.2015 + _ANSI_ARGS_((ClientData clientData));
1.2016 +EXTERN Tcl_Obj* TclpFilesystemPathType
1.2017 + _ANSI_ARGS_((Tcl_Obj* pathObjPtr));
1.2018 +EXTERN Tcl_PackageInitProc* TclpFindSymbol _ANSI_ARGS_((Tcl_Interp *interp,
1.2019 + Tcl_LoadHandle loadHandle, CONST char *symbol));
1.2020 +EXTERN int TclpDlopen _ANSI_ARGS_((Tcl_Interp *interp,
1.2021 + Tcl_Obj *pathPtr,
1.2022 + Tcl_LoadHandle *loadHandle,
1.2023 + Tcl_FSUnloadFileProc **unloadProcPtr));
1.2024 +EXTERN int TclpUtime _ANSI_ARGS_((Tcl_Obj *pathPtr,
1.2025 + struct utimbuf *tval));
1.2026 +
1.2027 +#ifdef TCL_LOAD_FROM_MEMORY
1.2028 +EXTERN void* TclpLoadMemoryGetBuffer _ANSI_ARGS_((
1.2029 + Tcl_Interp *interp, int size));
1.2030 +EXTERN int TclpLoadMemory _ANSI_ARGS_((Tcl_Interp *interp,
1.2031 + void *buffer, int size, int codeSize,
1.2032 + Tcl_LoadHandle *loadHandle,
1.2033 + Tcl_FSUnloadFileProc **unloadProcPtr));
1.2034 +#endif
1.2035 +
1.2036 +#ifdef __SYMBIAN32__
1.2037 +EXTERN int SetupStdFile _ANSI_ARGS_((TclFile file, int type));
1.2038 +#endif
1.2039 +/*
1.2040 + *----------------------------------------------------------------
1.2041 + * Command procedures in the generic core:
1.2042 + *----------------------------------------------------------------
1.2043 + */
1.2044 +
1.2045 +EXTERN int Tcl_AfterObjCmd _ANSI_ARGS_((ClientData clientData,
1.2046 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2047 +EXTERN int Tcl_AppendObjCmd _ANSI_ARGS_((ClientData clientData,
1.2048 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2049 +EXTERN int Tcl_ArrayObjCmd _ANSI_ARGS_((ClientData clientData,
1.2050 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2051 +EXTERN int Tcl_BinaryObjCmd _ANSI_ARGS_((ClientData clientData,
1.2052 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2053 +EXTERN int Tcl_BreakObjCmd _ANSI_ARGS_((ClientData clientData,
1.2054 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2055 +EXTERN int Tcl_CaseObjCmd _ANSI_ARGS_((ClientData clientData,
1.2056 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2057 +EXTERN int Tcl_CatchObjCmd _ANSI_ARGS_((ClientData clientData,
1.2058 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2059 +EXTERN int Tcl_CdObjCmd _ANSI_ARGS_((ClientData clientData,
1.2060 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2061 +EXTERN int Tcl_ClockObjCmd _ANSI_ARGS_((ClientData clientData,
1.2062 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2063 +EXTERN int Tcl_CloseObjCmd _ANSI_ARGS_((ClientData clientData,
1.2064 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2065 +EXTERN int Tcl_ConcatObjCmd _ANSI_ARGS_((ClientData clientData,
1.2066 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2067 +EXTERN int Tcl_ContinueObjCmd _ANSI_ARGS_((ClientData clientData,
1.2068 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2069 +EXTERN int Tcl_EncodingObjCmd _ANSI_ARGS_((ClientData clientData,
1.2070 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2071 +EXTERN int Tcl_EofObjCmd _ANSI_ARGS_((ClientData clientData,
1.2072 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2073 +EXTERN int Tcl_ErrorObjCmd _ANSI_ARGS_((ClientData clientData,
1.2074 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2075 +EXTERN int Tcl_EvalObjCmd _ANSI_ARGS_((ClientData clientData,
1.2076 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2077 +EXTERN int Tcl_ExecObjCmd _ANSI_ARGS_((ClientData clientData,
1.2078 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2079 +EXTERN int Tcl_ExitObjCmd _ANSI_ARGS_((ClientData clientData,
1.2080 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2081 +EXTERN int Tcl_ExprObjCmd _ANSI_ARGS_((ClientData clientData,
1.2082 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2083 +EXTERN int Tcl_FblockedObjCmd _ANSI_ARGS_((ClientData clientData,
1.2084 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2085 +EXTERN int Tcl_FconfigureObjCmd _ANSI_ARGS_((ClientData clientData,
1.2086 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2087 +EXTERN int Tcl_FcopyObjCmd _ANSI_ARGS_((ClientData dummy,
1.2088 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2089 +EXTERN int Tcl_FileObjCmd _ANSI_ARGS_((ClientData dummy,
1.2090 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2091 +EXTERN int Tcl_FileEventObjCmd _ANSI_ARGS_((ClientData clientData,
1.2092 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2093 +EXTERN int Tcl_FlushObjCmd _ANSI_ARGS_((ClientData clientData,
1.2094 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2095 +EXTERN int Tcl_ForObjCmd _ANSI_ARGS_((ClientData clientData,
1.2096 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2097 +EXTERN int Tcl_ForeachObjCmd _ANSI_ARGS_((ClientData clientData,
1.2098 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2099 +EXTERN int Tcl_FormatObjCmd _ANSI_ARGS_((ClientData dummy,
1.2100 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2101 +EXTERN int Tcl_GetsObjCmd _ANSI_ARGS_((ClientData clientData,
1.2102 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2103 +EXTERN int Tcl_GlobalObjCmd _ANSI_ARGS_((ClientData clientData,
1.2104 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2105 +EXTERN int Tcl_GlobObjCmd _ANSI_ARGS_((ClientData clientData,
1.2106 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2107 +EXTERN int Tcl_IfObjCmd _ANSI_ARGS_((ClientData clientData,
1.2108 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2109 +EXTERN int Tcl_IncrObjCmd _ANSI_ARGS_((ClientData clientData,
1.2110 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2111 +EXTERN int Tcl_InfoObjCmd _ANSI_ARGS_((ClientData clientData,
1.2112 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2113 +EXTERN int Tcl_InterpObjCmd _ANSI_ARGS_((ClientData clientData,
1.2114 + Tcl_Interp *interp, int argc, Tcl_Obj *CONST objv[]));
1.2115 +EXTERN int Tcl_JoinObjCmd _ANSI_ARGS_((ClientData clientData,
1.2116 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2117 +EXTERN int Tcl_LappendObjCmd _ANSI_ARGS_((ClientData clientData,
1.2118 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2119 +EXTERN int Tcl_LindexObjCmd _ANSI_ARGS_((ClientData clientData,
1.2120 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2121 +EXTERN int Tcl_LinsertObjCmd _ANSI_ARGS_((ClientData clientData,
1.2122 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2123 +EXTERN int Tcl_LlengthObjCmd _ANSI_ARGS_((ClientData clientData,
1.2124 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2125 +EXTERN int Tcl_ListObjCmd _ANSI_ARGS_((ClientData clientData,
1.2126 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2127 +EXTERN int Tcl_LoadObjCmd _ANSI_ARGS_((ClientData clientData,
1.2128 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2129 +EXTERN int Tcl_LrangeObjCmd _ANSI_ARGS_((ClientData clientData,
1.2130 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2131 +EXTERN int Tcl_LreplaceObjCmd _ANSI_ARGS_((ClientData clientData,
1.2132 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2133 +EXTERN int Tcl_LsearchObjCmd _ANSI_ARGS_((ClientData clientData,
1.2134 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2135 +EXTERN int Tcl_LsetObjCmd _ANSI_ARGS_((ClientData clientData,
1.2136 + Tcl_Interp* interp, int objc, Tcl_Obj *CONST objv[]));
1.2137 +EXTERN int Tcl_LsortObjCmd _ANSI_ARGS_((ClientData clientData,
1.2138 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2139 +EXTERN int Tcl_NamespaceObjCmd _ANSI_ARGS_((ClientData clientData,
1.2140 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2141 +EXTERN int Tcl_OpenObjCmd _ANSI_ARGS_((ClientData clientData,
1.2142 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2143 +EXTERN int Tcl_PackageObjCmd _ANSI_ARGS_((ClientData clientData,
1.2144 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2145 +EXTERN int Tcl_PidObjCmd _ANSI_ARGS_((ClientData clientData,
1.2146 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2147 +EXTERN int Tcl_PutsObjCmd _ANSI_ARGS_((ClientData clientData,
1.2148 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2149 +EXTERN int Tcl_PwdObjCmd _ANSI_ARGS_((ClientData clientData,
1.2150 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2151 +EXTERN int Tcl_ReadObjCmd _ANSI_ARGS_((ClientData clientData,
1.2152 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2153 +EXTERN int Tcl_RegexpObjCmd _ANSI_ARGS_((ClientData clientData,
1.2154 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2155 +EXTERN int Tcl_RegsubObjCmd _ANSI_ARGS_((ClientData clientData,
1.2156 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2157 +EXTERN int Tcl_RenameObjCmd _ANSI_ARGS_((ClientData clientData,
1.2158 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2159 +EXTERN int Tcl_ReturnObjCmd _ANSI_ARGS_((ClientData clientData,
1.2160 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2161 +EXTERN int Tcl_ScanObjCmd _ANSI_ARGS_((ClientData clientData,
1.2162 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2163 +EXTERN int Tcl_SeekObjCmd _ANSI_ARGS_((ClientData clientData,
1.2164 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2165 +EXTERN int Tcl_SetObjCmd _ANSI_ARGS_((ClientData clientData,
1.2166 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2167 +EXTERN int Tcl_SplitObjCmd _ANSI_ARGS_((ClientData clientData,
1.2168 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2169 +EXTERN int Tcl_SocketObjCmd _ANSI_ARGS_((ClientData clientData,
1.2170 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2171 +EXTERN int Tcl_SourceObjCmd _ANSI_ARGS_((ClientData clientData,
1.2172 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2173 +EXTERN int Tcl_StringObjCmd _ANSI_ARGS_((ClientData clientData,
1.2174 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2175 +EXTERN int Tcl_SubstObjCmd _ANSI_ARGS_((ClientData clientData,
1.2176 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2177 +EXTERN int Tcl_SwitchObjCmd _ANSI_ARGS_((ClientData clientData,
1.2178 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2179 +EXTERN int Tcl_TellObjCmd _ANSI_ARGS_((ClientData clientData,
1.2180 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2181 +EXTERN int Tcl_TimeObjCmd _ANSI_ARGS_((ClientData clientData,
1.2182 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2183 +EXTERN int Tcl_TraceObjCmd _ANSI_ARGS_((ClientData clientData,
1.2184 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2185 +EXTERN int Tcl_UnsetObjCmd _ANSI_ARGS_((ClientData clientData,
1.2186 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2187 +EXTERN int Tcl_UpdateObjCmd _ANSI_ARGS_((ClientData clientData,
1.2188 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2189 +EXTERN int Tcl_UplevelObjCmd _ANSI_ARGS_((ClientData clientData,
1.2190 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2191 +EXTERN int Tcl_UpvarObjCmd _ANSI_ARGS_((ClientData clientData,
1.2192 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2193 +EXTERN int Tcl_VariableObjCmd _ANSI_ARGS_((ClientData clientData,
1.2194 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2195 +EXTERN int Tcl_VwaitObjCmd _ANSI_ARGS_((ClientData clientData,
1.2196 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2197 +EXTERN int Tcl_WhileObjCmd _ANSI_ARGS_((ClientData clientData,
1.2198 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2199 +
1.2200 +/*
1.2201 + *----------------------------------------------------------------
1.2202 + * Command procedures found only in the Mac version of the core:
1.2203 + *----------------------------------------------------------------
1.2204 + */
1.2205 +
1.2206 +#ifdef MAC_TCL
1.2207 +EXTERN int Tcl_EchoCmd _ANSI_ARGS_((ClientData clientData,
1.2208 + Tcl_Interp *interp, int argc, CONST84 char **argv));
1.2209 +EXTERN int Tcl_LsObjCmd _ANSI_ARGS_((ClientData clientData,
1.2210 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2211 +EXTERN int Tcl_BeepObjCmd _ANSI_ARGS_((ClientData clientData,
1.2212 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2213 +EXTERN int Tcl_MacSourceObjCmd _ANSI_ARGS_((ClientData clientData,
1.2214 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2215 +EXTERN int Tcl_ResourceObjCmd _ANSI_ARGS_((ClientData clientData,
1.2216 + Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
1.2217 +#endif
1.2218 +
1.2219 +/*
1.2220 + *----------------------------------------------------------------
1.2221 + * Compilation procedures for commands in the generic core:
1.2222 + *----------------------------------------------------------------
1.2223 + */
1.2224 +
1.2225 +EXTERN int TclCompileAppendCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.2226 + Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
1.2227 +EXTERN int TclCompileBreakCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.2228 + Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
1.2229 +EXTERN int TclCompileCatchCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.2230 + Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
1.2231 +EXTERN int TclCompileContinueCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.2232 + Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
1.2233 +EXTERN int TclCompileExprCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.2234 + Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
1.2235 +EXTERN int TclCompileForCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.2236 + Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
1.2237 +EXTERN int TclCompileForeachCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.2238 + Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
1.2239 +EXTERN int TclCompileIfCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.2240 + Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
1.2241 +EXTERN int TclCompileIncrCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.2242 + Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
1.2243 +EXTERN int TclCompileLappendCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.2244 + Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
1.2245 +EXTERN int TclCompileLindexCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.2246 + Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
1.2247 +EXTERN int TclCompileListCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.2248 + Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
1.2249 +EXTERN int TclCompileLlengthCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.2250 + Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
1.2251 +EXTERN int TclCompileLsetCmd _ANSI_ARGS_((Tcl_Interp* interp,
1.2252 + Tcl_Parse* parsePtr, struct CompileEnv* envPtr));
1.2253 +EXTERN int TclCompileRegexpCmd _ANSI_ARGS_((Tcl_Interp* interp,
1.2254 + Tcl_Parse* parsePtr, struct CompileEnv* envPtr));
1.2255 +EXTERN int TclCompileReturnCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.2256 + Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
1.2257 +EXTERN int TclCompileSetCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.2258 + Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
1.2259 +EXTERN int TclCompileStringCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.2260 + Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
1.2261 +EXTERN int TclCompileWhileCmd _ANSI_ARGS_((Tcl_Interp *interp,
1.2262 + Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
1.2263 +
1.2264 +/*
1.2265 + * Functions defined in generic/tclVar.c and currenttly exported only
1.2266 + * for use by the bytecode compiler and engine. Some of these could later
1.2267 + * be placed in the public interface.
1.2268 + */
1.2269 +
1.2270 +EXTERN Var * TclLookupArrayElement _ANSI_ARGS_((Tcl_Interp *interp,
1.2271 + CONST char *arrayName, CONST char *elName, CONST int flags,
1.2272 + CONST char *msg, CONST int createPart1,
1.2273 + CONST int createPart2, Var *arrayPtr));
1.2274 +EXTERN Var * TclObjLookupVar _ANSI_ARGS_((Tcl_Interp *interp,
1.2275 + Tcl_Obj *part1Ptr, CONST char *part2, int flags,
1.2276 + CONST char *msg, CONST int createPart1,
1.2277 + CONST int createPart2, Var **arrayPtrPtr));
1.2278 +EXTERN Tcl_Obj *TclPtrGetVar _ANSI_ARGS_((Tcl_Interp *interp, Var *varPtr,
1.2279 + Var *arrayPtr, CONST char *part1, CONST char *part2,
1.2280 + CONST int flags));
1.2281 +EXTERN Tcl_Obj *TclPtrSetVar _ANSI_ARGS_((Tcl_Interp *interp, Var *varPtr,
1.2282 + Var *arrayPtr, CONST char *part1, CONST char *part2,
1.2283 + Tcl_Obj *newValuePtr, CONST int flags));
1.2284 +EXTERN Tcl_Obj *TclPtrIncrVar _ANSI_ARGS_((Tcl_Interp *interp, Var *varPtr,
1.2285 + Var *arrayPtr, CONST char *part1, CONST char *part2,
1.2286 + CONST long i, CONST int flags));
1.2287 +
1.2288 +/*
1.2289 + *----------------------------------------------------------------
1.2290 + * Macros used by the Tcl core to create and release Tcl objects.
1.2291 + * TclNewObj(objPtr) creates a new object denoting an empty string.
1.2292 + * TclDecrRefCount(objPtr) decrements the object's reference count,
1.2293 + * and frees the object if its reference count is zero.
1.2294 + * These macros are inline versions of Tcl_NewObj() and
1.2295 + * Tcl_DecrRefCount(). Notice that the names differ in not having
1.2296 + * a "_" after the "Tcl". Notice also that these macros reference
1.2297 + * their argument more than once, so you should avoid calling them
1.2298 + * with an expression that is expensive to compute or has
1.2299 + * side effects. The ANSI C "prototypes" for these macros are:
1.2300 + *
1.2301 + * EXTERN void TclNewObj _ANSI_ARGS_((Tcl_Obj *objPtr));
1.2302 + * EXTERN void TclDecrRefCount _ANSI_ARGS_((Tcl_Obj *objPtr));
1.2303 + *
1.2304 + * These macros are defined in terms of two macros that depend on
1.2305 + * memory allocator in use: TclAllocObjStorage, TclFreeObjStorage.
1.2306 + * They are defined below.
1.2307 + *----------------------------------------------------------------
1.2308 + */
1.2309 +
1.2310 +#ifdef TCL_COMPILE_STATS
1.2311 +# define TclIncrObjsAllocated() \
1.2312 + tclObjsAlloced++
1.2313 +# define TclIncrObjsFreed() \
1.2314 + tclObjsFreed++
1.2315 +#else
1.2316 +# define TclIncrObjsAllocated()
1.2317 +# define TclIncrObjsFreed()
1.2318 +#endif /* TCL_COMPILE_STATS */
1.2319 +
1.2320 +#define TclNewObj(objPtr) \
1.2321 + TclAllocObjStorage(objPtr); \
1.2322 + TclIncrObjsAllocated(); \
1.2323 + (objPtr)->refCount = 0; \
1.2324 + (objPtr)->bytes = tclEmptyStringRep; \
1.2325 + (objPtr)->length = 0; \
1.2326 + (objPtr)->typePtr = NULL
1.2327 +
1.2328 +
1.2329 +#ifdef TCL_MEM_DEBUG
1.2330 +# define TclDecrRefCount(objPtr) \
1.2331 + Tcl_DbDecrRefCount(objPtr, __FILE__, __LINE__)
1.2332 +#else
1.2333 +# define TclDecrRefCount(objPtr) \
1.2334 + if (--(objPtr)->refCount <= 0) { \
1.2335 + if (((objPtr)->typePtr != NULL) \
1.2336 + && ((objPtr)->typePtr->freeIntRepProc != NULL)) { \
1.2337 + (objPtr)->typePtr->freeIntRepProc(objPtr); \
1.2338 + } \
1.2339 + if (((objPtr)->bytes != NULL) \
1.2340 + && ((objPtr)->bytes != tclEmptyStringRep)) { \
1.2341 + ckfree((char *) (objPtr)->bytes); \
1.2342 + } \
1.2343 + TclFreeObjStorage(objPtr); \
1.2344 + TclIncrObjsFreed(); \
1.2345 + }
1.2346 +#endif
1.2347 +
1.2348 +#ifdef TCL_MEM_DEBUG
1.2349 +# define TclAllocObjStorage(objPtr) \
1.2350 + (objPtr) = (Tcl_Obj *) \
1.2351 + Tcl_DbCkalloc(sizeof(Tcl_Obj), __FILE__, __LINE__)
1.2352 +
1.2353 +# define TclFreeObjStorage(objPtr) \
1.2354 + if ((objPtr)->refCount < -1) { \
1.2355 + panic("Reference count for %lx was negative: %s line %d", \
1.2356 + (objPtr), __FILE__, __LINE__); \
1.2357 + } \
1.2358 + ckfree((char *) (objPtr))
1.2359 +
1.2360 +# define TclDbNewObj(objPtr, file, line) \
1.2361 + (objPtr) = (Tcl_Obj *) Tcl_DbCkalloc(sizeof(Tcl_Obj), (file), (line)); \
1.2362 + (objPtr)->refCount = 0; \
1.2363 + (objPtr)->bytes = tclEmptyStringRep; \
1.2364 + (objPtr)->length = 0; \
1.2365 + (objPtr)->typePtr = NULL; \
1.2366 + TclIncrObjsAllocated()
1.2367 +
1.2368 +#elif defined(PURIFY)
1.2369 +
1.2370 +/*
1.2371 + * The PURIFY mode is like the regular mode, but instead of doing block
1.2372 + * Tcl_Obj allocation and keeping a freed list for efficiency, it always
1.2373 + * allocates and frees a single Tcl_Obj so that tools like Purify can
1.2374 + * better track memory leaks
1.2375 + */
1.2376 +
1.2377 +# define TclAllocObjStorage(objPtr) \
1.2378 + (objPtr) = (Tcl_Obj *) Tcl_Ckalloc(sizeof(Tcl_Obj))
1.2379 +
1.2380 +# define TclFreeObjStorage(objPtr) \
1.2381 + ckfree((char *) (objPtr))
1.2382 +
1.2383 +#elif defined(TCL_THREADS) && defined(USE_THREAD_ALLOC)
1.2384 +
1.2385 +/*
1.2386 + * The TCL_THREADS mode is like the regular mode but allocates Tcl_Obj's
1.2387 + * from per-thread caches.
1.2388 + */
1.2389 +
1.2390 +EXTERN Tcl_Obj *TclThreadAllocObj _ANSI_ARGS_((void));
1.2391 +EXTERN void TclThreadFreeObj _ANSI_ARGS_((Tcl_Obj *));
1.2392 +EXTERN void TclFreeAllocCache _ANSI_ARGS_((void *));
1.2393 +EXTERN void TclpFreeAllocMutex _ANSI_ARGS_((Tcl_Mutex* mutex));
1.2394 +EXTERN void TclpFreeAllocCache _ANSI_ARGS_((void *));
1.2395 +
1.2396 +
1.2397 +# define TclAllocObjStorage(objPtr) \
1.2398 + (objPtr) = TclThreadAllocObj()
1.2399 +
1.2400 +# define TclFreeObjStorage(objPtr) \
1.2401 + TclThreadFreeObj((objPtr))
1.2402 +
1.2403 +#else /* not TCL_MEM_DEBUG */
1.2404 +
1.2405 +#ifdef TCL_THREADS
1.2406 +/* declared in tclObj.c */
1.2407 +extern Tcl_Mutex tclObjMutex;
1.2408 +#endif
1.2409 +
1.2410 +# define TclAllocObjStorage(objPtr) \
1.2411 + Tcl_MutexLock(&tclObjMutex); \
1.2412 + if (tclFreeObjList == NULL) { \
1.2413 + TclAllocateFreeObjects(); \
1.2414 + } \
1.2415 + (objPtr) = tclFreeObjList; \
1.2416 + tclFreeObjList = (Tcl_Obj *) \
1.2417 + tclFreeObjList->internalRep.otherValuePtr; \
1.2418 + Tcl_MutexUnlock(&tclObjMutex)
1.2419 +
1.2420 +# define TclFreeObjStorage(objPtr) \
1.2421 + Tcl_MutexLock(&tclObjMutex); \
1.2422 + (objPtr)->internalRep.otherValuePtr = (VOID *) tclFreeObjList; \
1.2423 + tclFreeObjList = (objPtr); \
1.2424 + Tcl_MutexUnlock(&tclObjMutex)
1.2425 +
1.2426 +#endif /* TCL_MEM_DEBUG */
1.2427 +
1.2428 +/*
1.2429 + *----------------------------------------------------------------
1.2430 + * Macro used by the Tcl core to set a Tcl_Obj's string representation
1.2431 + * to a copy of the "len" bytes starting at "bytePtr". This code
1.2432 + * works even if the byte array contains NULLs as long as the length
1.2433 + * is correct. Because "len" is referenced multiple times, it should
1.2434 + * be as simple an expression as possible. The ANSI C "prototype" for
1.2435 + * this macro is:
1.2436 + *
1.2437 + * EXTERN void TclInitStringRep _ANSI_ARGS_((Tcl_Obj *objPtr,
1.2438 + * char *bytePtr, int len));
1.2439 + *----------------------------------------------------------------
1.2440 + */
1.2441 +
1.2442 +#define TclInitStringRep(objPtr, bytePtr, len) \
1.2443 + if ((len) == 0) { \
1.2444 + (objPtr)->bytes = tclEmptyStringRep; \
1.2445 + (objPtr)->length = 0; \
1.2446 + } else { \
1.2447 + (objPtr)->bytes = (char *) ckalloc((unsigned) ((len) + 1)); \
1.2448 + memcpy((VOID *) (objPtr)->bytes, (VOID *) (bytePtr), \
1.2449 + (unsigned) (len)); \
1.2450 + (objPtr)->bytes[len] = '\0'; \
1.2451 + (objPtr)->length = (len); \
1.2452 + }
1.2453 +
1.2454 +/*
1.2455 + *----------------------------------------------------------------
1.2456 + * Macro used by the Tcl core to get the string representation's
1.2457 + * byte array pointer from a Tcl_Obj. This is an inline version
1.2458 + * of Tcl_GetString(). The macro's expression result is the string
1.2459 + * rep's byte pointer which might be NULL. The bytes referenced by
1.2460 + * this pointer must not be modified by the caller.
1.2461 + * The ANSI C "prototype" for this macro is:
1.2462 + *
1.2463 + * EXTERN char * TclGetString _ANSI_ARGS_((Tcl_Obj *objPtr));
1.2464 + *----------------------------------------------------------------
1.2465 + */
1.2466 +
1.2467 +#define TclGetString(objPtr) \
1.2468 + ((objPtr)->bytes? (objPtr)->bytes : Tcl_GetString((objPtr)))
1.2469 +
1.2470 +/*
1.2471 + *----------------------------------------------------------------
1.2472 + * Macro used by the Tcl core to get a Tcl_WideInt value out of
1.2473 + * a Tcl_Obj of the "wideInt" type. Different implementation on
1.2474 + * different platforms depending whether TCL_WIDE_INT_IS_LONG.
1.2475 + *----------------------------------------------------------------
1.2476 + */
1.2477 +
1.2478 +#ifdef TCL_WIDE_INT_IS_LONG
1.2479 +# define TclGetWide(resultVar, objPtr) \
1.2480 + (resultVar) = (objPtr)->internalRep.longValue
1.2481 +# define TclGetLongFromWide(resultVar, objPtr) \
1.2482 + (resultVar) = (objPtr)->internalRep.longValue
1.2483 +#else
1.2484 +# define TclGetWide(resultVar, objPtr) \
1.2485 + (resultVar) = (objPtr)->internalRep.wideValue
1.2486 +# define TclGetLongFromWide(resultVar, objPtr) \
1.2487 + (resultVar) = Tcl_WideAsLong((objPtr)->internalRep.wideValue)
1.2488 +#endif
1.2489 +
1.2490 +/*
1.2491 + *----------------------------------------------------------------
1.2492 + * Macro used by the Tcl core get a unicode char from a utf string.
1.2493 + * It checks to see if we have a one-byte utf char before calling
1.2494 + * the real Tcl_UtfToUniChar, as this will save a lot of time for
1.2495 + * primarily ascii string handling. The macro's expression result
1.2496 + * is 1 for the 1-byte case or the result of Tcl_UtfToUniChar.
1.2497 + * The ANSI C "prototype" for this macro is:
1.2498 + *
1.2499 + * EXTERN int TclUtfToUniChar _ANSI_ARGS_((CONST char *string,
1.2500 + * Tcl_UniChar *ch));
1.2501 + *----------------------------------------------------------------
1.2502 + */
1.2503 +
1.2504 +#define TclUtfToUniChar(str, chPtr) \
1.2505 + ((((unsigned char) *(str)) < 0xC0) ? \
1.2506 + ((*(chPtr) = (Tcl_UniChar) *(str)), 1) \
1.2507 + : Tcl_UtfToUniChar(str, chPtr))
1.2508 +
1.2509 +/*
1.2510 + *----------------------------------------------------------------
1.2511 + * Macro used by the Tcl core to compare Unicode strings. On
1.2512 + * big-endian systems we can use the more efficient memcmp, but
1.2513 + * this would not be lexically correct on little-endian systems.
1.2514 + * The ANSI C "prototype" for this macro is:
1.2515 + *
1.2516 + * EXTERN int TclUniCharNcmp _ANSI_ARGS_((CONST Tcl_UniChar *cs,
1.2517 + * CONST Tcl_UniChar *ct, unsigned long n));
1.2518 + *----------------------------------------------------------------
1.2519 + */
1.2520 +#ifdef WORDS_BIGENDIAN
1.2521 +# define TclUniCharNcmp(cs,ct,n) memcmp((cs),(ct),(n)*sizeof(Tcl_UniChar))
1.2522 +#else /* !WORDS_BIGENDIAN */
1.2523 +# define TclUniCharNcmp Tcl_UniCharNcmp
1.2524 +#endif /* WORDS_BIGENDIAN */
1.2525 +
1.2526 +#ifdef __SYMBIAN32__
1.2527 +/*
1.2528 + * Struct to keep records of synchronization objects (used in tclThread.c)
1.2529 + */
1.2530 +typedef struct SyncObjRecord {
1.2531 + int num; /* Number of objects remembered */
1.2532 + int max; /* Max size of the array */
1.2533 + char **list; /* List of pointers */
1.2534 +} SyncObjRecord;
1.2535 +#endif
1.2536 +
1.2537 +#include "tclIntDecls.h"
1.2538 +
1.2539 +# undef TCL_STORAGE_CLASS
1.2540 +# define TCL_STORAGE_CLASS DLLIMPORT
1.2541 +
1.2542 +#endif /* _TCLINT */
1.2543 +