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