Tcl Source Code

Artifact Content
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2018 Conference, Houston/TX, US, Oct 15-19
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Aug 20.

Artifact 947fcc72f55d1aca7e339a1f3ee3698b7502a243:


     1  /*
     2   * tcl.h --
     3   *
     4   *	This header file describes the externally-visible facilities of the
     5   *	Tcl interpreter.
     6   *
     7   * Copyright (c) 1987-1994 The Regents of the University of California.
     8   * Copyright (c) 1993-1996 Lucent Technologies.
     9   * Copyright (c) 1994-1998 Sun Microsystems, Inc.
    10   * Copyright (c) 1998-2000 by Scriptics Corporation.
    11   * Copyright (c) 2002 by Kevin B. Kenny.  All rights reserved.
    12   *
    13   * See the file "license.terms" for information on usage and redistribution of
    14   * this file, and for a DISCLAIMER OF ALL WARRANTIES.
    15   */
    16  
    17  #ifndef _TCL
    18  #define _TCL
    19  
    20  /*
    21   * For C++ compilers, use extern "C"
    22   */
    23  
    24  #ifdef __cplusplus
    25  extern "C" {
    26  #endif
    27  
    28  /*
    29   * The following defines are used to indicate the various release levels.
    30   */
    31  
    32  #define TCL_ALPHA_RELEASE	0
    33  #define TCL_BETA_RELEASE	1
    34  #define TCL_FINAL_RELEASE	2
    35  
    36  /*
    37   * When version numbers change here, must also go into the following files and
    38   * update the version numbers:
    39   *
    40   * library/init.tcl	(1 LOC patch)
    41   * unix/configure.in	(2 LOC Major, 2 LOC minor, 1 LOC patch)
    42   * win/configure.in	(as above)
    43   * win/tcl.m4		(not patchlevel)
    44   * win/makefile.bc	(not patchlevel) 2 LOC
    45   * README		(sections 0 and 2, with and without separator)
    46   * macosx/Tcl.pbproj/project.pbxproj (not patchlevel) 1 LOC
    47   * macosx/Tcl.pbproj/default.pbxuser (not patchlevel) 1 LOC
    48   * macosx/Tcl.xcode/project.pbxproj (not patchlevel) 2 LOC
    49   * macosx/Tcl.xcode/default.pbxuser (not patchlevel) 1 LOC
    50   * macosx/Tcl-Common.xcconfig (not patchlevel) 1 LOC
    51   * win/README		(not patchlevel) (sections 0 and 2)
    52   * unix/tcl.spec	(1 LOC patch)
    53   * tools/tcl.hpj.in	(not patchlevel, for windows installer)
    54   */
    55  
    56  #define TCL_MAJOR_VERSION   8
    57  #define TCL_MINOR_VERSION   6
    58  #define TCL_RELEASE_LEVEL   TCL_FINAL_RELEASE
    59  #define TCL_RELEASE_SERIAL  1
    60  
    61  #define TCL_VERSION	    "8.6"
    62  #define TCL_PATCH_LEVEL	    "8.6.1"
    63  
    64  /*
    65   *----------------------------------------------------------------------------
    66   * The following definitions set up the proper options for Windows compilers.
    67   * We use this method because there is no autoconf equivalent.
    68   */
    69  
    70  #ifdef _WIN32
    71  #   ifndef __WIN32__
    72  #	define __WIN32__
    73  #   endif
    74  #   ifndef WIN32
    75  #	define WIN32
    76  #   endif
    77  #endif
    78  
    79  /*
    80   * STRICT: See MSDN Article Q83456
    81   */
    82  
    83  #ifdef _WIN32
    84  #   ifndef STRICT
    85  #	define STRICT
    86  #   endif
    87  #endif /* _WIN32 */
    88  
    89  /*
    90   * Utility macros: STRINGIFY takes an argument and wraps it in "" (double
    91   * quotation marks), JOIN joins two arguments.
    92   */
    93  
    94  #ifndef STRINGIFY
    95  #  define STRINGIFY(x) STRINGIFY1(x)
    96  #  define STRINGIFY1(x) #x
    97  #endif
    98  #ifndef JOIN
    99  #  define JOIN(a,b) JOIN1(a,b)
   100  #  define JOIN1(a,b) a##b
   101  #endif
   102  
   103  /*
   104   * A special definition used to allow this header file to be included from
   105   * windows resource files so that they can obtain version information.
   106   * RC_INVOKED is defined by default by the windows RC tool.
   107   *
   108   * Resource compilers don't like all the C stuff, like typedefs and function
   109   * declarations, that occur below, so block them out.
   110   */
   111  
   112  #ifndef RC_INVOKED
   113  
   114  /*
   115   * Special macro to define mutexes, that doesn't do anything if we are not
   116   * using threads.
   117   */
   118  
   119  #ifdef TCL_THREADS
   120  #define TCL_DECLARE_MUTEX(name) static Tcl_Mutex name;
   121  #else
   122  #define TCL_DECLARE_MUTEX(name)
   123  #endif
   124  
   125  /*
   126   * Tcl's public routine Tcl_FSSeek() uses the values SEEK_SET, SEEK_CUR, and
   127   * SEEK_END, all #define'd by stdio.h .
   128   *
   129   * Also, many extensions need stdio.h, and they've grown accustomed to tcl.h
   130   * providing it for them rather than #include-ing it themselves as they
   131   * should, so also for their sake, we keep the #include to be consistent with
   132   * prior Tcl releases.
   133   */
   134  
   135  #include <stdio.h>
   136  
   137  /*
   138   *----------------------------------------------------------------------------
   139   * Support for functions with a variable number of arguments.
   140   *
   141   * The following TCL_VARARGS* macros are to support old extensions
   142   * written for older versions of Tcl where the macros permitted
   143   * support for the varargs.h system as well as stdarg.h .
   144   *
   145   * New code should just directly be written to use stdarg.h conventions.
   146   */
   147  
   148  #include <stdarg.h>
   149  #ifndef TCL_NO_DEPRECATED
   150  #    define TCL_VARARGS(type, name) (type name, ...)
   151  #    define TCL_VARARGS_DEF(type, name) (type name, ...)
   152  #    define TCL_VARARGS_START(type, name, list) (va_start(list, name), name)
   153  #endif
   154  #if defined(__GNUC__) && (__GNUC__ > 2)
   155  #   define TCL_FORMAT_PRINTF(a,b) __attribute__ ((__format__ (__printf__, a, b)))
   156  #else
   157  #   define TCL_FORMAT_PRINTF(a,b)
   158  #endif
   159  
   160  /*
   161   * Allow a part of Tcl's API to be explicitly marked as deprecated.
   162   *
   163   * Used to make TIP 330/336 generate moans even if people use the
   164   * compatibility macros. Change your code, guys! We won't support you forever.
   165   */
   166  
   167  #if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
   168  #   if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5))
   169  #	define TCL_DEPRECATED_API(msg)	__attribute__ ((__deprecated__ (msg)))
   170  #   else
   171  #	define TCL_DEPRECATED_API(msg)	__attribute__ ((__deprecated__))
   172  #   endif
   173  #else
   174  #   define TCL_DEPRECATED_API(msg)	/* nothing portable */
   175  #endif
   176  
   177  /*
   178   *----------------------------------------------------------------------------
   179   * Macros used to declare a function to be exported by a DLL. Used by Windows,
   180   * maps to no-op declarations on non-Windows systems. The default build on
   181   * windows is for a DLL, which causes the DLLIMPORT and DLLEXPORT macros to be
   182   * nonempty. To build a static library, the macro STATIC_BUILD should be
   183   * defined.
   184   *
   185   * Note: when building static but linking dynamically to MSVCRT we must still
   186   *       correctly decorate the C library imported function.  Use CRTIMPORT
   187   *       for this purpose.  _DLL is defined by the compiler when linking to
   188   *       MSVCRT.
   189   */
   190  
   191  #if (defined(_WIN32) && (defined(_MSC_VER) || (defined(__BORLANDC__) && (__BORLANDC__ >= 0x0550)) || defined(__LCC__) || defined(__WATCOMC__) || (defined(__GNUC__) && defined(__declspec))))
   192  #   define HAVE_DECLSPEC 1
   193  #   ifdef STATIC_BUILD
   194  #       define DLLIMPORT
   195  #       define DLLEXPORT
   196  #       ifdef _DLL
   197  #           define CRTIMPORT __declspec(dllimport)
   198  #       else
   199  #           define CRTIMPORT
   200  #       endif
   201  #   else
   202  #       define DLLIMPORT __declspec(dllimport)
   203  #       define DLLEXPORT __declspec(dllexport)
   204  #       define CRTIMPORT __declspec(dllimport)
   205  #   endif
   206  #else
   207  #   define DLLIMPORT
   208  #   if defined(__GNUC__) && __GNUC__ > 3
   209  #       define DLLEXPORT __attribute__ ((visibility("default")))
   210  #   else
   211  #       define DLLEXPORT
   212  #   endif
   213  #   define CRTIMPORT
   214  #endif
   215  
   216  /*
   217   * These macros are used to control whether functions are being declared for
   218   * import or export. If a function is being declared while it is being built
   219   * to be included in a shared library, then it should have the DLLEXPORT
   220   * storage class. If is being declared for use by a module that is going to
   221   * link against the shared library, then it should have the DLLIMPORT storage
   222   * class. If the symbol is beind declared for a static build or for use from a
   223   * stub library, then the storage class should be empty.
   224   *
   225   * The convention is that a macro called BUILD_xxxx, where xxxx is the name of
   226   * a library we are building, is set on the compile line for sources that are
   227   * to be placed in the library. When this macro is set, the storage class will
   228   * be set to DLLEXPORT. At the end of the header file, the storage class will
   229   * be reset to DLLIMPORT.
   230   */
   231  
   232  #undef TCL_STORAGE_CLASS
   233  #ifdef BUILD_tcl
   234  #   define TCL_STORAGE_CLASS DLLEXPORT
   235  #else
   236  #   ifdef USE_TCL_STUBS
   237  #      define TCL_STORAGE_CLASS
   238  #   else
   239  #      define TCL_STORAGE_CLASS DLLIMPORT
   240  #   endif
   241  #endif
   242  
   243  /*
   244   * The following _ANSI_ARGS_ macro is to support old extensions
   245   * written for older versions of Tcl where it permitted support
   246   * for compilers written in the pre-prototype era of C.
   247   *
   248   * New code should use prototypes.
   249   */
   250  
   251  #ifndef TCL_NO_DEPRECATED
   252  #   undef _ANSI_ARGS_
   253  #   define _ANSI_ARGS_(x)	x
   254  #endif
   255  
   256  /*
   257   * Definitions that allow this header file to be used either with or without
   258   * ANSI C features.
   259   */
   260  
   261  #ifndef INLINE
   262  #   define INLINE
   263  #endif
   264  
   265  #ifdef NO_CONST
   266  #   ifndef const
   267  #      define const
   268  #   endif
   269  #endif
   270  #ifndef CONST
   271  #   define CONST const
   272  #endif
   273  
   274  #ifdef USE_NON_CONST
   275  #   ifdef USE_COMPAT_CONST
   276  #      error define at most one of USE_NON_CONST and USE_COMPAT_CONST
   277  #   endif
   278  #   define CONST84
   279  #   define CONST84_RETURN
   280  #else
   281  #   ifdef USE_COMPAT_CONST
   282  #      define CONST84
   283  #      define CONST84_RETURN const
   284  #   else
   285  #      define CONST84 const
   286  #      define CONST84_RETURN const
   287  #   endif
   288  #endif
   289  
   290  #ifndef CONST86
   291  #      define CONST86 CONST84
   292  #endif
   293  
   294  /*
   295   * Make sure EXTERN isn't defined elsewhere.
   296   */
   297  
   298  #ifdef EXTERN
   299  #   undef EXTERN
   300  #endif /* EXTERN */
   301  
   302  #ifdef __cplusplus
   303  #   define EXTERN extern "C" TCL_STORAGE_CLASS
   304  #else
   305  #   define EXTERN extern TCL_STORAGE_CLASS
   306  #endif
   307  
   308  /*
   309   *----------------------------------------------------------------------------
   310   * The following code is copied from winnt.h. If we don't replicate it here,
   311   * then <windows.h> can't be included after tcl.h, since tcl.h also defines
   312   * VOID. This block is skipped under Cygwin and Mingw.
   313   */
   314  
   315  #if defined(_WIN32) && !defined(HAVE_WINNT_IGNORE_VOID)
   316  #ifndef VOID
   317  #define VOID void
   318  typedef char CHAR;
   319  typedef short SHORT;
   320  typedef long LONG;
   321  #endif
   322  #endif /* _WIN32 && !HAVE_WINNT_IGNORE_VOID */
   323  
   324  /*
   325   * Macro to use instead of "void" for arguments that must have type "void *"
   326   * in ANSI C; maps them to type "char *" in non-ANSI systems.
   327   */
   328  
   329  #ifndef __VXWORKS__
   330  #   ifndef NO_VOID
   331  #	define VOID void
   332  #   else
   333  #	define VOID char
   334  #   endif
   335  #endif
   336  
   337  /*
   338   * Miscellaneous declarations.
   339   */
   340  
   341  #ifndef _CLIENTDATA
   342  #   ifndef NO_VOID
   343  	typedef void *ClientData;
   344  #   else
   345  	typedef int *ClientData;
   346  #   endif
   347  #   define _CLIENTDATA
   348  #endif
   349  
   350  /*
   351   * Darwin specific configure overrides (to support fat compiles, where
   352   * configure runs only once for multiple architectures):
   353   */
   354  
   355  #ifdef __APPLE__
   356  #   ifdef __LP64__
   357  #	undef TCL_WIDE_INT_TYPE
   358  #	define TCL_WIDE_INT_IS_LONG 1
   359  #	define TCL_CFG_DO64BIT 1
   360  #    else /* !__LP64__ */
   361  #	define TCL_WIDE_INT_TYPE long long
   362  #	undef TCL_WIDE_INT_IS_LONG
   363  #	undef TCL_CFG_DO64BIT
   364  #    endif /* __LP64__ */
   365  #    undef HAVE_STRUCT_STAT64
   366  #endif /* __APPLE__ */
   367  
   368  /*
   369   * Define Tcl_WideInt to be a type that is (at least) 64-bits wide, and define
   370   * Tcl_WideUInt to be the unsigned variant of that type (assuming that where
   371   * we have one, we can have the other.)
   372   *
   373   * Also defines the following macros:
   374   * TCL_WIDE_INT_IS_LONG - if wide ints are really longs (i.e. we're on a real
   375   *	64-bit system.)
   376   * Tcl_WideAsLong - forgetful converter from wideInt to long.
   377   * Tcl_LongAsWide - sign-extending converter from long to wideInt.
   378   * Tcl_WideAsDouble - converter from wideInt to double.
   379   * Tcl_DoubleAsWide - converter from double to wideInt.
   380   *
   381   * The following invariant should hold for any long value 'longVal':
   382   *	longVal == Tcl_WideAsLong(Tcl_LongAsWide(longVal))
   383   *
   384   * Note on converting between Tcl_WideInt and strings. This implementation (in
   385   * tclObj.c) depends on the function
   386   * sprintf(...,"%" TCL_LL_MODIFIER "d",...).
   387   */
   388  
   389  #if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG)
   390  #   if defined(_WIN32)
   391  #      define TCL_WIDE_INT_TYPE __int64
   392  #      ifdef __BORLANDC__
   393  #         define TCL_LL_MODIFIER	"L"
   394  #      else /* __BORLANDC__ */
   395  #         define TCL_LL_MODIFIER	"I64"
   396  #      endif /* __BORLANDC__ */
   397  #   elif defined(__GNUC__)
   398  #      define TCL_WIDE_INT_TYPE long long
   399  #      define TCL_LL_MODIFIER	"ll"
   400  #   else /* ! _WIN32 && ! __GNUC__ */
   401  /*
   402   * Don't know what platform it is and configure hasn't discovered what is
   403   * going on for us. Try to guess...
   404   */
   405  #      ifdef NO_LIMITS_H
   406  #	  error please define either TCL_WIDE_INT_TYPE or TCL_WIDE_INT_IS_LONG
   407  #      else /* !NO_LIMITS_H */
   408  #	  include <limits.h>
   409  #	  if (INT_MAX < LONG_MAX)
   410  #	     define TCL_WIDE_INT_IS_LONG	1
   411  #	  else
   412  #	     define TCL_WIDE_INT_TYPE long long
   413  #         endif
   414  #      endif /* NO_LIMITS_H */
   415  #   endif /* _WIN32 */
   416  #endif /* !TCL_WIDE_INT_TYPE & !TCL_WIDE_INT_IS_LONG */
   417  #ifdef TCL_WIDE_INT_IS_LONG
   418  #   undef TCL_WIDE_INT_TYPE
   419  #   define TCL_WIDE_INT_TYPE	long
   420  #endif /* TCL_WIDE_INT_IS_LONG */
   421  
   422  typedef TCL_WIDE_INT_TYPE		Tcl_WideInt;
   423  typedef unsigned TCL_WIDE_INT_TYPE	Tcl_WideUInt;
   424  
   425  #ifdef TCL_WIDE_INT_IS_LONG
   426  #   define Tcl_WideAsLong(val)		((long)(val))
   427  #   define Tcl_LongAsWide(val)		((long)(val))
   428  #   define Tcl_WideAsDouble(val)	((double)((long)(val)))
   429  #   define Tcl_DoubleAsWide(val)	((long)((double)(val)))
   430  #   ifndef TCL_LL_MODIFIER
   431  #      define TCL_LL_MODIFIER		"l"
   432  #   endif /* !TCL_LL_MODIFIER */
   433  #else /* TCL_WIDE_INT_IS_LONG */
   434  /*
   435   * The next short section of defines are only done when not running on Windows
   436   * or some other strange platform.
   437   */
   438  #   ifndef TCL_LL_MODIFIER
   439  #      define TCL_LL_MODIFIER		"ll"
   440  #   endif /* !TCL_LL_MODIFIER */
   441  #   define Tcl_WideAsLong(val)		((long)((Tcl_WideInt)(val)))
   442  #   define Tcl_LongAsWide(val)		((Tcl_WideInt)((long)(val)))
   443  #   define Tcl_WideAsDouble(val)	((double)((Tcl_WideInt)(val)))
   444  #   define Tcl_DoubleAsWide(val)	((Tcl_WideInt)((double)(val)))
   445  #endif /* TCL_WIDE_INT_IS_LONG */
   446  
   447  #if defined(_WIN32)
   448  #   ifdef __BORLANDC__
   449  	typedef struct stati64 Tcl_StatBuf;
   450  #   elif defined(_WIN64)
   451  	typedef struct __stat64 Tcl_StatBuf;
   452  #   elif (defined(_MSC_VER) && (_MSC_VER < 1400)) || defined(_USE_32BIT_TIME_T)
   453  	typedef struct _stati64	Tcl_StatBuf;
   454  #   else
   455  	typedef struct _stat32i64 Tcl_StatBuf;
   456  #   endif /* _MSC_VER < 1400 */
   457  #elif defined(__CYGWIN__)
   458      typedef struct {
   459  	dev_t st_dev;
   460  	unsigned short st_ino;
   461  	unsigned short st_mode;
   462  	short st_nlink;
   463  	short st_uid;
   464  	short st_gid;
   465  	/* Here is a 2-byte gap */
   466  	dev_t st_rdev;
   467  	/* Here is a 4-byte gap */
   468  	long long st_size;
   469  	struct {long tv_sec;} st_atim;
   470  	struct {long tv_sec;} st_mtim;
   471  	struct {long tv_sec;} st_ctim;
   472  	/* Here is a 4-byte gap */
   473      } Tcl_StatBuf;
   474  #elif defined(HAVE_STRUCT_STAT64) && !defined(__APPLE__)
   475      typedef struct stat64 Tcl_StatBuf;
   476  #else
   477      typedef struct stat Tcl_StatBuf;
   478  #endif
   479  
   480  /*
   481   *----------------------------------------------------------------------------
   482   * Data structures defined opaquely in this module. The definitions below just
   483   * provide dummy types. A few fields are made visible in Tcl_Interp
   484   * structures, namely those used for returning a string result from commands.
   485   * Direct access to the result field is discouraged in Tcl 8.0. The
   486   * interpreter result is either an object or a string, and the two values are
   487   * kept consistent unless some C code sets interp->result directly.
   488   * Programmers should use either the function Tcl_GetObjResult() or
   489   * Tcl_GetStringResult() to read the interpreter's result. See the SetResult
   490   * man page for details.
   491   *
   492   * Note: any change to the Tcl_Interp definition below must be mirrored in the
   493   * "real" definition in tclInt.h.
   494   *
   495   * Note: Tcl_ObjCmdProc functions do not directly set result and freeProc.
   496   * Instead, they set a Tcl_Obj member in the "real" structure that can be
   497   * accessed with Tcl_GetObjResult() and Tcl_SetObjResult().
   498   */
   499  
   500  typedef struct Tcl_Interp
   501  #ifndef TCL_NO_DEPRECATED
   502  {
   503      /* TIP #330: Strongly discourage extensions from using the string
   504       * result. */
   505  #ifdef USE_INTERP_RESULT
   506      char *result TCL_DEPRECATED_API("use Tcl_GetStringResult/Tcl_SetResult");
   507  				/* If the last command returned a string
   508  				 * result, this points to it. */
   509      void (*freeProc) (char *blockPtr)
   510  	    TCL_DEPRECATED_API("use Tcl_GetStringResult/Tcl_SetResult");
   511  				/* Zero means the string result is statically
   512  				 * allocated. TCL_DYNAMIC means it was
   513  				 * allocated with ckalloc and should be freed
   514  				 * with ckfree. Other values give the address
   515  				 * of function to invoke to free the result.
   516  				 * Tcl_Eval must free it before executing next
   517  				 * command. */
   518  #else
   519      char *resultDontUse; /* Don't use in extensions! */
   520      void (*freeProcDontUse) (char *); /* Don't use in extensions! */
   521  #endif
   522  #ifdef USE_INTERP_ERRORLINE
   523      int errorLine TCL_DEPRECATED_API("use Tcl_GetErrorLine/Tcl_SetErrorLine");
   524  				/* When TCL_ERROR is returned, this gives the
   525  				 * line number within the command where the
   526  				 * error occurred (1 if first line). */
   527  #else
   528      int errorLineDontUse; /* Don't use in extensions! */
   529  #endif
   530  }
   531  #endif /* TCL_NO_DEPRECATED */
   532  Tcl_Interp;
   533  
   534  typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler;
   535  typedef struct Tcl_Channel_ *Tcl_Channel;
   536  typedef struct Tcl_ChannelTypeVersion_ *Tcl_ChannelTypeVersion;
   537  typedef struct Tcl_Command_ *Tcl_Command;
   538  typedef struct Tcl_Condition_ *Tcl_Condition;
   539  typedef struct Tcl_Dict_ *Tcl_Dict;
   540  typedef struct Tcl_EncodingState_ *Tcl_EncodingState;
   541  typedef struct Tcl_Encoding_ *Tcl_Encoding;
   542  typedef struct Tcl_Event Tcl_Event;
   543  typedef struct Tcl_InterpState_ *Tcl_InterpState;
   544  typedef struct Tcl_LoadHandle_ *Tcl_LoadHandle;
   545  typedef struct Tcl_Mutex_ *Tcl_Mutex;
   546  typedef struct Tcl_Pid_ *Tcl_Pid;
   547  typedef struct Tcl_RegExp_ *Tcl_RegExp;
   548  typedef struct Tcl_ThreadDataKey_ *Tcl_ThreadDataKey;
   549  typedef struct Tcl_ThreadId_ *Tcl_ThreadId;
   550  typedef struct Tcl_TimerToken_ *Tcl_TimerToken;
   551  typedef struct Tcl_Trace_ *Tcl_Trace;
   552  typedef struct Tcl_Var_ *Tcl_Var;
   553  typedef struct Tcl_ZLibStream_ *Tcl_ZlibStream;
   554  
   555  /*
   556   *----------------------------------------------------------------------------
   557   * Definition of the interface to functions implementing threads. A function
   558   * following this definition is given to each call of 'Tcl_CreateThread' and
   559   * will be called as the main fuction of the new thread created by that call.
   560   */
   561  
   562  #if defined _WIN32
   563  typedef unsigned (__stdcall Tcl_ThreadCreateProc) (ClientData clientData);
   564  #else
   565  typedef void (Tcl_ThreadCreateProc) (ClientData clientData);
   566  #endif
   567  
   568  /*
   569   * Threading function return types used for abstracting away platform
   570   * differences when writing a Tcl_ThreadCreateProc. See the NewThread function
   571   * in generic/tclThreadTest.c for it's usage.
   572   */
   573  
   574  #if defined _WIN32
   575  #   define Tcl_ThreadCreateType		unsigned __stdcall
   576  #   define TCL_THREAD_CREATE_RETURN	return 0
   577  #else
   578  #   define Tcl_ThreadCreateType		void
   579  #   define TCL_THREAD_CREATE_RETURN
   580  #endif
   581  
   582  /*
   583   * Definition of values for default stacksize and the possible flags to be
   584   * given to Tcl_CreateThread.
   585   */
   586  
   587  #define TCL_THREAD_STACK_DEFAULT (0)    /* Use default size for stack. */
   588  #define TCL_THREAD_NOFLAGS	 (0000) /* Standard flags, default
   589  					 * behaviour. */
   590  #define TCL_THREAD_JOINABLE	 (0001) /* Mark the thread as joinable. */
   591  
   592  /*
   593   * Flag values passed to Tcl_StringCaseMatch.
   594   */
   595  
   596  #define TCL_MATCH_NOCASE	(1<<0)
   597  
   598  /*
   599   * Flag values passed to Tcl_GetRegExpFromObj.
   600   */
   601  
   602  #define	TCL_REG_BASIC		000000	/* BREs (convenience). */
   603  #define	TCL_REG_EXTENDED	000001	/* EREs. */
   604  #define	TCL_REG_ADVF		000002	/* Advanced features in EREs. */
   605  #define	TCL_REG_ADVANCED	000003	/* AREs (which are also EREs). */
   606  #define	TCL_REG_QUOTE		000004	/* No special characters, none. */
   607  #define	TCL_REG_NOCASE		000010	/* Ignore case. */
   608  #define	TCL_REG_NOSUB		000020	/* Don't care about subexpressions. */
   609  #define	TCL_REG_EXPANDED	000040	/* Expanded format, white space &
   610  					 * comments. */
   611  #define	TCL_REG_NLSTOP		000100  /* \n doesn't match . or [^ ] */
   612  #define	TCL_REG_NLANCH		000200  /* ^ matches after \n, $ before. */
   613  #define	TCL_REG_NEWLINE		000300  /* Newlines are line terminators. */
   614  #define	TCL_REG_CANMATCH	001000  /* Report details on partial/limited
   615  					 * matches. */
   616  
   617  /*
   618   * Flags values passed to Tcl_RegExpExecObj.
   619   */
   620  
   621  #define	TCL_REG_NOTBOL	0001	/* Beginning of string does not match ^.  */
   622  #define	TCL_REG_NOTEOL	0002	/* End of string does not match $. */
   623  
   624  /*
   625   * Structures filled in by Tcl_RegExpInfo. Note that all offset values are
   626   * relative to the start of the match string, not the beginning of the entire
   627   * string.
   628   */
   629  
   630  typedef struct Tcl_RegExpIndices {
   631      long start;			/* Character offset of first character in
   632  				 * match. */
   633      long end;			/* Character offset of first character after
   634  				 * the match. */
   635  } Tcl_RegExpIndices;
   636  
   637  typedef struct Tcl_RegExpInfo {
   638      int nsubs;			/* Number of subexpressions in the compiled
   639  				 * expression. */
   640      Tcl_RegExpIndices *matches;	/* Array of nsubs match offset pairs. */
   641      long extendStart;		/* The offset at which a subsequent match
   642  				 * might begin. */
   643      long reserved;		/* Reserved for later use. */
   644  } Tcl_RegExpInfo;
   645  
   646  /*
   647   * Picky compilers complain if this typdef doesn't appear before the struct's
   648   * reference in tclDecls.h.
   649   */
   650  
   651  typedef Tcl_StatBuf *Tcl_Stat_;
   652  typedef struct stat *Tcl_OldStat_;
   653  
   654  /*
   655   *----------------------------------------------------------------------------
   656   * When a TCL command returns, the interpreter contains a result from the
   657   * command. Programmers are strongly encouraged to use one of the functions
   658   * Tcl_GetObjResult() or Tcl_GetStringResult() to read the interpreter's
   659   * result. See the SetResult man page for details. Besides this result, the
   660   * command function returns an integer code, which is one of the following:
   661   *
   662   * TCL_OK		Command completed normally; the interpreter's result
   663   *			contains the command's result.
   664   * TCL_ERROR		The command couldn't be completed successfully; the
   665   *			interpreter's result describes what went wrong.
   666   * TCL_RETURN		The command requests that the current function return;
   667   *			the interpreter's result contains the function's
   668   *			return value.
   669   * TCL_BREAK		The command requests that the innermost loop be
   670   *			exited; the interpreter's result is meaningless.
   671   * TCL_CONTINUE		Go on to the next iteration of the current loop; the
   672   *			interpreter's result is meaningless.
   673   */
   674  
   675  #define TCL_OK			0
   676  #define TCL_ERROR		1
   677  #define TCL_RETURN		2
   678  #define TCL_BREAK		3
   679  #define TCL_CONTINUE		4
   680  
   681  #define TCL_RESULT_SIZE		200
   682  
   683  /*
   684   *----------------------------------------------------------------------------
   685   * Flags to control what substitutions are performed by Tcl_SubstObj():
   686   */
   687  
   688  #define TCL_SUBST_COMMANDS	001
   689  #define TCL_SUBST_VARIABLES	002
   690  #define TCL_SUBST_BACKSLASHES	004
   691  #define TCL_SUBST_ALL		007
   692  
   693  /*
   694   * Argument descriptors for math function callbacks in expressions:
   695   */
   696  
   697  typedef enum {
   698      TCL_INT, TCL_DOUBLE, TCL_EITHER, TCL_WIDE_INT
   699  } Tcl_ValueType;
   700  
   701  typedef struct Tcl_Value {
   702      Tcl_ValueType type;		/* Indicates intValue or doubleValue is valid,
   703  				 * or both. */
   704      long intValue;		/* Integer value. */
   705      double doubleValue;		/* Double-precision floating value. */
   706      Tcl_WideInt wideValue;	/* Wide (min. 64-bit) integer value. */
   707  } Tcl_Value;
   708  
   709  /*
   710   * Forward declaration of Tcl_Obj to prevent an error when the forward
   711   * reference to Tcl_Obj is encountered in the function types declared below.
   712   */
   713  
   714  struct Tcl_Obj;
   715  
   716  /*
   717   *----------------------------------------------------------------------------
   718   * Function types defined by Tcl:
   719   */
   720  
   721  typedef int (Tcl_AppInitProc) (Tcl_Interp *interp);
   722  typedef int (Tcl_AsyncProc) (ClientData clientData, Tcl_Interp *interp,
   723  	int code);
   724  typedef void (Tcl_ChannelProc) (ClientData clientData, int mask);
   725  typedef void (Tcl_CloseProc) (ClientData data);
   726  typedef void (Tcl_CmdDeleteProc) (ClientData clientData);
   727  typedef int (Tcl_CmdProc) (ClientData clientData, Tcl_Interp *interp,
   728  	int argc, CONST84 char *argv[]);
   729  typedef void (Tcl_CmdTraceProc) (ClientData clientData, Tcl_Interp *interp,
   730  	int level, char *command, Tcl_CmdProc *proc,
   731  	ClientData cmdClientData, int argc, CONST84 char *argv[]);
   732  typedef int (Tcl_CmdObjTraceProc) (ClientData clientData, Tcl_Interp *interp,
   733  	int level, const char *command, Tcl_Command commandInfo, int objc,
   734  	struct Tcl_Obj *const *objv);
   735  typedef void (Tcl_CmdObjTraceDeleteProc) (ClientData clientData);
   736  typedef void (Tcl_DupInternalRepProc) (struct Tcl_Obj *srcPtr,
   737  	struct Tcl_Obj *dupPtr);
   738  typedef int (Tcl_EncodingConvertProc) (ClientData clientData, const char *src,
   739  	int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst,
   740  	int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr);
   741  typedef void (Tcl_EncodingFreeProc) (ClientData clientData);
   742  typedef int (Tcl_EventProc) (Tcl_Event *evPtr, int flags);
   743  typedef void (Tcl_EventCheckProc) (ClientData clientData, int flags);
   744  typedef int (Tcl_EventDeleteProc) (Tcl_Event *evPtr, ClientData clientData);
   745  typedef void (Tcl_EventSetupProc) (ClientData clientData, int flags);
   746  typedef void (Tcl_ExitProc) (ClientData clientData);
   747  typedef void (Tcl_FileProc) (ClientData clientData, int mask);
   748  typedef void (Tcl_FileFreeProc) (ClientData clientData);
   749  typedef void (Tcl_FreeInternalRepProc) (struct Tcl_Obj *objPtr);
   750  typedef void (Tcl_FreeProc) (char *blockPtr);
   751  typedef void (Tcl_IdleProc) (ClientData clientData);
   752  typedef void (Tcl_InterpDeleteProc) (ClientData clientData,
   753  	Tcl_Interp *interp);
   754  typedef int (Tcl_MathProc) (ClientData clientData, Tcl_Interp *interp,
   755  	Tcl_Value *args, Tcl_Value *resultPtr);
   756  typedef void (Tcl_NamespaceDeleteProc) (ClientData clientData);
   757  typedef int (Tcl_ObjCmdProc) (ClientData clientData, Tcl_Interp *interp,
   758  	int objc, struct Tcl_Obj *const *objv);
   759  typedef int (Tcl_PackageInitProc) (Tcl_Interp *interp);
   760  typedef int (Tcl_PackageUnloadProc) (Tcl_Interp *interp, int flags);
   761  typedef void (Tcl_PanicProc) (const char *format, ...);
   762  typedef void (Tcl_TcpAcceptProc) (ClientData callbackData, Tcl_Channel chan,
   763  	char *address, int port);
   764  typedef void (Tcl_TimerProc) (ClientData clientData);
   765  typedef int (Tcl_SetFromAnyProc) (Tcl_Interp *interp, struct Tcl_Obj *objPtr);
   766  typedef void (Tcl_UpdateStringProc) (struct Tcl_Obj *objPtr);
   767  typedef char * (Tcl_VarTraceProc) (ClientData clientData, Tcl_Interp *interp,
   768  	CONST84 char *part1, CONST84 char *part2, int flags);
   769  typedef void (Tcl_CommandTraceProc) (ClientData clientData, Tcl_Interp *interp,
   770  	const char *oldName, const char *newName, int flags);
   771  typedef void (Tcl_CreateFileHandlerProc) (int fd, int mask, Tcl_FileProc *proc,
   772  	ClientData clientData);
   773  typedef void (Tcl_DeleteFileHandlerProc) (int fd);
   774  typedef void (Tcl_AlertNotifierProc) (ClientData clientData);
   775  typedef void (Tcl_ServiceModeHookProc) (int mode);
   776  typedef ClientData (Tcl_InitNotifierProc) (void);
   777  typedef void (Tcl_FinalizeNotifierProc) (ClientData clientData);
   778  typedef void (Tcl_MainLoopProc) (void);
   779  
   780  /*
   781   *----------------------------------------------------------------------------
   782   * The following structure represents a type of object, which is a particular
   783   * internal representation for an object plus a set of functions that provide
   784   * standard operations on objects of that type.
   785   */
   786  
   787  typedef struct Tcl_ObjType {
   788      const char *name;		/* Name of the type, e.g. "int". */
   789      Tcl_FreeInternalRepProc *freeIntRepProc;
   790  				/* Called to free any storage for the type's
   791  				 * internal rep. NULL if the internal rep does
   792  				 * not need freeing. */
   793      Tcl_DupInternalRepProc *dupIntRepProc;
   794  				/* Called to create a new object as a copy of
   795  				 * an existing object. */
   796      Tcl_UpdateStringProc *updateStringProc;
   797  				/* Called to update the string rep from the
   798  				 * type's internal representation. */
   799      Tcl_SetFromAnyProc *setFromAnyProc;
   800  				/* Called to convert the object's internal rep
   801  				 * to this type. Frees the internal rep of the
   802  				 * old type. Returns TCL_ERROR on failure. */
   803  } Tcl_ObjType;
   804  
   805  /*
   806   * One of the following structures exists for each object in the Tcl system.
   807   * An object stores a value as either a string, some internal representation,
   808   * or both.
   809   */
   810  
   811  typedef struct Tcl_Obj {
   812      int refCount;		/* When 0 the object will be freed. */
   813      char *bytes;		/* This points to the first byte of the
   814  				 * object's string representation. The array
   815  				 * must be followed by a null byte (i.e., at
   816  				 * offset length) but may also contain
   817  				 * embedded null characters. The array's
   818  				 * storage is allocated by ckalloc. NULL means
   819  				 * the string rep is invalid and must be
   820  				 * regenerated from the internal rep.  Clients
   821  				 * should use Tcl_GetStringFromObj or
   822  				 * Tcl_GetString to get a pointer to the byte
   823  				 * array as a readonly value. */
   824      int length;			/* The number of bytes at *bytes, not
   825  				 * including the terminating null. */
   826      const Tcl_ObjType *typePtr;	/* Denotes the object's type. Always
   827  				 * corresponds to the type of the object's
   828  				 * internal rep. NULL indicates the object has
   829  				 * no internal rep (has no type). */
   830      union {			/* The internal representation: */
   831  	long longValue;		/*   - an long integer value. */
   832  	double doubleValue;	/*   - a double-precision floating value. */
   833  	void *otherValuePtr;	/*   - another, type-specific value. */
   834  	Tcl_WideInt wideValue;	/*   - a long long value. */
   835  	struct {		/*   - internal rep as two pointers. */
   836  	    void *ptr1;
   837  	    void *ptr2;
   838  	} twoPtrValue;
   839  	struct {		/*   - internal rep as a pointer and a long,
   840  				 *     the main use of which is a bignum's
   841  				 *     tightly packed fields, where the alloc,
   842  				 *     used and signum flags are packed into a
   843  				 *     single word with everything else hung
   844  				 *     off the pointer. */
   845  	    void *ptr;
   846  	    unsigned long value;
   847  	} ptrAndLongRep;
   848      } internalRep;
   849  } Tcl_Obj;
   850  
   851  /*
   852   * Macros to increment and decrement a Tcl_Obj's reference count, and to test
   853   * whether an object is shared (i.e. has reference count > 1). Note: clients
   854   * should use Tcl_DecrRefCount() when they are finished using an object, and
   855   * should never call TclFreeObj() directly. TclFreeObj() is only defined and
   856   * made public in tcl.h to support Tcl_DecrRefCount's macro definition.
   857   */
   858  
   859  void		Tcl_IncrRefCount(Tcl_Obj *objPtr);
   860  void		Tcl_DecrRefCount(Tcl_Obj *objPtr);
   861  int		Tcl_IsShared(Tcl_Obj *objPtr);
   862  
   863  /*
   864   *----------------------------------------------------------------------------
   865   * The following structure contains the state needed by Tcl_SaveResult. No-one
   866   * outside of Tcl should access any of these fields. This structure is
   867   * typically allocated on the stack.
   868   */
   869  
   870  typedef struct Tcl_SavedResult {
   871      char *result;
   872      Tcl_FreeProc *freeProc;
   873      Tcl_Obj *objResultPtr;
   874      char *appendResult;
   875      int appendAvl;
   876      int appendUsed;
   877      char resultSpace[TCL_RESULT_SIZE+1];
   878  } Tcl_SavedResult;
   879  
   880  /*
   881   *----------------------------------------------------------------------------
   882   * The following definitions support Tcl's namespace facility. Note: the first
   883   * five fields must match exactly the fields in a Namespace structure (see
   884   * tclInt.h).
   885   */
   886  
   887  typedef struct Tcl_Namespace {
   888      char *name;			/* The namespace's name within its parent
   889  				 * namespace. This contains no ::'s. The name
   890  				 * of the global namespace is "" although "::"
   891  				 * is an synonym. */
   892      char *fullName;		/* The namespace's fully qualified name. This
   893  				 * starts with ::. */
   894      ClientData clientData;	/* Arbitrary value associated with this
   895  				 * namespace. */
   896      Tcl_NamespaceDeleteProc *deleteProc;
   897  				/* Function invoked when deleting the
   898  				 * namespace to, e.g., free clientData. */
   899      struct Tcl_Namespace *parentPtr;
   900  				/* Points to the namespace that contains this
   901  				 * one. NULL if this is the global
   902  				 * namespace. */
   903  } Tcl_Namespace;
   904  
   905  /*
   906   *----------------------------------------------------------------------------
   907   * The following structure represents a call frame, or activation record. A
   908   * call frame defines a naming context for a procedure call: its local scope
   909   * (for local variables) and its namespace scope (used for non-local
   910   * variables; often the global :: namespace). A call frame can also define the
   911   * naming context for a namespace eval or namespace inscope command: the
   912   * namespace in which the command's code should execute. The Tcl_CallFrame
   913   * structures exist only while procedures or namespace eval/inscope's are
   914   * being executed, and provide a Tcl call stack.
   915   *
   916   * A call frame is initialized and pushed using Tcl_PushCallFrame and popped
   917   * using Tcl_PopCallFrame. Storage for a Tcl_CallFrame must be provided by the
   918   * Tcl_PushCallFrame caller, and callers typically allocate them on the C call
   919   * stack for efficiency. For this reason, Tcl_CallFrame is defined as a
   920   * structure and not as an opaque token. However, most Tcl_CallFrame fields
   921   * are hidden since applications should not access them directly; others are
   922   * declared as "dummyX".
   923   *
   924   * WARNING!! The structure definition must be kept consistent with the
   925   * CallFrame structure in tclInt.h. If you change one, change the other.
   926   */
   927  
   928  typedef struct Tcl_CallFrame {
   929      Tcl_Namespace *nsPtr;
   930      int dummy1;
   931      int dummy2;
   932      void *dummy3;
   933      void *dummy4;
   934      void *dummy5;
   935      int dummy6;
   936      void *dummy7;
   937      void *dummy8;
   938      int dummy9;
   939      void *dummy10;
   940      void *dummy11;
   941      void *dummy12;
   942      void *dummy13;
   943  } Tcl_CallFrame;
   944  
   945  /*
   946   *----------------------------------------------------------------------------
   947   * Information about commands that is returned by Tcl_GetCommandInfo and
   948   * passed to Tcl_SetCommandInfo. objProc is an objc/objv object-based command
   949   * function while proc is a traditional Tcl argc/argv string-based function.
   950   * Tcl_CreateObjCommand and Tcl_CreateCommand ensure that both objProc and
   951   * proc are non-NULL and can be called to execute the command. However, it may
   952   * be faster to call one instead of the other. The member isNativeObjectProc
   953   * is set to 1 if an object-based function was registered by
   954   * Tcl_CreateObjCommand, and to 0 if a string-based function was registered by
   955   * Tcl_CreateCommand. The other function is typically set to a compatibility
   956   * wrapper that does string-to-object or object-to-string argument conversions
   957   * then calls the other function.
   958   */
   959  
   960  typedef struct Tcl_CmdInfo {
   961      int isNativeObjectProc;	/* 1 if objProc was registered by a call to
   962  				 * Tcl_CreateObjCommand; 0 otherwise.
   963  				 * Tcl_SetCmdInfo does not modify this
   964  				 * field. */
   965      Tcl_ObjCmdProc *objProc;	/* Command's object-based function. */
   966      ClientData objClientData;	/* ClientData for object proc. */
   967      Tcl_CmdProc *proc;		/* Command's string-based function. */
   968      ClientData clientData;	/* ClientData for string proc. */
   969      Tcl_CmdDeleteProc *deleteProc;
   970  				/* Function to call when command is
   971  				 * deleted. */
   972      ClientData deleteData;	/* Value to pass to deleteProc (usually the
   973  				 * same as clientData). */
   974      Tcl_Namespace *namespacePtr;/* Points to the namespace that contains this
   975  				 * command. Note that Tcl_SetCmdInfo will not
   976  				 * change a command's namespace; use
   977  				 * TclRenameCommand or Tcl_Eval (of 'rename')
   978  				 * to do that. */
   979  } Tcl_CmdInfo;
   980  
   981  /*
   982   *----------------------------------------------------------------------------
   983   * The structure defined below is used to hold dynamic strings. The only
   984   * fields that clients should use are string and length, accessible via the
   985   * macros Tcl_DStringValue and Tcl_DStringLength.
   986   */
   987  
   988  #define TCL_DSTRING_STATIC_SIZE 200
   989  typedef struct Tcl_DString {
   990      char *string;		/* Points to beginning of string: either
   991  				 * staticSpace below or a malloced array. */
   992      int length;			/* Number of non-NULL characters in the
   993  				 * string. */
   994      int spaceAvl;		/* Total number of bytes available for the
   995  				 * string and its terminating NULL char. */
   996      char staticSpace[TCL_DSTRING_STATIC_SIZE];
   997  				/* Space to use in common case where string is
   998  				 * small. */
   999  } Tcl_DString;
  1000  
  1001  #define Tcl_DStringLength(dsPtr) ((dsPtr)->length)
  1002  #define Tcl_DStringValue(dsPtr) ((dsPtr)->string)
  1003  #define Tcl_DStringTrunc Tcl_DStringSetLength
  1004  
  1005  /*
  1006   * Definitions for the maximum number of digits of precision that may be
  1007   * specified in the "tcl_precision" variable, and the number of bytes of
  1008   * buffer space required by Tcl_PrintDouble.
  1009   */
  1010  
  1011  #define TCL_MAX_PREC		17
  1012  #define TCL_DOUBLE_SPACE	(TCL_MAX_PREC+10)
  1013  
  1014  /*
  1015   * Definition for a number of bytes of buffer space sufficient to hold the
  1016   * string representation of an integer in base 10 (assuming the existence of
  1017   * 64-bit integers).
  1018   */
  1019  
  1020  #define TCL_INTEGER_SPACE	24
  1021  
  1022  /*
  1023   * Flag values passed to Tcl_ConvertElement.
  1024   * TCL_DONT_USE_BRACES forces it not to enclose the element in braces, but to
  1025   *	use backslash quoting instead.
  1026   * TCL_DONT_QUOTE_HASH disables the default quoting of the '#' character. It
  1027   *	is safe to leave the hash unquoted when the element is not the first
  1028   *	element of a list, and this flag can be used by the caller to indicate
  1029   *	that condition.
  1030   */
  1031  
  1032  #define TCL_DONT_USE_BRACES	1
  1033  #define TCL_DONT_QUOTE_HASH	8
  1034  
  1035  /*
  1036   * Flag that may be passed to Tcl_GetIndexFromObj to force it to disallow
  1037   * abbreviated strings.
  1038   */
  1039  
  1040  #define TCL_EXACT	1
  1041  
  1042  /*
  1043   *----------------------------------------------------------------------------
  1044   * Flag values passed to Tcl_RecordAndEval, Tcl_EvalObj, Tcl_EvalObjv.
  1045   * WARNING: these bit choices must not conflict with the bit choices for
  1046   * evalFlag bits in tclInt.h!
  1047   *
  1048   * Meanings:
  1049   *	TCL_NO_EVAL:		Just record this command
  1050   *	TCL_EVAL_GLOBAL:	Execute script in global namespace
  1051   *	TCL_EVAL_DIRECT:	Do not compile this script
  1052   *	TCL_EVAL_INVOKE:	Magical Tcl_EvalObjv mode for aliases/ensembles
  1053   *				o Run in iPtr->lookupNsPtr or global namespace
  1054   *				o Cut out of error traces
  1055   *				o Don't reset the flags controlling ensemble
  1056   *				  error message rewriting.
  1057   *	TCL_CANCEL_UNWIND:	Magical Tcl_CancelEval mode that causes the
  1058   *				stack for the script in progress to be
  1059   *				completely unwound.
  1060   *	TCL_EVAL_NOERR:	Do no exception reporting at all, just return
  1061   *				as the caller will report.
  1062   */
  1063  
  1064  #define TCL_NO_EVAL		0x010000
  1065  #define TCL_EVAL_GLOBAL		0x020000
  1066  #define TCL_EVAL_DIRECT		0x040000
  1067  #define TCL_EVAL_INVOKE		0x080000
  1068  #define TCL_CANCEL_UNWIND	0x100000
  1069  #define TCL_EVAL_NOERR          0x200000
  1070  
  1071  /*
  1072   * Special freeProc values that may be passed to Tcl_SetResult (see the man
  1073   * page for details):
  1074   */
  1075  
  1076  #define TCL_VOLATILE		((Tcl_FreeProc *) 1)
  1077  #define TCL_STATIC		((Tcl_FreeProc *) 0)
  1078  #define TCL_DYNAMIC		((Tcl_FreeProc *) 3)
  1079  
  1080  /*
  1081   * Flag values passed to variable-related functions.
  1082   * WARNING: these bit choices must not conflict with the bit choice for
  1083   * TCL_CANCEL_UNWIND, above.
  1084   */
  1085  
  1086  #define TCL_GLOBAL_ONLY		 1
  1087  #define TCL_NAMESPACE_ONLY	 2
  1088  #define TCL_APPEND_VALUE	 4
  1089  #define TCL_LIST_ELEMENT	 8
  1090  #define TCL_TRACE_READS		 0x10
  1091  #define TCL_TRACE_WRITES	 0x20
  1092  #define TCL_TRACE_UNSETS	 0x40
  1093  #define TCL_TRACE_DESTROYED	 0x80
  1094  #define TCL_INTERP_DESTROYED	 0x100
  1095  #define TCL_LEAVE_ERR_MSG	 0x200
  1096  #define TCL_TRACE_ARRAY		 0x800
  1097  #ifndef TCL_REMOVE_OBSOLETE_TRACES
  1098  /* Required to support old variable/vdelete/vinfo traces. */
  1099  #define TCL_TRACE_OLD_STYLE	 0x1000
  1100  #endif
  1101  /* Indicate the semantics of the result of a trace. */
  1102  #define TCL_TRACE_RESULT_DYNAMIC 0x8000
  1103  #define TCL_TRACE_RESULT_OBJECT  0x10000
  1104  
  1105  /*
  1106   * Flag values for ensemble commands.
  1107   */
  1108  
  1109  #define TCL_ENSEMBLE_PREFIX 0x02/* Flag value to say whether to allow
  1110  				 * unambiguous prefixes of commands or to
  1111  				 * require exact matches for command names. */
  1112  
  1113  /*
  1114   * Flag values passed to command-related functions.
  1115   */
  1116  
  1117  #define TCL_TRACE_RENAME	0x2000
  1118  #define TCL_TRACE_DELETE	0x4000
  1119  
  1120  #define TCL_ALLOW_INLINE_COMPILATION 0x20000
  1121  
  1122  /*
  1123   * The TCL_PARSE_PART1 flag is deprecated and has no effect. The part1 is now
  1124   * always parsed whenever the part2 is NULL. (This is to avoid a common error
  1125   * when converting code to use the new object based APIs and forgetting to
  1126   * give the flag)
  1127   */
  1128  
  1129  #ifndef TCL_NO_DEPRECATED
  1130  #   define TCL_PARSE_PART1	0x400
  1131  #endif
  1132  
  1133  /*
  1134   * Types for linked variables:
  1135   */
  1136  
  1137  #define TCL_LINK_INT		1
  1138  #define TCL_LINK_DOUBLE		2
  1139  #define TCL_LINK_BOOLEAN	3
  1140  #define TCL_LINK_STRING		4
  1141  #define TCL_LINK_WIDE_INT	5
  1142  #define TCL_LINK_CHAR		6
  1143  #define TCL_LINK_UCHAR		7
  1144  #define TCL_LINK_SHORT		8
  1145  #define TCL_LINK_USHORT		9
  1146  #define TCL_LINK_UINT		10
  1147  #define TCL_LINK_LONG		11
  1148  #define TCL_LINK_ULONG		12
  1149  #define TCL_LINK_FLOAT		13
  1150  #define TCL_LINK_WIDE_UINT	14
  1151  #define TCL_LINK_READ_ONLY	0x80
  1152  
  1153  /*
  1154   *----------------------------------------------------------------------------
  1155   * Forward declarations of Tcl_HashTable and related types.
  1156   */
  1157  
  1158  typedef struct Tcl_HashKeyType Tcl_HashKeyType;
  1159  typedef struct Tcl_HashTable Tcl_HashTable;
  1160  typedef struct Tcl_HashEntry Tcl_HashEntry;
  1161  
  1162  typedef unsigned (Tcl_HashKeyProc) (Tcl_HashTable *tablePtr, void *keyPtr);
  1163  typedef int (Tcl_CompareHashKeysProc) (void *keyPtr, Tcl_HashEntry *hPtr);
  1164  typedef Tcl_HashEntry * (Tcl_AllocHashEntryProc) (Tcl_HashTable *tablePtr,
  1165  	void *keyPtr);
  1166  typedef void (Tcl_FreeHashEntryProc) (Tcl_HashEntry *hPtr);
  1167  
  1168  /*
  1169   * This flag controls whether the hash table stores the hash of a key, or
  1170   * recalculates it. There should be no reason for turning this flag off as it
  1171   * is completely binary and source compatible unless you directly access the
  1172   * bucketPtr member of the Tcl_HashTableEntry structure. This member has been
  1173   * removed and the space used to store the hash value.
  1174   */
  1175  
  1176  #ifndef TCL_HASH_KEY_STORE_HASH
  1177  #   define TCL_HASH_KEY_STORE_HASH 1
  1178  #endif
  1179  
  1180  /*
  1181   * Structure definition for an entry in a hash table. No-one outside Tcl
  1182   * should access any of these fields directly; use the macros defined below.
  1183   */
  1184  
  1185  struct Tcl_HashEntry {
  1186      Tcl_HashEntry *nextPtr;	/* Pointer to next entry in this hash bucket,
  1187  				 * or NULL for end of chain. */
  1188      Tcl_HashTable *tablePtr;	/* Pointer to table containing entry. */
  1189  #if TCL_HASH_KEY_STORE_HASH
  1190      void *hash;			/* Hash value, stored as pointer to ensure
  1191  				 * that the offsets of the fields in this
  1192  				 * structure are not changed. */
  1193  #else
  1194      Tcl_HashEntry **bucketPtr;	/* Pointer to bucket that points to first
  1195  				 * entry in this entry's chain: used for
  1196  				 * deleting the entry. */
  1197  #endif
  1198      ClientData clientData;	/* Application stores something here with
  1199  				 * Tcl_SetHashValue. */
  1200      union {			/* Key has one of these forms: */
  1201  	char *oneWordValue;	/* One-word value for key. */
  1202  	Tcl_Obj *objPtr;	/* Tcl_Obj * key value. */
  1203  	int words[1];		/* Multiple integer words for key. The actual
  1204  				 * size will be as large as necessary for this
  1205  				 * table's keys. */
  1206  	char string[1];		/* String for key. The actual size will be as
  1207  				 * large as needed to hold the key. */
  1208      } key;			/* MUST BE LAST FIELD IN RECORD!! */
  1209  };
  1210  
  1211  /*
  1212   * Flags used in Tcl_HashKeyType.
  1213   *
  1214   * TCL_HASH_KEY_RANDOMIZE_HASH -
  1215   *				There are some things, pointers for example
  1216   *				which don't hash well because they do not use
  1217   *				the lower bits. If this flag is set then the
  1218   *				hash table will attempt to rectify this by
  1219   *				randomising the bits and then using the upper
  1220   *				N bits as the index into the table.
  1221   * TCL_HASH_KEY_SYSTEM_HASH -	If this flag is set then all memory internally
  1222   *                              allocated for the hash table that is not for an
  1223   *                              entry will use the system heap.
  1224   */
  1225  
  1226  #define TCL_HASH_KEY_RANDOMIZE_HASH 0x1
  1227  #define TCL_HASH_KEY_SYSTEM_HASH    0x2
  1228  
  1229  /*
  1230   * Structure definition for the methods associated with a hash table key type.
  1231   */
  1232  
  1233  #define TCL_HASH_KEY_TYPE_VERSION 1
  1234  struct Tcl_HashKeyType {
  1235      int version;		/* Version of the table. If this structure is
  1236  				 * extended in future then the version can be
  1237  				 * used to distinguish between different
  1238  				 * structures. */
  1239      int flags;			/* Flags, see above for details. */
  1240      Tcl_HashKeyProc *hashKeyProc;
  1241  				/* Calculates a hash value for the key. If
  1242  				 * this is NULL then the pointer itself is
  1243  				 * used as a hash value. */
  1244      Tcl_CompareHashKeysProc *compareKeysProc;
  1245  				/* Compares two keys and returns zero if they
  1246  				 * do not match, and non-zero if they do. If
  1247  				 * this is NULL then the pointers are
  1248  				 * compared. */
  1249      Tcl_AllocHashEntryProc *allocEntryProc;
  1250  				/* Called to allocate memory for a new entry,
  1251  				 * i.e. if the key is a string then this could
  1252  				 * allocate a single block which contains
  1253  				 * enough space for both the entry and the
  1254  				 * string. Only the key field of the allocated
  1255  				 * Tcl_HashEntry structure needs to be filled
  1256  				 * in. If something else needs to be done to
  1257  				 * the key, i.e. incrementing a reference
  1258  				 * count then that should be done by this
  1259  				 * function. If this is NULL then Tcl_Alloc is
  1260  				 * used to allocate enough space for a
  1261  				 * Tcl_HashEntry and the key pointer is
  1262  				 * assigned to key.oneWordValue. */
  1263      Tcl_FreeHashEntryProc *freeEntryProc;
  1264  				/* Called to free memory associated with an
  1265  				 * entry. If something else needs to be done
  1266  				 * to the key, i.e. decrementing a reference
  1267  				 * count then that should be done by this
  1268  				 * function. If this is NULL then Tcl_Free is
  1269  				 * used to free the Tcl_HashEntry. */
  1270  };
  1271  
  1272  /*
  1273   * Structure definition for a hash table.  Must be in tcl.h so clients can
  1274   * allocate space for these structures, but clients should never access any
  1275   * fields in this structure.
  1276   */
  1277  
  1278  #define TCL_SMALL_HASH_TABLE 4
  1279  struct Tcl_HashTable {
  1280      Tcl_HashEntry **buckets;	/* Pointer to bucket array. Each element
  1281  				 * points to first entry in bucket's hash
  1282  				 * chain, or NULL. */
  1283      Tcl_HashEntry *staticBuckets[TCL_SMALL_HASH_TABLE];
  1284  				/* Bucket array used for small tables (to
  1285  				 * avoid mallocs and frees). */
  1286      int numBuckets;		/* Total number of buckets allocated at
  1287  				 * **bucketPtr. */
  1288      int numEntries;		/* Total number of entries present in
  1289  				 * table. */
  1290      int rebuildSize;		/* Enlarge table when numEntries gets to be
  1291  				 * this large. */
  1292      int downShift;		/* Shift count used in hashing function.
  1293  				 * Designed to use high-order bits of
  1294  				 * randomized keys. */
  1295      int mask;			/* Mask value used in hashing function. */
  1296      int keyType;		/* Type of keys used in this table. It's
  1297  				 * either TCL_CUSTOM_KEYS, TCL_STRING_KEYS,
  1298  				 * TCL_ONE_WORD_KEYS, or an integer giving the
  1299  				 * number of ints that is the size of the
  1300  				 * key. */
  1301      Tcl_HashEntry *(*findProc) (Tcl_HashTable *tablePtr, const char *key);
  1302      Tcl_HashEntry *(*createProc) (Tcl_HashTable *tablePtr, const char *key,
  1303  	    int *newPtr);
  1304      const Tcl_HashKeyType *typePtr;
  1305  				/* Type of the keys used in the
  1306  				 * Tcl_HashTable. */
  1307  };
  1308  
  1309  /*
  1310   * Structure definition for information used to keep track of searches through
  1311   * hash tables:
  1312   */
  1313  
  1314  typedef struct Tcl_HashSearch {
  1315      Tcl_HashTable *tablePtr;	/* Table being searched. */
  1316      int nextIndex;		/* Index of next bucket to be enumerated after
  1317  				 * present one. */
  1318      Tcl_HashEntry *nextEntryPtr;/* Next entry to be enumerated in the current
  1319  				 * bucket. */
  1320  } Tcl_HashSearch;
  1321  
  1322  /*
  1323   * Acceptable key types for hash tables:
  1324   *
  1325   * TCL_STRING_KEYS:		The keys are strings, they are copied into the
  1326   *				entry.
  1327   * TCL_ONE_WORD_KEYS:		The keys are pointers, the pointer is stored
  1328   *				in the entry.
  1329   * TCL_CUSTOM_TYPE_KEYS:	The keys are arbitrary types which are copied
  1330   *				into the entry.
  1331   * TCL_CUSTOM_PTR_KEYS:		The keys are pointers to arbitrary types, the
  1332   *				pointer is stored in the entry.
  1333   *
  1334   * While maintaining binary compatability the above have to be distinct values
  1335   * as they are used to differentiate between old versions of the hash table
  1336   * which don't have a typePtr and new ones which do. Once binary compatability
  1337   * is discarded in favour of making more wide spread changes TCL_STRING_KEYS
  1338   * can be the same as TCL_CUSTOM_TYPE_KEYS, and TCL_ONE_WORD_KEYS can be the
  1339   * same as TCL_CUSTOM_PTR_KEYS because they simply determine how the key is
  1340   * accessed from the entry and not the behaviour.
  1341   */
  1342  
  1343  #define TCL_STRING_KEYS		(0)
  1344  #define TCL_ONE_WORD_KEYS	(1)
  1345  #define TCL_CUSTOM_TYPE_KEYS	(-2)
  1346  #define TCL_CUSTOM_PTR_KEYS	(-1)
  1347  
  1348  /*
  1349   * Structure definition for information used to keep track of searches through
  1350   * dictionaries. These fields should not be accessed by code outside
  1351   * tclDictObj.c
  1352   */
  1353  
  1354  typedef struct {
  1355      void *next;			/* Search position for underlying hash
  1356  				 * table. */
  1357      int epoch;			/* Epoch marker for dictionary being searched,
  1358  				 * or -1 if search has terminated. */
  1359      Tcl_Dict dictionaryPtr;	/* Reference to dictionary being searched. */
  1360  } Tcl_DictSearch;
  1361  
  1362  /*
  1363   *----------------------------------------------------------------------------
  1364   * Flag values to pass to Tcl_DoOneEvent to disable searches for some kinds of
  1365   * events:
  1366   */
  1367  
  1368  #define TCL_DONT_WAIT		(1<<1)
  1369  #define TCL_WINDOW_EVENTS	(1<<2)
  1370  #define TCL_FILE_EVENTS		(1<<3)
  1371  #define TCL_TIMER_EVENTS	(1<<4)
  1372  #define TCL_IDLE_EVENTS		(1<<5)	/* WAS 0x10 ???? */
  1373  #define TCL_ALL_EVENTS		(~TCL_DONT_WAIT)
  1374  
  1375  /*
  1376   * The following structure defines a generic event for the Tcl event system.
  1377   * These are the things that are queued in calls to Tcl_QueueEvent and
  1378   * serviced later by Tcl_DoOneEvent. There can be many different kinds of
  1379   * events with different fields, corresponding to window events, timer events,
  1380   * etc. The structure for a particular event consists of a Tcl_Event header
  1381   * followed by additional information specific to that event.
  1382   */
  1383  
  1384  struct Tcl_Event {
  1385      Tcl_EventProc *proc;	/* Function to call to service this event. */
  1386      struct Tcl_Event *nextPtr;	/* Next in list of pending events, or NULL. */
  1387  };
  1388  
  1389  /*
  1390   * Positions to pass to Tcl_QueueEvent:
  1391   */
  1392  
  1393  typedef enum {
  1394      TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, TCL_QUEUE_MARK
  1395  } Tcl_QueuePosition;
  1396  
  1397  /*
  1398   * Values to pass to Tcl_SetServiceMode to specify the behavior of notifier
  1399   * event routines.
  1400   */
  1401  
  1402  #define TCL_SERVICE_NONE 0
  1403  #define TCL_SERVICE_ALL 1
  1404  
  1405  /*
  1406   * The following structure keeps is used to hold a time value, either as an
  1407   * absolute time (the number of seconds from the epoch) or as an elapsed time.
  1408   * On Unix systems the epoch is Midnight Jan 1, 1970 GMT.
  1409   */
  1410  
  1411  typedef struct Tcl_Time {
  1412      long sec;			/* Seconds. */
  1413      long usec;			/* Microseconds. */
  1414  } Tcl_Time;
  1415  
  1416  typedef void (Tcl_SetTimerProc) (CONST86 Tcl_Time *timePtr);
  1417  typedef int (Tcl_WaitForEventProc) (CONST86 Tcl_Time *timePtr);
  1418  
  1419  /*
  1420   * TIP #233 (Virtualized Time)
  1421   */
  1422  
  1423  typedef void (Tcl_GetTimeProc)   (Tcl_Time *timebuf, ClientData clientData);
  1424  typedef void (Tcl_ScaleTimeProc) (Tcl_Time *timebuf, ClientData clientData);
  1425  
  1426  /*
  1427   *----------------------------------------------------------------------------
  1428   * Bits to pass to Tcl_CreateFileHandler and Tcl_CreateChannelHandler to
  1429   * indicate what sorts of events are of interest:
  1430   */
  1431  
  1432  #define TCL_READABLE		(1<<1)
  1433  #define TCL_WRITABLE		(1<<2)
  1434  #define TCL_EXCEPTION		(1<<3)
  1435  
  1436  /*
  1437   * Flag values to pass to Tcl_OpenCommandChannel to indicate the disposition
  1438   * of the stdio handles. TCL_STDIN, TCL_STDOUT, TCL_STDERR, are also used in
  1439   * Tcl_GetStdChannel.
  1440   */
  1441  
  1442  #define TCL_STDIN		(1<<1)
  1443  #define TCL_STDOUT		(1<<2)
  1444  #define TCL_STDERR		(1<<3)
  1445  #define TCL_ENFORCE_MODE	(1<<4)
  1446  
  1447  /*
  1448   * Bits passed to Tcl_DriverClose2Proc to indicate which side of a channel
  1449   * should be closed.
  1450   */
  1451  
  1452  #define TCL_CLOSE_READ		(1<<1)
  1453  #define TCL_CLOSE_WRITE		(1<<2)
  1454  
  1455  /*
  1456   * Value to use as the closeProc for a channel that supports the close2Proc
  1457   * interface.
  1458   */
  1459  
  1460  #define TCL_CLOSE2PROC		((Tcl_DriverCloseProc *) 1)
  1461  
  1462  /*
  1463   * Channel version tag. This was introduced in 8.3.2/8.4.
  1464   */
  1465  
  1466  #define TCL_CHANNEL_VERSION_1	((Tcl_ChannelTypeVersion) 0x1)
  1467  #define TCL_CHANNEL_VERSION_2	((Tcl_ChannelTypeVersion) 0x2)
  1468  #define TCL_CHANNEL_VERSION_3	((Tcl_ChannelTypeVersion) 0x3)
  1469  #define TCL_CHANNEL_VERSION_4	((Tcl_ChannelTypeVersion) 0x4)
  1470  #define TCL_CHANNEL_VERSION_5	((Tcl_ChannelTypeVersion) 0x5)
  1471  
  1472  /*
  1473   * TIP #218: Channel Actions, Ids for Tcl_DriverThreadActionProc.
  1474   */
  1475  
  1476  #define TCL_CHANNEL_THREAD_INSERT (0)
  1477  #define TCL_CHANNEL_THREAD_REMOVE (1)
  1478  
  1479  /*
  1480   * Typedefs for the various operations in a channel type:
  1481   */
  1482  
  1483  typedef int	(Tcl_DriverBlockModeProc) (ClientData instanceData, int mode);
  1484  typedef int	(Tcl_DriverCloseProc) (ClientData instanceData,
  1485  			Tcl_Interp *interp);
  1486  typedef int	(Tcl_DriverClose2Proc) (ClientData instanceData,
  1487  			Tcl_Interp *interp, int flags);
  1488  typedef int	(Tcl_DriverInputProc) (ClientData instanceData, char *buf,
  1489  			int toRead, int *errorCodePtr);
  1490  typedef int	(Tcl_DriverOutputProc) (ClientData instanceData,
  1491  			CONST84 char *buf, int toWrite, int *errorCodePtr);
  1492  typedef int	(Tcl_DriverSeekProc) (ClientData instanceData, long offset,
  1493  			int mode, int *errorCodePtr);
  1494  typedef int	(Tcl_DriverSetOptionProc) (ClientData instanceData,
  1495  			Tcl_Interp *interp, const char *optionName,
  1496  			const char *value);
  1497  typedef int	(Tcl_DriverGetOptionProc) (ClientData instanceData,
  1498  			Tcl_Interp *interp, CONST84 char *optionName,
  1499  			Tcl_DString *dsPtr);
  1500  typedef void	(Tcl_DriverWatchProc) (ClientData instanceData, int mask);
  1501  typedef int	(Tcl_DriverGetHandleProc) (ClientData instanceData,
  1502  			int direction, ClientData *handlePtr);
  1503  typedef int	(Tcl_DriverFlushProc) (ClientData instanceData);
  1504  typedef int	(Tcl_DriverHandlerProc) (ClientData instanceData,
  1505  			int interestMask);
  1506  typedef Tcl_WideInt (Tcl_DriverWideSeekProc) (ClientData instanceData,
  1507  			Tcl_WideInt offset, int mode, int *errorCodePtr);
  1508  /*
  1509   * TIP #218, Channel Thread Actions
  1510   */
  1511  typedef void	(Tcl_DriverThreadActionProc) (ClientData instanceData,
  1512  			int action);
  1513  /*
  1514   * TIP #208, File Truncation (etc.)
  1515   */
  1516  typedef int	(Tcl_DriverTruncateProc) (ClientData instanceData,
  1517  			Tcl_WideInt length);
  1518  
  1519  /*
  1520   * struct Tcl_ChannelType:
  1521   *
  1522   * One such structure exists for each type (kind) of channel. It collects
  1523   * together in one place all the functions that are part of the specific
  1524   * channel type.
  1525   *
  1526   * It is recommend that the Tcl_Channel* functions are used to access elements
  1527   * of this structure, instead of direct accessing.
  1528   */
  1529  
  1530  typedef struct Tcl_ChannelType {
  1531      const char *typeName;	/* The name of the channel type in Tcl
  1532  				 * commands. This storage is owned by channel
  1533  				 * type. */
  1534      Tcl_ChannelTypeVersion version;
  1535  				/* Version of the channel type. */
  1536      Tcl_DriverCloseProc *closeProc;
  1537  				/* Function to call to close the channel, or
  1538  				 * TCL_CLOSE2PROC if the close2Proc should be
  1539  				 * used instead. */
  1540      Tcl_DriverInputProc *inputProc;
  1541  				/* Function to call for input on channel. */
  1542      Tcl_DriverOutputProc *outputProc;
  1543  				/* Function to call for output on channel. */
  1544      Tcl_DriverSeekProc *seekProc;
  1545  				/* Function to call to seek on the channel.
  1546  				 * May be NULL. */
  1547      Tcl_DriverSetOptionProc *setOptionProc;
  1548  				/* Set an option on a channel. */
  1549      Tcl_DriverGetOptionProc *getOptionProc;
  1550  				/* Get an option from a channel. */
  1551      Tcl_DriverWatchProc *watchProc;
  1552  				/* Set up the notifier to watch for events on
  1553  				 * this channel. */
  1554      Tcl_DriverGetHandleProc *getHandleProc;
  1555  				/* Get an OS handle from the channel or NULL
  1556  				 * if not supported. */
  1557      Tcl_DriverClose2Proc *close2Proc;
  1558  				/* Function to call to close the channel if
  1559  				 * the device supports closing the read &
  1560  				 * write sides independently. */
  1561      Tcl_DriverBlockModeProc *blockModeProc;
  1562  				/* Set blocking mode for the raw channel. May
  1563  				 * be NULL. */
  1564      /*
  1565       * Only valid in TCL_CHANNEL_VERSION_2 channels or later.
  1566       */
  1567      Tcl_DriverFlushProc *flushProc;
  1568  				/* Function to call to flush a channel. May be
  1569  				 * NULL. */
  1570      Tcl_DriverHandlerProc *handlerProc;
  1571  				/* Function to call to handle a channel event.
  1572  				 * This will be passed up the stacked channel
  1573  				 * chain. */
  1574      /*
  1575       * Only valid in TCL_CHANNEL_VERSION_3 channels or later.
  1576       */
  1577      Tcl_DriverWideSeekProc *wideSeekProc;
  1578  				/* Function to call to seek on the channel
  1579  				 * which can handle 64-bit offsets. May be
  1580  				 * NULL, and must be NULL if seekProc is
  1581  				 * NULL. */
  1582      /*
  1583       * Only valid in TCL_CHANNEL_VERSION_4 channels or later.
  1584       * TIP #218, Channel Thread Actions.
  1585       */
  1586      Tcl_DriverThreadActionProc *threadActionProc;
  1587  				/* Function to call to notify the driver of
  1588  				 * thread specific activity for a channel. May
  1589  				 * be NULL. */
  1590      /*
  1591       * Only valid in TCL_CHANNEL_VERSION_5 channels or later.
  1592       * TIP #208, File Truncation.
  1593       */
  1594      Tcl_DriverTruncateProc *truncateProc;
  1595  				/* Function to call to truncate the underlying
  1596  				 * file to a particular length. May be NULL if
  1597  				 * the channel does not support truncation. */
  1598  } Tcl_ChannelType;
  1599  
  1600  /*
  1601   * The following flags determine whether the blockModeProc above should set
  1602   * the channel into blocking or nonblocking mode. They are passed as arguments
  1603   * to the blockModeProc function in the above structure.
  1604   */
  1605  
  1606  #define TCL_MODE_BLOCKING	0	/* Put channel into blocking mode. */
  1607  #define TCL_MODE_NONBLOCKING	1	/* Put channel into nonblocking
  1608  					 * mode. */
  1609  
  1610  /*
  1611   *----------------------------------------------------------------------------
  1612   * Enum for different types of file paths.
  1613   */
  1614  
  1615  typedef enum Tcl_PathType {
  1616      TCL_PATH_ABSOLUTE,
  1617      TCL_PATH_RELATIVE,
  1618      TCL_PATH_VOLUME_RELATIVE
  1619  } Tcl_PathType;
  1620  
  1621  /*
  1622   * The following structure is used to pass glob type data amongst the various
  1623   * glob routines and Tcl_FSMatchInDirectory.
  1624   */
  1625  
  1626  typedef struct Tcl_GlobTypeData {
  1627      int type;			/* Corresponds to bcdpfls as in 'find -t'. */
  1628      int perm;			/* Corresponds to file permissions. */
  1629      Tcl_Obj *macType;		/* Acceptable Mac type. */
  1630      Tcl_Obj *macCreator;	/* Acceptable Mac creator. */
  1631  } Tcl_GlobTypeData;
  1632  
  1633  /*
  1634   * Type and permission definitions for glob command.
  1635   */
  1636  
  1637  #define TCL_GLOB_TYPE_BLOCK		(1<<0)
  1638  #define TCL_GLOB_TYPE_CHAR		(1<<1)
  1639  #define TCL_GLOB_TYPE_DIR		(1<<2)
  1640  #define TCL_GLOB_TYPE_PIPE		(1<<3)
  1641  #define TCL_GLOB_TYPE_FILE		(1<<4)
  1642  #define TCL_GLOB_TYPE_LINK		(1<<5)
  1643  #define TCL_GLOB_TYPE_SOCK		(1<<6)
  1644  #define TCL_GLOB_TYPE_MOUNT		(1<<7)
  1645  
  1646  #define TCL_GLOB_PERM_RONLY		(1<<0)
  1647  #define TCL_GLOB_PERM_HIDDEN		(1<<1)
  1648  #define TCL_GLOB_PERM_R			(1<<2)
  1649  #define TCL_GLOB_PERM_W			(1<<3)
  1650  #define TCL_GLOB_PERM_X			(1<<4)
  1651  
  1652  /*
  1653   * Flags for the unload callback function.
  1654   */
  1655  
  1656  #define TCL_UNLOAD_DETACH_FROM_INTERPRETER	(1<<0)
  1657  #define TCL_UNLOAD_DETACH_FROM_PROCESS		(1<<1)
  1658  
  1659  /*
  1660   * Typedefs for the various filesystem operations:
  1661   */
  1662  
  1663  typedef int (Tcl_FSStatProc) (Tcl_Obj *pathPtr, Tcl_StatBuf *buf);
  1664  typedef int (Tcl_FSAccessProc) (Tcl_Obj *pathPtr, int mode);
  1665  typedef Tcl_Channel (Tcl_FSOpenFileChannelProc) (Tcl_Interp *interp,
  1666  	Tcl_Obj *pathPtr, int mode, int permissions);
  1667  typedef int (Tcl_FSMatchInDirectoryProc) (Tcl_Interp *interp, Tcl_Obj *result,
  1668  	Tcl_Obj *pathPtr, const char *pattern, Tcl_GlobTypeData *types);
  1669  typedef Tcl_Obj * (Tcl_FSGetCwdProc) (Tcl_Interp *interp);
  1670  typedef int (Tcl_FSChdirProc) (Tcl_Obj *pathPtr);
  1671  typedef int (Tcl_FSLstatProc) (Tcl_Obj *pathPtr, Tcl_StatBuf *buf);
  1672  typedef int (Tcl_FSCreateDirectoryProc) (Tcl_Obj *pathPtr);
  1673  typedef int (Tcl_FSDeleteFileProc) (Tcl_Obj *pathPtr);
  1674  typedef int (Tcl_FSCopyDirectoryProc) (Tcl_Obj *srcPathPtr,
  1675  	Tcl_Obj *destPathPtr, Tcl_Obj **errorPtr);
  1676  typedef int (Tcl_FSCopyFileProc) (Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr);
  1677  typedef int (Tcl_FSRemoveDirectoryProc) (Tcl_Obj *pathPtr, int recursive,
  1678  	Tcl_Obj **errorPtr);
  1679  typedef int (Tcl_FSRenameFileProc) (Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr);
  1680  typedef void (Tcl_FSUnloadFileProc) (Tcl_LoadHandle loadHandle);
  1681  typedef Tcl_Obj * (Tcl_FSListVolumesProc) (void);
  1682  /* We have to declare the utime structure here. */
  1683  struct utimbuf;
  1684  typedef int (Tcl_FSUtimeProc) (Tcl_Obj *pathPtr, struct utimbuf *tval);
  1685  typedef int (Tcl_FSNormalizePathProc) (Tcl_Interp *interp, Tcl_Obj *pathPtr,
  1686  	int nextCheckpoint);
  1687  typedef int (Tcl_FSFileAttrsGetProc) (Tcl_Interp *interp, int index,
  1688  	Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef);
  1689  typedef const char *CONST86 * (Tcl_FSFileAttrStringsProc) (Tcl_Obj *pathPtr,
  1690  	Tcl_Obj **objPtrRef);
  1691  typedef int (Tcl_FSFileAttrsSetProc) (Tcl_Interp *interp, int index,
  1692  	Tcl_Obj *pathPtr, Tcl_Obj *objPtr);
  1693  typedef Tcl_Obj * (Tcl_FSLinkProc) (Tcl_Obj *pathPtr, Tcl_Obj *toPtr,
  1694  	int linkType);
  1695  typedef int (Tcl_FSLoadFileProc) (Tcl_Interp *interp, Tcl_Obj *pathPtr,
  1696  	Tcl_LoadHandle *handlePtr, Tcl_FSUnloadFileProc **unloadProcPtr);
  1697  typedef int (Tcl_FSPathInFilesystemProc) (Tcl_Obj *pathPtr,
  1698  	ClientData *clientDataPtr);
  1699  typedef Tcl_Obj * (Tcl_FSFilesystemPathTypeProc) (Tcl_Obj *pathPtr);
  1700  typedef Tcl_Obj * (Tcl_FSFilesystemSeparatorProc) (Tcl_Obj *pathPtr);
  1701  typedef void (Tcl_FSFreeInternalRepProc) (ClientData clientData);
  1702  typedef ClientData (Tcl_FSDupInternalRepProc) (ClientData clientData);
  1703  typedef Tcl_Obj * (Tcl_FSInternalToNormalizedProc) (ClientData clientData);
  1704  typedef ClientData (Tcl_FSCreateInternalRepProc) (Tcl_Obj *pathPtr);
  1705  
  1706  typedef struct Tcl_FSVersion_ *Tcl_FSVersion;
  1707  
  1708  /*
  1709   *----------------------------------------------------------------------------
  1710   * Data structures related to hooking into the filesystem
  1711   */
  1712  
  1713  /*
  1714   * Filesystem version tag.  This was introduced in 8.4.
  1715   */
  1716  
  1717  #define TCL_FILESYSTEM_VERSION_1	((Tcl_FSVersion) 0x1)
  1718  
  1719  /*
  1720   * struct Tcl_Filesystem:
  1721   *
  1722   * One such structure exists for each type (kind) of filesystem. It collects
  1723   * together in one place all the functions that are part of the specific
  1724   * filesystem. Tcl always accesses the filesystem through one of these
  1725   * structures.
  1726   *
  1727   * Not all entries need be non-NULL; any which are NULL are simply ignored.
  1728   * However, a complete filesystem should provide all of these functions. The
  1729   * explanations in the structure show the importance of each function.
  1730   */
  1731  
  1732  typedef struct Tcl_Filesystem {
  1733      const char *typeName;	/* The name of the filesystem. */
  1734      int structureLength;	/* Length of this structure, so future binary
  1735  				 * compatibility can be assured. */
  1736      Tcl_FSVersion version;	/* Version of the filesystem type. */
  1737      Tcl_FSPathInFilesystemProc *pathInFilesystemProc;
  1738  				/* Function to check whether a path is in this
  1739  				 * filesystem. This is the most important
  1740  				 * filesystem function. */
  1741      Tcl_FSDupInternalRepProc *dupInternalRepProc;
  1742  				/* Function to duplicate internal fs rep. May
  1743  				 * be NULL (but then fs is less efficient). */
  1744      Tcl_FSFreeInternalRepProc *freeInternalRepProc;
  1745  				/* Function to free internal fs rep. Must be
  1746  				 * implemented if internal representations
  1747  				 * need freeing, otherwise it can be NULL. */
  1748      Tcl_FSInternalToNormalizedProc *internalToNormalizedProc;
  1749  				/* Function to convert internal representation
  1750  				 * to a normalized path. Only required if the
  1751  				 * fs creates pure path objects with no
  1752  				 * string/path representation. */
  1753      Tcl_FSCreateInternalRepProc *createInternalRepProc;
  1754  				/* Function to create a filesystem-specific
  1755  				 * internal representation. May be NULL if
  1756  				 * paths have no internal representation, or
  1757  				 * if the Tcl_FSPathInFilesystemProc for this
  1758  				 * filesystem always immediately creates an
  1759  				 * internal representation for paths it
  1760  				 * accepts. */
  1761      Tcl_FSNormalizePathProc *normalizePathProc;
  1762  				/* Function to normalize a path.  Should be
  1763  				 * implemented for all filesystems which can
  1764  				 * have multiple string representations for
  1765  				 * the same path object. */
  1766      Tcl_FSFilesystemPathTypeProc *filesystemPathTypeProc;
  1767  				/* Function to determine the type of a path in
  1768  				 * this filesystem. May be NULL. */
  1769      Tcl_FSFilesystemSeparatorProc *filesystemSeparatorProc;
  1770  				/* Function to return the separator
  1771  				 * character(s) for this filesystem. Must be
  1772  				 * implemented. */
  1773      Tcl_FSStatProc *statProc;	/* Function to process a 'Tcl_FSStat()' call.
  1774  				 * Must be implemented for any reasonable
  1775  				 * filesystem. */
  1776      Tcl_FSAccessProc *accessProc;
  1777  				/* Function to process a 'Tcl_FSAccess()'
  1778  				 * call. Must be implemented for any
  1779  				 * reasonable filesystem. */
  1780      Tcl_FSOpenFileChannelProc *openFileChannelProc;
  1781  				/* Function to process a
  1782  				 * 'Tcl_FSOpenFileChannel()' call. Must be
  1783  				 * implemented for any reasonable
  1784  				 * filesystem. */
  1785      Tcl_FSMatchInDirectoryProc *matchInDirectoryProc;
  1786  				/* Function to process a
  1787  				 * 'Tcl_FSMatchInDirectory()'.  If not
  1788  				 * implemented, then glob and recursive copy
  1789  				 * functionality will be lacking in the
  1790  				 * filesystem. */
  1791      Tcl_FSUtimeProc *utimeProc;	/* Function to process a 'Tcl_FSUtime()' call.
  1792  				 * Required to allow setting (not reading) of
  1793  				 * times with 'file mtime', 'file atime' and
  1794  				 * the open-r/open-w/fcopy implementation of
  1795  				 * 'file copy'. */
  1796      Tcl_FSLinkProc *linkProc;	/* Function to process a 'Tcl_FSLink()' call.
  1797  				 * Should be implemented only if the
  1798  				 * filesystem supports links (reading or
  1799  				 * creating). */
  1800      Tcl_FSListVolumesProc *listVolumesProc;
  1801  				/* Function to list any filesystem volumes
  1802  				 * added by this filesystem. Should be
  1803  				 * implemented only if the filesystem adds
  1804  				 * volumes at the head of the filesystem. */
  1805      Tcl_FSFileAttrStringsProc *fileAttrStringsProc;
  1806  				/* Function to list all attributes strings
  1807  				 * which are valid for this filesystem. If not
  1808  				 * implemented the filesystem will not support
  1809  				 * the 'file attributes' command. This allows
  1810  				 * arbitrary additional information to be
  1811  				 * attached to files in the filesystem. */
  1812      Tcl_FSFileAttrsGetProc *fileAttrsGetProc;
  1813  				/* Function to process a
  1814  				 * 'Tcl_FSFileAttrsGet()' call, used by 'file
  1815  				 * attributes'. */
  1816      Tcl_FSFileAttrsSetProc *fileAttrsSetProc;
  1817  				/* Function to process a
  1818  				 * 'Tcl_FSFileAttrsSet()' call, used by 'file
  1819  				 * attributes'.  */
  1820      Tcl_FSCreateDirectoryProc *createDirectoryProc;
  1821  				/* Function to process a
  1822  				 * 'Tcl_FSCreateDirectory()' call. Should be
  1823  				 * implemented unless the FS is read-only. */
  1824      Tcl_FSRemoveDirectoryProc *removeDirectoryProc;
  1825  				/* Function to process a
  1826  				 * 'Tcl_FSRemoveDirectory()' call. Should be
  1827  				 * implemented unless the FS is read-only. */
  1828      Tcl_FSDeleteFileProc *deleteFileProc;
  1829  				/* Function to process a 'Tcl_FSDeleteFile()'
  1830  				 * call. Should be implemented unless the FS
  1831  				 * is read-only. */
  1832      Tcl_FSCopyFileProc *copyFileProc;
  1833  				/* Function to process a 'Tcl_FSCopyFile()'
  1834  				 * call. If not implemented Tcl will fall back
  1835  				 * on open-r, open-w and fcopy as a copying
  1836  				 * mechanism, for copying actions initiated in
  1837  				 * Tcl (not C). */
  1838      Tcl_FSRenameFileProc *renameFileProc;
  1839  				/* Function to process a 'Tcl_FSRenameFile()'
  1840  				 * call. If not implemented, Tcl will fall
  1841  				 * back on a copy and delete mechanism, for
  1842  				 * rename actions initiated in Tcl (not C). */
  1843      Tcl_FSCopyDirectoryProc *copyDirectoryProc;
  1844  				/* Function to process a
  1845  				 * 'Tcl_FSCopyDirectory()' call. If not
  1846  				 * implemented, Tcl will fall back on a
  1847  				 * recursive create-dir, file copy mechanism,
  1848  				 * for copying actions initiated in Tcl (not
  1849  				 * C). */
  1850      Tcl_FSLstatProc *lstatProc;	/* Function to process a 'Tcl_FSLstat()' call.
  1851  				 * If not implemented, Tcl will attempt to use
  1852  				 * the 'statProc' defined above instead. */
  1853      Tcl_FSLoadFileProc *loadFileProc;
  1854  				/* Function to process a 'Tcl_FSLoadFile()'
  1855  				 * call. If not implemented, Tcl will fall
  1856  				 * back on a copy to native-temp followed by a
  1857  				 * Tcl_FSLoadFile on that temporary copy. */
  1858      Tcl_FSGetCwdProc *getCwdProc;
  1859  				/* Function to process a 'Tcl_FSGetCwd()'
  1860  				 * call. Most filesystems need not implement
  1861  				 * this. It will usually only be called once,
  1862  				 * if 'getcwd' is called before 'chdir'. May
  1863  				 * be NULL. */
  1864      Tcl_FSChdirProc *chdirProc;	/* Function to process a 'Tcl_FSChdir()' call.
  1865  				 * If filesystems do not implement this, it
  1866  				 * will be emulated by a series of directory
  1867  				 * access checks. Otherwise, virtual
  1868  				 * filesystems which do implement it need only
  1869  				 * respond with a positive return result if
  1870  				 * the dirName is a valid directory in their
  1871  				 * filesystem. They need not remember the
  1872  				 * result, since that will be automatically
  1873  				 * remembered for use by GetCwd. Real
  1874  				 * filesystems should carry out the correct
  1875  				 * action (i.e. call the correct system
  1876  				 * 'chdir' api). If not implemented, then 'cd'
  1877  				 * and 'pwd' will fail inside the
  1878  				 * filesystem. */
  1879  } Tcl_Filesystem;
  1880  
  1881  /*
  1882   * The following definitions are used as values for the 'linkAction' flag to
  1883   * Tcl_FSLink, or the linkProc of any filesystem. Any combination of flags can
  1884   * be given. For link creation, the linkProc should create a link which
  1885   * matches any of the types given.
  1886   *
  1887   * TCL_CREATE_SYMBOLIC_LINK -	Create a symbolic or soft link.
  1888   * TCL_CREATE_HARD_LINK -	Create a hard link.
  1889   */
  1890  
  1891  #define TCL_CREATE_SYMBOLIC_LINK	0x01
  1892  #define TCL_CREATE_HARD_LINK		0x02
  1893  
  1894  /*
  1895   *----------------------------------------------------------------------------
  1896   * The following structure represents the Notifier functions that you can
  1897   * override with the Tcl_SetNotifier call.
  1898   */
  1899  
  1900  typedef struct Tcl_NotifierProcs {
  1901      Tcl_SetTimerProc *setTimerProc;
  1902      Tcl_WaitForEventProc *waitForEventProc;
  1903      Tcl_CreateFileHandlerProc *createFileHandlerProc;
  1904      Tcl_DeleteFileHandlerProc *deleteFileHandlerProc;
  1905      Tcl_InitNotifierProc *initNotifierProc;
  1906      Tcl_FinalizeNotifierProc *finalizeNotifierProc;
  1907      Tcl_AlertNotifierProc *alertNotifierProc;
  1908      Tcl_ServiceModeHookProc *serviceModeHookProc;
  1909  } Tcl_NotifierProcs;
  1910  
  1911  /*
  1912   *----------------------------------------------------------------------------
  1913   * The following data structures and declarations are for the new Tcl parser.
  1914   *
  1915   * For each word of a command, and for each piece of a word such as a variable
  1916   * reference, one of the following structures is created to describe the
  1917   * token.
  1918   */
  1919  
  1920  typedef struct Tcl_Token {
  1921      int type;			/* Type of token, such as TCL_TOKEN_WORD; see
  1922  				 * below for valid types. */
  1923      const char *start;		/* First character in token. */
  1924      int size;			/* Number of bytes in token. */
  1925      int numComponents;		/* If this token is composed of other tokens,
  1926  				 * this field tells how many of them there are
  1927  				 * (including components of components, etc.).
  1928  				 * The component tokens immediately follow
  1929  				 * this one. */
  1930  } Tcl_Token;
  1931  
  1932  /*
  1933   * Type values defined for Tcl_Token structures. These values are defined as
  1934   * mask bits so that it's easy to check for collections of types.
  1935   *
  1936   * TCL_TOKEN_WORD -		The token describes one word of a command,
  1937   *				from the first non-blank character of the word
  1938   *				(which may be " or {) up to but not including
  1939   *				the space, semicolon, or bracket that
  1940   *				terminates the word. NumComponents counts the
  1941   *				total number of sub-tokens that make up the
  1942   *				word. This includes, for example, sub-tokens
  1943   *				of TCL_TOKEN_VARIABLE tokens.
  1944   * TCL_TOKEN_SIMPLE_WORD -	This token is just like TCL_TOKEN_WORD except
  1945   *				that the word is guaranteed to consist of a
  1946   *				single TCL_TOKEN_TEXT sub-token.
  1947   * TCL_TOKEN_TEXT -		The token describes a range of literal text
  1948   *				that is part of a word. NumComponents is
  1949   *				always 0.
  1950   * TCL_TOKEN_BS -		The token describes a backslash sequence that
  1951   *				must be collapsed. NumComponents is always 0.
  1952   * TCL_TOKEN_COMMAND -		The token describes a command whose result
  1953   *				must be substituted into the word. The token
  1954   *				includes the enclosing brackets. NumComponents
  1955   *				is always 0.
  1956   * TCL_TOKEN_VARIABLE -		The token describes a variable substitution,
  1957   *				including the dollar sign, variable name, and
  1958   *				array index (if there is one) up through the
  1959   *				right parentheses. NumComponents tells how
  1960   *				many additional tokens follow to represent the
  1961   *				variable name. The first token will be a
  1962   *				TCL_TOKEN_TEXT token that describes the
  1963   *				variable name. If the variable is an array
  1964   *				reference then there will be one or more
  1965   *				additional tokens, of type TCL_TOKEN_TEXT,
  1966   *				TCL_TOKEN_BS, TCL_TOKEN_COMMAND, and
  1967   *				TCL_TOKEN_VARIABLE, that describe the array
  1968   *				index; numComponents counts the total number
  1969   *				of nested tokens that make up the variable
  1970   *				reference, including sub-tokens of
  1971   *				TCL_TOKEN_VARIABLE tokens.
  1972   * TCL_TOKEN_SUB_EXPR -		The token describes one subexpression of an
  1973   *				expression, from the first non-blank character
  1974   *				of the subexpression up to but not including
  1975   *				the space, brace, or bracket that terminates
  1976   *				the subexpression. NumComponents counts the
  1977   *				total number of following subtokens that make
  1978   *				up the subexpression; this includes all
  1979   *				subtokens for any nested TCL_TOKEN_SUB_EXPR
  1980   *				tokens. For example, a numeric value used as a
  1981   *				primitive operand is described by a
  1982   *				TCL_TOKEN_SUB_EXPR token followed by a
  1983   *				TCL_TOKEN_TEXT token. A binary subexpression
  1984   *				is described by a TCL_TOKEN_SUB_EXPR token
  1985   *				followed by the TCL_TOKEN_OPERATOR token for
  1986   *				the operator, then TCL_TOKEN_SUB_EXPR tokens
  1987   *				for the left then the right operands.
  1988   * TCL_TOKEN_OPERATOR -		The token describes one expression operator.
  1989   *				An operator might be the name of a math
  1990   *				function such as "abs". A TCL_TOKEN_OPERATOR
  1991   *				token is always preceeded by one
  1992   *				TCL_TOKEN_SUB_EXPR token for the operator's
  1993   *				subexpression, and is followed by zero or more
  1994   *				TCL_TOKEN_SUB_EXPR tokens for the operator's
  1995   *				operands. NumComponents is always 0.
  1996   * TCL_TOKEN_EXPAND_WORD -	This token is just like TCL_TOKEN_WORD except
  1997   *				that it marks a word that began with the
  1998   *				literal character prefix "{*}". This word is
  1999   *				marked to be expanded - that is, broken into
  2000   *				words after substitution is complete.
  2001   */
  2002  
  2003  #define TCL_TOKEN_WORD		1
  2004  #define TCL_TOKEN_SIMPLE_WORD	2
  2005  #define TCL_TOKEN_TEXT		4
  2006  #define TCL_TOKEN_BS		8
  2007  #define TCL_TOKEN_COMMAND	16
  2008  #define TCL_TOKEN_VARIABLE	32
  2009  #define TCL_TOKEN_SUB_EXPR	64
  2010  #define TCL_TOKEN_OPERATOR	128
  2011  #define TCL_TOKEN_EXPAND_WORD	256
  2012  
  2013  /*
  2014   * Parsing error types. On any parsing error, one of these values will be
  2015   * stored in the error field of the Tcl_Parse structure defined below.
  2016   */
  2017  
  2018  #define TCL_PARSE_SUCCESS		0
  2019  #define TCL_PARSE_QUOTE_EXTRA		1
  2020  #define TCL_PARSE_BRACE_EXTRA		2
  2021  #define TCL_PARSE_MISSING_BRACE		3
  2022  #define TCL_PARSE_MISSING_BRACKET	4
  2023  #define TCL_PARSE_MISSING_PAREN		5
  2024  #define TCL_PARSE_MISSING_QUOTE		6
  2025  #define TCL_PARSE_MISSING_VAR_BRACE	7
  2026  #define TCL_PARSE_SYNTAX		8
  2027  #define TCL_PARSE_BAD_NUMBER		9
  2028  
  2029  /*
  2030   * A structure of the following type is filled in by Tcl_ParseCommand. It
  2031   * describes a single command parsed from an input string.
  2032   */
  2033  
  2034  #define NUM_STATIC_TOKENS 20
  2035  
2036 typedef struct Tcl_Parse { 2037 const char *commentStart; /* Pointer to # that begins the first of one 2038 * or more comments preceding the command. */ 2039 int commentSize; /* Number of bytes in comments (up through 2040 * newline character that terminates the last 2041 * comment). If there were no comments, this 2042 * field is 0. */ 2043 const char *commandStart; /* First character in first word of 2044 * command. */ 2045 int commandSize; /* Number of bytes in command, including first 2046 * character of first word, up through the 2047 * terminating newline, close bracket, or 2048 * semicolon. */ 2049 int numWords; /* Total number of words in command. May be 2050 * 0. */
2051 Tcl_Token *tokenPtr; /* Pointer to first token representing the 2052 * words of the command. Initially points to 2053 * staticTokens, but may change to point to 2054 * malloc-ed space if command exceeds space in 2055 * staticTokens. */ 2056 int numTokens; /* Total number of tokens in command. */ 2057 int tokensAvailable; /* Total number of tokens available at 2058 * *tokenPtr. */ 2059 int errorType; /* One of the parsing error types defined 2060 * above. */ 2061 2062 /* 2063 * The fields below are intended only for the private use of the parser. 2064 * They should not be used by functions that invoke Tcl_ParseCommand. 2065 */ 2066 2067 const char *string; /* The original command string passed to 2068 * Tcl_ParseCommand. */ 2069 const char *end; /* Points to the character just after the last 2070 * one in the command string. */ 2071 Tcl_Interp *interp; /* Interpreter to use for error reporting, or 2072 * NULL. */ 2073 const char *term; /* Points to character in string that 2074 * terminated most recent token. Filled in by 2075 * ParseTokens. If an error occurs, points to 2076 * beginning of region where the error 2077 * occurred (e.g. the open brace if the close 2078 * brace is missing). */ 2079 int incomplete; /* This field is set to 1 by Tcl_ParseCommand 2080 * if the command appears to be incomplete. 2081 * This information is used by 2082 * Tcl_CommandComplete. */ 2083 Tcl_Token staticTokens[NUM_STATIC_TOKENS]; 2084 /* Initial space for tokens for command. This 2085 * space should be large enough to accommodate 2086 * most commands; dynamic space is allocated 2087 * for very large commands that don't fit 2088 * here. */ 2089 } Tcl_Parse; 2090 2091 /* 2092 *---------------------------------------------------------------------------- 2093 * The following structure represents a user-defined encoding. It collects 2094 * together all the functions that are used by the specific encoding. 2095 */ 2096 2097 typedef struct Tcl_EncodingType { 2098 const char *encodingName; /* The name of the encoding, e.g. "euc-jp". 2099 * This name is the unique key for this 2100 * encoding type. */ 2101 Tcl_EncodingConvertProc *toUtfProc; 2102 /* Function to convert from external encoding 2103 * into UTF-8. */ 2104 Tcl_EncodingConvertProc *fromUtfProc; 2105 /* Function to convert from UTF-8 into 2106 * external encoding. */ 2107 Tcl_EncodingFreeProc *freeProc; 2108 /* If non-NULL, function to call when this 2109 * encoding is deleted. */ 2110 ClientData clientData; /* Arbitrary value associated with encoding 2111 * type. Passed to conversion functions. */ 2112 int nullSize; /* Number of zero bytes that signify 2113 * end-of-string in this encoding. This number 2114 * is used to determine the source string 2115 * length when the srcLen argument is 2116 * negative. Must be 1 or 2. */ 2117 } Tcl_EncodingType; 2118 2119 /* 2120 * The following definitions are used as values for the conversion control 2121 * flags argument when converting text from one character set to another: 2122 * 2123 * TCL_ENCODING_START - Signifies that the source buffer is the first 2124 * block in a (potentially multi-block) input 2125 * stream. Tells the conversion function to reset 2126 * to an initial state and perform any 2127 * initialization that needs to occur before the 2128 * first byte is converted. If the source buffer 2129 * contains the entire input stream to be 2130 * converted, this flag should be set. 2131 * TCL_ENCODING_END - Signifies that the source buffer is the last 2132 * block in a (potentially multi-block) input 2133 * stream. Tells the conversion routine to 2134 * perform any finalization that needs to occur 2135 * after the last byte is converted and then to 2136 * reset to an initial state. If the source 2137 * buffer contains the entire input stream to be 2138 * converted, this flag should be set. 2139 * TCL_ENCODING_STOPONERROR - If set, then the converter will return 2140 * immediately upon encountering an invalid byte 2141 * sequence or a source character that has no 2142 * mapping in the target encoding. If clear, then 2143 * the converter will skip the problem, 2144 * substituting one or more "close" characters in 2145 * the destination buffer and then continue to 2146 * convert the source. 2147 */ 2148 2149 #define TCL_ENCODING_START 0x01 2150 #define TCL_ENCODING_END 0x02 2151 #define TCL_ENCODING_STOPONERROR 0x04 2152 2153 /* 2154 * The following definitions are the error codes returned by the conversion 2155 * routines: 2156 * 2157 * TCL_OK - All characters were converted. 2158 * TCL_CONVERT_NOSPACE - The output buffer would not have been large 2159 * enough for all of the converted data; as many 2160 * characters as could fit were converted though. 2161 * TCL_CONVERT_MULTIBYTE - The last few bytes in the source string were 2162 * the beginning of a multibyte sequence, but 2163 * more bytes were needed to complete this 2164 * sequence. A subsequent call to the conversion 2165 * routine should pass the beginning of this 2166 * unconverted sequence plus additional bytes 2167 * from the source stream to properly convert the 2168 * formerly split-up multibyte sequence. 2169 * TCL_CONVERT_SYNTAX - The source stream contained an invalid 2170 * character sequence. This may occur if the 2171 * input stream has been damaged or if the input 2172 * encoding method was misidentified. This error 2173 * is reported only if TCL_ENCODING_STOPONERROR 2174 * was specified. 2175 * TCL_CONVERT_UNKNOWN - The source string contained a character that 2176 * could not be represented in the target 2177 * encoding. This error is reported only if 2178 * TCL_ENCODING_STOPONERROR was specified. 2179 */ 2180 2181 #define TCL_CONVERT_MULTIBYTE (-1) 2182 #define TCL_CONVERT_SYNTAX (-2) 2183 #define TCL_CONVERT_UNKNOWN (-3) 2184 #define TCL_CONVERT_NOSPACE (-4) 2185 2186 /* 2187 * The maximum number of bytes that are necessary to represent a single 2188 * Unicode character in UTF-8. The valid values should be 3, 4 or 6 2189 * (or perhaps 1 if we want to support a non-unicode enabled core). If 3 or 2190 * 4, then Tcl_UniChar must be 2-bytes in size (UCS-2) (the default). If 6, 2191 * then Tcl_UniChar must be 4-bytes in size (UCS-4). At this time UCS-2 mode 2192 * is the default and recommended mode. UCS-4 is experimental and not 2193 * recommended. It works for the core, but most extensions expect UCS-2. 2194 */ 2195 2196 #ifndef TCL_UTF_MAX 2197 #define TCL_UTF_MAX 3 2198 #endif 2199 2200 /* 2201 * This represents a Unicode character. Any changes to this should also be 2202 * reflected in regcustom.h. 2203 */ 2204 2205 #if TCL_UTF_MAX > 4 2206 /* 2207 * unsigned int isn't 100% accurate as it should be a strict 4-byte value 2208 * (perhaps wchar_t). 64-bit systems may have troubles. The size of this 2209 * value must be reflected correctly in regcustom.h and 2210 * in tclEncoding.c. 2211 * XXX: Tcl is currently UCS-2 and planning UTF-16 for the Unicode 2212 * XXX: string rep that Tcl_UniChar represents. Changing the size 2213 * XXX: of Tcl_UniChar is /not/ supported. 2214 */ 2215 typedef unsigned int Tcl_UniChar; 2216 #else 2217 typedef unsigned short Tcl_UniChar; 2218 #endif 2219 2220 /* 2221 *---------------------------------------------------------------------------- 2222 * TIP #59: The following structure is used in calls 'Tcl_RegisterConfig' to 2223 * provide the system with the embedded configuration data. 2224 */ 2225 2226 typedef struct Tcl_Config { 2227 const char *key; /* Configuration key to register. ASCII 2228 * encoded, thus UTF-8. */ 2229 const char *value; /* The value associated with the key. System 2230 * encoding. */ 2231 } Tcl_Config; 2232 2233 /* 2234 *---------------------------------------------------------------------------- 2235 * Flags for TIP#143 limits, detailing which limits are active in an 2236 * interpreter. Used for Tcl_{Add,Remove}LimitHandler type argument. 2237 */ 2238 2239 #define TCL_LIMIT_COMMANDS 0x01 2240 #define TCL_LIMIT_TIME 0x02 2241 2242 /* 2243 * Structure containing information about a limit handler to be called when a 2244 * command- or time-limit is exceeded by an interpreter. 2245 */ 2246 2247 typedef void (Tcl_LimitHandlerProc) (ClientData clientData, Tcl_Interp *interp); 2248 typedef void (Tcl_LimitHandlerDeleteProc) (ClientData clientData); 2249 2250 /* 2251 *---------------------------------------------------------------------------- 2252 * Override definitions for libtommath. 2253 */ 2254 2255 typedef struct mp_int mp_int; 2256 #define MP_INT_DECLARED 2257 typedef unsigned int mp_digit; 2258 #define MP_DIGIT_DECLARED 2259 2260 /* 2261 *---------------------------------------------------------------------------- 2262 * Definitions needed for Tcl_ParseArgvObj routines. 2263 * Based on tkArgv.c. 2264 * Modifications from the original are copyright (c) Sam Bromley 2006 2265 */ 2266 2267 typedef struct { 2268 int type; /* Indicates the option type; see below. */ 2269 const char *keyStr; /* The key string that flags the option in the 2270 * argv array. */ 2271 void *srcPtr; /* Value to be used in setting dst; usage 2272 * depends on type.*/ 2273 void *dstPtr; /* Address of value to be modified; usage 2274 * depends on type.*/ 2275 const char *helpStr; /* Documentation message describing this 2276 * option. */ 2277 ClientData clientData; /* Word to pass to function callbacks. */ 2278 } Tcl_ArgvInfo; 2279 2280 /* 2281 * Legal values for the type field of a Tcl_ArgInfo: see the user 2282 * documentation for details. 2283 */ 2284 2285 #define TCL_ARGV_CONSTANT 15 2286 #define TCL_ARGV_INT 16 2287 #define TCL_ARGV_STRING 17 2288 #define TCL_ARGV_REST 18 2289 #define TCL_ARGV_FLOAT 19 2290 #define TCL_ARGV_FUNC 20 2291 #define TCL_ARGV_GENFUNC 21 2292 #define TCL_ARGV_HELP 22 2293 #define TCL_ARGV_END 23 2294 2295 /* 2296 * Types of callback functions for the TCL_ARGV_FUNC and TCL_ARGV_GENFUNC 2297 * argument types: 2298 */ 2299 2300 typedef int (Tcl_ArgvFuncProc)(ClientData clientData, Tcl_Obj *objPtr, 2301 void *dstPtr); 2302 typedef int (Tcl_ArgvGenFuncProc)(ClientData clientData, Tcl_Interp *interp, 2303 int objc, Tcl_Obj *const *objv, void *dstPtr); 2304 2305 /* 2306 * Shorthand for commonly used argTable entries. 2307 */ 2308 2309 #define TCL_ARGV_AUTO_HELP \ 2310 {TCL_ARGV_HELP, "-help", NULL, NULL, \ 2311 "Print summary of command-line options and abort", NULL} 2312 #define TCL_ARGV_AUTO_REST \ 2313 {TCL_ARGV_REST, "--", NULL, NULL, \ 2314 "Marks the end of the options", NULL} 2315 #define TCL_ARGV_TABLE_END \ 2316 {TCL_ARGV_END, NULL, NULL, NULL, NULL, NULL} 2317 2318 /* 2319 *---------------------------------------------------------------------------- 2320 * Definitions needed for Tcl_Zlib routines. [TIP #234] 2321 * 2322 * Constants for the format flags describing what sort of data format is 2323 * desired/expected for the Tcl_ZlibDeflate, Tcl_ZlibInflate and 2324 * Tcl_ZlibStreamInit functions. 2325 */ 2326 2327 #define TCL_ZLIB_FORMAT_RAW 1 2328 #define TCL_ZLIB_FORMAT_ZLIB 2 2329 #define TCL_ZLIB_FORMAT_GZIP 4 2330 #define TCL_ZLIB_FORMAT_AUTO 8 2331 2332 /* 2333 * Constants that describe whether the stream is to operate in compressing or 2334 * decompressing mode. 2335 */ 2336 2337 #define TCL_ZLIB_STREAM_DEFLATE 16 2338 #define TCL_ZLIB_STREAM_INFLATE 32 2339 2340 /* 2341 * Constants giving compression levels. Use of TCL_ZLIB_COMPRESS_DEFAULT is 2342 * recommended. 2343 */ 2344 2345 #define TCL_ZLIB_COMPRESS_NONE 0 2346 #define TCL_ZLIB_COMPRESS_FAST 1 2347 #define TCL_ZLIB_COMPRESS_BEST 9 2348 #define TCL_ZLIB_COMPRESS_DEFAULT (-1) 2349 2350 /* 2351 * Constants for types of flushing, used with Tcl_ZlibFlush. 2352 */ 2353 2354 #define TCL_ZLIB_NO_FLUSH 0 2355 #define TCL_ZLIB_FLUSH 2 2356 #define TCL_ZLIB_FULLFLUSH 3 2357 #define TCL_ZLIB_FINALIZE 4 2358 2359 /* 2360 *---------------------------------------------------------------------------- 2361 * Definitions needed for the Tcl_LoadFile function. [TIP #416] 2362 */ 2363 2364 #define TCL_LOAD_GLOBAL 1 2365 #define TCL_LOAD_LAZY 2 2366 2367 /* 2368 *---------------------------------------------------------------------------- 2369 * Single public declaration for NRE. 2370 */ 2371 2372 typedef int (Tcl_NRPostProc) (ClientData data[], Tcl_Interp *interp, 2373 int result); 2374 2375 /* 2376 *---------------------------------------------------------------------------- 2377 * The following constant is used to test for older versions of Tcl in the 2378 * stubs tables. 2379 * 2380 * Jan Nijtman's plus patch uses 0xFCA1BACF, so we need to pick a different 2381 * value since the stubs tables don't match. 2382 */ 2383 2384 #define TCL_STUB_MAGIC ((int) 0xFCA3BACF) 2385 2386 /* 2387 * The following function is required to be defined in all stubs aware 2388 * extensions. The function is actually implemented in the stub library, not 2389 * the main Tcl library, although there is a trivial implementation in the 2390 * main library in case an extension is statically linked into an application. 2391 */ 2392 2393 const char * Tcl_InitStubs(Tcl_Interp *interp, const char *version, 2394 int exact); 2395 const char * TclTomMathInitializeStubs(Tcl_Interp *interp, 2396 const char *version, int epoch, int revision); 2397 2398 /* 2399 * When not using stubs, make it a macro. 2400 */ 2401 2402 #ifndef USE_TCL_STUBS 2403 #define Tcl_InitStubs(interp, version, exact) \ 2404 Tcl_PkgInitStubsCheck(interp, version, exact) 2405 #endif 2406 2407 /* 2408 * TODO - tommath stubs export goes here! 2409 */ 2410 2411 /* 2412 * Public functions that are not accessible via the stubs table. 2413 * Tcl_GetMemoryInfo is needed for AOLserver. [Bug 1868171] 2414 */ 2415 2416 #define Tcl_Main(argc, argv, proc) Tcl_MainEx(argc, argv, proc, \ 2417 ((Tcl_CreateInterp)())) 2418 EXTERN void Tcl_MainEx(int argc, char **argv, 2419 Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); 2420 EXTERN const char * Tcl_PkgInitStubsCheck(Tcl_Interp *interp, 2421 const char *version, int exact); 2422 #if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC) 2423 EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr); 2424 #endif 2425 2426 /* 2427 *---------------------------------------------------------------------------- 2428 * Include the public function declarations that are accessible via the stubs 2429 * table. 2430 */ 2431 2432 #include "tclDecls.h" 2433 2434 /* 2435 * Include platform specific public function declarations that are accessible 2436 * via the stubs table. Make all TclOO symbols MODULE_SCOPE (which only 2437 * has effect on building it as a shared library). See ticket [3010352]. 2438 */ 2439 2440 #if defined(BUILD_tcl) 2441 # undef TCLAPI 2442 # define TCLAPI MODULE_SCOPE 2443 #endif 2444 2445 #include "tclPlatDecls.h" 2446 2447 /* 2448 *---------------------------------------------------------------------------- 2449 * The following declarations either map ckalloc and ckfree to malloc and 2450 * free, or they map them to functions with all sorts of debugging hooks 2451 * defined in tclCkalloc.c. 2452 */ 2453 2454 #ifdef TCL_MEM_DEBUG 2455 2456 # define ckalloc(x) \ 2457 ((void *) Tcl_DbCkalloc((unsigned)(x), __FILE__, __LINE__)) 2458 # define ckfree(x) \ 2459 Tcl_DbCkfree((char *)(x), __FILE__, __LINE__) 2460 # define ckrealloc(x,y) \ 2461 ((void *) Tcl_DbCkrealloc((char *)(x), (unsigned)(y), __FILE__, __LINE__)) 2462 # define attemptckalloc(x) \ 2463 ((void *) Tcl_AttemptDbCkalloc((unsigned)(x), __FILE__, __LINE__)) 2464 # define attemptckrealloc(x,y) \ 2465 ((void *) Tcl_AttemptDbCkrealloc((char *)(x), (unsigned)(y), __FILE__, __LINE__)) 2466 2467 #else /* !TCL_MEM_DEBUG */ 2468 2469 /* 2470 * If we are not using the debugging allocator, we should call the Tcl_Alloc, 2471 * et al. routines in order to guarantee that every module is using the same 2472 * memory allocator both inside and outside of the Tcl library. 2473 */ 2474 2475 # define ckalloc(x) \ 2476 ((void *) Tcl_Alloc((unsigned)(x))) 2477 # define ckfree(x) \ 2478 Tcl_Free((char *)(x)) 2479 # define ckrealloc(x,y) \ 2480 ((void *) Tcl_Realloc((char *)(x), (unsigned)(y))) 2481 # define attemptckalloc(x) \ 2482 ((void *) Tcl_AttemptAlloc((unsigned)(x))) 2483 # define attemptckrealloc(x,y) \ 2484 ((void *) Tcl_AttemptRealloc((char *)(x), (unsigned)(y))) 2485 # undef Tcl_InitMemory 2486 # define Tcl_InitMemory(x) 2487 # undef Tcl_DumpActiveMemory 2488 # define Tcl_DumpActiveMemory(x) 2489 # undef Tcl_ValidateAllMemory 2490 # define Tcl_ValidateAllMemory(x,y) 2491 2492 #endif /* !TCL_MEM_DEBUG */ 2493 2494 #ifdef TCL_MEM_DEBUG 2495 # define Tcl_IncrRefCount(objPtr) \ 2496 Tcl_DbIncrRefCount(objPtr, __FILE__, __LINE__) 2497 # define Tcl_DecrRefCount(objPtr) \ 2498 Tcl_DbDecrRefCount(objPtr, __FILE__, __LINE__) 2499 # define Tcl_IsShared(objPtr) \ 2500 Tcl_DbIsShared(objPtr, __FILE__, __LINE__) 2501 #else 2502 # define Tcl_IncrRefCount(objPtr) \ 2503 ++(objPtr)->refCount 2504 /* 2505 * Use do/while0 idiom for optimum correctness without compiler warnings. 2506 * http://c2.com/cgi/wiki?TrivialDoWhileLoop 2507 */ 2508 # define Tcl_DecrRefCount(objPtr) \ 2509 do { \ 2510 Tcl_Obj *_objPtr = (objPtr); \ 2511 if (--(_objPtr)->refCount <= 0) { \ 2512 TclFreeObj(_objPtr); \ 2513 } \ 2514 } while(0) 2515 # define Tcl_IsShared(objPtr) \ 2516 ((objPtr)->refCount > 1) 2517 #endif 2518 2519 /* 2520 * Macros and definitions that help to debug the use of Tcl objects. When 2521 * TCL_MEM_DEBUG is defined, the Tcl_New declarations are overridden to call 2522 * debugging versions of the object creation functions. 2523 */ 2524 2525 #ifdef TCL_MEM_DEBUG 2526 # undef Tcl_NewBignumObj 2527 # define Tcl_NewBignumObj(val) \ 2528 Tcl_DbNewBignumObj(val, __FILE__, __LINE__) 2529 # undef Tcl_NewBooleanObj 2530 # define Tcl_NewBooleanObj(val) \ 2531 Tcl_DbNewBooleanObj(val, __FILE__, __LINE__) 2532 # undef Tcl_NewByteArrayObj 2533 # define Tcl_NewByteArrayObj(bytes, len) \ 2534 Tcl_DbNewByteArrayObj(bytes, len, __FILE__, __LINE__) 2535 # undef Tcl_NewDoubleObj 2536 # define Tcl_NewDoubleObj(val) \ 2537 Tcl_DbNewDoubleObj(val, __FILE__, __LINE__) 2538 # undef Tcl_NewIntObj 2539 # define Tcl_NewIntObj(val) \ 2540 Tcl_DbNewLongObj(val, __FILE__, __LINE__) 2541 # undef Tcl_NewListObj 2542 # define Tcl_NewListObj(objc, objv) \ 2543 Tcl_DbNewListObj(objc, objv, __FILE__, __LINE__) 2544 # undef Tcl_NewLongObj 2545 # define Tcl_NewLongObj(val) \ 2546 Tcl_DbNewLongObj(val, __FILE__, __LINE__) 2547 # undef Tcl_NewObj 2548 # define Tcl_NewObj() \ 2549 Tcl_DbNewObj(__FILE__, __LINE__) 2550 # undef Tcl_NewStringObj 2551 # define Tcl_NewStringObj(bytes, len) \ 2552 Tcl_DbNewStringObj(bytes, len, __FILE__, __LINE__) 2553 # undef Tcl_NewWideIntObj 2554 # define Tcl_NewWideIntObj(val) \ 2555 Tcl_DbNewWideIntObj(val, __FILE__, __LINE__) 2556 #endif /* TCL_MEM_DEBUG */ 2557 2558 /* 2559 *---------------------------------------------------------------------------- 2560 * Macros for clients to use to access fields of hash entries: 2561 */ 2562 2563 #define Tcl_GetHashValue(h) ((h)->clientData) 2564 #define Tcl_SetHashValue(h, value) ((h)->clientData = (ClientData) (value)) 2565 #define Tcl_GetHashKey(tablePtr, h) \ 2566 ((void *) (((tablePtr)->keyType == TCL_ONE_WORD_KEYS || \ 2567 (tablePtr)->keyType == TCL_CUSTOM_PTR_KEYS) \ 2568 ? (h)->key.oneWordValue \ 2569 : (h)->key.string)) 2570 2571 /* 2572 * Macros to use for clients to use to invoke find and create functions for 2573 * hash tables: 2574 */ 2575 2576 #undef Tcl_FindHashEntry 2577 #define Tcl_FindHashEntry(tablePtr, key) \ 2578 (*((tablePtr)->findProc))(tablePtr, (const char *)(key)) 2579 #undef Tcl_CreateHashEntry 2580 #define Tcl_CreateHashEntry(tablePtr, key, newPtr) \ 2581 (*((tablePtr)->createProc))(tablePtr, (const char *)(key), newPtr) 2582 2583 /* 2584 *---------------------------------------------------------------------------- 2585 * Macros that eliminate the overhead of the thread synchronization functions 2586 * when compiling without thread support. 2587 */ 2588 2589 #ifndef TCL_THREADS 2590 #undef Tcl_MutexLock 2591 #define Tcl_MutexLock(mutexPtr) 2592 #undef Tcl_MutexUnlock 2593 #define Tcl_MutexUnlock(mutexPtr) 2594 #undef Tcl_MutexFinalize 2595 #define Tcl_MutexFinalize(mutexPtr) 2596 #undef Tcl_ConditionNotify 2597 #define Tcl_ConditionNotify(condPtr) 2598 #undef Tcl_ConditionWait 2599 #define Tcl_ConditionWait(condPtr, mutexPtr, timePtr) 2600 #undef Tcl_ConditionFinalize 2601 #define Tcl_ConditionFinalize(condPtr) 2602 #endif /* TCL_THREADS */ 2603 2604 /* 2605 *---------------------------------------------------------------------------- 2606 * Deprecated Tcl functions: 2607 */ 2608 2609 #ifndef TCL_NO_DEPRECATED 2610 /* 2611 * These function have been renamed. The old names are deprecated, but we 2612 * define these macros for backwards compatibilty. 2613 */ 2614 2615 # define Tcl_Ckalloc Tcl_Alloc 2616 # define Tcl_Ckfree Tcl_Free 2617 # define Tcl_Ckrealloc Tcl_Realloc 2618 # define Tcl_Return Tcl_SetResult 2619 # define Tcl_TildeSubst Tcl_TranslateFileName 2620 # define panic Tcl_Panic 2621 # define panicVA Tcl_PanicVA 2622 #endif /* !TCL_NO_DEPRECATED */ 2623 2624 /* 2625 *---------------------------------------------------------------------------- 2626 * Convenience declaration of Tcl_AppInit for backwards compatibility. This 2627 * function is not *implemented* by the tcl library, so the storage class is 2628 * neither DLLEXPORT nor DLLIMPORT. 2629 */ 2630 2631 extern Tcl_AppInitProc Tcl_AppInit; 2632 2633 #endif /* RC_INVOKED */ 2634 2635 /* 2636 * end block for C++ 2637 */ 2638 2639 #ifdef __cplusplus 2640 } 2641 #endif 2642 2643 #endif /* _TCL */ 2644 2645 /* 2646 * Local Variables: 2647 * mode: c 2648 * c-basic-offset: 4 2649 * fill-column: 78 2650 * End: 2651 */