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