os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/generic/tcl.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/generic/tcl.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,2380 @@
     1.4 +/*
     1.5 + * tcl.h --
     1.6 + *
     1.7 + *	This header file describes the externally-visible facilities
     1.8 + *	of the Tcl interpreter.
     1.9 + *
    1.10 + * Copyright (c) 1987-1994 The Regents of the University of California.
    1.11 + * Copyright (c) 1993-1996 Lucent Technologies.
    1.12 + * Copyright (c) 1994-1998 Sun Microsystems, Inc.
    1.13 + * Copyright (c) 1998-2000 by Scriptics Corporation.
    1.14 + * Copyright (c) 2002 by Kevin B. Kenny.  All rights reserved.
    1.15 + * Portions Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiaries. All rights reserved.  
    1.16 + *
    1.17 + * See the file "license.terms" for information on usage and redistribution
    1.18 + * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    1.19 + *
    1.20 + * RCS: @(#) $Id: tcl.h,v 1.153.2.30 2006/10/23 17:53:26 dgp Exp $
    1.21 + */
    1.22 +
    1.23 +#ifndef _TCL
    1.24 +#define _TCL
    1.25 +
    1.26 +/*
    1.27 + * For C++ compilers, use extern "C"
    1.28 + */
    1.29 +
    1.30 +#ifdef __cplusplus
    1.31 +extern "C" {
    1.32 +#endif
    1.33 +
    1.34 +/*
    1.35 + * The following defines are used to indicate the various release levels.
    1.36 + */
    1.37 +
    1.38 +#define TCL_ALPHA_RELEASE	0
    1.39 +#define TCL_BETA_RELEASE	1
    1.40 +#define TCL_FINAL_RELEASE	2
    1.41 +
    1.42 +/*
    1.43 + * When version numbers change here, must also go into the following files
    1.44 + * and update the version numbers:
    1.45 + *
    1.46 + * library/init.tcl	(only if Major.minor changes, not patchlevel) 1 LOC
    1.47 + * unix/configure.in	(2 LOC Major, 2 LOC minor, 1 LOC patch)
    1.48 + * win/configure.in	(as above)
    1.49 + * win/tcl.m4		(not patchlevel)
    1.50 + * win/makefile.vc	(not patchlevel) 2 LOC
    1.51 + * README		(sections 0 and 2)
    1.52 + * mac/README		(2 LOC, not patchlevel)
    1.53 + * macosx/Tcl.pbproj/project.pbxproj (not patchlevel) 1 LOC
    1.54 + * macosx/Tcl.pbproj/default.pbxuser (not patchlevel) 1 LOC
    1.55 + * win/README.binary	(sections 0-4)
    1.56 + * win/README		(not patchlevel) (sections 0 and 2)
    1.57 + * unix/tcl.spec	(2 LOC Major/Minor, 1 LOC patch)
    1.58 + * tests/basic.test	(1 LOC M/M, not patchlevel)
    1.59 + * tools/tcl.hpj.in	(not patchlevel, for windows installer)
    1.60 + * tools/tcl.wse.in	(for windows installer)
    1.61 + * tools/tclSplash.bmp	(not patchlevel)
    1.62 + */
    1.63 +#define TCL_MAJOR_VERSION   8
    1.64 +#define TCL_MINOR_VERSION   4
    1.65 +#define TCL_RELEASE_LEVEL   TCL_FINAL_RELEASE
    1.66 +#define TCL_RELEASE_SERIAL  15
    1.67 +
    1.68 +#define TCL_VERSION	    "8.4"
    1.69 +#define TCL_PATCH_LEVEL	    "8.4.15"
    1.70 +
    1.71 +/*
    1.72 + * The following definitions set up the proper options for Windows
    1.73 + * compilers.  We use this method because there is no autoconf equivalent.
    1.74 + */
    1.75 +
    1.76 +// Only if not compiling for Symbian on a PC with a Windows compiler
    1.77 +#ifndef __SYMBIAN32__  
    1.78 +#ifndef __WIN32__
    1.79 +#   if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__) || defined(__BORLANDC__)
    1.80 +#	define __WIN32__
    1.81 +#	ifndef WIN32
    1.82 +#	    define WIN32
    1.83 +#	endif
    1.84 +#   endif
    1.85 +#endif
    1.86 +#endif
    1.87 +
    1.88 +/*
    1.89 + * STRICT: See MSDN Article Q83456
    1.90 + */
    1.91 +#ifdef __WIN32__
    1.92 +#   ifndef STRICT
    1.93 +#	define STRICT
    1.94 +#   endif
    1.95 +#endif /* __WIN32__ */
    1.96 +
    1.97 +/*
    1.98 + * The following definitions set up the proper options for Macintosh
    1.99 + * compilers.  We use this method because there is no autoconf equivalent.
   1.100 + */
   1.101 +
   1.102 +#ifdef MAC_TCL
   1.103 +#include <ConditionalMacros.h>
   1.104 +#   ifndef USE_TCLALLOC
   1.105 +#	define USE_TCLALLOC 1
   1.106 +#   endif
   1.107 +#   ifndef NO_STRERROR
   1.108 +#	define NO_STRERROR 1
   1.109 +#   endif
   1.110 +#   define INLINE 
   1.111 +#endif
   1.112 +
   1.113 +
   1.114 +/*
   1.115 + * Utility macros: STRINGIFY takes an argument and wraps it in "" (double
   1.116 + * quotation marks), JOIN joins two arguments.
   1.117 + */
   1.118 +#ifndef STRINGIFY
   1.119 +#  define STRINGIFY(x) STRINGIFY1(x)
   1.120 +#  define STRINGIFY1(x) #x
   1.121 +#endif
   1.122 +#ifndef JOIN
   1.123 +#  define JOIN(a,b) JOIN1(a,b)
   1.124 +#  define JOIN1(a,b) a##b
   1.125 +#endif
   1.126 +
   1.127 +/* 
   1.128 + * A special definition used to allow this header file to be included
   1.129 + * from windows or mac resource files so that they can obtain version
   1.130 + * information.  RC_INVOKED is defined by default by the windows RC tool
   1.131 + * and manually set for macintosh.
   1.132 + *
   1.133 + * Resource compilers don't like all the C stuff, like typedefs and
   1.134 + * procedure declarations, that occur below, so block them out.
   1.135 + */
   1.136 +
   1.137 +#ifndef RC_INVOKED
   1.138 +
   1.139 +/*
   1.140 + * Special macro to define mutexes, that doesn't do anything
   1.141 + * if we are not using threads.
   1.142 + */
   1.143 +
   1.144 +#ifdef TCL_THREADS
   1.145 +#define TCL_DECLARE_MUTEX(name) static Tcl_Mutex name;
   1.146 +#else
   1.147 +#define TCL_DECLARE_MUTEX(name)
   1.148 +#endif
   1.149 +
   1.150 +/*
   1.151 + * Macros that eliminate the overhead of the thread synchronization
   1.152 + * functions when compiling without thread support.
   1.153 + */
   1.154 +
   1.155 +#ifndef TCL_THREADS
   1.156 +#define Tcl_MutexLock(mutexPtr)
   1.157 +#define Tcl_MutexUnlock(mutexPtr)
   1.158 +#define Tcl_MutexFinalize(mutexPtr)
   1.159 +#define Tcl_ConditionNotify(condPtr)
   1.160 +#define Tcl_ConditionWait(condPtr, mutexPtr, timePtr)
   1.161 +#define Tcl_ConditionFinalize(condPtr)
   1.162 +#endif /* TCL_THREADS */
   1.163 +
   1.164 +
   1.165 +#ifndef BUFSIZ
   1.166 +#   include <stdio.h>
   1.167 +#endif
   1.168 +
   1.169 +
   1.170 +/*
   1.171 + * Definitions that allow Tcl functions with variable numbers of
   1.172 + * arguments to be used with either varargs.h or stdarg.h.  TCL_VARARGS
   1.173 + * is used in procedure prototypes.  TCL_VARARGS_DEF is used to declare
   1.174 + * the arguments in a function definiton: it takes the type and name of
   1.175 + * the first argument and supplies the appropriate argument declaration
   1.176 + * string for use in the function definition.  TCL_VARARGS_START
   1.177 + * initializes the va_list data structure and returns the first argument.
   1.178 + */
   1.179 +#if !defined(NO_STDARG)
   1.180 +#   include <stdarg.h>
   1.181 +#   define TCL_VARARGS(type, name) (type name, ...)
   1.182 +#   define TCL_VARARGS_DEF(type, name) (type name, ...)
   1.183 +#   define TCL_VARARGS_START(type, name, list) (va_start(list, name), name)
   1.184 +#else
   1.185 +#   include <varargs.h>
   1.186 +#      define TCL_VARARGS(type, name) ()
   1.187 +#      define TCL_VARARGS_DEF(type, name) (va_alist)
   1.188 +#   define TCL_VARARGS_START(type, name, list) \
   1.189 +	(va_start(list), va_arg(list, type))
   1.190 +#endif
   1.191 +
   1.192 +/*
   1.193 + * Macros used to declare a function to be exported by a DLL.
   1.194 + * Used by Windows, maps to no-op declarations on non-Windows systems.
   1.195 + * The default build on windows is for a DLL, which causes the DLLIMPORT
   1.196 + * and DLLEXPORT macros to be nonempty. To build a static library, the
   1.197 + * macro STATIC_BUILD should be defined.
   1.198 + */
   1.199 +
   1.200 +#ifdef STATIC_BUILD
   1.201 +#   define DLLIMPORT
   1.202 +#   define DLLEXPORT
   1.203 +#else
   1.204 +#   if (defined(__WIN32__) && (defined(_MSC_VER) || (__BORLANDC__ >= 0x0550) || (defined(__GNUC__) && defined(__declspec)))) || (defined(MAC_TCL) && FUNCTION_DECLSPEC)
   1.205 +#	define DLLIMPORT __declspec(dllimport)
   1.206 +#	define DLLEXPORT __declspec(dllexport)
   1.207 +#   else
   1.208 +#	define DLLIMPORT
   1.209 +#	define DLLEXPORT
   1.210 +#   endif
   1.211 +#endif
   1.212 +
   1.213 +/*
   1.214 + * These macros are used to control whether functions are being declared for
   1.215 + * import or export.  If a function is being declared while it is being built
   1.216 + * to be included in a shared library, then it should have the DLLEXPORT
   1.217 + * storage class.  If is being declared for use by a module that is going to
   1.218 + * link against the shared library, then it should have the DLLIMPORT storage
   1.219 + * class.  If the symbol is beind declared for a static build or for use from a
   1.220 + * stub library, then the storage class should be empty.
   1.221 + *
   1.222 + * The convention is that a macro called BUILD_xxxx, where xxxx is the
   1.223 + * name of a library we are building, is set on the compile line for sources
   1.224 + * that are to be placed in the library.  When this macro is set, the
   1.225 + * storage class will be set to DLLEXPORT.  At the end of the header file, the
   1.226 + * storage class will be reset to DLLIMPORT.
   1.227 + */
   1.228 +#undef TCL_STORAGE_CLASS
   1.229 +#ifdef BUILD_tcl
   1.230 +#   define TCL_STORAGE_CLASS DLLEXPORT
   1.231 +#else
   1.232 +#   ifdef USE_TCL_STUBS
   1.233 +#      define TCL_STORAGE_CLASS
   1.234 +#   else
   1.235 +#      define TCL_STORAGE_CLASS DLLIMPORT
   1.236 +#   endif
   1.237 +#endif
   1.238 +
   1.239 +
   1.240 +/*
   1.241 + * Definitions that allow this header file to be used either with or
   1.242 + * without ANSI C features like function prototypes.
   1.243 + */
   1.244 +#undef _ANSI_ARGS_
   1.245 +#undef CONST
   1.246 +#ifndef INLINE
   1.247 +#   define INLINE
   1.248 +#endif
   1.249 +
   1.250 +#ifndef NO_CONST
   1.251 +#   define CONST const
   1.252 +#else
   1.253 +#   define CONST
   1.254 +#endif
   1.255 +
   1.256 +#ifndef NO_PROTOTYPES
   1.257 +#   define _ANSI_ARGS_(x)	x
   1.258 +#else
   1.259 +#   define _ANSI_ARGS_(x)	()
   1.260 +#endif
   1.261 +
   1.262 +#ifdef USE_NON_CONST
   1.263 +#   ifdef USE_COMPAT_CONST
   1.264 +#      error define at most one of USE_NON_CONST and USE_COMPAT_CONST
   1.265 +#   endif
   1.266 +#   define CONST84
   1.267 +#   define CONST84_RETURN
   1.268 +#else
   1.269 +#   ifdef USE_COMPAT_CONST
   1.270 +#      define CONST84 
   1.271 +#      define CONST84_RETURN CONST
   1.272 +#   else
   1.273 +#      define CONST84 CONST
   1.274 +#      define CONST84_RETURN CONST
   1.275 +#   endif
   1.276 +#endif
   1.277 +
   1.278 +
   1.279 +/*
   1.280 + * Make sure EXTERN isn't defined elsewhere
   1.281 + */
   1.282 +#ifdef EXTERN
   1.283 +#   undef EXTERN
   1.284 +#endif /* EXTERN */
   1.285 +
   1.286 +#ifdef __cplusplus
   1.287 +#   define EXTERN extern "C" TCL_STORAGE_CLASS
   1.288 +#else
   1.289 +#   define EXTERN extern TCL_STORAGE_CLASS
   1.290 +#endif
   1.291 +
   1.292 +#ifdef __SYMBIAN32__  
   1.293 +#ifdef EXTERN
   1.294 +#   undef EXTERN
   1.295 +#endif
   1.296 +#ifdef __cplusplus
   1.297 +#   define EXTERN extern "C"
   1.298 +#else
   1.299 +#   define EXTERN extern
   1.300 +#endif
   1.301 +#endif
   1.302 +
   1.303 +/*
   1.304 + * The following code is copied from winnt.h.
   1.305 + * If we don't replicate it here, then <windows.h> can't be included 
   1.306 + * after tcl.h, since tcl.h also defines VOID.
   1.307 + * This block is skipped under Cygwin and Mingw.
   1.308 + * 
   1.309 + * 
   1.310 + */
   1.311 +#if defined(__WIN32__) && !defined(HAVE_WINNT_IGNORE_VOID)
   1.312 +#ifndef VOID
   1.313 +#define VOID void
   1.314 +typedef char CHAR;
   1.315 +typedef short SHORT;
   1.316 +typedef long LONG;
   1.317 +#endif
   1.318 +#endif /* __WIN32__ && !HAVE_WINNT_IGNORE_VOID */
   1.319 +
   1.320 +/*
   1.321 + * Macro to use instead of "void" for arguments that must have
   1.322 + * type "void *" in ANSI C;  maps them to type "char *" in
   1.323 + * non-ANSI systems.
   1.324 + */
   1.325 +
   1.326 +#ifndef NO_VOID
   1.327 +#         define VOID void
   1.328 +#else
   1.329 +#         define VOID char
   1.330 +#endif
   1.331 +
   1.332 +/*
   1.333 + * Miscellaneous declarations.
   1.334 + */
   1.335 +
   1.336 +#ifndef _CLIENTDATA
   1.337 +#   ifndef NO_VOID
   1.338 +	typedef void *ClientData;
   1.339 +#   else
   1.340 +	typedef int *ClientData;
   1.341 +#   endif
   1.342 +#   define _CLIENTDATA
   1.343 +#endif
   1.344 +
   1.345 +/*
   1.346 + * Darwin specifc configure overrides (to support fat compiles, where
   1.347 + * configure runs only once for multiple architectures):
   1.348 + */
   1.349 +
   1.350 +#ifdef __APPLE__
   1.351 +#   ifdef __LP64__
   1.352 +#	undef TCL_WIDE_INT_TYPE
   1.353 +#	define TCL_WIDE_INT_IS_LONG 1
   1.354 +#    else /* !__LP64__ */
   1.355 +#	define TCL_WIDE_INT_TYPE long long
   1.356 +#	undef TCL_WIDE_INT_IS_LONG
   1.357 +#    endif /* __LP64__ */
   1.358 +#    undef HAVE_STRUCT_STAT64
   1.359 +#endif /* __APPLE__ */
   1.360 +
   1.361 +/*
   1.362 + * Define Tcl_WideInt to be a type that is (at least) 64-bits wide,
   1.363 + * and define Tcl_WideUInt to be the unsigned variant of that type
   1.364 + * (assuming that where we have one, we can have the other.)
   1.365 + *
   1.366 + * Also defines the following macros:
   1.367 + * TCL_WIDE_INT_IS_LONG - if wide ints are really longs (i.e. we're on
   1.368 + *	a real 64-bit system.)
   1.369 + * Tcl_WideAsLong - forgetful converter from wideInt to long.
   1.370 + * Tcl_LongAsWide - sign-extending converter from long to wideInt.
   1.371 + * Tcl_WideAsDouble - converter from wideInt to double.
   1.372 + * Tcl_DoubleAsWide - converter from double to wideInt.
   1.373 + *
   1.374 + * The following invariant should hold for any long value 'longVal':
   1.375 + *	longVal == Tcl_WideAsLong(Tcl_LongAsWide(longVal))
   1.376 + *
   1.377 + * Note on converting between Tcl_WideInt and strings.  This
   1.378 + * implementation (in tclObj.c) depends on the functions strtoull()
   1.379 + * and sprintf(...,"%" TCL_LL_MODIFIER "d",...).  TCL_LL_MODIFIER_SIZE
   1.380 + * is the length of the modifier string, which is "ll" on most 32-bit
   1.381 + * Unix systems.  It has to be split up like this to allow for the more
   1.382 + * complex formats sometimes needed (e.g. in the format(n) command.)
   1.383 + */
   1.384 +
   1.385 +#if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG)
   1.386 +#   if defined(__GNUC__)
   1.387 +#      define TCL_WIDE_INT_TYPE long long
   1.388 +#      if defined(__WIN32__) && !defined(__CYGWIN__)
   1.389 +#         define TCL_LL_MODIFIER        "I64"
   1.390 +#         define TCL_LL_MODIFIER_SIZE   3
   1.391 +#      else
   1.392 +#      define TCL_LL_MODIFIER	"L"
   1.393 +#      define TCL_LL_MODIFIER_SIZE	1
   1.394 +#      endif
   1.395 +typedef struct stat	Tcl_StatBuf;
   1.396 +#   elif defined(__WIN32__)
   1.397 +#      define TCL_WIDE_INT_TYPE __int64
   1.398 +#      ifdef __BORLANDC__
   1.399 +typedef struct stati64 Tcl_StatBuf;
   1.400 +#         define TCL_LL_MODIFIER	"L"
   1.401 +#         define TCL_LL_MODIFIER_SIZE	1
   1.402 +#      else /* __BORLANDC__ */
   1.403 +#         if _MSC_VER < 1400 || !defined(_M_IX86)
   1.404 +typedef struct _stati64	Tcl_StatBuf;
   1.405 +#         else
   1.406 +typedef struct _stat64 Tcl_StatBuf;
   1.407 +#         endif /* _MSC_VER < 1400 */
   1.408 +#         define TCL_LL_MODIFIER	"I64"
   1.409 +#         define TCL_LL_MODIFIER_SIZE	3
   1.410 +#      endif /* __BORLANDC__ */
   1.411 +#   else /* __WIN32__ */
   1.412 +/*
   1.413 + * Don't know what platform it is and configure hasn't discovered what
   1.414 + * is going on for us.  Try to guess...
   1.415 + */
   1.416 +#      ifdef NO_LIMITS_H
   1.417 +#	  error please define either TCL_WIDE_INT_TYPE or TCL_WIDE_INT_IS_LONG
   1.418 +#      else /* !NO_LIMITS_H */
   1.419 +#	  include <limits.h>
   1.420 +#	  if (INT_MAX < LONG_MAX)
   1.421 +#	     define TCL_WIDE_INT_IS_LONG	1
   1.422 +#	  else
   1.423 +#	     define TCL_WIDE_INT_TYPE long long
   1.424 +#         endif
   1.425 +#      endif /* NO_LIMITS_H */
   1.426 +#   endif /* __WIN32__ */
   1.427 +#endif /* !TCL_WIDE_INT_TYPE & !TCL_WIDE_INT_IS_LONG */
   1.428 +#ifdef TCL_WIDE_INT_IS_LONG
   1.429 +#   undef TCL_WIDE_INT_TYPE
   1.430 +#   define TCL_WIDE_INT_TYPE	long
   1.431 +#endif /* TCL_WIDE_INT_IS_LONG */
   1.432 +
   1.433 +typedef TCL_WIDE_INT_TYPE		Tcl_WideInt;
   1.434 +typedef unsigned TCL_WIDE_INT_TYPE	Tcl_WideUInt;
   1.435 +
   1.436 +#ifdef TCL_WIDE_INT_IS_LONG
   1.437 +typedef struct stat	Tcl_StatBuf;
   1.438 +#   define Tcl_WideAsLong(val)		((long)(val))
   1.439 +#   define Tcl_LongAsWide(val)		((long)(val))
   1.440 +#   define Tcl_WideAsDouble(val)	((double)((long)(val)))
   1.441 +#   define Tcl_DoubleAsWide(val)	((long)((double)(val)))
   1.442 +#   ifndef TCL_LL_MODIFIER
   1.443 +#      define TCL_LL_MODIFIER		"l"
   1.444 +#      define TCL_LL_MODIFIER_SIZE	1
   1.445 +#   endif /* !TCL_LL_MODIFIER */
   1.446 +#else /* TCL_WIDE_INT_IS_LONG */
   1.447 +/*
   1.448 + * The next short section of defines are only done when not running on
   1.449 + * Windows or some other strange platform.
   1.450 + */
   1.451 +#   ifndef TCL_LL_MODIFIER
   1.452 +#      ifdef HAVE_STRUCT_STAT64
   1.453 +typedef struct stat64	Tcl_StatBuf;
   1.454 +#      else
   1.455 +typedef struct stat	Tcl_StatBuf;
   1.456 +#      endif /* HAVE_STRUCT_STAT64 */
   1.457 +#      define TCL_LL_MODIFIER		"ll"
   1.458 +#      define TCL_LL_MODIFIER_SIZE	2
   1.459 +#   endif /* !TCL_LL_MODIFIER */
   1.460 +#   define Tcl_WideAsLong(val)		((long)((Tcl_WideInt)(val)))
   1.461 +#   define Tcl_LongAsWide(val)		((Tcl_WideInt)((long)(val)))
   1.462 +#   define Tcl_WideAsDouble(val)	((double)((Tcl_WideInt)(val)))
   1.463 +#   define Tcl_DoubleAsWide(val)	((Tcl_WideInt)((double)(val)))
   1.464 +#endif /* TCL_WIDE_INT_IS_LONG */
   1.465 +
   1.466 +
   1.467 +/*
   1.468 + * This flag controls whether binary compatability is maintained with
   1.469 + * extensions built against a previous version of Tcl. This is true
   1.470 + * by default.
   1.471 + */
   1.472 +#ifndef TCL_PRESERVE_BINARY_COMPATABILITY
   1.473 +#   define TCL_PRESERVE_BINARY_COMPATABILITY 1
   1.474 +#endif
   1.475 +
   1.476 +
   1.477 +/*
   1.478 + * Data structures defined opaquely in this module. The definitions below
   1.479 + * just provide dummy types. A few fields are made visible in Tcl_Interp
   1.480 + * structures, namely those used for returning a string result from
   1.481 + * commands. Direct access to the result field is discouraged in Tcl 8.0.
   1.482 + * The interpreter result is either an object or a string, and the two
   1.483 + * values are kept consistent unless some C code sets interp->result
   1.484 + * directly. Programmers should use either the procedure Tcl_GetObjResult()
   1.485 + * or Tcl_GetStringResult() to read the interpreter's result. See the
   1.486 + * SetResult man page for details.
   1.487 + * 
   1.488 + * Note: any change to the Tcl_Interp definition below must be mirrored
   1.489 + * in the "real" definition in tclInt.h.
   1.490 + *
   1.491 + * Note: Tcl_ObjCmdProc procedures do not directly set result and freeProc.
   1.492 + * Instead, they set a Tcl_Obj member in the "real" structure that can be
   1.493 + * accessed with Tcl_GetObjResult() and Tcl_SetObjResult().
   1.494 + */
   1.495 +
   1.496 +typedef struct Tcl_Interp {
   1.497 +    char *result;		/* If the last command returned a string
   1.498 +				 * result, this points to it. */
   1.499 +    void (*freeProc) _ANSI_ARGS_((char *blockPtr));
   1.500 +				/* Zero means the string result is
   1.501 +				 * statically allocated. TCL_DYNAMIC means
   1.502 +				 * it was allocated with ckalloc and should
   1.503 +				 * be freed with ckfree. Other values give
   1.504 +				 * the address of procedure to invoke to
   1.505 +				 * free the result. Tcl_Eval must free it
   1.506 +				 * before executing next command. */
   1.507 +    int errorLine;              /* When TCL_ERROR is returned, this gives
   1.508 +                                 * the line number within the command where
   1.509 +                                 * the error occurred (1 if first line). */
   1.510 +} Tcl_Interp;
   1.511 +
   1.512 +typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler;
   1.513 +typedef struct Tcl_Channel_ *Tcl_Channel;
   1.514 +typedef struct Tcl_Command_ *Tcl_Command;
   1.515 +typedef struct Tcl_Condition_ *Tcl_Condition;
   1.516 +typedef struct Tcl_EncodingState_ *Tcl_EncodingState;
   1.517 +typedef struct Tcl_Encoding_ *Tcl_Encoding;
   1.518 +typedef struct Tcl_Event Tcl_Event;
   1.519 +typedef struct Tcl_Mutex_ *Tcl_Mutex;
   1.520 +typedef struct Tcl_Pid_ *Tcl_Pid;
   1.521 +typedef struct Tcl_RegExp_ *Tcl_RegExp;
   1.522 +typedef struct Tcl_ThreadDataKey_ *Tcl_ThreadDataKey;
   1.523 +typedef struct Tcl_ThreadId_ *Tcl_ThreadId;
   1.524 +typedef struct Tcl_TimerToken_ *Tcl_TimerToken;
   1.525 +typedef struct Tcl_Trace_ *Tcl_Trace;
   1.526 +typedef struct Tcl_Var_ *Tcl_Var;
   1.527 +typedef struct Tcl_ChannelTypeVersion_ *Tcl_ChannelTypeVersion;
   1.528 +typedef struct Tcl_LoadHandle_ *Tcl_LoadHandle;
   1.529 +
   1.530 +/*
   1.531 + * Definition of the interface to procedures implementing threads.
   1.532 + * A procedure following this definition is given to each call of
   1.533 + * 'Tcl_CreateThread' and will be called as the main fuction of
   1.534 + * the new thread created by that call.
   1.535 + */
   1.536 +#ifdef MAC_TCL
   1.537 +typedef pascal void *(Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData));
   1.538 +#elif defined __WIN32__
   1.539 +typedef unsigned (__stdcall Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData));
   1.540 +#else
   1.541 +typedef void (Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData));
   1.542 +#endif
   1.543 +
   1.544 +
   1.545 +/*
   1.546 + * Threading function return types used for abstracting away platform
   1.547 + * differences when writing a Tcl_ThreadCreateProc.  See the NewThread
   1.548 + * function in generic/tclThreadTest.c for it's usage.
   1.549 + */
   1.550 +#ifdef MAC_TCL
   1.551 +#   define Tcl_ThreadCreateType		pascal void *
   1.552 +#   define TCL_THREAD_CREATE_RETURN	return NULL
   1.553 +#elif defined __WIN32__
   1.554 +#   define Tcl_ThreadCreateType		unsigned __stdcall
   1.555 +#   define TCL_THREAD_CREATE_RETURN	return 0
   1.556 +#else
   1.557 +#   define Tcl_ThreadCreateType		void
   1.558 +#   define TCL_THREAD_CREATE_RETURN	
   1.559 +#endif
   1.560 +
   1.561 +
   1.562 +/*
   1.563 + * Definition of values for default stacksize and the possible flags to be
   1.564 + * given to Tcl_CreateThread.
   1.565 + */
   1.566 +#define TCL_THREAD_STACK_DEFAULT (0)    /* Use default size for stack */
   1.567 +#define TCL_THREAD_NOFLAGS       (0000) /* Standard flags, default behaviour */
   1.568 +#define TCL_THREAD_JOINABLE      (0001) /* Mark the thread as joinable */
   1.569 +
   1.570 +/*
   1.571 + * Flag values passed to Tcl_GetRegExpFromObj.
   1.572 + */
   1.573 +#define	TCL_REG_BASIC		000000	/* BREs (convenience) */
   1.574 +#define	TCL_REG_EXTENDED	000001	/* EREs */
   1.575 +#define	TCL_REG_ADVF		000002	/* advanced features in EREs */
   1.576 +#define	TCL_REG_ADVANCED	000003	/* AREs (which are also EREs) */
   1.577 +#define	TCL_REG_QUOTE		000004	/* no special characters, none */
   1.578 +#define	TCL_REG_NOCASE		000010	/* ignore case */
   1.579 +#define	TCL_REG_NOSUB		000020	/* don't care about subexpressions */
   1.580 +#define	TCL_REG_EXPANDED	000040	/* expanded format, white space &
   1.581 +					 * comments */
   1.582 +#define	TCL_REG_NLSTOP		000100  /* \n doesn't match . or [^ ] */
   1.583 +#define	TCL_REG_NLANCH		000200  /* ^ matches after \n, $ before */
   1.584 +#define	TCL_REG_NEWLINE		000300  /* newlines are line terminators */
   1.585 +#define	TCL_REG_CANMATCH	001000  /* report details on partial/limited
   1.586 +					 * matches */
   1.587 +
   1.588 +/*
   1.589 + * The following flag is experimental and only intended for use by Expect.  It
   1.590 + * will probably go away in a later release.
   1.591 + */
   1.592 +#define TCL_REG_BOSONLY		002000	/* prepend \A to pattern so it only
   1.593 +					 * matches at the beginning of the
   1.594 +					 * string. */
   1.595 +
   1.596 +/*
   1.597 + * Flags values passed to Tcl_RegExpExecObj.
   1.598 + */
   1.599 +#define	TCL_REG_NOTBOL	0001	/* Beginning of string does not match ^.  */
   1.600 +#define	TCL_REG_NOTEOL	0002	/* End of string does not match $. */
   1.601 +
   1.602 +/*
   1.603 + * Structures filled in by Tcl_RegExpInfo.  Note that all offset values are
   1.604 + * relative to the start of the match string, not the beginning of the
   1.605 + * entire string.
   1.606 + */
   1.607 +typedef struct Tcl_RegExpIndices {
   1.608 +    long start;		/* character offset of first character in match */
   1.609 +    long end;		/* character offset of first character after the
   1.610 +			 * match. */
   1.611 +} Tcl_RegExpIndices;
   1.612 +
   1.613 +typedef struct Tcl_RegExpInfo {
   1.614 +    int nsubs;			/* number of subexpressions in the
   1.615 +				 * compiled expression */
   1.616 +    Tcl_RegExpIndices *matches;	/* array of nsubs match offset
   1.617 +				 * pairs */
   1.618 +    long extendStart;		/* The offset at which a subsequent
   1.619 +				 * match might begin. */
   1.620 +    long reserved;		/* Reserved for later use. */
   1.621 +} Tcl_RegExpInfo;
   1.622 +
   1.623 +/*
   1.624 + * Picky compilers complain if this typdef doesn't appear before the
   1.625 + * struct's reference in tclDecls.h.
   1.626 + */
   1.627 +typedef Tcl_StatBuf *Tcl_Stat_;
   1.628 +typedef struct stat *Tcl_OldStat_;
   1.629 +
   1.630 +/*
   1.631 + * When a TCL command returns, the interpreter contains a result from the
   1.632 + * command. Programmers are strongly encouraged to use one of the
   1.633 + * procedures Tcl_GetObjResult() or Tcl_GetStringResult() to read the
   1.634 + * interpreter's result. See the SetResult man page for details. Besides
   1.635 + * this result, the command procedure returns an integer code, which is 
   1.636 + * one of the following:
   1.637 + *
   1.638 + * TCL_OK		Command completed normally; the interpreter's
   1.639 + *			result contains	the command's result.
   1.640 + * TCL_ERROR		The command couldn't be completed successfully;
   1.641 + *			the interpreter's result describes what went wrong.
   1.642 + * TCL_RETURN		The command requests that the current procedure
   1.643 + *			return; the interpreter's result contains the
   1.644 + *			procedure's return value.
   1.645 + * TCL_BREAK		The command requests that the innermost loop
   1.646 + *			be exited; the interpreter's result is meaningless.
   1.647 + * TCL_CONTINUE		Go on to the next iteration of the current loop;
   1.648 + *			the interpreter's result is meaningless.
   1.649 + */
   1.650 +#define TCL_OK		0
   1.651 +#define TCL_ERROR	1
   1.652 +#define TCL_RETURN	2
   1.653 +#define TCL_BREAK	3
   1.654 +#define TCL_CONTINUE	4
   1.655 +
   1.656 +#define TCL_RESULT_SIZE 200
   1.657 +
   1.658 +/*
   1.659 + * Flags to control what substitutions are performed by Tcl_SubstObj():
   1.660 + */
   1.661 +#define TCL_SUBST_COMMANDS	001
   1.662 +#define TCL_SUBST_VARIABLES	002
   1.663 +#define TCL_SUBST_BACKSLASHES	004
   1.664 +#define TCL_SUBST_ALL		007
   1.665 +
   1.666 +
   1.667 +/*
   1.668 + * Argument descriptors for math function callbacks in expressions:
   1.669 + */
   1.670 +typedef enum {
   1.671 +    TCL_INT, TCL_DOUBLE, TCL_EITHER, TCL_WIDE_INT
   1.672 +} Tcl_ValueType;
   1.673 +typedef struct Tcl_Value {
   1.674 +    Tcl_ValueType type;		/* Indicates intValue or doubleValue is
   1.675 +				 * valid, or both. */
   1.676 +    long intValue;		/* Integer value. */
   1.677 +    double doubleValue;		/* Double-precision floating value. */
   1.678 +    Tcl_WideInt wideValue;	/* Wide (min. 64-bit) integer value. */
   1.679 +} Tcl_Value;
   1.680 +
   1.681 +/*
   1.682 + * Forward declaration of Tcl_Obj to prevent an error when the forward
   1.683 + * reference to Tcl_Obj is encountered in the procedure types declared 
   1.684 + * below.
   1.685 + */
   1.686 +struct Tcl_Obj;
   1.687 +
   1.688 +
   1.689 +/*
   1.690 + * Procedure types defined by Tcl:
   1.691 + */
   1.692 +
   1.693 +typedef int (Tcl_AppInitProc) _ANSI_ARGS_((Tcl_Interp *interp));
   1.694 +typedef int (Tcl_AsyncProc) _ANSI_ARGS_((ClientData clientData,
   1.695 +	Tcl_Interp *interp, int code));
   1.696 +typedef void (Tcl_ChannelProc) _ANSI_ARGS_((ClientData clientData, int mask));
   1.697 +typedef void (Tcl_CloseProc) _ANSI_ARGS_((ClientData data));
   1.698 +typedef void (Tcl_CmdDeleteProc) _ANSI_ARGS_((ClientData clientData));
   1.699 +typedef int (Tcl_CmdProc) _ANSI_ARGS_((ClientData clientData,
   1.700 +	Tcl_Interp *interp, int argc, CONST84 char *argv[]));
   1.701 +typedef void (Tcl_CmdTraceProc) _ANSI_ARGS_((ClientData clientData,
   1.702 +	Tcl_Interp *interp, int level, char *command, Tcl_CmdProc *proc,
   1.703 +	ClientData cmdClientData, int argc, CONST84 char *argv[]));
   1.704 +typedef int (Tcl_CmdObjTraceProc) _ANSI_ARGS_((ClientData clientData,
   1.705 +	Tcl_Interp *interp, int level, CONST char *command,
   1.706 +	Tcl_Command commandInfo, int objc, struct Tcl_Obj * CONST * objv));
   1.707 +typedef void (Tcl_CmdObjTraceDeleteProc) _ANSI_ARGS_((ClientData clientData));
   1.708 +typedef void (Tcl_DupInternalRepProc) _ANSI_ARGS_((struct Tcl_Obj *srcPtr, 
   1.709 +        struct Tcl_Obj *dupPtr));
   1.710 +typedef int (Tcl_EncodingConvertProc)_ANSI_ARGS_((ClientData clientData,
   1.711 +	CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr,
   1.712 +	char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr,
   1.713 +	int *dstCharsPtr));
   1.714 +typedef void (Tcl_EncodingFreeProc)_ANSI_ARGS_((ClientData clientData));
   1.715 +typedef int (Tcl_EventProc) _ANSI_ARGS_((Tcl_Event *evPtr, int flags));
   1.716 +typedef void (Tcl_EventCheckProc) _ANSI_ARGS_((ClientData clientData,
   1.717 +	int flags));
   1.718 +typedef int (Tcl_EventDeleteProc) _ANSI_ARGS_((Tcl_Event *evPtr,
   1.719 +        ClientData clientData));
   1.720 +typedef void (Tcl_EventSetupProc) _ANSI_ARGS_((ClientData clientData,
   1.721 +	int flags));
   1.722 +typedef void (Tcl_ExitProc) _ANSI_ARGS_((ClientData clientData));
   1.723 +typedef void (Tcl_FileProc) _ANSI_ARGS_((ClientData clientData, int mask));
   1.724 +typedef void (Tcl_FileFreeProc) _ANSI_ARGS_((ClientData clientData));
   1.725 +typedef void (Tcl_FreeInternalRepProc) _ANSI_ARGS_((struct Tcl_Obj *objPtr));
   1.726 +typedef void (Tcl_FreeProc) _ANSI_ARGS_((char *blockPtr));
   1.727 +typedef void (Tcl_IdleProc) _ANSI_ARGS_((ClientData clientData));
   1.728 +typedef void (Tcl_InterpDeleteProc) _ANSI_ARGS_((ClientData clientData,
   1.729 +	Tcl_Interp *interp));
   1.730 +typedef int (Tcl_MathProc) _ANSI_ARGS_((ClientData clientData,
   1.731 +	Tcl_Interp *interp, Tcl_Value *args, Tcl_Value *resultPtr));
   1.732 +typedef void (Tcl_NamespaceDeleteProc) _ANSI_ARGS_((ClientData clientData));
   1.733 +typedef int (Tcl_ObjCmdProc) _ANSI_ARGS_((ClientData clientData,
   1.734 +	Tcl_Interp *interp, int objc, struct Tcl_Obj * CONST * objv));
   1.735 +typedef int (Tcl_PackageInitProc) _ANSI_ARGS_((Tcl_Interp *interp));
   1.736 +typedef void (Tcl_PanicProc) _ANSI_ARGS_(TCL_VARARGS(CONST char *, format));
   1.737 +typedef void (Tcl_TcpAcceptProc) _ANSI_ARGS_((ClientData callbackData,
   1.738 +        Tcl_Channel chan, char *address, int port));
   1.739 +typedef void (Tcl_TimerProc) _ANSI_ARGS_((ClientData clientData));
   1.740 +typedef int (Tcl_SetFromAnyProc) _ANSI_ARGS_((Tcl_Interp *interp,
   1.741 +	struct Tcl_Obj *objPtr));
   1.742 +typedef void (Tcl_UpdateStringProc) _ANSI_ARGS_((struct Tcl_Obj *objPtr));
   1.743 +typedef char *(Tcl_VarTraceProc) _ANSI_ARGS_((ClientData clientData,
   1.744 +	Tcl_Interp *interp, CONST84 char *part1, CONST84 char *part2, int flags));
   1.745 +typedef void (Tcl_CommandTraceProc) _ANSI_ARGS_((ClientData clientData,
   1.746 +	Tcl_Interp *interp, CONST char *oldName, CONST char *newName,
   1.747 +	int flags));
   1.748 +typedef void (Tcl_CreateFileHandlerProc) _ANSI_ARGS_((int fd, int mask,
   1.749 +	Tcl_FileProc *proc, ClientData clientData));
   1.750 +typedef void (Tcl_DeleteFileHandlerProc) _ANSI_ARGS_((int fd));
   1.751 +typedef void (Tcl_AlertNotifierProc) _ANSI_ARGS_((ClientData clientData));
   1.752 +typedef void (Tcl_ServiceModeHookProc) _ANSI_ARGS_((int mode));
   1.753 +typedef ClientData (Tcl_InitNotifierProc) _ANSI_ARGS_((VOID));
   1.754 +typedef void (Tcl_FinalizeNotifierProc) _ANSI_ARGS_((ClientData clientData));
   1.755 +typedef void (Tcl_MainLoopProc) _ANSI_ARGS_((void));
   1.756 +
   1.757 +
   1.758 +/*
   1.759 + * The following structure represents a type of object, which is a
   1.760 + * particular internal representation for an object plus a set of
   1.761 + * procedures that provide standard operations on objects of that type.
   1.762 + */
   1.763 +
   1.764 +typedef struct Tcl_ObjType {
   1.765 +    char *name;			/* Name of the type, e.g. "int". */
   1.766 +    Tcl_FreeInternalRepProc *freeIntRepProc;
   1.767 +				/* Called to free any storage for the type's
   1.768 +				 * internal rep. NULL if the internal rep
   1.769 +				 * does not need freeing. */
   1.770 +    Tcl_DupInternalRepProc *dupIntRepProc;
   1.771 +    				/* Called to create a new object as a copy
   1.772 +				 * of an existing object. */
   1.773 +    Tcl_UpdateStringProc *updateStringProc;
   1.774 +    				/* Called to update the string rep from the
   1.775 +				 * type's internal representation. */
   1.776 +    Tcl_SetFromAnyProc *setFromAnyProc;
   1.777 +    				/* Called to convert the object's internal
   1.778 +				 * rep to this type. Frees the internal rep
   1.779 +				 * of the old type. Returns TCL_ERROR on
   1.780 +				 * failure. */
   1.781 +} Tcl_ObjType;
   1.782 +
   1.783 +
   1.784 +/*
   1.785 + * One of the following structures exists for each object in the Tcl
   1.786 + * system. An object stores a value as either a string, some internal
   1.787 + * representation, or both.
   1.788 + */
   1.789 +
   1.790 +typedef struct Tcl_Obj {
   1.791 +    int refCount;		/* When 0 the object will be freed. */
   1.792 +    char *bytes;		/* This points to the first byte of the
   1.793 +				 * object's string representation. The array
   1.794 +				 * must be followed by a null byte (i.e., at
   1.795 +				 * offset length) but may also contain
   1.796 +				 * embedded null characters. The array's
   1.797 +				 * storage is allocated by ckalloc. NULL
   1.798 +				 * means the string rep is invalid and must
   1.799 +				 * be regenerated from the internal rep.
   1.800 +				 * Clients should use Tcl_GetStringFromObj
   1.801 +				 * or Tcl_GetString to get a pointer to the
   1.802 +				 * byte array as a readonly value. */
   1.803 +    int length;			/* The number of bytes at *bytes, not
   1.804 +				 * including the terminating null. */
   1.805 +    Tcl_ObjType *typePtr;	/* Denotes the object's type. Always
   1.806 +				 * corresponds to the type of the object's
   1.807 +				 * internal rep. NULL indicates the object
   1.808 +				 * has no internal rep (has no type). */
   1.809 +    union {			/* The internal representation: */
   1.810 +	long longValue;		/*   - an long integer value */
   1.811 +	double doubleValue;	/*   - a double-precision floating value */
   1.812 +	VOID *otherValuePtr;	/*   - another, type-specific value */
   1.813 +	Tcl_WideInt wideValue;	/*   - a long long value */
   1.814 +	struct {		/*   - internal rep as two pointers */
   1.815 +	    VOID *ptr1;
   1.816 +	    VOID *ptr2;
   1.817 +	} twoPtrValue;
   1.818 +    } internalRep;
   1.819 +} Tcl_Obj;
   1.820 +
   1.821 +
   1.822 +/*
   1.823 + * Macros to increment and decrement a Tcl_Obj's reference count, and to
   1.824 + * test whether an object is shared (i.e. has reference count > 1).
   1.825 + * Note: clients should use Tcl_DecrRefCount() when they are finished using
   1.826 + * an object, and should never call TclFreeObj() directly. TclFreeObj() is
   1.827 + * only defined and made public in tcl.h to support Tcl_DecrRefCount's macro
   1.828 + * definition. Note also that Tcl_DecrRefCount() refers to the parameter
   1.829 + * "obj" twice. This means that you should avoid calling it with an
   1.830 + * expression that is expensive to compute or has side effects.
   1.831 + */
   1.832 +void		Tcl_IncrRefCount _ANSI_ARGS_((Tcl_Obj *objPtr));
   1.833 +void		Tcl_DecrRefCount _ANSI_ARGS_((Tcl_Obj *objPtr));
   1.834 +int		Tcl_IsShared _ANSI_ARGS_((Tcl_Obj *objPtr));
   1.835 +
   1.836 +#ifdef TCL_MEM_DEBUG
   1.837 +#   define Tcl_IncrRefCount(objPtr) \
   1.838 +	Tcl_DbIncrRefCount(objPtr, __FILE__, __LINE__)
   1.839 +#   define Tcl_DecrRefCount(objPtr) \
   1.840 +	Tcl_DbDecrRefCount(objPtr, __FILE__, __LINE__)
   1.841 +#   define Tcl_IsShared(objPtr) \
   1.842 +	Tcl_DbIsShared(objPtr, __FILE__, __LINE__)
   1.843 +#else
   1.844 +#   define Tcl_IncrRefCount(objPtr) \
   1.845 +	++(objPtr)->refCount
   1.846 +    /*
   1.847 +     * Use empty if ; else to handle use in unbraced outer if/else conditions
   1.848 +     */
   1.849 +#   define Tcl_DecrRefCount(objPtr) \
   1.850 +	if (--(objPtr)->refCount > 0) ; else TclFreeObj(objPtr)
   1.851 +#   define Tcl_IsShared(objPtr) \
   1.852 +	((objPtr)->refCount > 1)
   1.853 +#endif
   1.854 +
   1.855 +/*
   1.856 + * Macros and definitions that help to debug the use of Tcl objects.
   1.857 + * When TCL_MEM_DEBUG is defined, the Tcl_New declarations are 
   1.858 + * overridden to call debugging versions of the object creation procedures.
   1.859 + */
   1.860 +
   1.861 +#ifdef TCL_MEM_DEBUG
   1.862 +#  define Tcl_NewBooleanObj(val) \
   1.863 +     Tcl_DbNewBooleanObj(val, __FILE__, __LINE__)
   1.864 +#  define Tcl_NewByteArrayObj(bytes, len) \
   1.865 +     Tcl_DbNewByteArrayObj(bytes, len, __FILE__, __LINE__)
   1.866 +#  define Tcl_NewDoubleObj(val) \
   1.867 +     Tcl_DbNewDoubleObj(val, __FILE__, __LINE__)
   1.868 +#  define Tcl_NewIntObj(val) \
   1.869 +     Tcl_DbNewLongObj(val, __FILE__, __LINE__)
   1.870 +#  define Tcl_NewListObj(objc, objv) \
   1.871 +     Tcl_DbNewListObj(objc, objv, __FILE__, __LINE__)
   1.872 +#  define Tcl_NewLongObj(val) \
   1.873 +     Tcl_DbNewLongObj(val, __FILE__, __LINE__)
   1.874 +#  define Tcl_NewObj() \
   1.875 +     Tcl_DbNewObj(__FILE__, __LINE__)
   1.876 +#  define Tcl_NewStringObj(bytes, len) \
   1.877 +     Tcl_DbNewStringObj(bytes, len, __FILE__, __LINE__)
   1.878 +#  define Tcl_NewWideIntObj(val) \
   1.879 +     Tcl_DbNewWideIntObj(val, __FILE__, __LINE__)
   1.880 +#endif /* TCL_MEM_DEBUG */
   1.881 +
   1.882 +
   1.883 +/*
   1.884 + * The following structure contains the state needed by
   1.885 + * Tcl_SaveResult.  No-one outside of Tcl should access any of these
   1.886 + * fields.  This structure is typically allocated on the stack.
   1.887 + */
   1.888 +typedef struct Tcl_SavedResult {
   1.889 +    char *result;
   1.890 +    Tcl_FreeProc *freeProc;
   1.891 +    Tcl_Obj *objResultPtr;
   1.892 +    char *appendResult;
   1.893 +    int appendAvl;
   1.894 +    int appendUsed;
   1.895 +    char resultSpace[TCL_RESULT_SIZE+1];
   1.896 +} Tcl_SavedResult;
   1.897 +
   1.898 +
   1.899 +/*
   1.900 + * The following definitions support Tcl's namespace facility.
   1.901 + * Note: the first five fields must match exactly the fields in a
   1.902 + * Namespace structure (see tclInt.h). 
   1.903 + */
   1.904 +
   1.905 +typedef struct Tcl_Namespace {
   1.906 +    char *name;                 /* The namespace's name within its parent
   1.907 +				 * namespace. This contains no ::'s. The
   1.908 +				 * name of the global namespace is ""
   1.909 +				 * although "::" is an synonym. */
   1.910 +    char *fullName;             /* The namespace's fully qualified name.
   1.911 +				 * This starts with ::. */
   1.912 +    ClientData clientData;      /* Arbitrary value associated with this
   1.913 +				 * namespace. */
   1.914 +    Tcl_NamespaceDeleteProc* deleteProc;
   1.915 +                                /* Procedure invoked when deleting the
   1.916 +				 * namespace to, e.g., free clientData. */
   1.917 +    struct Tcl_Namespace* parentPtr;
   1.918 +                                /* Points to the namespace that contains
   1.919 +				 * this one. NULL if this is the global
   1.920 +				 * namespace. */
   1.921 +} Tcl_Namespace;
   1.922 +
   1.923 +
   1.924 +/*
   1.925 + * The following structure represents a call frame, or activation record.
   1.926 + * A call frame defines a naming context for a procedure call: its local
   1.927 + * scope (for local variables) and its namespace scope (used for non-local
   1.928 + * variables; often the global :: namespace). A call frame can also define
   1.929 + * the naming context for a namespace eval or namespace inscope command:
   1.930 + * the namespace in which the command's code should execute. The
   1.931 + * Tcl_CallFrame structures exist only while procedures or namespace
   1.932 + * eval/inscope's are being executed, and provide a Tcl call stack.
   1.933 + * 
   1.934 + * A call frame is initialized and pushed using Tcl_PushCallFrame and
   1.935 + * popped using Tcl_PopCallFrame. Storage for a Tcl_CallFrame must be
   1.936 + * provided by the Tcl_PushCallFrame caller, and callers typically allocate
   1.937 + * them on the C call stack for efficiency. For this reason, Tcl_CallFrame
   1.938 + * is defined as a structure and not as an opaque token. However, most
   1.939 + * Tcl_CallFrame fields are hidden since applications should not access
   1.940 + * them directly; others are declared as "dummyX".
   1.941 + *
   1.942 + * WARNING!! The structure definition must be kept consistent with the
   1.943 + * CallFrame structure in tclInt.h. If you change one, change the other.
   1.944 + */
   1.945 +
   1.946 +typedef struct Tcl_CallFrame {
   1.947 +    Tcl_Namespace *nsPtr;
   1.948 +    int dummy1;
   1.949 +    int dummy2;
   1.950 +    char *dummy3;
   1.951 +    char *dummy4;
   1.952 +    char *dummy5;
   1.953 +    int dummy6;
   1.954 +    char *dummy7;
   1.955 +    char *dummy8;
   1.956 +    int dummy9;
   1.957 +    char* dummy10;
   1.958 +} Tcl_CallFrame;
   1.959 +
   1.960 +
   1.961 +/*
   1.962 + * Information about commands that is returned by Tcl_GetCommandInfo and
   1.963 + * passed to Tcl_SetCommandInfo. objProc is an objc/objv object-based
   1.964 + * command procedure while proc is a traditional Tcl argc/argv
   1.965 + * string-based procedure. Tcl_CreateObjCommand and Tcl_CreateCommand
   1.966 + * ensure that both objProc and proc are non-NULL and can be called to
   1.967 + * execute the command. However, it may be faster to call one instead of
   1.968 + * the other. The member isNativeObjectProc is set to 1 if an
   1.969 + * object-based procedure was registered by Tcl_CreateObjCommand, and to
   1.970 + * 0 if a string-based procedure was registered by Tcl_CreateCommand.
   1.971 + * The other procedure is typically set to a compatibility wrapper that
   1.972 + * does string-to-object or object-to-string argument conversions then
   1.973 + * calls the other procedure.
   1.974 + */
   1.975 +
   1.976 +typedef struct Tcl_CmdInfo {
   1.977 +    int isNativeObjectProc;	 /* 1 if objProc was registered by a call to
   1.978 +				  * Tcl_CreateObjCommand; 0 otherwise.
   1.979 +				  * Tcl_SetCmdInfo does not modify this
   1.980 +				  * field. */
   1.981 +    Tcl_ObjCmdProc *objProc;	 /* Command's object-based procedure. */
   1.982 +    ClientData objClientData;	 /* ClientData for object proc. */
   1.983 +    Tcl_CmdProc *proc;		 /* Command's string-based procedure. */
   1.984 +    ClientData clientData;	 /* ClientData for string proc. */
   1.985 +    Tcl_CmdDeleteProc *deleteProc;
   1.986 +                                 /* Procedure to call when command is
   1.987 +                                  * deleted. */
   1.988 +    ClientData deleteData;	 /* Value to pass to deleteProc (usually
   1.989 +				  * the same as clientData). */
   1.990 +    Tcl_Namespace *namespacePtr; /* Points to the namespace that contains
   1.991 +				  * this command. Note that Tcl_SetCmdInfo
   1.992 +				  * will not change a command's namespace;
   1.993 +				  * use Tcl_RenameCommand to do that. */
   1.994 +
   1.995 +} Tcl_CmdInfo;
   1.996 +
   1.997 +/*
   1.998 + * The structure defined below is used to hold dynamic strings.  The only
   1.999 + * field that clients should use is the string field, accessible via the
  1.1000 + * macro Tcl_DStringValue.  
  1.1001 + */
  1.1002 +#define TCL_DSTRING_STATIC_SIZE 200
  1.1003 +typedef struct Tcl_DString {
  1.1004 +    char *string;		/* Points to beginning of string:  either
  1.1005 +				 * staticSpace below or a malloced array. */
  1.1006 +    int length;			/* Number of non-NULL characters in the
  1.1007 +				 * string. */
  1.1008 +    int spaceAvl;		/* Total number of bytes available for the
  1.1009 +				 * string and its terminating NULL char. */
  1.1010 +    char staticSpace[TCL_DSTRING_STATIC_SIZE];
  1.1011 +				/* Space to use in common case where string
  1.1012 +				 * is small. */
  1.1013 +} Tcl_DString;
  1.1014 +
  1.1015 +#define Tcl_DStringLength(dsPtr) ((dsPtr)->length)
  1.1016 +#define Tcl_DStringValue(dsPtr) ((dsPtr)->string)
  1.1017 +#define Tcl_DStringTrunc Tcl_DStringSetLength
  1.1018 +
  1.1019 +/*
  1.1020 + * Definitions for the maximum number of digits of precision that may
  1.1021 + * be specified in the "tcl_precision" variable, and the number of
  1.1022 + * bytes of buffer space required by Tcl_PrintDouble.
  1.1023 + */
  1.1024 +#define TCL_MAX_PREC 17
  1.1025 +#define TCL_DOUBLE_SPACE (TCL_MAX_PREC+10)
  1.1026 +
  1.1027 +/*
  1.1028 + * Definition for a number of bytes of buffer space sufficient to hold the
  1.1029 + * string representation of an integer in base 10 (assuming the existence
  1.1030 + * of 64-bit integers).
  1.1031 + */
  1.1032 +#define TCL_INTEGER_SPACE	24
  1.1033 +
  1.1034 +/*
  1.1035 + * Flag that may be passed to Tcl_ConvertElement to force it not to
  1.1036 + * output braces (careful!  if you change this flag be sure to change
  1.1037 + * the definitions at the front of tclUtil.c).
  1.1038 + */
  1.1039 +#define TCL_DONT_USE_BRACES	1
  1.1040 +
  1.1041 +/*
  1.1042 + * Flag that may be passed to Tcl_GetIndexFromObj to force it to disallow
  1.1043 + * abbreviated strings.
  1.1044 + */
  1.1045 +#define TCL_EXACT	1
  1.1046 +
  1.1047 +/*
  1.1048 + * Flag values passed to Tcl_RecordAndEval and/or Tcl_EvalObj.
  1.1049 + * WARNING: these bit choices must not conflict with the bit choices
  1.1050 + * for evalFlag bits in tclInt.h!!
  1.1051 + */
  1.1052 +#define TCL_NO_EVAL		0x10000
  1.1053 +#define TCL_EVAL_GLOBAL		0x20000
  1.1054 +#define TCL_EVAL_DIRECT		0x40000
  1.1055 +#define TCL_EVAL_INVOKE	        0x80000
  1.1056 +
  1.1057 +/*
  1.1058 + * Special freeProc values that may be passed to Tcl_SetResult (see
  1.1059 + * the man page for details):
  1.1060 + */
  1.1061 +#define TCL_VOLATILE	((Tcl_FreeProc *) 1)
  1.1062 +#define TCL_STATIC	((Tcl_FreeProc *) 0)
  1.1063 +#define TCL_DYNAMIC	((Tcl_FreeProc *) 3)
  1.1064 +
  1.1065 +/*
  1.1066 + * Flag values passed to variable-related procedures.
  1.1067 + */
  1.1068 +#define TCL_GLOBAL_ONLY		 1
  1.1069 +#define TCL_NAMESPACE_ONLY	 2
  1.1070 +#define TCL_APPEND_VALUE	 4
  1.1071 +#define TCL_LIST_ELEMENT	 8
  1.1072 +#define TCL_TRACE_READS		 0x10
  1.1073 +#define TCL_TRACE_WRITES	 0x20
  1.1074 +#define TCL_TRACE_UNSETS	 0x40
  1.1075 +#define TCL_TRACE_DESTROYED	 0x80
  1.1076 +#define TCL_INTERP_DESTROYED	 0x100
  1.1077 +#define TCL_LEAVE_ERR_MSG	 0x200
  1.1078 +#define TCL_TRACE_ARRAY		 0x800
  1.1079 +#ifndef TCL_REMOVE_OBSOLETE_TRACES
  1.1080 +/* Required to support old variable/vdelete/vinfo traces */
  1.1081 +#define TCL_TRACE_OLD_STYLE	 0x1000
  1.1082 +#endif
  1.1083 +/* Indicate the semantics of the result of a trace */
  1.1084 +#define TCL_TRACE_RESULT_DYNAMIC 0x8000
  1.1085 +#define TCL_TRACE_RESULT_OBJECT  0x10000
  1.1086 +
  1.1087 +/*
  1.1088 + * Flag values passed to command-related procedures.
  1.1089 + */
  1.1090 +
  1.1091 +#define TCL_TRACE_RENAME 0x2000
  1.1092 +#define TCL_TRACE_DELETE 0x4000
  1.1093 +
  1.1094 +#define TCL_ALLOW_INLINE_COMPILATION 0x20000
  1.1095 +
  1.1096 +/*
  1.1097 + * Flag values passed to Tcl_CreateObjTrace, and used internally
  1.1098 + * by command execution traces.  Slots 4,8,16 and 32 are
  1.1099 + * used internally by execution traces (see tclCmdMZ.c)
  1.1100 + */
  1.1101 +#define TCL_TRACE_ENTER_EXEC		1
  1.1102 +#define TCL_TRACE_LEAVE_EXEC		2
  1.1103 +
  1.1104 +/*
  1.1105 + * The TCL_PARSE_PART1 flag is deprecated and has no effect. 
  1.1106 + * The part1 is now always parsed whenever the part2 is NULL.
  1.1107 + * (This is to avoid a common error when converting code to
  1.1108 + *  use the new object based APIs and forgetting to give the
  1.1109 + *  flag)
  1.1110 + */
  1.1111 +#ifndef TCL_NO_DEPRECATED
  1.1112 +#   define TCL_PARSE_PART1      0x400
  1.1113 +#endif
  1.1114 +
  1.1115 +
  1.1116 +/*
  1.1117 + * Types for linked variables:
  1.1118 + */
  1.1119 +#define TCL_LINK_INT		1
  1.1120 +#define TCL_LINK_DOUBLE		2
  1.1121 +#define TCL_LINK_BOOLEAN	3
  1.1122 +#define TCL_LINK_STRING		4
  1.1123 +#define TCL_LINK_WIDE_INT	5
  1.1124 +#define TCL_LINK_READ_ONLY	0x80
  1.1125 +
  1.1126 +
  1.1127 +/*
  1.1128 + * Forward declarations of Tcl_HashTable and related types.
  1.1129 + */
  1.1130 +typedef struct Tcl_HashKeyType Tcl_HashKeyType;
  1.1131 +typedef struct Tcl_HashTable Tcl_HashTable;
  1.1132 +typedef struct Tcl_HashEntry Tcl_HashEntry;
  1.1133 +
  1.1134 +typedef unsigned int (Tcl_HashKeyProc) _ANSI_ARGS_((Tcl_HashTable *tablePtr,
  1.1135 +	VOID *keyPtr));
  1.1136 +typedef int (Tcl_CompareHashKeysProc) _ANSI_ARGS_((VOID *keyPtr,
  1.1137 +	Tcl_HashEntry *hPtr));
  1.1138 +typedef Tcl_HashEntry *(Tcl_AllocHashEntryProc) _ANSI_ARGS_((
  1.1139 +	Tcl_HashTable *tablePtr, VOID *keyPtr));
  1.1140 +typedef void (Tcl_FreeHashEntryProc) _ANSI_ARGS_((Tcl_HashEntry *hPtr));
  1.1141 +
  1.1142 +/*
  1.1143 + * This flag controls whether the hash table stores the hash of a key, or
  1.1144 + * recalculates it. There should be no reason for turning this flag off
  1.1145 + * as it is completely binary and source compatible unless you directly
  1.1146 + * access the bucketPtr member of the Tcl_HashTableEntry structure. This
  1.1147 + * member has been removed and the space used to store the hash value.
  1.1148 + */
  1.1149 +#ifndef TCL_HASH_KEY_STORE_HASH
  1.1150 +#   define TCL_HASH_KEY_STORE_HASH 1
  1.1151 +#endif
  1.1152 +
  1.1153 +/*
  1.1154 + * Structure definition for an entry in a hash table.  No-one outside
  1.1155 + * Tcl should access any of these fields directly;  use the macros
  1.1156 + * defined below.
  1.1157 + */
  1.1158 +
  1.1159 +struct Tcl_HashEntry {
  1.1160 +    Tcl_HashEntry *nextPtr;		/* Pointer to next entry in this
  1.1161 +					 * hash bucket, or NULL for end of
  1.1162 +					 * chain. */
  1.1163 +    Tcl_HashTable *tablePtr;		/* Pointer to table containing entry. */
  1.1164 +#if TCL_HASH_KEY_STORE_HASH
  1.1165 +#   if TCL_PRESERVE_BINARY_COMPATABILITY
  1.1166 +    VOID *hash;				/* Hash value, stored as pointer to
  1.1167 +					 * ensure that the offsets of the
  1.1168 +					 * fields in this structure are not
  1.1169 +					 * changed. */
  1.1170 +#   else
  1.1171 +    unsigned int hash;			/* Hash value. */
  1.1172 +#   endif
  1.1173 +#else
  1.1174 +    Tcl_HashEntry **bucketPtr;		/* Pointer to bucket that points to
  1.1175 +					 * first entry in this entry's chain:
  1.1176 +					 * used for deleting the entry. */
  1.1177 +#endif
  1.1178 +    ClientData clientData;		/* Application stores something here
  1.1179 +					 * with Tcl_SetHashValue. */
  1.1180 +    union {				/* Key has one of these forms: */
  1.1181 +	char *oneWordValue;		/* One-word value for key. */
  1.1182 +        Tcl_Obj *objPtr;		/* Tcl_Obj * key value. */
  1.1183 +	int words[1];			/* Multiple integer words for key.
  1.1184 +					 * The actual size will be as large
  1.1185 +					 * as necessary for this table's
  1.1186 +					 * keys. */
  1.1187 +	char string[4];			/* String for key.  The actual size
  1.1188 +					 * will be as large as needed to hold
  1.1189 +					 * the key. */
  1.1190 +    } key;				/* MUST BE LAST FIELD IN RECORD!! */
  1.1191 +};
  1.1192 +
  1.1193 +/*
  1.1194 + * Flags used in Tcl_HashKeyType.
  1.1195 + *
  1.1196 + * TCL_HASH_KEY_RANDOMIZE_HASH:
  1.1197 + *				There are some things, pointers for example
  1.1198 + *				which don't hash well because they do not use
  1.1199 + *				the lower bits. If this flag is set then the
  1.1200 + *				hash table will attempt to rectify this by
  1.1201 + *				randomising the bits and then using the upper
  1.1202 + *				N bits as the index into the table.
  1.1203 + */
  1.1204 +#define TCL_HASH_KEY_RANDOMIZE_HASH 0x1
  1.1205 +
  1.1206 +/*
  1.1207 + * Structure definition for the methods associated with a hash table
  1.1208 + * key type.
  1.1209 + */
  1.1210 +#define TCL_HASH_KEY_TYPE_VERSION 1
  1.1211 +struct Tcl_HashKeyType {
  1.1212 +    int version;		/* Version of the table. If this structure is
  1.1213 +				 * extended in future then the version can be
  1.1214 +				 * used to distinguish between different
  1.1215 +				 * structures. 
  1.1216 +				 */
  1.1217 +
  1.1218 +    int flags;			/* Flags, see above for details. */
  1.1219 +
  1.1220 +    /* Calculates a hash value for the key. If this is NULL then the pointer
  1.1221 +     * itself is used as a hash value.
  1.1222 +     */
  1.1223 +    Tcl_HashKeyProc *hashKeyProc;
  1.1224 +
  1.1225 +    /* Compares two keys and returns zero if they do not match, and non-zero
  1.1226 +     * if they do. If this is NULL then the pointers are compared.
  1.1227 +     */
  1.1228 +    Tcl_CompareHashKeysProc *compareKeysProc;
  1.1229 +
  1.1230 +    /* Called to allocate memory for a new entry, i.e. if the key is a
  1.1231 +     * string then this could allocate a single block which contains enough
  1.1232 +     * space for both the entry and the string. Only the key field of the
  1.1233 +     * allocated Tcl_HashEntry structure needs to be filled in. If something
  1.1234 +     * else needs to be done to the key, i.e. incrementing a reference count
  1.1235 +     * then that should be done by this function. If this is NULL then Tcl_Alloc
  1.1236 +     * is used to allocate enough space for a Tcl_HashEntry and the key pointer
  1.1237 +     * is assigned to key.oneWordValue.
  1.1238 +     */
  1.1239 +    Tcl_AllocHashEntryProc *allocEntryProc;
  1.1240 +
  1.1241 +    /* Called to free memory associated with an entry. If something else needs
  1.1242 +     * to be done to the key, i.e. decrementing a reference count then that
  1.1243 +     * should be done by this function. If this is NULL then Tcl_Free is used
  1.1244 +     * to free the Tcl_HashEntry.
  1.1245 +     */
  1.1246 +    Tcl_FreeHashEntryProc *freeEntryProc;
  1.1247 +};
  1.1248 +
  1.1249 +/*
  1.1250 + * Structure definition for a hash table.  Must be in tcl.h so clients
  1.1251 + * can allocate space for these structures, but clients should never
  1.1252 + * access any fields in this structure.
  1.1253 + */
  1.1254 +
  1.1255 +#define TCL_SMALL_HASH_TABLE 4
  1.1256 +struct Tcl_HashTable {
  1.1257 +    Tcl_HashEntry **buckets;		/* Pointer to bucket array.  Each
  1.1258 +					 * element points to first entry in
  1.1259 +					 * bucket's hash chain, or NULL. */
  1.1260 +    Tcl_HashEntry *staticBuckets[TCL_SMALL_HASH_TABLE];
  1.1261 +					/* Bucket array used for small tables
  1.1262 +					 * (to avoid mallocs and frees). */
  1.1263 +    int numBuckets;			/* Total number of buckets allocated
  1.1264 +					 * at **bucketPtr. */
  1.1265 +    int numEntries;			/* Total number of entries present
  1.1266 +					 * in table. */
  1.1267 +    int rebuildSize;			/* Enlarge table when numEntries gets
  1.1268 +					 * to be this large. */
  1.1269 +    int downShift;			/* Shift count used in hashing
  1.1270 +					 * function.  Designed to use high-
  1.1271 +					 * order bits of randomized keys. */
  1.1272 +    int mask;				/* Mask value used in hashing
  1.1273 +					 * function. */
  1.1274 +    int keyType;			/* Type of keys used in this table. 
  1.1275 +					 * It's either TCL_CUSTOM_KEYS,
  1.1276 +					 * TCL_STRING_KEYS, TCL_ONE_WORD_KEYS,
  1.1277 +					 * or an integer giving the number of
  1.1278 +					 * ints that is the size of the key.
  1.1279 +					 */
  1.1280 +#if TCL_PRESERVE_BINARY_COMPATABILITY
  1.1281 +    Tcl_HashEntry *(*findProc) _ANSI_ARGS_((Tcl_HashTable *tablePtr,
  1.1282 +	    CONST char *key));
  1.1283 +    Tcl_HashEntry *(*createProc) _ANSI_ARGS_((Tcl_HashTable *tablePtr,
  1.1284 +	    CONST char *key, int *newPtr));
  1.1285 +#endif
  1.1286 +    Tcl_HashKeyType *typePtr;		/* Type of the keys used in the
  1.1287 +					 * Tcl_HashTable. */
  1.1288 +};
  1.1289 +
  1.1290 +/*
  1.1291 + * Structure definition for information used to keep track of searches
  1.1292 + * through hash tables:
  1.1293 + */
  1.1294 +
  1.1295 +typedef struct Tcl_HashSearch {
  1.1296 +    Tcl_HashTable *tablePtr;		/* Table being searched. */
  1.1297 +    int nextIndex;			/* Index of next bucket to be
  1.1298 +					 * enumerated after present one. */
  1.1299 +    Tcl_HashEntry *nextEntryPtr;	/* Next entry to be enumerated in the
  1.1300 +					 * the current bucket. */
  1.1301 +} Tcl_HashSearch;
  1.1302 +
  1.1303 +/*
  1.1304 + * Acceptable key types for hash tables:
  1.1305 + *
  1.1306 + * TCL_STRING_KEYS:		The keys are strings, they are copied into
  1.1307 + *				the entry.
  1.1308 + * TCL_ONE_WORD_KEYS:		The keys are pointers, the pointer is stored
  1.1309 + *				in the entry.
  1.1310 + * TCL_CUSTOM_TYPE_KEYS:	The keys are arbitrary types which are copied
  1.1311 + *				into the entry.
  1.1312 + * TCL_CUSTOM_PTR_KEYS:		The keys are pointers to arbitrary types, the
  1.1313 + *				pointer is stored in the entry.
  1.1314 + *
  1.1315 + * While maintaining binary compatability the above have to be distinct
  1.1316 + * values as they are used to differentiate between old versions of the
  1.1317 + * hash table which don't have a typePtr and new ones which do. Once binary
  1.1318 + * compatability is discarded in favour of making more wide spread changes
  1.1319 + * TCL_STRING_KEYS can be the same as TCL_CUSTOM_TYPE_KEYS, and
  1.1320 + * TCL_ONE_WORD_KEYS can be the same as TCL_CUSTOM_PTR_KEYS because they
  1.1321 + * simply determine how the key is accessed from the entry and not the
  1.1322 + * behaviour.
  1.1323 + */
  1.1324 +
  1.1325 +#define TCL_STRING_KEYS		0
  1.1326 +#define TCL_ONE_WORD_KEYS	1
  1.1327 +
  1.1328 +#if TCL_PRESERVE_BINARY_COMPATABILITY
  1.1329 +#   define TCL_CUSTOM_TYPE_KEYS		-2
  1.1330 +#   define TCL_CUSTOM_PTR_KEYS		-1
  1.1331 +#else
  1.1332 +#   define TCL_CUSTOM_TYPE_KEYS		TCL_STRING_KEYS
  1.1333 +#   define TCL_CUSTOM_PTR_KEYS		TCL_ONE_WORD_KEYS
  1.1334 +#endif
  1.1335 +
  1.1336 +/*
  1.1337 + * Macros for clients to use to access fields of hash entries:
  1.1338 + */
  1.1339 +
  1.1340 +#define Tcl_GetHashValue(h) ((h)->clientData)
  1.1341 +#define Tcl_SetHashValue(h, value) ((h)->clientData = (ClientData) (value))
  1.1342 +#if TCL_PRESERVE_BINARY_COMPATABILITY
  1.1343 +#   define Tcl_GetHashKey(tablePtr, h) \
  1.1344 +	((char *) (((tablePtr)->keyType == TCL_ONE_WORD_KEYS || \
  1.1345 +		    (tablePtr)->keyType == TCL_CUSTOM_PTR_KEYS) \
  1.1346 +		   ? (h)->key.oneWordValue \
  1.1347 +		   : (h)->key.string))
  1.1348 +#else
  1.1349 +#   define Tcl_GetHashKey(tablePtr, h) \
  1.1350 +	((char *) (((tablePtr)->keyType == TCL_ONE_WORD_KEYS) \
  1.1351 +		   ? (h)->key.oneWordValue \
  1.1352 +		   : (h)->key.string))
  1.1353 +#endif
  1.1354 +
  1.1355 +/*
  1.1356 + * Macros to use for clients to use to invoke find and create procedures
  1.1357 + * for hash tables:
  1.1358 + */
  1.1359 +
  1.1360 +#if TCL_PRESERVE_BINARY_COMPATABILITY
  1.1361 +#   define Tcl_FindHashEntry(tablePtr, key) \
  1.1362 +	(*((tablePtr)->findProc))(tablePtr, key)
  1.1363 +#   define Tcl_CreateHashEntry(tablePtr, key, newPtr) \
  1.1364 +	(*((tablePtr)->createProc))(tablePtr, key, newPtr)
  1.1365 +#else /* !TCL_PRESERVE_BINARY_COMPATABILITY */
  1.1366 +/*
  1.1367 + * Macro to use new extended version of Tcl_InitHashTable.
  1.1368 + */
  1.1369 +#   define Tcl_InitHashTable(tablePtr, keyType) \
  1.1370 +	Tcl_InitHashTableEx(tablePtr, keyType, NULL)
  1.1371 +#endif /* TCL_PRESERVE_BINARY_COMPATABILITY */
  1.1372 +
  1.1373 +
  1.1374 +/*
  1.1375 + * Flag values to pass to Tcl_DoOneEvent to disable searches
  1.1376 + * for some kinds of events:
  1.1377 + */
  1.1378 +#define TCL_DONT_WAIT		(1<<1)
  1.1379 +#define TCL_WINDOW_EVENTS	(1<<2)
  1.1380 +#define TCL_FILE_EVENTS		(1<<3)
  1.1381 +#define TCL_TIMER_EVENTS	(1<<4)
  1.1382 +#define TCL_IDLE_EVENTS		(1<<5)	/* WAS 0x10 ???? */
  1.1383 +#define TCL_ALL_EVENTS		(~TCL_DONT_WAIT)
  1.1384 +
  1.1385 +/*
  1.1386 + * The following structure defines a generic event for the Tcl event
  1.1387 + * system.  These are the things that are queued in calls to Tcl_QueueEvent
  1.1388 + * and serviced later by Tcl_DoOneEvent.  There can be many different
  1.1389 + * kinds of events with different fields, corresponding to window events,
  1.1390 + * timer events, etc.  The structure for a particular event consists of
  1.1391 + * a Tcl_Event header followed by additional information specific to that
  1.1392 + * event.
  1.1393 + */
  1.1394 +struct Tcl_Event {
  1.1395 +    Tcl_EventProc *proc;	/* Procedure to call to service this event. */
  1.1396 +    struct Tcl_Event *nextPtr;	/* Next in list of pending events, or NULL. */
  1.1397 +};
  1.1398 +
  1.1399 +/*
  1.1400 + * Positions to pass to Tcl_QueueEvent:
  1.1401 + */
  1.1402 +typedef enum {
  1.1403 +    TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, TCL_QUEUE_MARK
  1.1404 +} Tcl_QueuePosition;
  1.1405 +
  1.1406 +/*
  1.1407 + * Values to pass to Tcl_SetServiceMode to specify the behavior of notifier
  1.1408 + * event routines.
  1.1409 + */
  1.1410 +#define TCL_SERVICE_NONE 0
  1.1411 +#define TCL_SERVICE_ALL 1
  1.1412 +
  1.1413 +
  1.1414 +/*
  1.1415 + * The following structure keeps is used to hold a time value, either as
  1.1416 + * an absolute time (the number of seconds from the epoch) or as an
  1.1417 + * elapsed time. On Unix systems the epoch is Midnight Jan 1, 1970 GMT.
  1.1418 + * On Macintosh systems the epoch is Midnight Jan 1, 1904 GMT.
  1.1419 + */
  1.1420 +typedef struct Tcl_Time {
  1.1421 +    long sec;			/* Seconds. */
  1.1422 +    long usec;			/* Microseconds. */
  1.1423 +} Tcl_Time;
  1.1424 +
  1.1425 +typedef void (Tcl_SetTimerProc) _ANSI_ARGS_((Tcl_Time *timePtr));
  1.1426 +typedef int (Tcl_WaitForEventProc) _ANSI_ARGS_((Tcl_Time *timePtr));
  1.1427 +
  1.1428 +
  1.1429 +/*
  1.1430 + * Bits to pass to Tcl_CreateFileHandler and Tcl_CreateChannelHandler
  1.1431 + * to indicate what sorts of events are of interest:
  1.1432 + */
  1.1433 +#define TCL_READABLE	(1<<1)
  1.1434 +#define TCL_WRITABLE	(1<<2)
  1.1435 +#define TCL_EXCEPTION	(1<<3)
  1.1436 +
  1.1437 +/*
  1.1438 + * Flag values to pass to Tcl_OpenCommandChannel to indicate the
  1.1439 + * disposition of the stdio handles.  TCL_STDIN, TCL_STDOUT, TCL_STDERR,
  1.1440 + * are also used in Tcl_GetStdChannel.
  1.1441 + */
  1.1442 +#define TCL_STDIN		(1<<1)	
  1.1443 +#define TCL_STDOUT		(1<<2)
  1.1444 +#define TCL_STDERR		(1<<3)
  1.1445 +#define TCL_ENFORCE_MODE	(1<<4)
  1.1446 +
  1.1447 +/*
  1.1448 + * Bits passed to Tcl_DriverClose2Proc to indicate which side of a channel
  1.1449 + * should be closed.
  1.1450 + */
  1.1451 +#define TCL_CLOSE_READ	(1<<1)
  1.1452 +#define TCL_CLOSE_WRITE	(1<<2)
  1.1453 +
  1.1454 +/*
  1.1455 + * Value to use as the closeProc for a channel that supports the
  1.1456 + * close2Proc interface.
  1.1457 + */
  1.1458 +#define TCL_CLOSE2PROC	((Tcl_DriverCloseProc *)1)
  1.1459 +
  1.1460 +/*
  1.1461 + * Channel version tag.  This was introduced in 8.3.2/8.4.
  1.1462 + */
  1.1463 +#define TCL_CHANNEL_VERSION_1	((Tcl_ChannelTypeVersion) 0x1)
  1.1464 +#define TCL_CHANNEL_VERSION_2	((Tcl_ChannelTypeVersion) 0x2)
  1.1465 +#define TCL_CHANNEL_VERSION_3	((Tcl_ChannelTypeVersion) 0x3)
  1.1466 +#define TCL_CHANNEL_VERSION_4	((Tcl_ChannelTypeVersion) 0x4)
  1.1467 +
  1.1468 +/*
  1.1469 + * TIP #218: Channel Actions, Ids for Tcl_DriverThreadActionProc
  1.1470 + */
  1.1471 +
  1.1472 +#define TCL_CHANNEL_THREAD_INSERT (0)
  1.1473 +#define TCL_CHANNEL_THREAD_REMOVE (1)
  1.1474 +
  1.1475 +/*
  1.1476 + * Typedefs for the various operations in a channel type:
  1.1477 + */
  1.1478 +typedef int	(Tcl_DriverBlockModeProc) _ANSI_ARGS_((
  1.1479 +		    ClientData instanceData, int mode));
  1.1480 +typedef int	(Tcl_DriverCloseProc) _ANSI_ARGS_((ClientData instanceData,
  1.1481 +		    Tcl_Interp *interp));
  1.1482 +typedef int	(Tcl_DriverClose2Proc) _ANSI_ARGS_((ClientData instanceData,
  1.1483 +		    Tcl_Interp *interp, int flags));
  1.1484 +typedef int	(Tcl_DriverInputProc) _ANSI_ARGS_((ClientData instanceData,
  1.1485 +		    char *buf, int toRead, int *errorCodePtr));
  1.1486 +typedef int	(Tcl_DriverOutputProc) _ANSI_ARGS_((ClientData instanceData,
  1.1487 +		    CONST84 char *buf, int toWrite, int *errorCodePtr));
  1.1488 +typedef int	(Tcl_DriverSeekProc) _ANSI_ARGS_((ClientData instanceData,
  1.1489 +		    long offset, int mode, int *errorCodePtr));
  1.1490 +typedef int	(Tcl_DriverSetOptionProc) _ANSI_ARGS_((
  1.1491 +		    ClientData instanceData, Tcl_Interp *interp,
  1.1492 +	            CONST char *optionName, CONST char *value));
  1.1493 +typedef int	(Tcl_DriverGetOptionProc) _ANSI_ARGS_((
  1.1494 +		    ClientData instanceData, Tcl_Interp *interp,
  1.1495 +		    CONST84 char *optionName, Tcl_DString *dsPtr));
  1.1496 +typedef void	(Tcl_DriverWatchProc) _ANSI_ARGS_((
  1.1497 +		    ClientData instanceData, int mask));
  1.1498 +typedef int	(Tcl_DriverGetHandleProc) _ANSI_ARGS_((
  1.1499 +		    ClientData instanceData, int direction,
  1.1500 +		    ClientData *handlePtr));
  1.1501 +typedef int	(Tcl_DriverFlushProc) _ANSI_ARGS_((
  1.1502 +		    ClientData instanceData));
  1.1503 +typedef int	(Tcl_DriverHandlerProc) _ANSI_ARGS_((
  1.1504 +		    ClientData instanceData, int interestMask));
  1.1505 +typedef Tcl_WideInt (Tcl_DriverWideSeekProc) _ANSI_ARGS_((
  1.1506 +		    ClientData instanceData, Tcl_WideInt offset,
  1.1507 +		    int mode, int *errorCodePtr));
  1.1508 +
  1.1509 +  /* TIP #218, Channel Thread Actions */
  1.1510 +typedef void     (Tcl_DriverThreadActionProc) _ANSI_ARGS_ ((
  1.1511 +		    ClientData instanceData, int action));
  1.1512 +
  1.1513 +/*
  1.1514 + * The following declarations either map ckalloc and ckfree to
  1.1515 + * malloc and free, or they map them to procedures with all sorts
  1.1516 + * of debugging hooks defined in tclCkalloc.c.
  1.1517 + */
  1.1518 +#ifdef TCL_MEM_DEBUG
  1.1519 +
  1.1520 +#   define ckalloc(x) Tcl_DbCkalloc(x, __FILE__, __LINE__)
  1.1521 +#   define ckfree(x)  Tcl_DbCkfree(x, __FILE__, __LINE__)
  1.1522 +#   define ckrealloc(x,y) Tcl_DbCkrealloc((x), (y),__FILE__, __LINE__)
  1.1523 +#   define attemptckalloc(x) Tcl_AttemptDbCkalloc(x, __FILE__, __LINE__)
  1.1524 +#   define attemptckrealloc(x,y) Tcl_AttemptDbCkrealloc((x), (y), __FILE__, __LINE__)
  1.1525 +#else /* !TCL_MEM_DEBUG */
  1.1526 +
  1.1527 +/*
  1.1528 + * If we are not using the debugging allocator, we should call the 
  1.1529 + * Tcl_Alloc, et al. routines in order to guarantee that every module
  1.1530 + * is using the same memory allocator both inside and outside of the
  1.1531 + * Tcl library.
  1.1532 + */
  1.1533 +#   define ckalloc(x) Tcl_Alloc(x)
  1.1534 +#   define ckfree(x) Tcl_Free(x)
  1.1535 +#   define ckrealloc(x,y) Tcl_Realloc(x,y)
  1.1536 +#   define attemptckalloc(x) Tcl_AttemptAlloc(x)
  1.1537 +#   define attemptckrealloc(x,y) Tcl_AttemptRealloc(x,y)
  1.1538 +#   define Tcl_InitMemory(x)
  1.1539 +#   define Tcl_DumpActiveMemory(x)
  1.1540 +#   define Tcl_ValidateAllMemory(x,y)
  1.1541 +
  1.1542 +#endif /* !TCL_MEM_DEBUG */
  1.1543 +
  1.1544 +/*
  1.1545 + * struct Tcl_ChannelType:
  1.1546 + *
  1.1547 + * One such structure exists for each type (kind) of channel.
  1.1548 + * It collects together in one place all the functions that are
  1.1549 + * part of the specific channel type.
  1.1550 + *
  1.1551 + * It is recommend that the Tcl_Channel* functions are used to access
  1.1552 + * elements of this structure, instead of direct accessing.
  1.1553 + */
  1.1554 +typedef struct Tcl_ChannelType {
  1.1555 +    char *typeName;			/* The name of the channel type in Tcl
  1.1556 +                                         * commands. This storage is owned by
  1.1557 +                                         * channel type. */
  1.1558 +    Tcl_ChannelTypeVersion version;	/* Version of the channel type. */
  1.1559 +    Tcl_DriverCloseProc *closeProc;	/* Procedure to call to close the
  1.1560 +					 * channel, or TCL_CLOSE2PROC if the
  1.1561 +					 * close2Proc should be used
  1.1562 +					 * instead. */
  1.1563 +    Tcl_DriverInputProc *inputProc;	/* Procedure to call for input
  1.1564 +					 * on channel. */
  1.1565 +    Tcl_DriverOutputProc *outputProc;	/* Procedure to call for output
  1.1566 +					 * on channel. */
  1.1567 +    Tcl_DriverSeekProc *seekProc;	/* Procedure to call to seek
  1.1568 +					 * on the channel. May be NULL. */
  1.1569 +    Tcl_DriverSetOptionProc *setOptionProc;
  1.1570 +					/* Set an option on a channel. */
  1.1571 +    Tcl_DriverGetOptionProc *getOptionProc;
  1.1572 +					/* Get an option from a channel. */
  1.1573 +    Tcl_DriverWatchProc *watchProc;	/* Set up the notifier to watch
  1.1574 +					 * for events on this channel. */
  1.1575 +    Tcl_DriverGetHandleProc *getHandleProc;
  1.1576 +					/* Get an OS handle from the channel
  1.1577 +					 * or NULL if not supported. */
  1.1578 +    Tcl_DriverClose2Proc *close2Proc;	/* Procedure to call to close the
  1.1579 +					 * channel if the device supports
  1.1580 +					 * closing the read & write sides
  1.1581 +					 * independently. */
  1.1582 +    Tcl_DriverBlockModeProc *blockModeProc;
  1.1583 +					/* Set blocking mode for the
  1.1584 +					 * raw channel. May be NULL. */
  1.1585 +    /*
  1.1586 +     * Only valid in TCL_CHANNEL_VERSION_2 channels or later
  1.1587 +     */
  1.1588 +    Tcl_DriverFlushProc *flushProc;	/* Procedure to call to flush a
  1.1589 +					 * channel. May be NULL. */
  1.1590 +    Tcl_DriverHandlerProc *handlerProc;	/* Procedure to call to handle a
  1.1591 +					 * channel event.  This will be passed
  1.1592 +					 * up the stacked channel chain. */
  1.1593 +    /*
  1.1594 +     * Only valid in TCL_CHANNEL_VERSION_3 channels or later
  1.1595 +     */
  1.1596 +    Tcl_DriverWideSeekProc *wideSeekProc;
  1.1597 +					/* Procedure to call to seek
  1.1598 +					 * on the channel which can
  1.1599 +					 * handle 64-bit offsets. May be
  1.1600 +					 * NULL, and must be NULL if
  1.1601 +					 * seekProc is NULL. */
  1.1602 +
  1.1603 +     /*
  1.1604 +      * Only valid in TCL_CHANNEL_VERSION_4 channels or later
  1.1605 +      * TIP #218, Channel Thread Actions
  1.1606 +      */
  1.1607 +     Tcl_DriverThreadActionProc *threadActionProc;
  1.1608 + 					/* Procedure to call to notify
  1.1609 + 					 * the driver of thread specific
  1.1610 + 					 * activity for a channel.
  1.1611 +					 * May be NULL. */
  1.1612 +} Tcl_ChannelType;
  1.1613 +
  1.1614 +/*
  1.1615 + * The following flags determine whether the blockModeProc above should
  1.1616 + * set the channel into blocking or nonblocking mode. They are passed
  1.1617 + * as arguments to the blockModeProc procedure in the above structure.
  1.1618 + */
  1.1619 +#define TCL_MODE_BLOCKING	0	/* Put channel into blocking mode. */
  1.1620 +#define TCL_MODE_NONBLOCKING	1	/* Put channel into nonblocking
  1.1621 +					 * mode. */
  1.1622 +
  1.1623 +/*
  1.1624 + * Enum for different types of file paths.
  1.1625 + */
  1.1626 +typedef enum Tcl_PathType {
  1.1627 +    TCL_PATH_ABSOLUTE,
  1.1628 +    TCL_PATH_RELATIVE,
  1.1629 +    TCL_PATH_VOLUME_RELATIVE
  1.1630 +} Tcl_PathType;
  1.1631 +
  1.1632 +
  1.1633 +/* 
  1.1634 + * The following structure is used to pass glob type data amongst
  1.1635 + * the various glob routines and Tcl_FSMatchInDirectory.
  1.1636 + */
  1.1637 +typedef struct Tcl_GlobTypeData {
  1.1638 +    /* Corresponds to bcdpfls as in 'find -t' */
  1.1639 +    int type;
  1.1640 +    /* Corresponds to file permissions */
  1.1641 +    int perm;
  1.1642 +    /* Acceptable mac type */
  1.1643 +    Tcl_Obj* macType;
  1.1644 +    /* Acceptable mac creator */
  1.1645 +    Tcl_Obj* macCreator;
  1.1646 +} Tcl_GlobTypeData;
  1.1647 +
  1.1648 +/*
  1.1649 + * type and permission definitions for glob command
  1.1650 + */
  1.1651 +#define TCL_GLOB_TYPE_BLOCK		(1<<0)
  1.1652 +#define TCL_GLOB_TYPE_CHAR		(1<<1)
  1.1653 +#define TCL_GLOB_TYPE_DIR		(1<<2)
  1.1654 +#define TCL_GLOB_TYPE_PIPE		(1<<3)
  1.1655 +#define TCL_GLOB_TYPE_FILE		(1<<4)
  1.1656 +#define TCL_GLOB_TYPE_LINK		(1<<5)
  1.1657 +#define TCL_GLOB_TYPE_SOCK		(1<<6)
  1.1658 +#define TCL_GLOB_TYPE_MOUNT		(1<<7)
  1.1659 +
  1.1660 +#define TCL_GLOB_PERM_RONLY		(1<<0)
  1.1661 +#define TCL_GLOB_PERM_HIDDEN		(1<<1)
  1.1662 +#define TCL_GLOB_PERM_R			(1<<2)
  1.1663 +#define TCL_GLOB_PERM_W			(1<<3)
  1.1664 +#define TCL_GLOB_PERM_X			(1<<4)
  1.1665 +
  1.1666 +
  1.1667 +/*
  1.1668 + * Typedefs for the various filesystem operations:
  1.1669 + */
  1.1670 +typedef int (Tcl_FSStatProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, Tcl_StatBuf *buf));
  1.1671 +typedef int (Tcl_FSAccessProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, int mode));
  1.1672 +typedef Tcl_Channel (Tcl_FSOpenFileChannelProc) 
  1.1673 +	_ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *pathPtr, 
  1.1674 +	int mode, int permissions));
  1.1675 +typedef int (Tcl_FSMatchInDirectoryProc) _ANSI_ARGS_((Tcl_Interp* interp, 
  1.1676 +	Tcl_Obj *result, Tcl_Obj *pathPtr, CONST char *pattern, 
  1.1677 +	Tcl_GlobTypeData * types));
  1.1678 +typedef Tcl_Obj* (Tcl_FSGetCwdProc) _ANSI_ARGS_((Tcl_Interp *interp));
  1.1679 +typedef int (Tcl_FSChdirProc) _ANSI_ARGS_((Tcl_Obj *pathPtr));
  1.1680 +typedef int (Tcl_FSLstatProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, 
  1.1681 +					   Tcl_StatBuf *buf));
  1.1682 +typedef int (Tcl_FSCreateDirectoryProc) _ANSI_ARGS_((Tcl_Obj *pathPtr));
  1.1683 +typedef int (Tcl_FSDeleteFileProc) _ANSI_ARGS_((Tcl_Obj *pathPtr));
  1.1684 +typedef int (Tcl_FSCopyDirectoryProc) _ANSI_ARGS_((Tcl_Obj *srcPathPtr,
  1.1685 +	   Tcl_Obj *destPathPtr, Tcl_Obj **errorPtr));
  1.1686 +typedef int (Tcl_FSCopyFileProc) _ANSI_ARGS_((Tcl_Obj *srcPathPtr,
  1.1687 +			    Tcl_Obj *destPathPtr));
  1.1688 +typedef int (Tcl_FSRemoveDirectoryProc) _ANSI_ARGS_((Tcl_Obj *pathPtr,
  1.1689 +			    int recursive, Tcl_Obj **errorPtr));
  1.1690 +typedef int (Tcl_FSRenameFileProc) _ANSI_ARGS_((Tcl_Obj *srcPathPtr,
  1.1691 +			    Tcl_Obj *destPathPtr));
  1.1692 +typedef void (Tcl_FSUnloadFileProc) _ANSI_ARGS_((Tcl_LoadHandle loadHandle));
  1.1693 +typedef Tcl_Obj* (Tcl_FSListVolumesProc) _ANSI_ARGS_((void));
  1.1694 +/* We have to declare the utime structure here. */
  1.1695 +struct utimbuf;
  1.1696 +typedef int (Tcl_FSUtimeProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, 
  1.1697 +					   struct utimbuf *tval));
  1.1698 +typedef int (Tcl_FSNormalizePathProc) _ANSI_ARGS_((Tcl_Interp *interp, 
  1.1699 +			 Tcl_Obj *pathPtr, int nextCheckpoint));
  1.1700 +typedef int (Tcl_FSFileAttrsGetProc) _ANSI_ARGS_((Tcl_Interp *interp,
  1.1701 +			    int index, Tcl_Obj *pathPtr,
  1.1702 +			    Tcl_Obj **objPtrRef));
  1.1703 +typedef CONST char** (Tcl_FSFileAttrStringsProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, 
  1.1704 +			    Tcl_Obj** objPtrRef));
  1.1705 +typedef int (Tcl_FSFileAttrsSetProc) _ANSI_ARGS_((Tcl_Interp *interp,
  1.1706 +			    int index, Tcl_Obj *pathPtr,
  1.1707 +			    Tcl_Obj *objPtr));
  1.1708 +typedef Tcl_Obj* (Tcl_FSLinkProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, 
  1.1709 +					       Tcl_Obj *toPtr, int linkType));
  1.1710 +typedef int (Tcl_FSLoadFileProc) _ANSI_ARGS_((Tcl_Interp * interp, 
  1.1711 +			    Tcl_Obj *pathPtr,
  1.1712 +			    Tcl_LoadHandle *handlePtr,
  1.1713 +			    Tcl_FSUnloadFileProc **unloadProcPtr));
  1.1714 +typedef int (Tcl_FSPathInFilesystemProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, 
  1.1715 +			    ClientData *clientDataPtr));
  1.1716 +typedef Tcl_Obj* (Tcl_FSFilesystemPathTypeProc) 
  1.1717 +			    _ANSI_ARGS_((Tcl_Obj *pathPtr));
  1.1718 +typedef Tcl_Obj* (Tcl_FSFilesystemSeparatorProc) 
  1.1719 +			    _ANSI_ARGS_((Tcl_Obj *pathPtr));
  1.1720 +typedef void (Tcl_FSFreeInternalRepProc) _ANSI_ARGS_((ClientData clientData));
  1.1721 +typedef ClientData (Tcl_FSDupInternalRepProc) 
  1.1722 +			    _ANSI_ARGS_((ClientData clientData));
  1.1723 +typedef Tcl_Obj* (Tcl_FSInternalToNormalizedProc) 
  1.1724 +			    _ANSI_ARGS_((ClientData clientData));
  1.1725 +typedef ClientData (Tcl_FSCreateInternalRepProc) _ANSI_ARGS_((Tcl_Obj *pathPtr));
  1.1726 +
  1.1727 +typedef struct Tcl_FSVersion_ *Tcl_FSVersion;
  1.1728 +
  1.1729 +/*
  1.1730 + *----------------------------------------------------------------
  1.1731 + * Data structures related to hooking into the filesystem
  1.1732 + *----------------------------------------------------------------
  1.1733 + */
  1.1734 +
  1.1735 +/*
  1.1736 + * Filesystem version tag.  This was introduced in 8.4.
  1.1737 + */
  1.1738 +#define TCL_FILESYSTEM_VERSION_1	((Tcl_FSVersion) 0x1)
  1.1739 +
  1.1740 +/*
  1.1741 + * struct Tcl_Filesystem:
  1.1742 + *
  1.1743 + * One such structure exists for each type (kind) of filesystem.
  1.1744 + * It collects together in one place all the functions that are
  1.1745 + * part of the specific filesystem.  Tcl always accesses the
  1.1746 + * filesystem through one of these structures.
  1.1747 + * 
  1.1748 + * Not all entries need be non-NULL; any which are NULL are simply
  1.1749 + * ignored.  However, a complete filesystem should provide all of
  1.1750 + * these functions.  The explanations in the structure show
  1.1751 + * the importance of each function.
  1.1752 + */
  1.1753 +
  1.1754 +typedef struct Tcl_Filesystem {
  1.1755 +    CONST char *typeName;   /* The name of the filesystem. */
  1.1756 +    int structureLength;    /* Length of this structure, so future
  1.1757 +			     * binary compatibility can be assured. */
  1.1758 +    Tcl_FSVersion version;  
  1.1759 +			    /* Version of the filesystem type. */
  1.1760 +    Tcl_FSPathInFilesystemProc *pathInFilesystemProc;
  1.1761 +			    /* Function to check whether a path is in 
  1.1762 +			     * this filesystem.  This is the most
  1.1763 +			     * important filesystem procedure. */
  1.1764 +    Tcl_FSDupInternalRepProc *dupInternalRepProc;
  1.1765 +			    /* Function to duplicate internal fs rep.  May
  1.1766 +			     * be NULL (but then fs is less efficient). */ 
  1.1767 +    Tcl_FSFreeInternalRepProc *freeInternalRepProc;
  1.1768 +			    /* Function to free internal fs rep.  Must
  1.1769 +			     * be implemented, if internal representations
  1.1770 +			     * need freeing, otherwise it can be NULL. */ 
  1.1771 +    Tcl_FSInternalToNormalizedProc *internalToNormalizedProc;
  1.1772 +			    /* Function to convert internal representation
  1.1773 +			     * to a normalized path.  Only required if
  1.1774 +			     * the fs creates pure path objects with no
  1.1775 +			     * string/path representation. */
  1.1776 +    Tcl_FSCreateInternalRepProc *createInternalRepProc;
  1.1777 +			    /* Function to create a filesystem-specific
  1.1778 +			     * internal representation.  May be NULL
  1.1779 +			     * if paths have no internal representation, 
  1.1780 +			     * or if the Tcl_FSPathInFilesystemProc
  1.1781 +			     * for this filesystem always immediately 
  1.1782 +			     * creates an internal representation for 
  1.1783 +			     * paths it accepts. */
  1.1784 +    Tcl_FSNormalizePathProc *normalizePathProc;       
  1.1785 +			    /* Function to normalize a path.  Should
  1.1786 +			     * be implemented for all filesystems
  1.1787 +			     * which can have multiple string 
  1.1788 +			     * representations for the same path 
  1.1789 +			     * object. */
  1.1790 +    Tcl_FSFilesystemPathTypeProc *filesystemPathTypeProc;
  1.1791 +			    /* Function to determine the type of a 
  1.1792 +			     * path in this filesystem.  May be NULL. */
  1.1793 +    Tcl_FSFilesystemSeparatorProc *filesystemSeparatorProc;
  1.1794 +			    /* Function to return the separator 
  1.1795 +			     * character(s) for this filesystem.  Must
  1.1796 +			     * be implemented. */
  1.1797 +    Tcl_FSStatProc *statProc; 
  1.1798 +			    /* 
  1.1799 +			     * Function to process a 'Tcl_FSStat()'
  1.1800 +			     * call.  Must be implemented for any
  1.1801 +			     * reasonable filesystem.
  1.1802 +			     */
  1.1803 +    Tcl_FSAccessProc *accessProc;	    
  1.1804 +			    /* 
  1.1805 +			     * Function to process a 'Tcl_FSAccess()'
  1.1806 +			     * call.  Must be implemented for any
  1.1807 +			     * reasonable filesystem.
  1.1808 +			     */
  1.1809 +    Tcl_FSOpenFileChannelProc *openFileChannelProc; 
  1.1810 +			    /* 
  1.1811 +			     * Function to process a
  1.1812 +			     * 'Tcl_FSOpenFileChannel()' call.  Must be
  1.1813 +			     * implemented for any reasonable
  1.1814 +			     * filesystem.
  1.1815 +			     */
  1.1816 +    Tcl_FSMatchInDirectoryProc *matchInDirectoryProc;  
  1.1817 +			    /* Function to process a 
  1.1818 +			     * 'Tcl_FSMatchInDirectory()'.  If not
  1.1819 +			     * implemented, then glob and recursive
  1.1820 +			     * copy functionality will be lacking in
  1.1821 +			     * the filesystem. */
  1.1822 +    Tcl_FSUtimeProc *utimeProc;       
  1.1823 +			    /* Function to process a 
  1.1824 +			     * 'Tcl_FSUtime()' call.  Required to
  1.1825 +			     * allow setting (not reading) of times 
  1.1826 +			     * with 'file mtime', 'file atime' and
  1.1827 +			     * the open-r/open-w/fcopy implementation
  1.1828 +			     * of 'file copy'. */
  1.1829 +    Tcl_FSLinkProc *linkProc; 
  1.1830 +			    /* Function to process a 
  1.1831 +			     * 'Tcl_FSLink()' call.  Should be
  1.1832 +			     * implemented only if the filesystem supports
  1.1833 +			     * links (reading or creating). */
  1.1834 +    Tcl_FSListVolumesProc *listVolumesProc;	    
  1.1835 +			    /* Function to list any filesystem volumes 
  1.1836 +			     * added by this filesystem.  Should be
  1.1837 +			     * implemented only if the filesystem adds
  1.1838 +			     * volumes at the head of the filesystem. */
  1.1839 +    Tcl_FSFileAttrStringsProc *fileAttrStringsProc;
  1.1840 +			    /* Function to list all attributes strings 
  1.1841 +			     * which are valid for this filesystem.  
  1.1842 +			     * If not implemented the filesystem will
  1.1843 +			     * not support the 'file attributes' command.
  1.1844 +			     * This allows arbitrary additional information
  1.1845 +			     * to be attached to files in the filesystem. */
  1.1846 +    Tcl_FSFileAttrsGetProc *fileAttrsGetProc;
  1.1847 +			    /* Function to process a 
  1.1848 +			     * 'Tcl_FSFileAttrsGet()' call, used by
  1.1849 +			     * 'file attributes'. */
  1.1850 +    Tcl_FSFileAttrsSetProc *fileAttrsSetProc;
  1.1851 +			    /* Function to process a 
  1.1852 +			     * 'Tcl_FSFileAttrsSet()' call, used by
  1.1853 +			     * 'file attributes'.  */
  1.1854 +    Tcl_FSCreateDirectoryProc *createDirectoryProc;	    
  1.1855 +			    /* Function to process a 
  1.1856 +			     * 'Tcl_FSCreateDirectory()' call. Should
  1.1857 +			     * be implemented unless the FS is
  1.1858 +			     * read-only. */
  1.1859 +    Tcl_FSRemoveDirectoryProc *removeDirectoryProc;	    
  1.1860 +			    /* Function to process a 
  1.1861 +			     * 'Tcl_FSRemoveDirectory()' call. Should
  1.1862 +			     * be implemented unless the FS is
  1.1863 +			     * read-only. */
  1.1864 +    Tcl_FSDeleteFileProc *deleteFileProc;	    
  1.1865 +			    /* Function to process a 
  1.1866 +			     * 'Tcl_FSDeleteFile()' call.  Should
  1.1867 +			     * be implemented unless the FS is
  1.1868 +			     * read-only. */
  1.1869 +    Tcl_FSCopyFileProc *copyFileProc; 
  1.1870 +			    /* Function to process a 
  1.1871 +			     * 'Tcl_FSCopyFile()' call.  If not
  1.1872 +			     * implemented Tcl will fall back
  1.1873 +			     * on open-r, open-w and fcopy as
  1.1874 +			     * a copying mechanism, for copying
  1.1875 +			     * actions initiated in Tcl (not C). */
  1.1876 +    Tcl_FSRenameFileProc *renameFileProc;	    
  1.1877 +			    /* Function to process a 
  1.1878 +			     * 'Tcl_FSRenameFile()' call.  If not
  1.1879 +			     * implemented, Tcl will fall back on
  1.1880 +			     * a copy and delete mechanism, for 
  1.1881 +			     * rename actions initiated in Tcl (not C). */
  1.1882 +    Tcl_FSCopyDirectoryProc *copyDirectoryProc;	    
  1.1883 +			    /* Function to process a 
  1.1884 +			     * 'Tcl_FSCopyDirectory()' call.  If
  1.1885 +			     * not implemented, Tcl will fall back
  1.1886 +			     * on a recursive create-dir, file copy
  1.1887 +			     * mechanism, for copying actions
  1.1888 +			     * initiated in Tcl (not C). */
  1.1889 +    Tcl_FSLstatProc *lstatProc;	    
  1.1890 +			    /* Function to process a 
  1.1891 +			     * 'Tcl_FSLstat()' call.  If not implemented,
  1.1892 +			     * Tcl will attempt to use the 'statProc'
  1.1893 +			     * defined above instead. */
  1.1894 +    Tcl_FSLoadFileProc *loadFileProc; 
  1.1895 +			    /* Function to process a 
  1.1896 +			     * 'Tcl_FSLoadFile()' call.  If not
  1.1897 +			     * implemented, Tcl will fall back on
  1.1898 +			     * a copy to native-temp followed by a 
  1.1899 +			     * Tcl_FSLoadFile on that temporary copy. */
  1.1900 +    Tcl_FSGetCwdProc *getCwdProc;     
  1.1901 +			    /* 
  1.1902 +			     * Function to process a 'Tcl_FSGetCwd()'
  1.1903 +			     * call.  Most filesystems need not
  1.1904 +			     * implement this.  It will usually only be
  1.1905 +			     * called once, if 'getcwd' is called
  1.1906 +			     * before 'chdir'.  May be NULL.
  1.1907 +			     */
  1.1908 +    Tcl_FSChdirProc *chdirProc;	    
  1.1909 +			    /* 
  1.1910 +			     * Function to process a 'Tcl_FSChdir()'
  1.1911 +			     * call.  If filesystems do not implement
  1.1912 +			     * this, it will be emulated by a series of
  1.1913 +			     * directory access checks.  Otherwise,
  1.1914 +			     * virtual filesystems which do implement
  1.1915 +			     * it need only respond with a positive
  1.1916 +			     * return result if the dirName is a valid
  1.1917 +			     * directory in their filesystem.  They
  1.1918 +			     * need not remember the result, since that
  1.1919 +			     * will be automatically remembered for use
  1.1920 +			     * by GetCwd.  Real filesystems should
  1.1921 +			     * carry out the correct action (i.e. call
  1.1922 +			     * the correct system 'chdir' api).  If not
  1.1923 +			     * implemented, then 'cd' and 'pwd' will
  1.1924 +			     * fail inside the filesystem.
  1.1925 +			     */
  1.1926 +} Tcl_Filesystem;
  1.1927 +
  1.1928 +/*
  1.1929 + * The following definitions are used as values for the 'linkAction' flag
  1.1930 + * to Tcl_FSLink, or the linkProc of any filesystem.  Any combination
  1.1931 + * of flags can be given.  For link creation, the linkProc should create
  1.1932 + * a link which matches any of the types given.
  1.1933 + * 
  1.1934 + * TCL_CREATE_SYMBOLIC_LINK:  Create a symbolic or soft link.
  1.1935 + * TCL_CREATE_HARD_LINK:      Create a hard link.
  1.1936 + */
  1.1937 +#define TCL_CREATE_SYMBOLIC_LINK   0x01
  1.1938 +#define TCL_CREATE_HARD_LINK       0x02
  1.1939 +
  1.1940 +/*
  1.1941 + * The following structure represents the Notifier functions that
  1.1942 + * you can override with the Tcl_SetNotifier call.
  1.1943 + */
  1.1944 +typedef struct Tcl_NotifierProcs {
  1.1945 +    Tcl_SetTimerProc *setTimerProc;
  1.1946 +    Tcl_WaitForEventProc *waitForEventProc;
  1.1947 +    Tcl_CreateFileHandlerProc *createFileHandlerProc;
  1.1948 +    Tcl_DeleteFileHandlerProc *deleteFileHandlerProc;
  1.1949 +    Tcl_InitNotifierProc *initNotifierProc;
  1.1950 +    Tcl_FinalizeNotifierProc *finalizeNotifierProc;
  1.1951 +    Tcl_AlertNotifierProc *alertNotifierProc;
  1.1952 +    Tcl_ServiceModeHookProc *serviceModeHookProc;
  1.1953 +} Tcl_NotifierProcs;
  1.1954 +
  1.1955 +
  1.1956 +/*
  1.1957 + * The following structure represents a user-defined encoding.  It collects
  1.1958 + * together all the functions that are used by the specific encoding.
  1.1959 + */
  1.1960 +typedef struct Tcl_EncodingType {
  1.1961 +    CONST char *encodingName;	/* The name of the encoding, e.g.  "euc-jp".
  1.1962 +				 * This name is the unique key for this
  1.1963 +				 * encoding type. */
  1.1964 +    Tcl_EncodingConvertProc *toUtfProc;
  1.1965 +				/* Procedure to convert from external
  1.1966 +				 * encoding into UTF-8. */
  1.1967 +    Tcl_EncodingConvertProc *fromUtfProc;
  1.1968 +				/* Procedure to convert from UTF-8 into
  1.1969 +				 * external encoding. */
  1.1970 +    Tcl_EncodingFreeProc *freeProc;
  1.1971 +				/* If non-NULL, procedure to call when this
  1.1972 +				 * encoding is deleted. */
  1.1973 +    ClientData clientData;	/* Arbitrary value associated with encoding
  1.1974 +				 * type.  Passed to conversion procedures. */
  1.1975 +    int nullSize;		/* Number of zero bytes that signify
  1.1976 +				 * end-of-string in this encoding.  This
  1.1977 +				 * number is used to determine the source
  1.1978 +				 * string length when the srcLen argument is
  1.1979 +				 * negative.  Must be 1 or 2. */
  1.1980 +} Tcl_EncodingType;    
  1.1981 +
  1.1982 +/*
  1.1983 + * The following definitions are used as values for the conversion control
  1.1984 + * flags argument when converting text from one character set to another:
  1.1985 + *
  1.1986 + * TCL_ENCODING_START:	     	Signifies that the source buffer is the first
  1.1987 + *				block in a (potentially multi-block) input
  1.1988 + *				stream.  Tells the conversion procedure to
  1.1989 + *				reset to an initial state and perform any
  1.1990 + *				initialization that needs to occur before the
  1.1991 + *				first byte is converted.  If the source
  1.1992 + *				buffer contains the entire input stream to be
  1.1993 + *				converted, this flag should be set.
  1.1994 + *
  1.1995 + * TCL_ENCODING_END:		Signifies that the source buffer is the last
  1.1996 + *				block in a (potentially multi-block) input
  1.1997 + *				stream.  Tells the conversion routine to
  1.1998 + *				perform any finalization that needs to occur
  1.1999 + *				after the last byte is converted and then to
  1.2000 + *				reset to an initial state.  If the source
  1.2001 + *				buffer contains the entire input stream to be
  1.2002 + *				converted, this flag should be set.
  1.2003 + *				
  1.2004 + * TCL_ENCODING_STOPONERROR:	If set, then the converter will return
  1.2005 + *				immediately upon encountering an invalid
  1.2006 + *				byte sequence or a source character that has
  1.2007 + *				no mapping in the target encoding.  If clear,
  1.2008 + *				then the converter will skip the problem,
  1.2009 + *				substituting one or more "close" characters
  1.2010 + *				in the destination buffer and then continue
  1.2011 + *				to sonvert the source.
  1.2012 + */
  1.2013 +#define TCL_ENCODING_START		0x01
  1.2014 +#define TCL_ENCODING_END		0x02
  1.2015 +#define TCL_ENCODING_STOPONERROR	0x04
  1.2016 +
  1.2017 +
  1.2018 +/*
  1.2019 + * The following data structures and declarations are for the new Tcl
  1.2020 + * parser.
  1.2021 + */
  1.2022 +
  1.2023 +/*
  1.2024 + * For each word of a command, and for each piece of a word such as a
  1.2025 + * variable reference, one of the following structures is created to
  1.2026 + * describe the token.
  1.2027 + */
  1.2028 +typedef struct Tcl_Token {
  1.2029 +    int type;			/* Type of token, such as TCL_TOKEN_WORD;
  1.2030 +				 * see below for valid types. */
  1.2031 +    CONST char *start;		/* First character in token. */
  1.2032 +    int size;			/* Number of bytes in token. */
  1.2033 +    int numComponents;		/* If this token is composed of other
  1.2034 +				 * tokens, this field tells how many of
  1.2035 +				 * them there are (including components of
  1.2036 +				 * components, etc.).  The component tokens
  1.2037 +				 * immediately follow this one. */
  1.2038 +} Tcl_Token;
  1.2039 +
  1.2040 +/*
  1.2041 + * Type values defined for Tcl_Token structures.  These values are
  1.2042 + * defined as mask bits so that it's easy to check for collections of
  1.2043 + * types.
  1.2044 + *
  1.2045 + * TCL_TOKEN_WORD -		The token describes one word of a command,
  1.2046 + *				from the first non-blank character of
  1.2047 + *				the word (which may be " or {) up to but
  1.2048 + *				not including the space, semicolon, or
  1.2049 + *				bracket that terminates the word. 
  1.2050 + *				NumComponents counts the total number of
  1.2051 + *				sub-tokens that make up the word.  This
  1.2052 + *				includes, for example, sub-tokens of
  1.2053 + *				TCL_TOKEN_VARIABLE tokens.
  1.2054 + * TCL_TOKEN_SIMPLE_WORD -	This token is just like TCL_TOKEN_WORD
  1.2055 + *				except that the word is guaranteed to
  1.2056 + *				consist of a single TCL_TOKEN_TEXT
  1.2057 + *				sub-token.
  1.2058 + * TCL_TOKEN_TEXT -		The token describes a range of literal
  1.2059 + *				text that is part of a word. 
  1.2060 + *				NumComponents is always 0.
  1.2061 + * TCL_TOKEN_BS -		The token describes a backslash sequence
  1.2062 + *				that must be collapsed.	 NumComponents
  1.2063 + *				is always 0.
  1.2064 + * TCL_TOKEN_COMMAND -		The token describes a command whose result
  1.2065 + *				must be substituted into the word.  The
  1.2066 + *				token includes the enclosing brackets. 
  1.2067 + *				NumComponents is always 0.
  1.2068 + * TCL_TOKEN_VARIABLE -		The token describes a variable
  1.2069 + *				substitution, including the dollar sign,
  1.2070 + *				variable name, and array index (if there
  1.2071 + *				is one) up through the right
  1.2072 + *				parentheses.  NumComponents tells how
  1.2073 + *				many additional tokens follow to
  1.2074 + *				represent the variable name.  The first
  1.2075 + *				token will be a TCL_TOKEN_TEXT token
  1.2076 + *				that describes the variable name.  If
  1.2077 + *				the variable is an array reference then
  1.2078 + *				there will be one or more additional
  1.2079 + *				tokens, of type TCL_TOKEN_TEXT,
  1.2080 + *				TCL_TOKEN_BS, TCL_TOKEN_COMMAND, and
  1.2081 + *				TCL_TOKEN_VARIABLE, that describe the
  1.2082 + *				array index; numComponents counts the
  1.2083 + *				total number of nested tokens that make
  1.2084 + *				up the variable reference, including
  1.2085 + *				sub-tokens of TCL_TOKEN_VARIABLE tokens.
  1.2086 + * TCL_TOKEN_SUB_EXPR -		The token describes one subexpression of a
  1.2087 + *				expression, from the first non-blank
  1.2088 + *				character of the subexpression up to but not
  1.2089 + *				including the space, brace, or bracket
  1.2090 + *				that terminates the subexpression. 
  1.2091 + *				NumComponents counts the total number of
  1.2092 + *				following subtokens that make up the
  1.2093 + *				subexpression; this includes all subtokens
  1.2094 + *				for any nested TCL_TOKEN_SUB_EXPR tokens.
  1.2095 + *				For example, a numeric value used as a
  1.2096 + *				primitive operand is described by a
  1.2097 + *				TCL_TOKEN_SUB_EXPR token followed by a
  1.2098 + *				TCL_TOKEN_TEXT token. A binary subexpression
  1.2099 + *				is described by a TCL_TOKEN_SUB_EXPR token
  1.2100 + *				followed by the	TCL_TOKEN_OPERATOR token
  1.2101 + *				for the operator, then TCL_TOKEN_SUB_EXPR
  1.2102 + *				tokens for the left then the right operands.
  1.2103 + * TCL_TOKEN_OPERATOR -		The token describes one expression operator.
  1.2104 + *				An operator might be the name of a math
  1.2105 + *				function such as "abs". A TCL_TOKEN_OPERATOR
  1.2106 + *				token is always preceeded by one
  1.2107 + *				TCL_TOKEN_SUB_EXPR token for the operator's
  1.2108 + *				subexpression, and is followed by zero or
  1.2109 + *				more TCL_TOKEN_SUB_EXPR tokens for the
  1.2110 + *				operator's operands. NumComponents is
  1.2111 + *				always 0.
  1.2112 + */
  1.2113 +#define TCL_TOKEN_WORD		1
  1.2114 +#define TCL_TOKEN_SIMPLE_WORD	2
  1.2115 +#define TCL_TOKEN_TEXT		4
  1.2116 +#define TCL_TOKEN_BS		8
  1.2117 +#define TCL_TOKEN_COMMAND	16
  1.2118 +#define TCL_TOKEN_VARIABLE	32
  1.2119 +#define TCL_TOKEN_SUB_EXPR	64
  1.2120 +#define TCL_TOKEN_OPERATOR	128
  1.2121 +
  1.2122 +/*
  1.2123 + * Parsing error types.  On any parsing error, one of these values
  1.2124 + * will be stored in the error field of the Tcl_Parse structure
  1.2125 + * defined below.
  1.2126 + */
  1.2127 +#define TCL_PARSE_SUCCESS		0
  1.2128 +#define TCL_PARSE_QUOTE_EXTRA		1
  1.2129 +#define TCL_PARSE_BRACE_EXTRA		2
  1.2130 +#define TCL_PARSE_MISSING_BRACE		3
  1.2131 +#define TCL_PARSE_MISSING_BRACKET	4
  1.2132 +#define TCL_PARSE_MISSING_PAREN		5
  1.2133 +#define TCL_PARSE_MISSING_QUOTE		6
  1.2134 +#define TCL_PARSE_MISSING_VAR_BRACE	7
  1.2135 +#define TCL_PARSE_SYNTAX		8
  1.2136 +#define TCL_PARSE_BAD_NUMBER		9
  1.2137 +
  1.2138 +/*
  1.2139 + * A structure of the following type is filled in by Tcl_ParseCommand.
  1.2140 + * It describes a single command parsed from an input string.
  1.2141 + */
  1.2142 +#define NUM_STATIC_TOKENS 20
  1.2143 +
  1.2144 +typedef struct Tcl_Parse {
  1.2145 +    CONST char *commentStart;	/* Pointer to # that begins the first of
  1.2146 +				 * one or more comments preceding the
  1.2147 +				 * command. */
  1.2148 +    int commentSize;		/* Number of bytes in comments (up through
  1.2149 +				 * newline character that terminates the
  1.2150 +				 * last comment).  If there were no
  1.2151 +				 * comments, this field is 0. */
  1.2152 +    CONST char *commandStart;	/* First character in first word of command. */
  1.2153 +    int commandSize;		/* Number of bytes in command, including
  1.2154 +				 * first character of first word, up
  1.2155 +				 * through the terminating newline,
  1.2156 +				 * close bracket, or semicolon. */
  1.2157 +    int numWords;		/* Total number of words in command.  May
  1.2158 +				 * be 0. */
  1.2159 +    Tcl_Token *tokenPtr;	/* Pointer to first token representing
  1.2160 +				 * the words of the command.  Initially
  1.2161 +				 * points to staticTokens, but may change
  1.2162 +				 * to point to malloc-ed space if command
  1.2163 +				 * exceeds space in staticTokens. */
  1.2164 +    int numTokens;		/* Total number of tokens in command. */
  1.2165 +    int tokensAvailable;	/* Total number of tokens available at
  1.2166 +				 * *tokenPtr. */
  1.2167 +    int errorType;		/* One of the parsing error types defined
  1.2168 +				 * above. */
  1.2169 +
  1.2170 +    /*
  1.2171 +     * The fields below are intended only for the private use of the
  1.2172 +     * parser.	They should not be used by procedures that invoke
  1.2173 +     * Tcl_ParseCommand.
  1.2174 +     */
  1.2175 +
  1.2176 +    CONST char *string;		/* The original command string passed to
  1.2177 +				 * Tcl_ParseCommand. */
  1.2178 +    CONST char *end;		/* Points to the character just after the
  1.2179 +				 * last one in the command string. */
  1.2180 +    Tcl_Interp *interp;		/* Interpreter to use for error reporting,
  1.2181 +				 * or NULL. */
  1.2182 +    CONST char *term;		/* Points to character in string that
  1.2183 +				 * terminated most recent token.  Filled in
  1.2184 +				 * by ParseTokens.  If an error occurs,
  1.2185 +				 * points to beginning of region where the
  1.2186 +				 * error occurred (e.g. the open brace if
  1.2187 +				 * the close brace is missing). */
  1.2188 +    int incomplete;		/* This field is set to 1 by Tcl_ParseCommand
  1.2189 +				 * if the command appears to be incomplete.
  1.2190 +				 * This information is used by
  1.2191 +				 * Tcl_CommandComplete. */
  1.2192 +    Tcl_Token staticTokens[NUM_STATIC_TOKENS];
  1.2193 +				/* Initial space for tokens for command.
  1.2194 +				 * This space should be large enough to
  1.2195 +				 * accommodate most commands; dynamic
  1.2196 +				 * space is allocated for very large
  1.2197 +				 * commands that don't fit here. */
  1.2198 +} Tcl_Parse;
  1.2199 +
  1.2200 +/*
  1.2201 + * The following definitions are the error codes returned by the conversion
  1.2202 + * routines:
  1.2203 + *
  1.2204 + * TCL_OK:			All characters were converted.
  1.2205 + *
  1.2206 + * TCL_CONVERT_NOSPACE:		The output buffer would not have been large
  1.2207 + *				enough for all of the converted data; as many
  1.2208 + *				characters as could fit were converted though.
  1.2209 + *
  1.2210 + * TCL_CONVERT_MULTIBYTE:	The last few bytes in the source string were
  1.2211 + *				the beginning of a multibyte sequence, but
  1.2212 + *				more bytes were needed to complete this
  1.2213 + *				sequence.  A subsequent call to the conversion
  1.2214 + *				routine should pass the beginning of this
  1.2215 + *				unconverted sequence plus additional bytes
  1.2216 + *				from the source stream to properly convert
  1.2217 + *				the formerly split-up multibyte sequence.
  1.2218 + *
  1.2219 + * TCL_CONVERT_SYNTAX:		The source stream contained an invalid
  1.2220 + *				character sequence.  This may occur if the
  1.2221 + *				input stream has been damaged or if the input
  1.2222 + *				encoding method was misidentified.  This error
  1.2223 + *				is reported only if TCL_ENCODING_STOPONERROR
  1.2224 + *				was specified.
  1.2225 + * 
  1.2226 + * TCL_CONVERT_UNKNOWN:		The source string contained a character
  1.2227 + *				that could not be represented in the target
  1.2228 + *				encoding.  This error is reported only if
  1.2229 + *				TCL_ENCODING_STOPONERROR was specified.
  1.2230 + */
  1.2231 +#define TCL_CONVERT_MULTIBYTE		-1
  1.2232 +#define TCL_CONVERT_SYNTAX		-2
  1.2233 +#define TCL_CONVERT_UNKNOWN		-3
  1.2234 +#define TCL_CONVERT_NOSPACE		-4
  1.2235 +
  1.2236 +/*
  1.2237 + * The maximum number of bytes that are necessary to represent a single
  1.2238 + * Unicode character in UTF-8.  The valid values should be 3 or 6 (or
  1.2239 + * perhaps 1 if we want to support a non-unicode enabled core).
  1.2240 + * If 3, then Tcl_UniChar must be 2-bytes in size (UCS-2). (default)
  1.2241 + * If 6, then Tcl_UniChar must be 4-bytes in size (UCS-4).
  1.2242 + * At this time UCS-2 mode is the default and recommended mode.
  1.2243 + * UCS-4 is experimental and not recommended.  It works for the core,
  1.2244 + * but most extensions expect UCS-2.
  1.2245 + */
  1.2246 +#ifndef TCL_UTF_MAX
  1.2247 +#define TCL_UTF_MAX		3
  1.2248 +#endif
  1.2249 +
  1.2250 +/*
  1.2251 + * This represents a Unicode character.  Any changes to this should
  1.2252 + * also be reflected in regcustom.h.
  1.2253 + */
  1.2254 +#if TCL_UTF_MAX > 3
  1.2255 +    /*
  1.2256 +     * unsigned int isn't 100% accurate as it should be a strict 4-byte
  1.2257 +     * value (perhaps wchar_t).  64-bit systems may have troubles.  The
  1.2258 +     * size of this value must be reflected correctly in regcustom.h and
  1.2259 +     * in tclEncoding.c.
  1.2260 +     * XXX: Tcl is currently UCS-2 and planning UTF-16 for the Unicode
  1.2261 +     * XXX: string rep that Tcl_UniChar represents.  Changing the size
  1.2262 +     * XXX: of Tcl_UniChar is /not/ supported.
  1.2263 +     */
  1.2264 +typedef unsigned int Tcl_UniChar;
  1.2265 +#else
  1.2266 +typedef unsigned short Tcl_UniChar;
  1.2267 +#endif
  1.2268 +
  1.2269 +
  1.2270 +/*
  1.2271 + * Deprecated Tcl procedures:
  1.2272 + */
  1.2273 +#ifndef TCL_NO_DEPRECATED
  1.2274 +#   define Tcl_EvalObj(interp,objPtr) \
  1.2275 +	Tcl_EvalObjEx((interp),(objPtr),0)
  1.2276 +#   define Tcl_GlobalEvalObj(interp,objPtr) \
  1.2277 +	Tcl_EvalObjEx((interp),(objPtr),TCL_EVAL_GLOBAL)
  1.2278 +#endif
  1.2279 +
  1.2280 +
  1.2281 +/*
  1.2282 + * These function have been renamed. The old names are deprecated, but we
  1.2283 + * define these macros for backwards compatibilty.
  1.2284 + */
  1.2285 +#define Tcl_Ckalloc Tcl_Alloc
  1.2286 +#define Tcl_Ckfree Tcl_Free
  1.2287 +#define Tcl_Ckrealloc Tcl_Realloc
  1.2288 +#define Tcl_Return Tcl_SetResult
  1.2289 +#define Tcl_TildeSubst Tcl_TranslateFileName
  1.2290 +#define panic Tcl_Panic
  1.2291 +#define panicVA Tcl_PanicVA
  1.2292 +
  1.2293 +
  1.2294 +/*
  1.2295 + * The following constant is used to test for older versions of Tcl
  1.2296 + * in the stubs tables.
  1.2297 + *
  1.2298 + * Jan Nijtman's plus patch uses 0xFCA1BACF, so we need to pick a different
  1.2299 + * value since the stubs tables don't match.
  1.2300 + */
  1.2301 +
  1.2302 +#define TCL_STUB_MAGIC ((int)0xFCA3BACF)
  1.2303 +
  1.2304 +/*
  1.2305 + * The following function is required to be defined in all stubs aware
  1.2306 + * extensions.  The function is actually implemented in the stub
  1.2307 + * library, not the main Tcl library, although there is a trivial
  1.2308 + * implementation in the main library in case an extension is statically
  1.2309 + * linked into an application.
  1.2310 + */
  1.2311 +
  1.2312 +EXTERN CONST char *	Tcl_InitStubs _ANSI_ARGS_((Tcl_Interp *interp,
  1.2313 +			    CONST char *version, int exact));
  1.2314 +
  1.2315 +#ifndef USE_TCL_STUBS
  1.2316 +
  1.2317 +/*
  1.2318 + * When not using stubs, make it a macro.
  1.2319 + */
  1.2320 +
  1.2321 +#define Tcl_InitStubs(interp, version, exact) \
  1.2322 +    Tcl_PkgRequire(interp, "Tcl", version, exact)
  1.2323 +
  1.2324 +#endif
  1.2325 +
  1.2326 +
  1.2327 +/*
  1.2328 + * Include the public function declarations that are accessible via
  1.2329 + * the stubs table.
  1.2330 + */
  1.2331 +
  1.2332 +#include "tclDecls.h"
  1.2333 +
  1.2334 +/*
  1.2335 + * Include platform specific public function declarations that are
  1.2336 + * accessible via the stubs table.
  1.2337 + */
  1.2338 +
  1.2339 +/*
  1.2340 + * tclPlatDecls.h can't be included here on the Mac, as we need
  1.2341 + * Mac specific headers to define the Mac types used in this file,
  1.2342 + * but these Mac haders conflict with a number of tk types
  1.2343 + * and thus can't be included in the globally read tcl.h
  1.2344 + * This header was originally added here as a fix for bug 5241
  1.2345 + * (stub link error for symbols in TclPlatStubs table), as a work-
  1.2346 + * around for the bug on the mac, tclMac.h is included immediately 
  1.2347 + * after tcl.h in the tcl precompiled header (with DLLEXPORT set).
  1.2348 + */
  1.2349 +
  1.2350 +#if !defined(MAC_TCL)
  1.2351 +#include "tclPlatDecls.h"
  1.2352 +#endif
  1.2353 +
  1.2354 +/*
  1.2355 + * Public functions that are not accessible via the stubs table.
  1.2356 + */
  1.2357 +
  1.2358 +EXTERN void Tcl_Main _ANSI_ARGS_((int argc, char **argv,
  1.2359 +	Tcl_AppInitProc *appInitProc));
  1.2360 +
  1.2361 +/*
  1.2362 + * Convenience declaration of Tcl_AppInit for backwards compatibility.
  1.2363 + * This function is not *implemented* by the tcl library, so the storage
  1.2364 + * class is neither DLLEXPORT nor DLLIMPORT
  1.2365 + */
  1.2366 +#undef TCL_STORAGE_CLASS
  1.2367 +#define TCL_STORAGE_CLASS
  1.2368 +
  1.2369 +EXTERN int		Tcl_AppInit _ANSI_ARGS_((Tcl_Interp *interp));
  1.2370 +
  1.2371 +#undef TCL_STORAGE_CLASS
  1.2372 +#define TCL_STORAGE_CLASS DLLIMPORT
  1.2373 +
  1.2374 +#endif /* RC_INVOKED */
  1.2375 +
  1.2376 +/*
  1.2377 + * end block for C++
  1.2378 + */
  1.2379 +#ifdef __cplusplus
  1.2380 +}
  1.2381 +#endif
  1.2382 +
  1.2383 +#endif /* _TCL */