Fossil SCM

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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button