Fossil SCM

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

Keyboard Shortcuts

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