jpayne@69: /* jpayne@69: * tcl.h -- jpayne@69: * jpayne@69: * This header file describes the externally-visible facilities of the jpayne@69: * Tcl interpreter. jpayne@69: * jpayne@69: * Copyright (c) 1987-1994 The Regents of the University of California. jpayne@69: * Copyright (c) 1993-1996 Lucent Technologies. jpayne@69: * Copyright (c) 1994-1998 Sun Microsystems, Inc. jpayne@69: * Copyright (c) 1998-2000 by Scriptics Corporation. jpayne@69: * Copyright (c) 2002 by Kevin B. Kenny. All rights reserved. jpayne@69: * jpayne@69: * See the file "license.terms" for information on usage and redistribution of jpayne@69: * this file, and for a DISCLAIMER OF ALL WARRANTIES. jpayne@69: */ jpayne@69: jpayne@69: #ifndef _TCL jpayne@69: #define _TCL jpayne@69: jpayne@69: /* jpayne@69: * For C++ compilers, use extern "C" jpayne@69: */ jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: extern "C" { jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * The following defines are used to indicate the various release levels. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_ALPHA_RELEASE 0 jpayne@69: #define TCL_BETA_RELEASE 1 jpayne@69: #define TCL_FINAL_RELEASE 2 jpayne@69: jpayne@69: /* jpayne@69: * When version numbers change here, must also go into the following files and jpayne@69: * update the version numbers: jpayne@69: * jpayne@69: * library/init.tcl (1 LOC patch) jpayne@69: * unix/configure.in (2 LOC Major, 2 LOC minor, 1 LOC patch) jpayne@69: * win/configure.in (as above) jpayne@69: * win/tcl.m4 (not patchlevel) jpayne@69: * README (sections 0 and 2, with and without separator) jpayne@69: * macosx/Tcl-Common.xcconfig (not patchlevel) 1 LOC jpayne@69: * win/README (not patchlevel) (sections 0 and 2) jpayne@69: * unix/tcl.spec (1 LOC patch) jpayne@69: * tools/tcl.hpj.in (not patchlevel, for windows installer) jpayne@69: */ jpayne@69: jpayne@69: #define TCL_MAJOR_VERSION 8 jpayne@69: #define TCL_MINOR_VERSION 6 jpayne@69: #define TCL_RELEASE_LEVEL TCL_FINAL_RELEASE jpayne@69: #define TCL_RELEASE_SERIAL 13 jpayne@69: jpayne@69: #define TCL_VERSION "8.6" jpayne@69: #define TCL_PATCH_LEVEL "8.6.13" jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * The following definitions set up the proper options for Windows compilers. jpayne@69: * We use this method because there is no autoconf equivalent. jpayne@69: */ jpayne@69: jpayne@69: #ifdef _WIN32 jpayne@69: # ifndef __WIN32__ jpayne@69: # define __WIN32__ jpayne@69: # endif jpayne@69: # ifndef WIN32 jpayne@69: # define WIN32 jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Utility macros: STRINGIFY takes an argument and wraps it in "" (double jpayne@69: * quotation marks), JOIN joins two arguments. jpayne@69: */ jpayne@69: jpayne@69: #ifndef STRINGIFY jpayne@69: # define STRINGIFY(x) STRINGIFY1(x) jpayne@69: # define STRINGIFY1(x) #x jpayne@69: #endif jpayne@69: #ifndef JOIN jpayne@69: # define JOIN(a,b) JOIN1(a,b) jpayne@69: # define JOIN1(a,b) a##b jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * A special definition used to allow this header file to be included from jpayne@69: * windows resource files so that they can obtain version information. jpayne@69: * RC_INVOKED is defined by default by the windows RC tool. jpayne@69: * jpayne@69: * Resource compilers don't like all the C stuff, like typedefs and function jpayne@69: * declarations, that occur below, so block them out. jpayne@69: */ jpayne@69: jpayne@69: #ifndef RC_INVOKED jpayne@69: jpayne@69: /* jpayne@69: * Special macro to define mutexes, that doesn't do anything if we are not jpayne@69: * using threads. jpayne@69: */ jpayne@69: jpayne@69: #ifdef TCL_THREADS jpayne@69: #define TCL_DECLARE_MUTEX(name) static Tcl_Mutex name; jpayne@69: #else jpayne@69: #define TCL_DECLARE_MUTEX(name) jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Tcl's public routine Tcl_FSSeek() uses the values SEEK_SET, SEEK_CUR, and jpayne@69: * SEEK_END, all #define'd by stdio.h . jpayne@69: * jpayne@69: * Also, many extensions need stdio.h, and they've grown accustomed to tcl.h jpayne@69: * providing it for them rather than #include-ing it themselves as they jpayne@69: * should, so also for their sake, we keep the #include to be consistent with jpayne@69: * prior Tcl releases. jpayne@69: */ jpayne@69: jpayne@69: #include jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Support for functions with a variable number of arguments. jpayne@69: * jpayne@69: * The following TCL_VARARGS* macros are to support old extensions jpayne@69: * written for older versions of Tcl where the macros permitted jpayne@69: * support for the varargs.h system as well as stdarg.h . jpayne@69: * jpayne@69: * New code should just directly be written to use stdarg.h conventions. jpayne@69: */ jpayne@69: jpayne@69: #include jpayne@69: #if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 jpayne@69: # define TCL_VARARGS(type, name) (type name, ...) jpayne@69: # define TCL_VARARGS_DEF(type, name) (type name, ...) jpayne@69: # define TCL_VARARGS_START(type, name, list) (va_start(list, name), name) jpayne@69: #endif /* !TCL_NO_DEPRECATED */ jpayne@69: #if defined(__GNUC__) && (__GNUC__ > 2) jpayne@69: # if defined(_WIN32) && defined(__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO jpayne@69: # define TCL_FORMAT_PRINTF(a,b) __attribute__ ((__format__ (__MINGW_PRINTF_FORMAT, a, b))) jpayne@69: # else jpayne@69: # define TCL_FORMAT_PRINTF(a,b) __attribute__ ((__format__ (__printf__, a, b))) jpayne@69: # endif jpayne@69: # define TCL_NORETURN __attribute__ ((noreturn)) jpayne@69: # if defined(BUILD_tcl) || defined(BUILD_tk) jpayne@69: # define TCL_NORETURN1 __attribute__ ((noreturn)) jpayne@69: # else jpayne@69: # define TCL_NORETURN1 /* nothing */ jpayne@69: # endif jpayne@69: #else jpayne@69: # define TCL_FORMAT_PRINTF(a,b) jpayne@69: # if defined(_MSC_VER) && (_MSC_VER >= 1310) jpayne@69: # define TCL_NORETURN _declspec(noreturn) jpayne@69: # else jpayne@69: # define TCL_NORETURN /* nothing */ jpayne@69: # endif jpayne@69: # define TCL_NORETURN1 /* nothing */ jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Allow a part of Tcl's API to be explicitly marked as deprecated. jpayne@69: * jpayne@69: * Used to make TIP 330/336 generate moans even if people use the jpayne@69: * compatibility macros. Change your code, guys! We won't support you forever. jpayne@69: */ jpayne@69: jpayne@69: #if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) jpayne@69: # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) jpayne@69: # define TCL_DEPRECATED_API(msg) __attribute__ ((__deprecated__ (msg))) jpayne@69: # else jpayne@69: # define TCL_DEPRECATED_API(msg) __attribute__ ((__deprecated__)) jpayne@69: # endif jpayne@69: #else jpayne@69: # define TCL_DEPRECATED_API(msg) /* nothing portable */ jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Macros used to declare a function to be exported by a DLL. Used by Windows, jpayne@69: * maps to no-op declarations on non-Windows systems. The default build on jpayne@69: * windows is for a DLL, which causes the DLLIMPORT and DLLEXPORT macros to be jpayne@69: * nonempty. To build a static library, the macro STATIC_BUILD should be jpayne@69: * defined. jpayne@69: * jpayne@69: * Note: when building static but linking dynamically to MSVCRT we must still jpayne@69: * correctly decorate the C library imported function. Use CRTIMPORT jpayne@69: * for this purpose. _DLL is defined by the compiler when linking to jpayne@69: * MSVCRT. jpayne@69: */ jpayne@69: jpayne@69: #if (defined(_WIN32) && (defined(_MSC_VER) || (defined(__BORLANDC__) && (__BORLANDC__ >= 0x0550)) || defined(__LCC__) || defined(__WATCOMC__) || (defined(__GNUC__) && defined(__declspec)))) jpayne@69: # define HAVE_DECLSPEC 1 jpayne@69: # ifdef STATIC_BUILD jpayne@69: # define DLLIMPORT jpayne@69: # define DLLEXPORT jpayne@69: # ifdef _DLL jpayne@69: # define CRTIMPORT __declspec(dllimport) jpayne@69: # else jpayne@69: # define CRTIMPORT jpayne@69: # endif jpayne@69: # else jpayne@69: # define DLLIMPORT __declspec(dllimport) jpayne@69: # define DLLEXPORT __declspec(dllexport) jpayne@69: # define CRTIMPORT __declspec(dllimport) jpayne@69: # endif jpayne@69: #else jpayne@69: # define DLLIMPORT jpayne@69: # if defined(__GNUC__) && __GNUC__ > 3 jpayne@69: # define DLLEXPORT __attribute__ ((visibility("default"))) jpayne@69: # else jpayne@69: # define DLLEXPORT jpayne@69: # endif jpayne@69: # define CRTIMPORT jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * These macros are used to control whether functions are being declared for jpayne@69: * import or export. If a function is being declared while it is being built jpayne@69: * to be included in a shared library, then it should have the DLLEXPORT jpayne@69: * storage class. If is being declared for use by a module that is going to jpayne@69: * link against the shared library, then it should have the DLLIMPORT storage jpayne@69: * class. If the symbol is being declared for a static build or for use from a jpayne@69: * stub library, then the storage class should be empty. jpayne@69: * jpayne@69: * The convention is that a macro called BUILD_xxxx, where xxxx is the name of jpayne@69: * a library we are building, is set on the compile line for sources that are jpayne@69: * to be placed in the library. When this macro is set, the storage class will jpayne@69: * be set to DLLEXPORT. At the end of the header file, the storage class will jpayne@69: * be reset to DLLIMPORT. jpayne@69: */ jpayne@69: jpayne@69: #undef TCL_STORAGE_CLASS jpayne@69: #ifdef BUILD_tcl jpayne@69: # define TCL_STORAGE_CLASS DLLEXPORT jpayne@69: #else jpayne@69: # ifdef USE_TCL_STUBS jpayne@69: # define TCL_STORAGE_CLASS jpayne@69: # else jpayne@69: # define TCL_STORAGE_CLASS DLLIMPORT jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * The following _ANSI_ARGS_ macro is to support old extensions jpayne@69: * written for older versions of Tcl where it permitted support jpayne@69: * for compilers written in the pre-prototype era of C. jpayne@69: * jpayne@69: * New code should use prototypes. jpayne@69: */ jpayne@69: jpayne@69: #ifndef TCL_NO_DEPRECATED jpayne@69: # undef _ANSI_ARGS_ jpayne@69: # define _ANSI_ARGS_(x) x jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Definitions that allow this header file to be used either with or without jpayne@69: * ANSI C features. jpayne@69: */ jpayne@69: jpayne@69: #ifndef INLINE jpayne@69: # define INLINE jpayne@69: #endif jpayne@69: jpayne@69: #ifdef NO_CONST jpayne@69: # ifndef const jpayne@69: # define const jpayne@69: # endif jpayne@69: #endif jpayne@69: #ifndef CONST jpayne@69: # define CONST const jpayne@69: #endif jpayne@69: jpayne@69: #ifdef USE_NON_CONST jpayne@69: # ifdef USE_COMPAT_CONST jpayne@69: # error define at most one of USE_NON_CONST and USE_COMPAT_CONST jpayne@69: # endif jpayne@69: # define CONST84 jpayne@69: # define CONST84_RETURN jpayne@69: #else jpayne@69: # ifdef USE_COMPAT_CONST jpayne@69: # define CONST84 jpayne@69: # define CONST84_RETURN const jpayne@69: # else jpayne@69: # define CONST84 const jpayne@69: # define CONST84_RETURN const jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: #ifndef CONST86 jpayne@69: # define CONST86 CONST84 jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Make sure EXTERN isn't defined elsewhere. jpayne@69: */ jpayne@69: jpayne@69: #ifdef EXTERN jpayne@69: # undef EXTERN jpayne@69: #endif /* EXTERN */ jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: # define EXTERN extern "C" TCL_STORAGE_CLASS jpayne@69: #else jpayne@69: # define EXTERN extern TCL_STORAGE_CLASS jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * The following code is copied from winnt.h. If we don't replicate it here, jpayne@69: * then can't be included after tcl.h, since tcl.h also defines jpayne@69: * VOID. This block is skipped under Cygwin and Mingw. jpayne@69: */ jpayne@69: jpayne@69: #if defined(_WIN32) && !defined(HAVE_WINNT_IGNORE_VOID) jpayne@69: #ifndef VOID jpayne@69: #define VOID void jpayne@69: typedef char CHAR; jpayne@69: typedef short SHORT; jpayne@69: typedef long LONG; jpayne@69: #endif jpayne@69: #endif /* _WIN32 && !HAVE_WINNT_IGNORE_VOID */ jpayne@69: jpayne@69: /* jpayne@69: * Macro to use instead of "void" for arguments that must have type "void *" jpayne@69: * in ANSI C; maps them to type "char *" in non-ANSI systems. jpayne@69: */ jpayne@69: jpayne@69: #ifndef __VXWORKS__ jpayne@69: # ifndef NO_VOID jpayne@69: # define VOID void jpayne@69: # else jpayne@69: # define VOID char jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Miscellaneous declarations. jpayne@69: */ jpayne@69: jpayne@69: #ifndef _CLIENTDATA jpayne@69: # ifndef NO_VOID jpayne@69: typedef void *ClientData; jpayne@69: # else jpayne@69: typedef int *ClientData; jpayne@69: # endif jpayne@69: # define _CLIENTDATA jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Darwin specific configure overrides (to support fat compiles, where jpayne@69: * configure runs only once for multiple architectures): jpayne@69: */ jpayne@69: jpayne@69: #ifdef __APPLE__ jpayne@69: # ifdef __LP64__ jpayne@69: # undef TCL_WIDE_INT_TYPE jpayne@69: # define TCL_WIDE_INT_IS_LONG 1 jpayne@69: # define TCL_CFG_DO64BIT 1 jpayne@69: # else /* !__LP64__ */ jpayne@69: # define TCL_WIDE_INT_TYPE long long jpayne@69: # undef TCL_WIDE_INT_IS_LONG jpayne@69: # undef TCL_CFG_DO64BIT jpayne@69: # endif /* __LP64__ */ jpayne@69: # undef HAVE_STRUCT_STAT64 jpayne@69: #endif /* __APPLE__ */ jpayne@69: jpayne@69: /* Cross-compiling 32-bit on a 64-bit platform? Then our jpayne@69: * configure script does the wrong thing. Correct that here. jpayne@69: */ jpayne@69: #if defined(__GNUC__) && !defined(_WIN32) && !defined(__LP64__) jpayne@69: # undef TCL_WIDE_INT_IS_LONG jpayne@69: # undef TCL_WIDE_INT_TYPE jpayne@69: # define TCL_WIDE_INT_TYPE long long jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Define Tcl_WideInt to be a type that is (at least) 64-bits wide, and define jpayne@69: * Tcl_WideUInt to be the unsigned variant of that type (assuming that where jpayne@69: * we have one, we can have the other.) jpayne@69: * jpayne@69: * Also defines the following macros: jpayne@69: * TCL_WIDE_INT_IS_LONG - if wide ints are really longs (i.e. we're on a jpayne@69: * LP64 system such as modern Solaris or Linux ... not including Win64) jpayne@69: * Tcl_WideAsLong - forgetful converter from wideInt to long. jpayne@69: * Tcl_LongAsWide - sign-extending converter from long to wideInt. jpayne@69: * Tcl_WideAsDouble - converter from wideInt to double. jpayne@69: * Tcl_DoubleAsWide - converter from double to wideInt. jpayne@69: * jpayne@69: * The following invariant should hold for any long value 'longVal': jpayne@69: * longVal == Tcl_WideAsLong(Tcl_LongAsWide(longVal)) jpayne@69: * jpayne@69: * Note on converting between Tcl_WideInt and strings. This implementation (in jpayne@69: * tclObj.c) depends on the function jpayne@69: * sprintf(...,"%" TCL_LL_MODIFIER "d",...). jpayne@69: */ jpayne@69: jpayne@69: #if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG) jpayne@69: # ifdef _WIN32 jpayne@69: # define TCL_WIDE_INT_TYPE __int64 jpayne@69: # ifdef __BORLANDC__ jpayne@69: # define TCL_LL_MODIFIER "L" jpayne@69: # elif defined(_WIN32) && (!defined(__USE_MINGW_ANSI_STDIO) || !__USE_MINGW_ANSI_STDIO) jpayne@69: # define TCL_LL_MODIFIER "I64" jpayne@69: # else jpayne@69: # define TCL_LL_MODIFIER "ll" jpayne@69: # endif jpayne@69: # elif defined(__GNUC__) jpayne@69: # define TCL_WIDE_INT_TYPE long long jpayne@69: # define TCL_LL_MODIFIER "ll" jpayne@69: # else /* ! _WIN32 && ! __GNUC__ */ jpayne@69: /* jpayne@69: * Don't know what platform it is and configure hasn't discovered what is jpayne@69: * going on for us. Try to guess... jpayne@69: */ jpayne@69: # include jpayne@69: # if (INT_MAX < LONG_MAX) jpayne@69: # define TCL_WIDE_INT_IS_LONG 1 jpayne@69: # else jpayne@69: # define TCL_WIDE_INT_TYPE long long jpayne@69: # endif jpayne@69: # endif /* _WIN32 */ jpayne@69: #endif /* !TCL_WIDE_INT_TYPE & !TCL_WIDE_INT_IS_LONG */ jpayne@69: #ifdef TCL_WIDE_INT_IS_LONG jpayne@69: # undef TCL_WIDE_INT_TYPE jpayne@69: # define TCL_WIDE_INT_TYPE long jpayne@69: #endif /* TCL_WIDE_INT_IS_LONG */ jpayne@69: jpayne@69: typedef TCL_WIDE_INT_TYPE Tcl_WideInt; jpayne@69: typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; jpayne@69: jpayne@69: #ifdef TCL_WIDE_INT_IS_LONG jpayne@69: # define Tcl_WideAsLong(val) ((long)(val)) jpayne@69: # define Tcl_LongAsWide(val) ((long)(val)) jpayne@69: # define Tcl_WideAsDouble(val) ((double)((long)(val))) jpayne@69: # define Tcl_DoubleAsWide(val) ((long)((double)(val))) jpayne@69: # ifndef TCL_LL_MODIFIER jpayne@69: # define TCL_LL_MODIFIER "l" jpayne@69: # endif /* !TCL_LL_MODIFIER */ jpayne@69: #else /* TCL_WIDE_INT_IS_LONG */ jpayne@69: /* jpayne@69: * The next short section of defines are only done when not running on Windows jpayne@69: * or some other strange platform. jpayne@69: */ jpayne@69: # ifndef TCL_LL_MODIFIER jpayne@69: # define TCL_LL_MODIFIER "ll" jpayne@69: # endif /* !TCL_LL_MODIFIER */ jpayne@69: # define Tcl_WideAsLong(val) ((long)((Tcl_WideInt)(val))) jpayne@69: # define Tcl_LongAsWide(val) ((Tcl_WideInt)((long)(val))) jpayne@69: # define Tcl_WideAsDouble(val) ((double)((Tcl_WideInt)(val))) jpayne@69: # define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val))) jpayne@69: #endif /* TCL_WIDE_INT_IS_LONG */ jpayne@69: jpayne@69: #ifdef _WIN32 jpayne@69: # ifdef __BORLANDC__ jpayne@69: typedef struct stati64 Tcl_StatBuf; jpayne@69: # elif defined(_WIN64) || defined(_USE_64BIT_TIME_T) jpayne@69: typedef struct __stat64 Tcl_StatBuf; jpayne@69: # elif (defined(_MSC_VER) && (_MSC_VER < 1400)) || defined(_USE_32BIT_TIME_T) jpayne@69: typedef struct _stati64 Tcl_StatBuf; jpayne@69: # else jpayne@69: typedef struct _stat32i64 Tcl_StatBuf; jpayne@69: # endif /* _MSC_VER < 1400 */ jpayne@69: #elif defined(__CYGWIN__) jpayne@69: typedef struct { jpayne@69: dev_t st_dev; jpayne@69: unsigned short st_ino; jpayne@69: unsigned short st_mode; jpayne@69: short st_nlink; jpayne@69: short st_uid; jpayne@69: short st_gid; jpayne@69: /* Here is a 2-byte gap */ jpayne@69: dev_t st_rdev; jpayne@69: /* Here is a 4-byte gap */ jpayne@69: long long st_size; jpayne@69: struct {long tv_sec;} st_atim; jpayne@69: struct {long tv_sec;} st_mtim; jpayne@69: struct {long tv_sec;} st_ctim; jpayne@69: /* Here is a 4-byte gap */ jpayne@69: } Tcl_StatBuf; jpayne@69: #elif defined(HAVE_STRUCT_STAT64) && !defined(__APPLE__) jpayne@69: typedef struct stat64 Tcl_StatBuf; jpayne@69: #else jpayne@69: typedef struct stat Tcl_StatBuf; jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Data structures defined opaquely in this module. The definitions below just jpayne@69: * provide dummy types. A few fields are made visible in Tcl_Interp jpayne@69: * structures, namely those used for returning a string result from commands. jpayne@69: * Direct access to the result field is discouraged in Tcl 8.0. The jpayne@69: * interpreter result is either an object or a string, and the two values are jpayne@69: * kept consistent unless some C code sets interp->result directly. jpayne@69: * Programmers should use either the function Tcl_GetObjResult() or jpayne@69: * Tcl_GetStringResult() to read the interpreter's result. See the SetResult jpayne@69: * man page for details. jpayne@69: * jpayne@69: * Note: any change to the Tcl_Interp definition below must be mirrored in the jpayne@69: * "real" definition in tclInt.h. jpayne@69: * jpayne@69: * Note: Tcl_ObjCmdProc functions do not directly set result and freeProc. jpayne@69: * Instead, they set a Tcl_Obj member in the "real" structure that can be jpayne@69: * accessed with Tcl_GetObjResult() and Tcl_SetObjResult(). jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tcl_Interp jpayne@69: #if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 jpayne@69: { jpayne@69: /* TIP #330: Strongly discourage extensions from using the string jpayne@69: * result. */ jpayne@69: #ifdef USE_INTERP_RESULT jpayne@69: char *result TCL_DEPRECATED_API("use Tcl_GetStringResult/Tcl_SetResult"); jpayne@69: /* If the last command returned a string jpayne@69: * result, this points to it. */ jpayne@69: void (*freeProc) (char *blockPtr) jpayne@69: TCL_DEPRECATED_API("use Tcl_GetStringResult/Tcl_SetResult"); jpayne@69: /* Zero means the string result is statically jpayne@69: * allocated. TCL_DYNAMIC means it was jpayne@69: * allocated with ckalloc and should be freed jpayne@69: * with ckfree. Other values give the address jpayne@69: * of function to invoke to free the result. jpayne@69: * Tcl_Eval must free it before executing next jpayne@69: * command. */ jpayne@69: #else jpayne@69: char *resultDontUse; /* Don't use in extensions! */ jpayne@69: void (*freeProcDontUse) (char *); /* Don't use in extensions! */ jpayne@69: #endif jpayne@69: #ifdef USE_INTERP_ERRORLINE jpayne@69: int errorLine TCL_DEPRECATED_API("use Tcl_GetErrorLine/Tcl_SetErrorLine"); jpayne@69: /* When TCL_ERROR is returned, this gives the jpayne@69: * line number within the command where the jpayne@69: * error occurred (1 if first line). */ jpayne@69: #else jpayne@69: int errorLineDontUse; /* Don't use in extensions! */ jpayne@69: #endif jpayne@69: } jpayne@69: #endif /* !TCL_NO_DEPRECATED */ jpayne@69: Tcl_Interp; jpayne@69: jpayne@69: typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler; jpayne@69: typedef struct Tcl_Channel_ *Tcl_Channel; jpayne@69: typedef struct Tcl_ChannelTypeVersion_ *Tcl_ChannelTypeVersion; jpayne@69: typedef struct Tcl_Command_ *Tcl_Command; jpayne@69: typedef struct Tcl_Condition_ *Tcl_Condition; jpayne@69: typedef struct Tcl_Dict_ *Tcl_Dict; jpayne@69: typedef struct Tcl_EncodingState_ *Tcl_EncodingState; jpayne@69: typedef struct Tcl_Encoding_ *Tcl_Encoding; jpayne@69: typedef struct Tcl_Event Tcl_Event; jpayne@69: typedef struct Tcl_InterpState_ *Tcl_InterpState; jpayne@69: typedef struct Tcl_LoadHandle_ *Tcl_LoadHandle; jpayne@69: typedef struct Tcl_Mutex_ *Tcl_Mutex; jpayne@69: typedef struct Tcl_Pid_ *Tcl_Pid; jpayne@69: typedef struct Tcl_RegExp_ *Tcl_RegExp; jpayne@69: typedef struct Tcl_ThreadDataKey_ *Tcl_ThreadDataKey; jpayne@69: typedef struct Tcl_ThreadId_ *Tcl_ThreadId; jpayne@69: typedef struct Tcl_TimerToken_ *Tcl_TimerToken; jpayne@69: typedef struct Tcl_Trace_ *Tcl_Trace; jpayne@69: typedef struct Tcl_Var_ *Tcl_Var; jpayne@69: typedef struct Tcl_ZLibStream_ *Tcl_ZlibStream; jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Definition of the interface to functions implementing threads. A function jpayne@69: * following this definition is given to each call of 'Tcl_CreateThread' and jpayne@69: * will be called as the main fuction of the new thread created by that call. jpayne@69: */ jpayne@69: jpayne@69: #if defined _WIN32 jpayne@69: typedef unsigned (__stdcall Tcl_ThreadCreateProc) (ClientData clientData); jpayne@69: #else jpayne@69: typedef void (Tcl_ThreadCreateProc) (ClientData clientData); jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Threading function return types used for abstracting away platform jpayne@69: * differences when writing a Tcl_ThreadCreateProc. See the NewThread function jpayne@69: * in generic/tclThreadTest.c for it's usage. jpayne@69: */ jpayne@69: jpayne@69: #if defined _WIN32 jpayne@69: # define Tcl_ThreadCreateType unsigned __stdcall jpayne@69: # define TCL_THREAD_CREATE_RETURN return 0 jpayne@69: #else jpayne@69: # define Tcl_ThreadCreateType void jpayne@69: # define TCL_THREAD_CREATE_RETURN jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Definition of values for default stacksize and the possible flags to be jpayne@69: * given to Tcl_CreateThread. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_THREAD_STACK_DEFAULT (0) /* Use default size for stack. */ jpayne@69: #define TCL_THREAD_NOFLAGS (0000) /* Standard flags, default jpayne@69: * behaviour. */ jpayne@69: #define TCL_THREAD_JOINABLE (0001) /* Mark the thread as joinable. */ jpayne@69: jpayne@69: /* jpayne@69: * Flag values passed to Tcl_StringCaseMatch. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_MATCH_NOCASE (1<<0) jpayne@69: jpayne@69: /* jpayne@69: * Flag values passed to Tcl_GetRegExpFromObj. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_REG_BASIC 000000 /* BREs (convenience). */ jpayne@69: #define TCL_REG_EXTENDED 000001 /* EREs. */ jpayne@69: #define TCL_REG_ADVF 000002 /* Advanced features in EREs. */ jpayne@69: #define TCL_REG_ADVANCED 000003 /* AREs (which are also EREs). */ jpayne@69: #define TCL_REG_QUOTE 000004 /* No special characters, none. */ jpayne@69: #define TCL_REG_NOCASE 000010 /* Ignore case. */ jpayne@69: #define TCL_REG_NOSUB 000020 /* Don't care about subexpressions. */ jpayne@69: #define TCL_REG_EXPANDED 000040 /* Expanded format, white space & jpayne@69: * comments. */ jpayne@69: #define TCL_REG_NLSTOP 000100 /* \n doesn't match . or [^ ] */ jpayne@69: #define TCL_REG_NLANCH 000200 /* ^ matches after \n, $ before. */ jpayne@69: #define TCL_REG_NEWLINE 000300 /* Newlines are line terminators. */ jpayne@69: #define TCL_REG_CANMATCH 001000 /* Report details on partial/limited jpayne@69: * matches. */ jpayne@69: jpayne@69: /* jpayne@69: * Flags values passed to Tcl_RegExpExecObj. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_REG_NOTBOL 0001 /* Beginning of string does not match ^. */ jpayne@69: #define TCL_REG_NOTEOL 0002 /* End of string does not match $. */ jpayne@69: jpayne@69: /* jpayne@69: * Structures filled in by Tcl_RegExpInfo. Note that all offset values are jpayne@69: * relative to the start of the match string, not the beginning of the entire jpayne@69: * string. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tcl_RegExpIndices { jpayne@69: long start; /* Character offset of first character in jpayne@69: * match. */ jpayne@69: long end; /* Character offset of first character after jpayne@69: * the match. */ jpayne@69: } Tcl_RegExpIndices; jpayne@69: jpayne@69: typedef struct Tcl_RegExpInfo { jpayne@69: int nsubs; /* Number of subexpressions in the compiled jpayne@69: * expression. */ jpayne@69: Tcl_RegExpIndices *matches; /* Array of nsubs match offset pairs. */ jpayne@69: long extendStart; /* The offset at which a subsequent match jpayne@69: * might begin. */ jpayne@69: long reserved; /* Reserved for later use. */ jpayne@69: } Tcl_RegExpInfo; jpayne@69: jpayne@69: /* jpayne@69: * Picky compilers complain if this typdef doesn't appear before the struct's jpayne@69: * reference in tclDecls.h. jpayne@69: */ jpayne@69: jpayne@69: typedef Tcl_StatBuf *Tcl_Stat_; jpayne@69: typedef struct stat *Tcl_OldStat_; jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * When a TCL command returns, the interpreter contains a result from the jpayne@69: * command. Programmers are strongly encouraged to use one of the functions jpayne@69: * Tcl_GetObjResult() or Tcl_GetStringResult() to read the interpreter's jpayne@69: * result. See the SetResult man page for details. Besides this result, the jpayne@69: * command function returns an integer code, which is one of the following: jpayne@69: * jpayne@69: * TCL_OK Command completed normally; the interpreter's result jpayne@69: * contains the command's result. jpayne@69: * TCL_ERROR The command couldn't be completed successfully; the jpayne@69: * interpreter's result describes what went wrong. jpayne@69: * TCL_RETURN The command requests that the current function return; jpayne@69: * the interpreter's result contains the function's jpayne@69: * return value. jpayne@69: * TCL_BREAK The command requests that the innermost loop be jpayne@69: * exited; the interpreter's result is meaningless. jpayne@69: * TCL_CONTINUE Go on to the next iteration of the current loop; the jpayne@69: * interpreter's result is meaningless. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_OK 0 jpayne@69: #define TCL_ERROR 1 jpayne@69: #define TCL_RETURN 2 jpayne@69: #define TCL_BREAK 3 jpayne@69: #define TCL_CONTINUE 4 jpayne@69: jpayne@69: #define TCL_RESULT_SIZE 200 jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Flags to control what substitutions are performed by Tcl_SubstObj(): jpayne@69: */ jpayne@69: jpayne@69: #define TCL_SUBST_COMMANDS 001 jpayne@69: #define TCL_SUBST_VARIABLES 002 jpayne@69: #define TCL_SUBST_BACKSLASHES 004 jpayne@69: #define TCL_SUBST_ALL 007 jpayne@69: jpayne@69: /* jpayne@69: * Argument descriptors for math function callbacks in expressions: jpayne@69: */ jpayne@69: jpayne@69: typedef enum { jpayne@69: TCL_INT, TCL_DOUBLE, TCL_EITHER, TCL_WIDE_INT jpayne@69: } Tcl_ValueType; jpayne@69: jpayne@69: typedef struct Tcl_Value { jpayne@69: Tcl_ValueType type; /* Indicates intValue or doubleValue is valid, jpayne@69: * or both. */ jpayne@69: long intValue; /* Integer value. */ jpayne@69: double doubleValue; /* Double-precision floating value. */ jpayne@69: Tcl_WideInt wideValue; /* Wide (min. 64-bit) integer value. */ jpayne@69: } Tcl_Value; jpayne@69: jpayne@69: /* jpayne@69: * Forward declaration of Tcl_Obj to prevent an error when the forward jpayne@69: * reference to Tcl_Obj is encountered in the function types declared below. jpayne@69: */ jpayne@69: jpayne@69: struct Tcl_Obj; jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Function types defined by Tcl: jpayne@69: */ jpayne@69: jpayne@69: typedef int (Tcl_AppInitProc) (Tcl_Interp *interp); jpayne@69: typedef int (Tcl_AsyncProc) (ClientData clientData, Tcl_Interp *interp, jpayne@69: int code); jpayne@69: typedef void (Tcl_ChannelProc) (ClientData clientData, int mask); jpayne@69: typedef void (Tcl_CloseProc) (ClientData data); jpayne@69: typedef void (Tcl_CmdDeleteProc) (ClientData clientData); jpayne@69: typedef int (Tcl_CmdProc) (ClientData clientData, Tcl_Interp *interp, jpayne@69: int argc, CONST84 char *argv[]); jpayne@69: typedef void (Tcl_CmdTraceProc) (ClientData clientData, Tcl_Interp *interp, jpayne@69: int level, char *command, Tcl_CmdProc *proc, jpayne@69: ClientData cmdClientData, int argc, CONST84 char *argv[]); jpayne@69: typedef int (Tcl_CmdObjTraceProc) (ClientData clientData, Tcl_Interp *interp, jpayne@69: int level, const char *command, Tcl_Command commandInfo, int objc, jpayne@69: struct Tcl_Obj *const *objv); jpayne@69: typedef void (Tcl_CmdObjTraceDeleteProc) (ClientData clientData); jpayne@69: typedef void (Tcl_DupInternalRepProc) (struct Tcl_Obj *srcPtr, jpayne@69: struct Tcl_Obj *dupPtr); jpayne@69: typedef int (Tcl_EncodingConvertProc) (ClientData clientData, const char *src, jpayne@69: int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, jpayne@69: int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); jpayne@69: typedef void (Tcl_EncodingFreeProc) (ClientData clientData); jpayne@69: typedef int (Tcl_EventProc) (Tcl_Event *evPtr, int flags); jpayne@69: typedef void (Tcl_EventCheckProc) (ClientData clientData, int flags); jpayne@69: typedef int (Tcl_EventDeleteProc) (Tcl_Event *evPtr, ClientData clientData); jpayne@69: typedef void (Tcl_EventSetupProc) (ClientData clientData, int flags); jpayne@69: typedef void (Tcl_ExitProc) (ClientData clientData); jpayne@69: typedef void (Tcl_FileProc) (ClientData clientData, int mask); jpayne@69: typedef void (Tcl_FileFreeProc) (ClientData clientData); jpayne@69: typedef void (Tcl_FreeInternalRepProc) (struct Tcl_Obj *objPtr); jpayne@69: typedef void (Tcl_FreeProc) (char *blockPtr); jpayne@69: typedef void (Tcl_IdleProc) (ClientData clientData); jpayne@69: typedef void (Tcl_InterpDeleteProc) (ClientData clientData, jpayne@69: Tcl_Interp *interp); jpayne@69: typedef int (Tcl_MathProc) (ClientData clientData, Tcl_Interp *interp, jpayne@69: Tcl_Value *args, Tcl_Value *resultPtr); jpayne@69: typedef void (Tcl_NamespaceDeleteProc) (ClientData clientData); jpayne@69: typedef int (Tcl_ObjCmdProc) (ClientData clientData, Tcl_Interp *interp, jpayne@69: int objc, struct Tcl_Obj *const *objv); jpayne@69: typedef int (Tcl_PackageInitProc) (Tcl_Interp *interp); jpayne@69: typedef int (Tcl_PackageUnloadProc) (Tcl_Interp *interp, int flags); jpayne@69: typedef void (Tcl_PanicProc) (const char *format, ...); jpayne@69: typedef void (Tcl_TcpAcceptProc) (ClientData callbackData, Tcl_Channel chan, jpayne@69: char *address, int port); jpayne@69: typedef void (Tcl_TimerProc) (ClientData clientData); jpayne@69: typedef int (Tcl_SetFromAnyProc) (Tcl_Interp *interp, struct Tcl_Obj *objPtr); jpayne@69: typedef void (Tcl_UpdateStringProc) (struct Tcl_Obj *objPtr); jpayne@69: typedef char * (Tcl_VarTraceProc) (ClientData clientData, Tcl_Interp *interp, jpayne@69: CONST84 char *part1, CONST84 char *part2, int flags); jpayne@69: typedef void (Tcl_CommandTraceProc) (ClientData clientData, Tcl_Interp *interp, jpayne@69: const char *oldName, const char *newName, int flags); jpayne@69: typedef void (Tcl_CreateFileHandlerProc) (int fd, int mask, Tcl_FileProc *proc, jpayne@69: ClientData clientData); jpayne@69: typedef void (Tcl_DeleteFileHandlerProc) (int fd); jpayne@69: typedef void (Tcl_AlertNotifierProc) (ClientData clientData); jpayne@69: typedef void (Tcl_ServiceModeHookProc) (int mode); jpayne@69: typedef ClientData (Tcl_InitNotifierProc) (void); jpayne@69: typedef void (Tcl_FinalizeNotifierProc) (ClientData clientData); jpayne@69: typedef void (Tcl_MainLoopProc) (void); jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * The following structure represents a type of object, which is a particular jpayne@69: * internal representation for an object plus a set of functions that provide jpayne@69: * standard operations on objects of that type. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tcl_ObjType { jpayne@69: const char *name; /* Name of the type, e.g. "int". */ jpayne@69: Tcl_FreeInternalRepProc *freeIntRepProc; jpayne@69: /* Called to free any storage for the type's jpayne@69: * internal rep. NULL if the internal rep does jpayne@69: * not need freeing. */ jpayne@69: Tcl_DupInternalRepProc *dupIntRepProc; jpayne@69: /* Called to create a new object as a copy of jpayne@69: * an existing object. */ jpayne@69: Tcl_UpdateStringProc *updateStringProc; jpayne@69: /* Called to update the string rep from the jpayne@69: * type's internal representation. */ jpayne@69: Tcl_SetFromAnyProc *setFromAnyProc; jpayne@69: /* Called to convert the object's internal rep jpayne@69: * to this type. Frees the internal rep of the jpayne@69: * old type. Returns TCL_ERROR on failure. */ jpayne@69: } Tcl_ObjType; jpayne@69: jpayne@69: /* jpayne@69: * One of the following structures exists for each object in the Tcl system. jpayne@69: * An object stores a value as either a string, some internal representation, jpayne@69: * or both. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tcl_Obj { jpayne@69: int refCount; /* When 0 the object will be freed. */ jpayne@69: char *bytes; /* This points to the first byte of the jpayne@69: * object's string representation. The array jpayne@69: * must be followed by a null byte (i.e., at jpayne@69: * offset length) but may also contain jpayne@69: * embedded null characters. The array's jpayne@69: * storage is allocated by ckalloc. NULL means jpayne@69: * the string rep is invalid and must be jpayne@69: * regenerated from the internal rep. Clients jpayne@69: * should use Tcl_GetStringFromObj or jpayne@69: * Tcl_GetString to get a pointer to the byte jpayne@69: * array as a readonly value. */ jpayne@69: int length; /* The number of bytes at *bytes, not jpayne@69: * including the terminating null. */ jpayne@69: const Tcl_ObjType *typePtr; /* Denotes the object's type. Always jpayne@69: * corresponds to the type of the object's jpayne@69: * internal rep. NULL indicates the object has jpayne@69: * no internal rep (has no type). */ jpayne@69: union { /* The internal representation: */ jpayne@69: long longValue; /* - an long integer value. */ jpayne@69: double doubleValue; /* - a double-precision floating value. */ jpayne@69: void *otherValuePtr; /* - another, type-specific value, jpayne@69: not used internally any more. */ jpayne@69: Tcl_WideInt wideValue; /* - a long long value. */ jpayne@69: struct { /* - internal rep as two pointers. jpayne@69: * the main use of which is a bignum's jpayne@69: * tightly packed fields, where the alloc, jpayne@69: * used and signum flags are packed into jpayne@69: * ptr2 with everything else hung off ptr1. */ jpayne@69: void *ptr1; jpayne@69: void *ptr2; jpayne@69: } twoPtrValue; jpayne@69: struct { /* - internal rep as a pointer and a long, jpayne@69: not used internally any more. */ jpayne@69: void *ptr; jpayne@69: unsigned long value; jpayne@69: } ptrAndLongRep; jpayne@69: } internalRep; jpayne@69: } Tcl_Obj; jpayne@69: jpayne@69: /* jpayne@69: * Macros to increment and decrement a Tcl_Obj's reference count, and to test jpayne@69: * whether an object is shared (i.e. has reference count > 1). Note: clients jpayne@69: * should use Tcl_DecrRefCount() when they are finished using an object, and jpayne@69: * should never call TclFreeObj() directly. TclFreeObj() is only defined and jpayne@69: * made public in tcl.h to support Tcl_DecrRefCount's macro definition. jpayne@69: */ jpayne@69: jpayne@69: void Tcl_IncrRefCount(Tcl_Obj *objPtr); jpayne@69: void Tcl_DecrRefCount(Tcl_Obj *objPtr); jpayne@69: int Tcl_IsShared(Tcl_Obj *objPtr); jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * The following structure contains the state needed by Tcl_SaveResult. No-one jpayne@69: * outside of Tcl should access any of these fields. This structure is jpayne@69: * typically allocated on the stack. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tcl_SavedResult { jpayne@69: char *result; jpayne@69: Tcl_FreeProc *freeProc; jpayne@69: Tcl_Obj *objResultPtr; jpayne@69: char *appendResult; jpayne@69: int appendAvl; jpayne@69: int appendUsed; jpayne@69: char resultSpace[TCL_RESULT_SIZE+1]; jpayne@69: } Tcl_SavedResult; jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * The following definitions support Tcl's namespace facility. Note: the first jpayne@69: * five fields must match exactly the fields in a Namespace structure (see jpayne@69: * tclInt.h). jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tcl_Namespace { jpayne@69: char *name; /* The namespace's name within its parent jpayne@69: * namespace. This contains no ::'s. The name jpayne@69: * of the global namespace is "" although "::" jpayne@69: * is an synonym. */ jpayne@69: char *fullName; /* The namespace's fully qualified name. This jpayne@69: * starts with ::. */ jpayne@69: ClientData clientData; /* Arbitrary value associated with this jpayne@69: * namespace. */ jpayne@69: Tcl_NamespaceDeleteProc *deleteProc; jpayne@69: /* Function invoked when deleting the jpayne@69: * namespace to, e.g., free clientData. */ jpayne@69: struct Tcl_Namespace *parentPtr; jpayne@69: /* Points to the namespace that contains this jpayne@69: * one. NULL if this is the global jpayne@69: * namespace. */ jpayne@69: } Tcl_Namespace; jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * The following structure represents a call frame, or activation record. A jpayne@69: * call frame defines a naming context for a procedure call: its local scope jpayne@69: * (for local variables) and its namespace scope (used for non-local jpayne@69: * variables; often the global :: namespace). A call frame can also define the jpayne@69: * naming context for a namespace eval or namespace inscope command: the jpayne@69: * namespace in which the command's code should execute. The Tcl_CallFrame jpayne@69: * structures exist only while procedures or namespace eval/inscope's are jpayne@69: * being executed, and provide a Tcl call stack. jpayne@69: * jpayne@69: * A call frame is initialized and pushed using Tcl_PushCallFrame and popped jpayne@69: * using Tcl_PopCallFrame. Storage for a Tcl_CallFrame must be provided by the jpayne@69: * Tcl_PushCallFrame caller, and callers typically allocate them on the C call jpayne@69: * stack for efficiency. For this reason, Tcl_CallFrame is defined as a jpayne@69: * structure and not as an opaque token. However, most Tcl_CallFrame fields jpayne@69: * are hidden since applications should not access them directly; others are jpayne@69: * declared as "dummyX". jpayne@69: * jpayne@69: * WARNING!! The structure definition must be kept consistent with the jpayne@69: * CallFrame structure in tclInt.h. If you change one, change the other. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tcl_CallFrame { jpayne@69: Tcl_Namespace *nsPtr; jpayne@69: int dummy1; jpayne@69: int dummy2; jpayne@69: void *dummy3; jpayne@69: void *dummy4; jpayne@69: void *dummy5; jpayne@69: int dummy6; jpayne@69: void *dummy7; jpayne@69: void *dummy8; jpayne@69: int dummy9; jpayne@69: void *dummy10; jpayne@69: void *dummy11; jpayne@69: void *dummy12; jpayne@69: void *dummy13; jpayne@69: } Tcl_CallFrame; jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Information about commands that is returned by Tcl_GetCommandInfo and jpayne@69: * passed to Tcl_SetCommandInfo. objProc is an objc/objv object-based command jpayne@69: * function while proc is a traditional Tcl argc/argv string-based function. jpayne@69: * Tcl_CreateObjCommand and Tcl_CreateCommand ensure that both objProc and jpayne@69: * proc are non-NULL and can be called to execute the command. However, it may jpayne@69: * be faster to call one instead of the other. The member isNativeObjectProc jpayne@69: * is set to 1 if an object-based function was registered by jpayne@69: * Tcl_CreateObjCommand, and to 0 if a string-based function was registered by jpayne@69: * Tcl_CreateCommand. The other function is typically set to a compatibility jpayne@69: * wrapper that does string-to-object or object-to-string argument conversions jpayne@69: * then calls the other function. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tcl_CmdInfo { jpayne@69: int isNativeObjectProc; /* 1 if objProc was registered by a call to jpayne@69: * Tcl_CreateObjCommand; 0 otherwise. jpayne@69: * Tcl_SetCmdInfo does not modify this jpayne@69: * field. */ jpayne@69: Tcl_ObjCmdProc *objProc; /* Command's object-based function. */ jpayne@69: ClientData objClientData; /* ClientData for object proc. */ jpayne@69: Tcl_CmdProc *proc; /* Command's string-based function. */ jpayne@69: ClientData clientData; /* ClientData for string proc. */ jpayne@69: Tcl_CmdDeleteProc *deleteProc; jpayne@69: /* Function to call when command is jpayne@69: * deleted. */ jpayne@69: ClientData deleteData; /* Value to pass to deleteProc (usually the jpayne@69: * same as clientData). */ jpayne@69: Tcl_Namespace *namespacePtr;/* Points to the namespace that contains this jpayne@69: * command. Note that Tcl_SetCmdInfo will not jpayne@69: * change a command's namespace; use jpayne@69: * TclRenameCommand or Tcl_Eval (of 'rename') jpayne@69: * to do that. */ jpayne@69: } Tcl_CmdInfo; jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * The structure defined below is used to hold dynamic strings. The only jpayne@69: * fields that clients should use are string and length, accessible via the jpayne@69: * macros Tcl_DStringValue and Tcl_DStringLength. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_DSTRING_STATIC_SIZE 200 jpayne@69: typedef struct Tcl_DString { jpayne@69: char *string; /* Points to beginning of string: either jpayne@69: * staticSpace below or a malloced array. */ jpayne@69: int length; /* Number of non-NULL characters in the jpayne@69: * string. */ jpayne@69: int spaceAvl; /* Total number of bytes available for the jpayne@69: * string and its terminating NULL char. */ jpayne@69: char staticSpace[TCL_DSTRING_STATIC_SIZE]; jpayne@69: /* Space to use in common case where string is jpayne@69: * small. */ jpayne@69: } Tcl_DString; jpayne@69: jpayne@69: #define Tcl_DStringLength(dsPtr) ((dsPtr)->length) jpayne@69: #define Tcl_DStringValue(dsPtr) ((dsPtr)->string) jpayne@69: #define Tcl_DStringTrunc Tcl_DStringSetLength jpayne@69: jpayne@69: /* jpayne@69: * Definitions for the maximum number of digits of precision that may be jpayne@69: * specified in the "tcl_precision" variable, and the number of bytes of jpayne@69: * buffer space required by Tcl_PrintDouble. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_MAX_PREC 17 jpayne@69: #define TCL_DOUBLE_SPACE (TCL_MAX_PREC+10) jpayne@69: jpayne@69: /* jpayne@69: * Definition for a number of bytes of buffer space sufficient to hold the jpayne@69: * string representation of an integer in base 10 (assuming the existence of jpayne@69: * 64-bit integers). jpayne@69: */ jpayne@69: jpayne@69: #define TCL_INTEGER_SPACE 24 jpayne@69: jpayne@69: /* jpayne@69: * Flag values passed to Tcl_ConvertElement. jpayne@69: * TCL_DONT_USE_BRACES forces it not to enclose the element in braces, but to jpayne@69: * use backslash quoting instead. jpayne@69: * TCL_DONT_QUOTE_HASH disables the default quoting of the '#' character. It jpayne@69: * is safe to leave the hash unquoted when the element is not the first jpayne@69: * element of a list, and this flag can be used by the caller to indicate jpayne@69: * that condition. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_DONT_USE_BRACES 1 jpayne@69: #define TCL_DONT_QUOTE_HASH 8 jpayne@69: jpayne@69: /* jpayne@69: * Flag that may be passed to Tcl_GetIndexFromObj to force it to disallow jpayne@69: * abbreviated strings. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_EXACT 1 jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Flag values passed to Tcl_RecordAndEval, Tcl_EvalObj, Tcl_EvalObjv. jpayne@69: * WARNING: these bit choices must not conflict with the bit choices for jpayne@69: * evalFlag bits in tclInt.h! jpayne@69: * jpayne@69: * Meanings: jpayne@69: * TCL_NO_EVAL: Just record this command jpayne@69: * TCL_EVAL_GLOBAL: Execute script in global namespace jpayne@69: * TCL_EVAL_DIRECT: Do not compile this script jpayne@69: * TCL_EVAL_INVOKE: Magical Tcl_EvalObjv mode for aliases/ensembles jpayne@69: * o Run in iPtr->lookupNsPtr or global namespace jpayne@69: * o Cut out of error traces jpayne@69: * o Don't reset the flags controlling ensemble jpayne@69: * error message rewriting. jpayne@69: * TCL_CANCEL_UNWIND: Magical Tcl_CancelEval mode that causes the jpayne@69: * stack for the script in progress to be jpayne@69: * completely unwound. jpayne@69: * TCL_EVAL_NOERR: Do no exception reporting at all, just return jpayne@69: * as the caller will report. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_NO_EVAL 0x010000 jpayne@69: #define TCL_EVAL_GLOBAL 0x020000 jpayne@69: #define TCL_EVAL_DIRECT 0x040000 jpayne@69: #define TCL_EVAL_INVOKE 0x080000 jpayne@69: #define TCL_CANCEL_UNWIND 0x100000 jpayne@69: #define TCL_EVAL_NOERR 0x200000 jpayne@69: jpayne@69: /* jpayne@69: * Special freeProc values that may be passed to Tcl_SetResult (see the man jpayne@69: * page for details): jpayne@69: */ jpayne@69: jpayne@69: #define TCL_VOLATILE ((Tcl_FreeProc *) 1) jpayne@69: #define TCL_STATIC ((Tcl_FreeProc *) 0) jpayne@69: #define TCL_DYNAMIC ((Tcl_FreeProc *) 3) jpayne@69: jpayne@69: /* jpayne@69: * Flag values passed to variable-related functions. jpayne@69: * WARNING: these bit choices must not conflict with the bit choice for jpayne@69: * TCL_CANCEL_UNWIND, above. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_GLOBAL_ONLY 1 jpayne@69: #define TCL_NAMESPACE_ONLY 2 jpayne@69: #define TCL_APPEND_VALUE 4 jpayne@69: #define TCL_LIST_ELEMENT 8 jpayne@69: #define TCL_TRACE_READS 0x10 jpayne@69: #define TCL_TRACE_WRITES 0x20 jpayne@69: #define TCL_TRACE_UNSETS 0x40 jpayne@69: #define TCL_TRACE_DESTROYED 0x80 jpayne@69: #define TCL_INTERP_DESTROYED 0x100 jpayne@69: #define TCL_LEAVE_ERR_MSG 0x200 jpayne@69: #define TCL_TRACE_ARRAY 0x800 jpayne@69: #ifndef TCL_REMOVE_OBSOLETE_TRACES jpayne@69: /* Required to support old variable/vdelete/vinfo traces. */ jpayne@69: #define TCL_TRACE_OLD_STYLE 0x1000 jpayne@69: #endif jpayne@69: /* Indicate the semantics of the result of a trace. */ jpayne@69: #define TCL_TRACE_RESULT_DYNAMIC 0x8000 jpayne@69: #define TCL_TRACE_RESULT_OBJECT 0x10000 jpayne@69: jpayne@69: /* jpayne@69: * Flag values for ensemble commands. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_ENSEMBLE_PREFIX 0x02/* Flag value to say whether to allow jpayne@69: * unambiguous prefixes of commands or to jpayne@69: * require exact matches for command names. */ jpayne@69: jpayne@69: /* jpayne@69: * Flag values passed to command-related functions. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_TRACE_RENAME 0x2000 jpayne@69: #define TCL_TRACE_DELETE 0x4000 jpayne@69: jpayne@69: #define TCL_ALLOW_INLINE_COMPILATION 0x20000 jpayne@69: jpayne@69: /* jpayne@69: * The TCL_PARSE_PART1 flag is deprecated and has no effect. The part1 is now jpayne@69: * always parsed whenever the part2 is NULL. (This is to avoid a common error jpayne@69: * when converting code to use the new object based APIs and forgetting to jpayne@69: * give the flag) jpayne@69: */ jpayne@69: jpayne@69: #if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 jpayne@69: # define TCL_PARSE_PART1 0x400 jpayne@69: #endif /* !TCL_NO_DEPRECATED */ jpayne@69: jpayne@69: /* jpayne@69: * Types for linked variables: jpayne@69: */ jpayne@69: jpayne@69: #define TCL_LINK_INT 1 jpayne@69: #define TCL_LINK_DOUBLE 2 jpayne@69: #define TCL_LINK_BOOLEAN 3 jpayne@69: #define TCL_LINK_STRING 4 jpayne@69: #define TCL_LINK_WIDE_INT 5 jpayne@69: #define TCL_LINK_CHAR 6 jpayne@69: #define TCL_LINK_UCHAR 7 jpayne@69: #define TCL_LINK_SHORT 8 jpayne@69: #define TCL_LINK_USHORT 9 jpayne@69: #define TCL_LINK_UINT 10 jpayne@69: #define TCL_LINK_LONG 11 jpayne@69: #define TCL_LINK_ULONG 12 jpayne@69: #define TCL_LINK_FLOAT 13 jpayne@69: #define TCL_LINK_WIDE_UINT 14 jpayne@69: #define TCL_LINK_READ_ONLY 0x80 jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Forward declarations of Tcl_HashTable and related types. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tcl_HashKeyType Tcl_HashKeyType; jpayne@69: typedef struct Tcl_HashTable Tcl_HashTable; jpayne@69: typedef struct Tcl_HashEntry Tcl_HashEntry; jpayne@69: jpayne@69: typedef unsigned (Tcl_HashKeyProc) (Tcl_HashTable *tablePtr, void *keyPtr); jpayne@69: typedef int (Tcl_CompareHashKeysProc) (void *keyPtr, Tcl_HashEntry *hPtr); jpayne@69: typedef Tcl_HashEntry * (Tcl_AllocHashEntryProc) (Tcl_HashTable *tablePtr, jpayne@69: void *keyPtr); jpayne@69: typedef void (Tcl_FreeHashEntryProc) (Tcl_HashEntry *hPtr); jpayne@69: jpayne@69: /* jpayne@69: * This flag controls whether the hash table stores the hash of a key, or jpayne@69: * recalculates it. There should be no reason for turning this flag off as it jpayne@69: * is completely binary and source compatible unless you directly access the jpayne@69: * bucketPtr member of the Tcl_HashTableEntry structure. This member has been jpayne@69: * removed and the space used to store the hash value. jpayne@69: */ jpayne@69: jpayne@69: #ifndef TCL_HASH_KEY_STORE_HASH jpayne@69: # define TCL_HASH_KEY_STORE_HASH 1 jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Structure definition for an entry in a hash table. No-one outside Tcl jpayne@69: * should access any of these fields directly; use the macros defined below. jpayne@69: */ jpayne@69: jpayne@69: struct Tcl_HashEntry { jpayne@69: Tcl_HashEntry *nextPtr; /* Pointer to next entry in this hash bucket, jpayne@69: * or NULL for end of chain. */ jpayne@69: Tcl_HashTable *tablePtr; /* Pointer to table containing entry. */ jpayne@69: #if TCL_HASH_KEY_STORE_HASH jpayne@69: void *hash; /* Hash value, stored as pointer to ensure jpayne@69: * that the offsets of the fields in this jpayne@69: * structure are not changed. */ jpayne@69: #else jpayne@69: Tcl_HashEntry **bucketPtr; /* Pointer to bucket that points to first jpayne@69: * entry in this entry's chain: used for jpayne@69: * deleting the entry. */ jpayne@69: #endif jpayne@69: ClientData clientData; /* Application stores something here with jpayne@69: * Tcl_SetHashValue. */ jpayne@69: union { /* Key has one of these forms: */ jpayne@69: char *oneWordValue; /* One-word value for key. */ jpayne@69: Tcl_Obj *objPtr; /* Tcl_Obj * key value. */ jpayne@69: int words[1]; /* Multiple integer words for key. The actual jpayne@69: * size will be as large as necessary for this jpayne@69: * table's keys. */ jpayne@69: char string[1]; /* String for key. The actual size will be as jpayne@69: * large as needed to hold the key. */ jpayne@69: } key; /* MUST BE LAST FIELD IN RECORD!! */ jpayne@69: }; jpayne@69: jpayne@69: /* jpayne@69: * Flags used in Tcl_HashKeyType. jpayne@69: * jpayne@69: * TCL_HASH_KEY_RANDOMIZE_HASH - jpayne@69: * There are some things, pointers for example jpayne@69: * which don't hash well because they do not use jpayne@69: * the lower bits. If this flag is set then the jpayne@69: * hash table will attempt to rectify this by jpayne@69: * randomising the bits and then using the upper jpayne@69: * N bits as the index into the table. jpayne@69: * TCL_HASH_KEY_SYSTEM_HASH - If this flag is set then all memory internally jpayne@69: * allocated for the hash table that is not for an jpayne@69: * entry will use the system heap. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_HASH_KEY_RANDOMIZE_HASH 0x1 jpayne@69: #define TCL_HASH_KEY_SYSTEM_HASH 0x2 jpayne@69: jpayne@69: /* jpayne@69: * Structure definition for the methods associated with a hash table key type. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_HASH_KEY_TYPE_VERSION 1 jpayne@69: struct Tcl_HashKeyType { jpayne@69: int version; /* Version of the table. If this structure is jpayne@69: * extended in future then the version can be jpayne@69: * used to distinguish between different jpayne@69: * structures. */ jpayne@69: int flags; /* Flags, see above for details. */ jpayne@69: Tcl_HashKeyProc *hashKeyProc; jpayne@69: /* Calculates a hash value for the key. If jpayne@69: * this is NULL then the pointer itself is jpayne@69: * used as a hash value. */ jpayne@69: Tcl_CompareHashKeysProc *compareKeysProc; jpayne@69: /* Compares two keys and returns zero if they jpayne@69: * do not match, and non-zero if they do. If jpayne@69: * this is NULL then the pointers are jpayne@69: * compared. */ jpayne@69: Tcl_AllocHashEntryProc *allocEntryProc; jpayne@69: /* Called to allocate memory for a new entry, jpayne@69: * i.e. if the key is a string then this could jpayne@69: * allocate a single block which contains jpayne@69: * enough space for both the entry and the jpayne@69: * string. Only the key field of the allocated jpayne@69: * Tcl_HashEntry structure needs to be filled jpayne@69: * in. If something else needs to be done to jpayne@69: * the key, i.e. incrementing a reference jpayne@69: * count then that should be done by this jpayne@69: * function. If this is NULL then Tcl_Alloc is jpayne@69: * used to allocate enough space for a jpayne@69: * Tcl_HashEntry and the key pointer is jpayne@69: * assigned to key.oneWordValue. */ jpayne@69: Tcl_FreeHashEntryProc *freeEntryProc; jpayne@69: /* Called to free memory associated with an jpayne@69: * entry. If something else needs to be done jpayne@69: * to the key, i.e. decrementing a reference jpayne@69: * count then that should be done by this jpayne@69: * function. If this is NULL then Tcl_Free is jpayne@69: * used to free the Tcl_HashEntry. */ jpayne@69: }; jpayne@69: jpayne@69: /* jpayne@69: * Structure definition for a hash table. Must be in tcl.h so clients can jpayne@69: * allocate space for these structures, but clients should never access any jpayne@69: * fields in this structure. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_SMALL_HASH_TABLE 4 jpayne@69: struct Tcl_HashTable { jpayne@69: Tcl_HashEntry **buckets; /* Pointer to bucket array. Each element jpayne@69: * points to first entry in bucket's hash jpayne@69: * chain, or NULL. */ jpayne@69: Tcl_HashEntry *staticBuckets[TCL_SMALL_HASH_TABLE]; jpayne@69: /* Bucket array used for small tables (to jpayne@69: * avoid mallocs and frees). */ jpayne@69: int numBuckets; /* Total number of buckets allocated at jpayne@69: * **bucketPtr. */ jpayne@69: int numEntries; /* Total number of entries present in jpayne@69: * table. */ jpayne@69: int rebuildSize; /* Enlarge table when numEntries gets to be jpayne@69: * this large. */ jpayne@69: int downShift; /* Shift count used in hashing function. jpayne@69: * Designed to use high-order bits of jpayne@69: * randomized keys. */ jpayne@69: int mask; /* Mask value used in hashing function. */ jpayne@69: int keyType; /* Type of keys used in this table. It's jpayne@69: * either TCL_CUSTOM_KEYS, TCL_STRING_KEYS, jpayne@69: * TCL_ONE_WORD_KEYS, or an integer giving the jpayne@69: * number of ints that is the size of the jpayne@69: * key. */ jpayne@69: Tcl_HashEntry *(*findProc) (Tcl_HashTable *tablePtr, const char *key); jpayne@69: Tcl_HashEntry *(*createProc) (Tcl_HashTable *tablePtr, const char *key, jpayne@69: int *newPtr); jpayne@69: const Tcl_HashKeyType *typePtr; jpayne@69: /* Type of the keys used in the jpayne@69: * Tcl_HashTable. */ jpayne@69: }; jpayne@69: jpayne@69: /* jpayne@69: * Structure definition for information used to keep track of searches through jpayne@69: * hash tables: jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tcl_HashSearch { jpayne@69: Tcl_HashTable *tablePtr; /* Table being searched. */ jpayne@69: int nextIndex; /* Index of next bucket to be enumerated after jpayne@69: * present one. */ jpayne@69: Tcl_HashEntry *nextEntryPtr;/* Next entry to be enumerated in the current jpayne@69: * bucket. */ jpayne@69: } Tcl_HashSearch; jpayne@69: jpayne@69: /* jpayne@69: * Acceptable key types for hash tables: jpayne@69: * jpayne@69: * TCL_STRING_KEYS: The keys are strings, they are copied into the jpayne@69: * entry. jpayne@69: * TCL_ONE_WORD_KEYS: The keys are pointers, the pointer is stored jpayne@69: * in the entry. jpayne@69: * TCL_CUSTOM_TYPE_KEYS: The keys are arbitrary types which are copied jpayne@69: * into the entry. jpayne@69: * TCL_CUSTOM_PTR_KEYS: The keys are pointers to arbitrary types, the jpayne@69: * pointer is stored in the entry. jpayne@69: * jpayne@69: * While maintaining binary compatibility the above have to be distinct values jpayne@69: * as they are used to differentiate between old versions of the hash table jpayne@69: * which don't have a typePtr and new ones which do. Once binary compatibility jpayne@69: * is discarded in favour of making more wide spread changes TCL_STRING_KEYS jpayne@69: * can be the same as TCL_CUSTOM_TYPE_KEYS, and TCL_ONE_WORD_KEYS can be the jpayne@69: * same as TCL_CUSTOM_PTR_KEYS because they simply determine how the key is jpayne@69: * accessed from the entry and not the behaviour. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_STRING_KEYS (0) jpayne@69: #define TCL_ONE_WORD_KEYS (1) jpayne@69: #define TCL_CUSTOM_TYPE_KEYS (-2) jpayne@69: #define TCL_CUSTOM_PTR_KEYS (-1) jpayne@69: jpayne@69: /* jpayne@69: * Structure definition for information used to keep track of searches through jpayne@69: * dictionaries. These fields should not be accessed by code outside jpayne@69: * tclDictObj.c jpayne@69: */ jpayne@69: jpayne@69: typedef struct { jpayne@69: void *next; /* Search position for underlying hash jpayne@69: * table. */ jpayne@69: int epoch; /* Epoch marker for dictionary being searched, jpayne@69: * or -1 if search has terminated. */ jpayne@69: Tcl_Dict dictionaryPtr; /* Reference to dictionary being searched. */ jpayne@69: } Tcl_DictSearch; jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Flag values to pass to Tcl_DoOneEvent to disable searches for some kinds of jpayne@69: * events: jpayne@69: */ jpayne@69: jpayne@69: #define TCL_DONT_WAIT (1<<1) jpayne@69: #define TCL_WINDOW_EVENTS (1<<2) jpayne@69: #define TCL_FILE_EVENTS (1<<3) jpayne@69: #define TCL_TIMER_EVENTS (1<<4) jpayne@69: #define TCL_IDLE_EVENTS (1<<5) /* WAS 0x10 ???? */ jpayne@69: #define TCL_ALL_EVENTS (~TCL_DONT_WAIT) jpayne@69: jpayne@69: /* jpayne@69: * The following structure defines a generic event for the Tcl event system. jpayne@69: * These are the things that are queued in calls to Tcl_QueueEvent and jpayne@69: * serviced later by Tcl_DoOneEvent. There can be many different kinds of jpayne@69: * events with different fields, corresponding to window events, timer events, jpayne@69: * etc. The structure for a particular event consists of a Tcl_Event header jpayne@69: * followed by additional information specific to that event. jpayne@69: */ jpayne@69: jpayne@69: struct Tcl_Event { jpayne@69: Tcl_EventProc *proc; /* Function to call to service this event. */ jpayne@69: struct Tcl_Event *nextPtr; /* Next in list of pending events, or NULL. */ jpayne@69: }; jpayne@69: jpayne@69: /* jpayne@69: * Positions to pass to Tcl_QueueEvent: jpayne@69: */ jpayne@69: jpayne@69: typedef enum { jpayne@69: TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, TCL_QUEUE_MARK jpayne@69: } Tcl_QueuePosition; jpayne@69: jpayne@69: /* jpayne@69: * Values to pass to Tcl_SetServiceMode to specify the behavior of notifier jpayne@69: * event routines. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_SERVICE_NONE 0 jpayne@69: #define TCL_SERVICE_ALL 1 jpayne@69: jpayne@69: /* jpayne@69: * The following structure keeps is used to hold a time value, either as an jpayne@69: * absolute time (the number of seconds from the epoch) or as an elapsed time. jpayne@69: * On Unix systems the epoch is Midnight Jan 1, 1970 GMT. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tcl_Time { jpayne@69: long sec; /* Seconds. */ jpayne@69: long usec; /* Microseconds. */ jpayne@69: } Tcl_Time; jpayne@69: jpayne@69: typedef void (Tcl_SetTimerProc) (CONST86 Tcl_Time *timePtr); jpayne@69: typedef int (Tcl_WaitForEventProc) (CONST86 Tcl_Time *timePtr); jpayne@69: jpayne@69: /* jpayne@69: * TIP #233 (Virtualized Time) jpayne@69: */ jpayne@69: jpayne@69: typedef void (Tcl_GetTimeProc) (Tcl_Time *timebuf, ClientData clientData); jpayne@69: typedef void (Tcl_ScaleTimeProc) (Tcl_Time *timebuf, ClientData clientData); jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Bits to pass to Tcl_CreateFileHandler and Tcl_CreateChannelHandler to jpayne@69: * indicate what sorts of events are of interest: jpayne@69: */ jpayne@69: jpayne@69: #define TCL_READABLE (1<<1) jpayne@69: #define TCL_WRITABLE (1<<2) jpayne@69: #define TCL_EXCEPTION (1<<3) jpayne@69: jpayne@69: /* jpayne@69: * Flag values to pass to Tcl_OpenCommandChannel to indicate the disposition jpayne@69: * of the stdio handles. TCL_STDIN, TCL_STDOUT, TCL_STDERR, are also used in jpayne@69: * Tcl_GetStdChannel. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_STDIN (1<<1) jpayne@69: #define TCL_STDOUT (1<<2) jpayne@69: #define TCL_STDERR (1<<3) jpayne@69: #define TCL_ENFORCE_MODE (1<<4) jpayne@69: jpayne@69: /* jpayne@69: * Bits passed to Tcl_DriverClose2Proc to indicate which side of a channel jpayne@69: * should be closed. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_CLOSE_READ (1<<1) jpayne@69: #define TCL_CLOSE_WRITE (1<<2) jpayne@69: jpayne@69: /* jpayne@69: * Value to use as the closeProc for a channel that supports the close2Proc jpayne@69: * interface. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_CLOSE2PROC ((Tcl_DriverCloseProc *) 1) jpayne@69: jpayne@69: /* jpayne@69: * Channel version tag. This was introduced in 8.3.2/8.4. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_CHANNEL_VERSION_1 ((Tcl_ChannelTypeVersion) 0x1) jpayne@69: #define TCL_CHANNEL_VERSION_2 ((Tcl_ChannelTypeVersion) 0x2) jpayne@69: #define TCL_CHANNEL_VERSION_3 ((Tcl_ChannelTypeVersion) 0x3) jpayne@69: #define TCL_CHANNEL_VERSION_4 ((Tcl_ChannelTypeVersion) 0x4) jpayne@69: #define TCL_CHANNEL_VERSION_5 ((Tcl_ChannelTypeVersion) 0x5) jpayne@69: jpayne@69: /* jpayne@69: * TIP #218: Channel Actions, Ids for Tcl_DriverThreadActionProc. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_CHANNEL_THREAD_INSERT (0) jpayne@69: #define TCL_CHANNEL_THREAD_REMOVE (1) jpayne@69: jpayne@69: /* jpayne@69: * Typedefs for the various operations in a channel type: jpayne@69: */ jpayne@69: jpayne@69: typedef int (Tcl_DriverBlockModeProc) (ClientData instanceData, int mode); jpayne@69: typedef int (Tcl_DriverCloseProc) (ClientData instanceData, jpayne@69: Tcl_Interp *interp); jpayne@69: typedef int (Tcl_DriverClose2Proc) (ClientData instanceData, jpayne@69: Tcl_Interp *interp, int flags); jpayne@69: typedef int (Tcl_DriverInputProc) (ClientData instanceData, char *buf, jpayne@69: int toRead, int *errorCodePtr); jpayne@69: typedef int (Tcl_DriverOutputProc) (ClientData instanceData, jpayne@69: CONST84 char *buf, int toWrite, int *errorCodePtr); jpayne@69: typedef int (Tcl_DriverSeekProc) (ClientData instanceData, long offset, jpayne@69: int mode, int *errorCodePtr); jpayne@69: typedef int (Tcl_DriverSetOptionProc) (ClientData instanceData, jpayne@69: Tcl_Interp *interp, const char *optionName, jpayne@69: const char *value); jpayne@69: typedef int (Tcl_DriverGetOptionProc) (ClientData instanceData, jpayne@69: Tcl_Interp *interp, CONST84 char *optionName, jpayne@69: Tcl_DString *dsPtr); jpayne@69: typedef void (Tcl_DriverWatchProc) (ClientData instanceData, int mask); jpayne@69: typedef int (Tcl_DriverGetHandleProc) (ClientData instanceData, jpayne@69: int direction, ClientData *handlePtr); jpayne@69: typedef int (Tcl_DriverFlushProc) (ClientData instanceData); jpayne@69: typedef int (Tcl_DriverHandlerProc) (ClientData instanceData, jpayne@69: int interestMask); jpayne@69: typedef Tcl_WideInt (Tcl_DriverWideSeekProc) (ClientData instanceData, jpayne@69: Tcl_WideInt offset, int mode, int *errorCodePtr); jpayne@69: /* jpayne@69: * TIP #218, Channel Thread Actions jpayne@69: */ jpayne@69: typedef void (Tcl_DriverThreadActionProc) (ClientData instanceData, jpayne@69: int action); jpayne@69: /* jpayne@69: * TIP #208, File Truncation (etc.) jpayne@69: */ jpayne@69: typedef int (Tcl_DriverTruncateProc) (ClientData instanceData, jpayne@69: Tcl_WideInt length); jpayne@69: jpayne@69: /* jpayne@69: * struct Tcl_ChannelType: jpayne@69: * jpayne@69: * One such structure exists for each type (kind) of channel. It collects jpayne@69: * together in one place all the functions that are part of the specific jpayne@69: * channel type. jpayne@69: * jpayne@69: * It is recommend that the Tcl_Channel* functions are used to access elements jpayne@69: * of this structure, instead of direct accessing. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tcl_ChannelType { jpayne@69: const char *typeName; /* The name of the channel type in Tcl jpayne@69: * commands. This storage is owned by channel jpayne@69: * type. */ jpayne@69: Tcl_ChannelTypeVersion version; jpayne@69: /* Version of the channel type. */ jpayne@69: Tcl_DriverCloseProc *closeProc; jpayne@69: /* Function to call to close the channel, or jpayne@69: * TCL_CLOSE2PROC if the close2Proc should be jpayne@69: * used instead. */ jpayne@69: Tcl_DriverInputProc *inputProc; jpayne@69: /* Function to call for input on channel. */ jpayne@69: Tcl_DriverOutputProc *outputProc; jpayne@69: /* Function to call for output on channel. */ jpayne@69: Tcl_DriverSeekProc *seekProc; jpayne@69: /* Function to call to seek on the channel. jpayne@69: * May be NULL. */ jpayne@69: Tcl_DriverSetOptionProc *setOptionProc; jpayne@69: /* Set an option on a channel. */ jpayne@69: Tcl_DriverGetOptionProc *getOptionProc; jpayne@69: /* Get an option from a channel. */ jpayne@69: Tcl_DriverWatchProc *watchProc; jpayne@69: /* Set up the notifier to watch for events on jpayne@69: * this channel. */ jpayne@69: Tcl_DriverGetHandleProc *getHandleProc; jpayne@69: /* Get an OS handle from the channel or NULL jpayne@69: * if not supported. */ jpayne@69: Tcl_DriverClose2Proc *close2Proc; jpayne@69: /* Function to call to close the channel if jpayne@69: * the device supports closing the read & jpayne@69: * write sides independently. */ jpayne@69: Tcl_DriverBlockModeProc *blockModeProc; jpayne@69: /* Set blocking mode for the raw channel. May jpayne@69: * be NULL. */ jpayne@69: /* jpayne@69: * Only valid in TCL_CHANNEL_VERSION_2 channels or later. jpayne@69: */ jpayne@69: Tcl_DriverFlushProc *flushProc; jpayne@69: /* Function to call to flush a channel. May be jpayne@69: * NULL. */ jpayne@69: Tcl_DriverHandlerProc *handlerProc; jpayne@69: /* Function to call to handle a channel event. jpayne@69: * This will be passed up the stacked channel jpayne@69: * chain. */ jpayne@69: /* jpayne@69: * Only valid in TCL_CHANNEL_VERSION_3 channels or later. jpayne@69: */ jpayne@69: Tcl_DriverWideSeekProc *wideSeekProc; jpayne@69: /* Function to call to seek on the channel jpayne@69: * which can handle 64-bit offsets. May be jpayne@69: * NULL, and must be NULL if seekProc is jpayne@69: * NULL. */ jpayne@69: /* jpayne@69: * Only valid in TCL_CHANNEL_VERSION_4 channels or later. jpayne@69: * TIP #218, Channel Thread Actions. jpayne@69: */ jpayne@69: Tcl_DriverThreadActionProc *threadActionProc; jpayne@69: /* Function to call to notify the driver of jpayne@69: * thread specific activity for a channel. May jpayne@69: * be NULL. */ jpayne@69: /* jpayne@69: * Only valid in TCL_CHANNEL_VERSION_5 channels or later. jpayne@69: * TIP #208, File Truncation. jpayne@69: */ jpayne@69: Tcl_DriverTruncateProc *truncateProc; jpayne@69: /* Function to call to truncate the underlying jpayne@69: * file to a particular length. May be NULL if jpayne@69: * the channel does not support truncation. */ jpayne@69: } Tcl_ChannelType; jpayne@69: jpayne@69: /* jpayne@69: * The following flags determine whether the blockModeProc above should set jpayne@69: * the channel into blocking or nonblocking mode. They are passed as arguments jpayne@69: * to the blockModeProc function in the above structure. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_MODE_BLOCKING 0 /* Put channel into blocking mode. */ jpayne@69: #define TCL_MODE_NONBLOCKING 1 /* Put channel into nonblocking jpayne@69: * mode. */ jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Enum for different types of file paths. jpayne@69: */ jpayne@69: jpayne@69: typedef enum Tcl_PathType { jpayne@69: TCL_PATH_ABSOLUTE, jpayne@69: TCL_PATH_RELATIVE, jpayne@69: TCL_PATH_VOLUME_RELATIVE jpayne@69: } Tcl_PathType; jpayne@69: jpayne@69: /* jpayne@69: * The following structure is used to pass glob type data amongst the various jpayne@69: * glob routines and Tcl_FSMatchInDirectory. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tcl_GlobTypeData { jpayne@69: int type; /* Corresponds to bcdpfls as in 'find -t'. */ jpayne@69: int perm; /* Corresponds to file permissions. */ jpayne@69: Tcl_Obj *macType; /* Acceptable Mac type. */ jpayne@69: Tcl_Obj *macCreator; /* Acceptable Mac creator. */ jpayne@69: } Tcl_GlobTypeData; jpayne@69: jpayne@69: /* jpayne@69: * Type and permission definitions for glob command. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_GLOB_TYPE_BLOCK (1<<0) jpayne@69: #define TCL_GLOB_TYPE_CHAR (1<<1) jpayne@69: #define TCL_GLOB_TYPE_DIR (1<<2) jpayne@69: #define TCL_GLOB_TYPE_PIPE (1<<3) jpayne@69: #define TCL_GLOB_TYPE_FILE (1<<4) jpayne@69: #define TCL_GLOB_TYPE_LINK (1<<5) jpayne@69: #define TCL_GLOB_TYPE_SOCK (1<<6) jpayne@69: #define TCL_GLOB_TYPE_MOUNT (1<<7) jpayne@69: jpayne@69: #define TCL_GLOB_PERM_RONLY (1<<0) jpayne@69: #define TCL_GLOB_PERM_HIDDEN (1<<1) jpayne@69: #define TCL_GLOB_PERM_R (1<<2) jpayne@69: #define TCL_GLOB_PERM_W (1<<3) jpayne@69: #define TCL_GLOB_PERM_X (1<<4) jpayne@69: jpayne@69: /* jpayne@69: * Flags for the unload callback function. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_UNLOAD_DETACH_FROM_INTERPRETER (1<<0) jpayne@69: #define TCL_UNLOAD_DETACH_FROM_PROCESS (1<<1) jpayne@69: jpayne@69: /* jpayne@69: * Typedefs for the various filesystem operations: jpayne@69: */ jpayne@69: jpayne@69: typedef int (Tcl_FSStatProc) (Tcl_Obj *pathPtr, Tcl_StatBuf *buf); jpayne@69: typedef int (Tcl_FSAccessProc) (Tcl_Obj *pathPtr, int mode); jpayne@69: typedef Tcl_Channel (Tcl_FSOpenFileChannelProc) (Tcl_Interp *interp, jpayne@69: Tcl_Obj *pathPtr, int mode, int permissions); jpayne@69: typedef int (Tcl_FSMatchInDirectoryProc) (Tcl_Interp *interp, Tcl_Obj *result, jpayne@69: Tcl_Obj *pathPtr, const char *pattern, Tcl_GlobTypeData *types); jpayne@69: typedef Tcl_Obj * (Tcl_FSGetCwdProc) (Tcl_Interp *interp); jpayne@69: typedef int (Tcl_FSChdirProc) (Tcl_Obj *pathPtr); jpayne@69: typedef int (Tcl_FSLstatProc) (Tcl_Obj *pathPtr, Tcl_StatBuf *buf); jpayne@69: typedef int (Tcl_FSCreateDirectoryProc) (Tcl_Obj *pathPtr); jpayne@69: typedef int (Tcl_FSDeleteFileProc) (Tcl_Obj *pathPtr); jpayne@69: typedef int (Tcl_FSCopyDirectoryProc) (Tcl_Obj *srcPathPtr, jpayne@69: Tcl_Obj *destPathPtr, Tcl_Obj **errorPtr); jpayne@69: typedef int (Tcl_FSCopyFileProc) (Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr); jpayne@69: typedef int (Tcl_FSRemoveDirectoryProc) (Tcl_Obj *pathPtr, int recursive, jpayne@69: Tcl_Obj **errorPtr); jpayne@69: typedef int (Tcl_FSRenameFileProc) (Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr); jpayne@69: typedef void (Tcl_FSUnloadFileProc) (Tcl_LoadHandle loadHandle); jpayne@69: typedef Tcl_Obj * (Tcl_FSListVolumesProc) (void); jpayne@69: /* We have to declare the utime structure here. */ jpayne@69: struct utimbuf; jpayne@69: typedef int (Tcl_FSUtimeProc) (Tcl_Obj *pathPtr, struct utimbuf *tval); jpayne@69: typedef int (Tcl_FSNormalizePathProc) (Tcl_Interp *interp, Tcl_Obj *pathPtr, jpayne@69: int nextCheckpoint); jpayne@69: typedef int (Tcl_FSFileAttrsGetProc) (Tcl_Interp *interp, int index, jpayne@69: Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef); jpayne@69: typedef const char *CONST86 * (Tcl_FSFileAttrStringsProc) (Tcl_Obj *pathPtr, jpayne@69: Tcl_Obj **objPtrRef); jpayne@69: typedef int (Tcl_FSFileAttrsSetProc) (Tcl_Interp *interp, int index, jpayne@69: Tcl_Obj *pathPtr, Tcl_Obj *objPtr); jpayne@69: typedef Tcl_Obj * (Tcl_FSLinkProc) (Tcl_Obj *pathPtr, Tcl_Obj *toPtr, jpayne@69: int linkType); jpayne@69: typedef int (Tcl_FSLoadFileProc) (Tcl_Interp *interp, Tcl_Obj *pathPtr, jpayne@69: Tcl_LoadHandle *handlePtr, Tcl_FSUnloadFileProc **unloadProcPtr); jpayne@69: typedef int (Tcl_FSPathInFilesystemProc) (Tcl_Obj *pathPtr, jpayne@69: ClientData *clientDataPtr); jpayne@69: typedef Tcl_Obj * (Tcl_FSFilesystemPathTypeProc) (Tcl_Obj *pathPtr); jpayne@69: typedef Tcl_Obj * (Tcl_FSFilesystemSeparatorProc) (Tcl_Obj *pathPtr); jpayne@69: typedef void (Tcl_FSFreeInternalRepProc) (ClientData clientData); jpayne@69: typedef ClientData (Tcl_FSDupInternalRepProc) (ClientData clientData); jpayne@69: typedef Tcl_Obj * (Tcl_FSInternalToNormalizedProc) (ClientData clientData); jpayne@69: typedef ClientData (Tcl_FSCreateInternalRepProc) (Tcl_Obj *pathPtr); jpayne@69: jpayne@69: typedef struct Tcl_FSVersion_ *Tcl_FSVersion; jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Data structures related to hooking into the filesystem jpayne@69: */ jpayne@69: jpayne@69: /* jpayne@69: * Filesystem version tag. This was introduced in 8.4. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_FILESYSTEM_VERSION_1 ((Tcl_FSVersion) 0x1) jpayne@69: jpayne@69: /* jpayne@69: * struct Tcl_Filesystem: jpayne@69: * jpayne@69: * One such structure exists for each type (kind) of filesystem. It collects jpayne@69: * together the functions that form the interface for a particulr the jpayne@69: * filesystem. Tcl always accesses the filesystem through one of these jpayne@69: * structures. jpayne@69: * jpayne@69: * Not all entries need be non-NULL; any which are NULL are simply ignored. jpayne@69: * However, a complete filesystem should provide all of these functions. The jpayne@69: * explanations in the structure show the importance of each function. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tcl_Filesystem { jpayne@69: const char *typeName; /* The name of the filesystem. */ jpayne@69: int structureLength; /* Length of this structure, so future binary jpayne@69: * compatibility can be assured. */ jpayne@69: Tcl_FSVersion version; /* Version of the filesystem type. */ jpayne@69: Tcl_FSPathInFilesystemProc *pathInFilesystemProc; jpayne@69: /* Determines whether the pathname is in this jpayne@69: * filesystem. This is the most important jpayne@69: * filesystem function. */ jpayne@69: Tcl_FSDupInternalRepProc *dupInternalRepProc; jpayne@69: /* Duplicates the internal handle of the node. jpayne@69: * If it is NULL, the filesystem is less jpayne@69: * performant. */ jpayne@69: Tcl_FSFreeInternalRepProc *freeInternalRepProc; jpayne@69: /* Frees the internal handle of the node. NULL jpayne@69: * only if there is no need to free resources jpayne@69: * used for the internal handle. */ jpayne@69: Tcl_FSInternalToNormalizedProc *internalToNormalizedProc; jpayne@69: /* Converts the internal handle to a normalized jpayne@69: * path. NULL if the filesystem creates nodes jpayne@69: * having no pathname. */ jpayne@69: Tcl_FSCreateInternalRepProc *createInternalRepProc; jpayne@69: /* Creates an internal handle for a pathname. jpayne@69: * May be NULL if pathnames have no internal jpayne@69: * handle or if pathInFilesystemProc always jpayne@69: * immediately creates an internal jpayne@69: * representation for pathnames in the jpayne@69: * filesystem. */ jpayne@69: Tcl_FSNormalizePathProc *normalizePathProc; jpayne@69: /* Normalizes a path. Should be implemented if jpayne@69: * the filesystems supports multiple paths to jpayne@69: * the same node. */ jpayne@69: Tcl_FSFilesystemPathTypeProc *filesystemPathTypeProc; jpayne@69: /* Determines the type of a path in this jpayne@69: * filesystem. May be NULL. */ jpayne@69: Tcl_FSFilesystemSeparatorProc *filesystemSeparatorProc; jpayne@69: /* Produces the separator character(s) for this jpayne@69: * filesystem. Must not be NULL. */ jpayne@69: Tcl_FSStatProc *statProc; /* Called by 'Tcl_FSStat()'. Provided by any jpayne@69: * reasonable filesystem. */ jpayne@69: Tcl_FSAccessProc *accessProc; jpayne@69: /* Called by 'Tcl_FSAccess()'. Implemented by jpayne@69: * any reasonable filesystem. */ jpayne@69: Tcl_FSOpenFileChannelProc *openFileChannelProc; jpayne@69: /* Called by 'Tcl_FSOpenFileChannel()'. jpayne@69: * Provided by any reasonable filesystem. */ jpayne@69: Tcl_FSMatchInDirectoryProc *matchInDirectoryProc; jpayne@69: /* Called by 'Tcl_FSMatchInDirectory()'. NULL jpayne@69: * if the filesystem does not support glob or jpayne@69: * recursive copy. */ jpayne@69: Tcl_FSUtimeProc *utimeProc; /* Called by 'Tcl_FSUtime()', by 'file jpayne@69: * mtime' to set (not read) times, 'file jpayne@69: * atime', and the open-r/open-w/fcopy variant jpayne@69: * of 'file copy'. */ jpayne@69: Tcl_FSLinkProc *linkProc; /* Called by 'Tcl_FSLink()'. NULL if reading or jpayne@69: * creating links is not supported. */ jpayne@69: Tcl_FSListVolumesProc *listVolumesProc; jpayne@69: /* Lists filesystem volumes added by this jpayne@69: * filesystem. NULL if the filesystem does not jpayne@69: * use volumes. */ jpayne@69: Tcl_FSFileAttrStringsProc *fileAttrStringsProc; jpayne@69: /* List all valid attributes strings. NULL if jpayne@69: * the filesystem does not support the 'file jpayne@69: * attributes' command. Can be used to attach jpayne@69: * arbitrary additional data to files in a jpayne@69: * filesystem. */ jpayne@69: Tcl_FSFileAttrsGetProc *fileAttrsGetProc; jpayne@69: /* Called by 'Tcl_FSFileAttrsGet()' and by jpayne@69: * 'file attributes'. */ jpayne@69: Tcl_FSFileAttrsSetProc *fileAttrsSetProc; jpayne@69: /* Called by 'Tcl_FSFileAttrsSet()' and by jpayne@69: * 'file attributes'. */ jpayne@69: Tcl_FSCreateDirectoryProc *createDirectoryProc; jpayne@69: /* Called by 'Tcl_FSCreateDirectory()'. May be jpayne@69: * NULL if the filesystem is read-only. */ jpayne@69: Tcl_FSRemoveDirectoryProc *removeDirectoryProc; jpayne@69: /* Called by 'Tcl_FSRemoveDirectory()'. May be jpayne@69: * NULL if the filesystem is read-only. */ jpayne@69: Tcl_FSDeleteFileProc *deleteFileProc; jpayne@69: /* Called by 'Tcl_FSDeleteFile()' May be NULL jpayne@69: * if the filesystem is is read-only. */ jpayne@69: Tcl_FSCopyFileProc *copyFileProc; jpayne@69: /* Called by 'Tcl_FSCopyFile()'. If NULL, for jpayne@69: * a copy operation at the script level (not jpayne@69: * C) Tcl uses open-r, open-w and fcopy. */ jpayne@69: Tcl_FSRenameFileProc *renameFileProc; jpayne@69: /* Called by 'Tcl_FSRenameFile()'. If NULL, for jpayne@69: * a rename operation at the script level (not jpayne@69: * C) Tcl performs a copy operation followed jpayne@69: * by a delete operation. */ jpayne@69: Tcl_FSCopyDirectoryProc *copyDirectoryProc; jpayne@69: /* Called by 'Tcl_FSCopyDirectory()'. If NULL, jpayne@69: * for a copy operation at the script level jpayne@69: * (not C) Tcl recursively creates directories jpayne@69: * and copies files. */ jpayne@69: Tcl_FSLstatProc *lstatProc; /* Called by 'Tcl_FSLstat()'. If NULL, Tcl jpayne@69: * attempts to use 'statProc' instead. */ jpayne@69: Tcl_FSLoadFileProc *loadFileProc; jpayne@69: /* Called by 'Tcl_FSLoadFile()'. If NULL, Tcl jpayne@69: * performs a copy to a temporary file in the jpayne@69: * native filesystem and then calls jpayne@69: * Tcl_FSLoadFile() on that temporary copy. */ jpayne@69: Tcl_FSGetCwdProc *getCwdProc; jpayne@69: /* Called by 'Tcl_FSGetCwd()'. Normally NULL. jpayne@69: * Usually only called once: If 'getcwd' is jpayne@69: * called before 'chdir' is ever called. */ jpayne@69: Tcl_FSChdirProc *chdirProc; /* Called by 'Tcl_FSChdir()'. For a virtual jpayne@69: * filesystem, chdirProc just returns zero jpayne@69: * (success) if the pathname is a valid jpayne@69: * directory, and some other value otherwise. jpayne@69: * For A real filesystem, chdirProc performs jpayne@69: * the correct action, e.g. calls the system jpayne@69: * 'chdir' function. If not implemented, then jpayne@69: * 'cd' and 'pwd' fail for a pathname in this jpayne@69: * filesystem. On success Tcl stores the jpayne@69: * pathname for use by GetCwd. If NULL, Tcl jpayne@69: * performs records the pathname as the new jpayne@69: * current directory if it passes a series of jpayne@69: * directory access checks. */ jpayne@69: } Tcl_Filesystem; jpayne@69: jpayne@69: /* jpayne@69: * The following definitions are used as values for the 'linkAction' flag to jpayne@69: * Tcl_FSLink, or the linkProc of any filesystem. Any combination of flags can jpayne@69: * be given. For link creation, the linkProc should create a link which jpayne@69: * matches any of the types given. jpayne@69: * jpayne@69: * TCL_CREATE_SYMBOLIC_LINK - Create a symbolic or soft link. jpayne@69: * TCL_CREATE_HARD_LINK - Create a hard link. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_CREATE_SYMBOLIC_LINK 0x01 jpayne@69: #define TCL_CREATE_HARD_LINK 0x02 jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * The following structure represents the Notifier functions that you can jpayne@69: * override with the Tcl_SetNotifier call. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tcl_NotifierProcs { jpayne@69: Tcl_SetTimerProc *setTimerProc; jpayne@69: Tcl_WaitForEventProc *waitForEventProc; jpayne@69: Tcl_CreateFileHandlerProc *createFileHandlerProc; jpayne@69: Tcl_DeleteFileHandlerProc *deleteFileHandlerProc; jpayne@69: Tcl_InitNotifierProc *initNotifierProc; jpayne@69: Tcl_FinalizeNotifierProc *finalizeNotifierProc; jpayne@69: Tcl_AlertNotifierProc *alertNotifierProc; jpayne@69: Tcl_ServiceModeHookProc *serviceModeHookProc; jpayne@69: } Tcl_NotifierProcs; jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * The following data structures and declarations are for the new Tcl parser. jpayne@69: * jpayne@69: * For each word of a command, and for each piece of a word such as a variable jpayne@69: * reference, one of the following structures is created to describe the jpayne@69: * token. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tcl_Token { jpayne@69: int type; /* Type of token, such as TCL_TOKEN_WORD; see jpayne@69: * below for valid types. */ jpayne@69: const char *start; /* First character in token. */ jpayne@69: int size; /* Number of bytes in token. */ jpayne@69: int numComponents; /* If this token is composed of other tokens, jpayne@69: * this field tells how many of them there are jpayne@69: * (including components of components, etc.). jpayne@69: * The component tokens immediately follow jpayne@69: * this one. */ jpayne@69: } Tcl_Token; jpayne@69: jpayne@69: /* jpayne@69: * Type values defined for Tcl_Token structures. These values are defined as jpayne@69: * mask bits so that it's easy to check for collections of types. jpayne@69: * jpayne@69: * TCL_TOKEN_WORD - The token describes one word of a command, jpayne@69: * from the first non-blank character of the word jpayne@69: * (which may be " or {) up to but not including jpayne@69: * the space, semicolon, or bracket that jpayne@69: * terminates the word. NumComponents counts the jpayne@69: * total number of sub-tokens that make up the jpayne@69: * word. This includes, for example, sub-tokens jpayne@69: * of TCL_TOKEN_VARIABLE tokens. jpayne@69: * TCL_TOKEN_SIMPLE_WORD - This token is just like TCL_TOKEN_WORD except jpayne@69: * that the word is guaranteed to consist of a jpayne@69: * single TCL_TOKEN_TEXT sub-token. jpayne@69: * TCL_TOKEN_TEXT - The token describes a range of literal text jpayne@69: * that is part of a word. NumComponents is jpayne@69: * always 0. jpayne@69: * TCL_TOKEN_BS - The token describes a backslash sequence that jpayne@69: * must be collapsed. NumComponents is always 0. jpayne@69: * TCL_TOKEN_COMMAND - The token describes a command whose result jpayne@69: * must be substituted into the word. The token jpayne@69: * includes the enclosing brackets. NumComponents jpayne@69: * is always 0. jpayne@69: * TCL_TOKEN_VARIABLE - The token describes a variable substitution, jpayne@69: * including the dollar sign, variable name, and jpayne@69: * array index (if there is one) up through the jpayne@69: * right parentheses. NumComponents tells how jpayne@69: * many additional tokens follow to represent the jpayne@69: * variable name. The first token will be a jpayne@69: * TCL_TOKEN_TEXT token that describes the jpayne@69: * variable name. If the variable is an array jpayne@69: * reference then there will be one or more jpayne@69: * additional tokens, of type TCL_TOKEN_TEXT, jpayne@69: * TCL_TOKEN_BS, TCL_TOKEN_COMMAND, and jpayne@69: * TCL_TOKEN_VARIABLE, that describe the array jpayne@69: * index; numComponents counts the total number jpayne@69: * of nested tokens that make up the variable jpayne@69: * reference, including sub-tokens of jpayne@69: * TCL_TOKEN_VARIABLE tokens. jpayne@69: * TCL_TOKEN_SUB_EXPR - The token describes one subexpression of an jpayne@69: * expression, from the first non-blank character jpayne@69: * of the subexpression up to but not including jpayne@69: * the space, brace, or bracket that terminates jpayne@69: * the subexpression. NumComponents counts the jpayne@69: * total number of following subtokens that make jpayne@69: * up the subexpression; this includes all jpayne@69: * subtokens for any nested TCL_TOKEN_SUB_EXPR jpayne@69: * tokens. For example, a numeric value used as a jpayne@69: * primitive operand is described by a jpayne@69: * TCL_TOKEN_SUB_EXPR token followed by a jpayne@69: * TCL_TOKEN_TEXT token. A binary subexpression jpayne@69: * is described by a TCL_TOKEN_SUB_EXPR token jpayne@69: * followed by the TCL_TOKEN_OPERATOR token for jpayne@69: * the operator, then TCL_TOKEN_SUB_EXPR tokens jpayne@69: * for the left then the right operands. jpayne@69: * TCL_TOKEN_OPERATOR - The token describes one expression operator. jpayne@69: * An operator might be the name of a math jpayne@69: * function such as "abs". A TCL_TOKEN_OPERATOR jpayne@69: * token is always preceded by one jpayne@69: * TCL_TOKEN_SUB_EXPR token for the operator's jpayne@69: * subexpression, and is followed by zero or more jpayne@69: * TCL_TOKEN_SUB_EXPR tokens for the operator's jpayne@69: * operands. NumComponents is always 0. jpayne@69: * TCL_TOKEN_EXPAND_WORD - This token is just like TCL_TOKEN_WORD except jpayne@69: * that it marks a word that began with the jpayne@69: * literal character prefix "{*}". This word is jpayne@69: * marked to be expanded - that is, broken into jpayne@69: * words after substitution is complete. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_TOKEN_WORD 1 jpayne@69: #define TCL_TOKEN_SIMPLE_WORD 2 jpayne@69: #define TCL_TOKEN_TEXT 4 jpayne@69: #define TCL_TOKEN_BS 8 jpayne@69: #define TCL_TOKEN_COMMAND 16 jpayne@69: #define TCL_TOKEN_VARIABLE 32 jpayne@69: #define TCL_TOKEN_SUB_EXPR 64 jpayne@69: #define TCL_TOKEN_OPERATOR 128 jpayne@69: #define TCL_TOKEN_EXPAND_WORD 256 jpayne@69: jpayne@69: /* jpayne@69: * Parsing error types. On any parsing error, one of these values will be jpayne@69: * stored in the error field of the Tcl_Parse structure defined below. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_PARSE_SUCCESS 0 jpayne@69: #define TCL_PARSE_QUOTE_EXTRA 1 jpayne@69: #define TCL_PARSE_BRACE_EXTRA 2 jpayne@69: #define TCL_PARSE_MISSING_BRACE 3 jpayne@69: #define TCL_PARSE_MISSING_BRACKET 4 jpayne@69: #define TCL_PARSE_MISSING_PAREN 5 jpayne@69: #define TCL_PARSE_MISSING_QUOTE 6 jpayne@69: #define TCL_PARSE_MISSING_VAR_BRACE 7 jpayne@69: #define TCL_PARSE_SYNTAX 8 jpayne@69: #define TCL_PARSE_BAD_NUMBER 9 jpayne@69: jpayne@69: /* jpayne@69: * A structure of the following type is filled in by Tcl_ParseCommand. It jpayne@69: * describes a single command parsed from an input string. jpayne@69: */ jpayne@69: jpayne@69: #define NUM_STATIC_TOKENS 20 jpayne@69: jpayne@69: typedef struct Tcl_Parse { jpayne@69: const char *commentStart; /* Pointer to # that begins the first of one jpayne@69: * or more comments preceding the command. */ jpayne@69: int commentSize; /* Number of bytes in comments (up through jpayne@69: * newline character that terminates the last jpayne@69: * comment). If there were no comments, this jpayne@69: * field is 0. */ jpayne@69: const char *commandStart; /* First character in first word of jpayne@69: * command. */ jpayne@69: int commandSize; /* Number of bytes in command, including first jpayne@69: * character of first word, up through the jpayne@69: * terminating newline, close bracket, or jpayne@69: * semicolon. */ jpayne@69: int numWords; /* Total number of words in command. May be jpayne@69: * 0. */ jpayne@69: Tcl_Token *tokenPtr; /* Pointer to first token representing the jpayne@69: * words of the command. Initially points to jpayne@69: * staticTokens, but may change to point to jpayne@69: * malloc-ed space if command exceeds space in jpayne@69: * staticTokens. */ jpayne@69: int numTokens; /* Total number of tokens in command. */ jpayne@69: int tokensAvailable; /* Total number of tokens available at jpayne@69: * *tokenPtr. */ jpayne@69: int errorType; /* One of the parsing error types defined jpayne@69: * above. */ jpayne@69: jpayne@69: /* jpayne@69: * The fields below are intended only for the private use of the parser. jpayne@69: * They should not be used by functions that invoke Tcl_ParseCommand. jpayne@69: */ jpayne@69: jpayne@69: const char *string; /* The original command string passed to jpayne@69: * Tcl_ParseCommand. */ jpayne@69: const char *end; /* Points to the character just after the last jpayne@69: * one in the command string. */ jpayne@69: Tcl_Interp *interp; /* Interpreter to use for error reporting, or jpayne@69: * NULL. */ jpayne@69: const char *term; /* Points to character in string that jpayne@69: * terminated most recent token. Filled in by jpayne@69: * ParseTokens. If an error occurs, points to jpayne@69: * beginning of region where the error jpayne@69: * occurred (e.g. the open brace if the close jpayne@69: * brace is missing). */ jpayne@69: int incomplete; /* This field is set to 1 by Tcl_ParseCommand jpayne@69: * if the command appears to be incomplete. jpayne@69: * This information is used by jpayne@69: * Tcl_CommandComplete. */ jpayne@69: Tcl_Token staticTokens[NUM_STATIC_TOKENS]; jpayne@69: /* Initial space for tokens for command. This jpayne@69: * space should be large enough to accommodate jpayne@69: * most commands; dynamic space is allocated jpayne@69: * for very large commands that don't fit jpayne@69: * here. */ jpayne@69: } Tcl_Parse; jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * The following structure represents a user-defined encoding. It collects jpayne@69: * together all the functions that are used by the specific encoding. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tcl_EncodingType { jpayne@69: const char *encodingName; /* The name of the encoding, e.g. "euc-jp". jpayne@69: * This name is the unique key for this jpayne@69: * encoding type. */ jpayne@69: Tcl_EncodingConvertProc *toUtfProc; jpayne@69: /* Function to convert from external encoding jpayne@69: * into UTF-8. */ jpayne@69: Tcl_EncodingConvertProc *fromUtfProc; jpayne@69: /* Function to convert from UTF-8 into jpayne@69: * external encoding. */ jpayne@69: Tcl_EncodingFreeProc *freeProc; jpayne@69: /* If non-NULL, function to call when this jpayne@69: * encoding is deleted. */ jpayne@69: ClientData clientData; /* Arbitrary value associated with encoding jpayne@69: * type. Passed to conversion functions. */ jpayne@69: int nullSize; /* Number of zero bytes that signify jpayne@69: * end-of-string in this encoding. This number jpayne@69: * is used to determine the source string jpayne@69: * length when the srcLen argument is jpayne@69: * negative. Must be 1 or 2. */ jpayne@69: } Tcl_EncodingType; jpayne@69: jpayne@69: /* jpayne@69: * The following definitions are used as values for the conversion control jpayne@69: * flags argument when converting text from one character set to another: jpayne@69: * jpayne@69: * TCL_ENCODING_START - Signifies that the source buffer is the first jpayne@69: * block in a (potentially multi-block) input jpayne@69: * stream. Tells the conversion function to reset jpayne@69: * to an initial state and perform any jpayne@69: * initialization that needs to occur before the jpayne@69: * first byte is converted. If the source buffer jpayne@69: * contains the entire input stream to be jpayne@69: * converted, this flag should be set. jpayne@69: * TCL_ENCODING_END - Signifies that the source buffer is the last jpayne@69: * block in a (potentially multi-block) input jpayne@69: * stream. Tells the conversion routine to jpayne@69: * perform any finalization that needs to occur jpayne@69: * after the last byte is converted and then to jpayne@69: * reset to an initial state. If the source jpayne@69: * buffer contains the entire input stream to be jpayne@69: * converted, this flag should be set. jpayne@69: * TCL_ENCODING_STOPONERROR - If set, the converter returns immediately upon jpayne@69: * encountering an invalid byte sequence or a jpayne@69: * source character that has no mapping in the jpayne@69: * target encoding. If clear, the converter jpayne@69: * substitues the problematic character(s) with jpayne@69: * one or more "close" characters in the jpayne@69: * destination buffer and then continues to jpayne@69: * convert the source. jpayne@69: * TCL_ENCODING_NO_TERMINATE - If set, Tcl_ExternalToUtf does not append a jpayne@69: * terminating NUL byte. Since it does not need jpayne@69: * an extra byte for a terminating NUL, it fills jpayne@69: * all dstLen bytes with encoded UTF-8 content if jpayne@69: * needed. If clear, a byte is reserved in the jpayne@69: * dst space for NUL termination, and a jpayne@69: * terminating NUL is appended. jpayne@69: * TCL_ENCODING_CHAR_LIMIT - If set and dstCharsPtr is not NULL, then jpayne@69: * Tcl_ExternalToUtf takes the initial value of jpayne@69: * *dstCharsPtr as a limit of the maximum number jpayne@69: * of chars to produce in the encoded UTF-8 jpayne@69: * content. Otherwise, the number of chars jpayne@69: * produced is controlled only by other limiting jpayne@69: * factors. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_ENCODING_START 0x01 jpayne@69: #define TCL_ENCODING_END 0x02 jpayne@69: #define TCL_ENCODING_STOPONERROR 0x04 jpayne@69: #define TCL_ENCODING_NO_TERMINATE 0x08 jpayne@69: #define TCL_ENCODING_CHAR_LIMIT 0x10 jpayne@69: jpayne@69: /* jpayne@69: * The following definitions are the error codes returned by the conversion jpayne@69: * routines: jpayne@69: * jpayne@69: * TCL_OK - All characters were converted. jpayne@69: * TCL_CONVERT_NOSPACE - The output buffer would not have been large jpayne@69: * enough for all of the converted data; as many jpayne@69: * characters as could fit were converted though. jpayne@69: * TCL_CONVERT_MULTIBYTE - The last few bytes in the source string were jpayne@69: * the beginning of a multibyte sequence, but jpayne@69: * more bytes were needed to complete this jpayne@69: * sequence. A subsequent call to the conversion jpayne@69: * routine should pass the beginning of this jpayne@69: * unconverted sequence plus additional bytes jpayne@69: * from the source stream to properly convert the jpayne@69: * formerly split-up multibyte sequence. jpayne@69: * TCL_CONVERT_SYNTAX - The source stream contained an invalid jpayne@69: * character sequence. This may occur if the jpayne@69: * input stream has been damaged or if the input jpayne@69: * encoding method was misidentified. This error jpayne@69: * is reported only if TCL_ENCODING_STOPONERROR jpayne@69: * was specified. jpayne@69: * TCL_CONVERT_UNKNOWN - The source string contained a character that jpayne@69: * could not be represented in the target jpayne@69: * encoding. This error is reported only if jpayne@69: * TCL_ENCODING_STOPONERROR was specified. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_CONVERT_MULTIBYTE (-1) jpayne@69: #define TCL_CONVERT_SYNTAX (-2) jpayne@69: #define TCL_CONVERT_UNKNOWN (-3) jpayne@69: #define TCL_CONVERT_NOSPACE (-4) jpayne@69: jpayne@69: /* jpayne@69: * The maximum number of bytes that are necessary to represent a single jpayne@69: * Unicode character in UTF-8. The valid values should be 3, 4 or 6 jpayne@69: * (or perhaps 1 if we want to support a non-unicode enabled core). If 3 or jpayne@69: * 4, then Tcl_UniChar must be 2-bytes in size (UCS-2) (the default). If 6, jpayne@69: * then Tcl_UniChar must be 4-bytes in size (UCS-4). At this time UCS-2 mode jpayne@69: * is the default and recommended mode. UCS-4 is experimental and not jpayne@69: * recommended. It works for the core, but most extensions expect UCS-2. jpayne@69: */ jpayne@69: jpayne@69: #ifndef TCL_UTF_MAX jpayne@69: #define TCL_UTF_MAX 3 jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * This represents a Unicode character. Any changes to this should also be jpayne@69: * reflected in regcustom.h. jpayne@69: */ jpayne@69: jpayne@69: #if TCL_UTF_MAX > 4 jpayne@69: /* jpayne@69: * unsigned int isn't 100% accurate as it should be a strict 4-byte value. jpayne@69: * The size of this value must be reflected correctly in regcustom.h. jpayne@69: * XXX: Tcl is currently UCS-2 and planning UTF-16 for the Unicode jpayne@69: * XXX: string rep that Tcl_UniChar represents. Changing the size jpayne@69: * XXX: of Tcl_UniChar is /not/ supported. jpayne@69: */ jpayne@69: typedef unsigned int Tcl_UniChar; jpayne@69: #else jpayne@69: typedef unsigned short Tcl_UniChar; jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * TIP #59: The following structure is used in calls 'Tcl_RegisterConfig' to jpayne@69: * provide the system with the embedded configuration data. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tcl_Config { jpayne@69: const char *key; /* Configuration key to register. ASCII jpayne@69: * encoded, thus UTF-8. */ jpayne@69: const char *value; /* The value associated with the key. System jpayne@69: * encoding. */ jpayne@69: } Tcl_Config; jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Flags for TIP#143 limits, detailing which limits are active in an jpayne@69: * interpreter. Used for Tcl_{Add,Remove}LimitHandler type argument. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_LIMIT_COMMANDS 0x01 jpayne@69: #define TCL_LIMIT_TIME 0x02 jpayne@69: jpayne@69: /* jpayne@69: * Structure containing information about a limit handler to be called when a jpayne@69: * command- or time-limit is exceeded by an interpreter. jpayne@69: */ jpayne@69: jpayne@69: typedef void (Tcl_LimitHandlerProc) (ClientData clientData, Tcl_Interp *interp); jpayne@69: typedef void (Tcl_LimitHandlerDeleteProc) (ClientData clientData); jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Override definitions for libtommath. jpayne@69: */ jpayne@69: jpayne@69: typedef struct mp_int mp_int; jpayne@69: #define MP_INT_DECLARED jpayne@69: typedef unsigned int mp_digit; jpayne@69: #define MP_DIGIT_DECLARED jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Definitions needed for Tcl_ParseArgvObj routines. jpayne@69: * Based on tkArgv.c. jpayne@69: * Modifications from the original are copyright (c) Sam Bromley 2006 jpayne@69: */ jpayne@69: jpayne@69: typedef struct { jpayne@69: int type; /* Indicates the option type; see below. */ jpayne@69: const char *keyStr; /* The key string that flags the option in the jpayne@69: * argv array. */ jpayne@69: void *srcPtr; /* Value to be used in setting dst; usage jpayne@69: * depends on type.*/ jpayne@69: void *dstPtr; /* Address of value to be modified; usage jpayne@69: * depends on type.*/ jpayne@69: const char *helpStr; /* Documentation message describing this jpayne@69: * option. */ jpayne@69: ClientData clientData; /* Word to pass to function callbacks. */ jpayne@69: } Tcl_ArgvInfo; jpayne@69: jpayne@69: /* jpayne@69: * Legal values for the type field of a Tcl_ArgInfo: see the user jpayne@69: * documentation for details. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_ARGV_CONSTANT 15 jpayne@69: #define TCL_ARGV_INT 16 jpayne@69: #define TCL_ARGV_STRING 17 jpayne@69: #define TCL_ARGV_REST 18 jpayne@69: #define TCL_ARGV_FLOAT 19 jpayne@69: #define TCL_ARGV_FUNC 20 jpayne@69: #define TCL_ARGV_GENFUNC 21 jpayne@69: #define TCL_ARGV_HELP 22 jpayne@69: #define TCL_ARGV_END 23 jpayne@69: jpayne@69: /* jpayne@69: * Types of callback functions for the TCL_ARGV_FUNC and TCL_ARGV_GENFUNC jpayne@69: * argument types: jpayne@69: */ jpayne@69: jpayne@69: typedef int (Tcl_ArgvFuncProc)(ClientData clientData, Tcl_Obj *objPtr, jpayne@69: void *dstPtr); jpayne@69: typedef int (Tcl_ArgvGenFuncProc)(ClientData clientData, Tcl_Interp *interp, jpayne@69: int objc, Tcl_Obj *const *objv, void *dstPtr); jpayne@69: jpayne@69: /* jpayne@69: * Shorthand for commonly used argTable entries. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_ARGV_AUTO_HELP \ jpayne@69: {TCL_ARGV_HELP, "-help", NULL, NULL, \ jpayne@69: "Print summary of command-line options and abort", NULL} jpayne@69: #define TCL_ARGV_AUTO_REST \ jpayne@69: {TCL_ARGV_REST, "--", NULL, NULL, \ jpayne@69: "Marks the end of the options", NULL} jpayne@69: #define TCL_ARGV_TABLE_END \ jpayne@69: {TCL_ARGV_END, NULL, NULL, NULL, NULL, NULL} jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Definitions needed for Tcl_Zlib routines. [TIP #234] jpayne@69: * jpayne@69: * Constants for the format flags describing what sort of data format is jpayne@69: * desired/expected for the Tcl_ZlibDeflate, Tcl_ZlibInflate and jpayne@69: * Tcl_ZlibStreamInit functions. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_ZLIB_FORMAT_RAW 1 jpayne@69: #define TCL_ZLIB_FORMAT_ZLIB 2 jpayne@69: #define TCL_ZLIB_FORMAT_GZIP 4 jpayne@69: #define TCL_ZLIB_FORMAT_AUTO 8 jpayne@69: jpayne@69: /* jpayne@69: * Constants that describe whether the stream is to operate in compressing or jpayne@69: * decompressing mode. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_ZLIB_STREAM_DEFLATE 16 jpayne@69: #define TCL_ZLIB_STREAM_INFLATE 32 jpayne@69: jpayne@69: /* jpayne@69: * Constants giving compression levels. Use of TCL_ZLIB_COMPRESS_DEFAULT is jpayne@69: * recommended. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_ZLIB_COMPRESS_NONE 0 jpayne@69: #define TCL_ZLIB_COMPRESS_FAST 1 jpayne@69: #define TCL_ZLIB_COMPRESS_BEST 9 jpayne@69: #define TCL_ZLIB_COMPRESS_DEFAULT (-1) jpayne@69: jpayne@69: /* jpayne@69: * Constants for types of flushing, used with Tcl_ZlibFlush. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_ZLIB_NO_FLUSH 0 jpayne@69: #define TCL_ZLIB_FLUSH 2 jpayne@69: #define TCL_ZLIB_FULLFLUSH 3 jpayne@69: #define TCL_ZLIB_FINALIZE 4 jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Definitions needed for the Tcl_LoadFile function. [TIP #416] jpayne@69: */ jpayne@69: jpayne@69: #define TCL_LOAD_GLOBAL 1 jpayne@69: #define TCL_LOAD_LAZY 2 jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Single public declaration for NRE. jpayne@69: */ jpayne@69: jpayne@69: typedef int (Tcl_NRPostProc) (ClientData data[], Tcl_Interp *interp, jpayne@69: int result); jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * The following constant is used to test for older versions of Tcl in the jpayne@69: * stubs tables. jpayne@69: */ jpayne@69: jpayne@69: #define TCL_STUB_MAGIC ((int) 0xFCA3BACF) jpayne@69: jpayne@69: /* jpayne@69: * The following function is required to be defined in all stubs aware jpayne@69: * extensions. The function is actually implemented in the stub library, not jpayne@69: * the main Tcl library, although there is a trivial implementation in the jpayne@69: * main library in case an extension is statically linked into an application. jpayne@69: */ jpayne@69: jpayne@69: const char * Tcl_InitStubs(Tcl_Interp *interp, const char *version, jpayne@69: int exact); jpayne@69: const char * TclTomMathInitializeStubs(Tcl_Interp *interp, jpayne@69: const char *version, int epoch, int revision); jpayne@69: jpayne@69: /* jpayne@69: * When not using stubs, make it a macro. jpayne@69: */ jpayne@69: jpayne@69: #ifndef USE_TCL_STUBS jpayne@69: #define Tcl_InitStubs(interp, version, exact) \ jpayne@69: Tcl_PkgInitStubsCheck(interp, version, exact) jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Public functions that are not accessible via the stubs table. jpayne@69: * Tcl_GetMemoryInfo is needed for AOLserver. [Bug 1868171] jpayne@69: */ jpayne@69: jpayne@69: #define Tcl_Main(argc, argv, proc) Tcl_MainEx(argc, argv, proc, \ jpayne@69: ((Tcl_CreateInterp)())) jpayne@69: EXTERN void Tcl_MainEx(int argc, char **argv, jpayne@69: Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); jpayne@69: EXTERN const char * Tcl_PkgInitStubsCheck(Tcl_Interp *interp, jpayne@69: const char *version, int exact); jpayne@69: EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr); jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Include the public function declarations that are accessible via the stubs jpayne@69: * table. jpayne@69: */ jpayne@69: jpayne@69: #include "tclDecls.h" jpayne@69: jpayne@69: /* jpayne@69: * Include platform specific public function declarations that are accessible jpayne@69: * via the stubs table. Make all TclOO symbols MODULE_SCOPE (which only jpayne@69: * has effect on building it as a shared library). See ticket [3010352]. jpayne@69: */ jpayne@69: jpayne@69: #if defined(BUILD_tcl) jpayne@69: # undef TCLAPI jpayne@69: # define TCLAPI MODULE_SCOPE jpayne@69: #endif jpayne@69: jpayne@69: #include "tclPlatDecls.h" jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * The following declarations either map ckalloc and ckfree to malloc and jpayne@69: * free, or they map them to functions with all sorts of debugging hooks jpayne@69: * defined in tclCkalloc.c. jpayne@69: */ jpayne@69: jpayne@69: #ifdef TCL_MEM_DEBUG jpayne@69: jpayne@69: # define ckalloc(x) \ jpayne@69: ((void *) Tcl_DbCkalloc((unsigned)(x), __FILE__, __LINE__)) jpayne@69: # define ckfree(x) \ jpayne@69: Tcl_DbCkfree((char *)(x), __FILE__, __LINE__) jpayne@69: # define ckrealloc(x,y) \ jpayne@69: ((void *) Tcl_DbCkrealloc((char *)(x), (unsigned)(y), __FILE__, __LINE__)) jpayne@69: # define attemptckalloc(x) \ jpayne@69: ((void *) Tcl_AttemptDbCkalloc((unsigned)(x), __FILE__, __LINE__)) jpayne@69: # define attemptckrealloc(x,y) \ jpayne@69: ((void *) Tcl_AttemptDbCkrealloc((char *)(x), (unsigned)(y), __FILE__, __LINE__)) jpayne@69: jpayne@69: #else /* !TCL_MEM_DEBUG */ jpayne@69: jpayne@69: /* jpayne@69: * If we are not using the debugging allocator, we should call the Tcl_Alloc, jpayne@69: * et al. routines in order to guarantee that every module is using the same jpayne@69: * memory allocator both inside and outside of the Tcl library. jpayne@69: */ jpayne@69: jpayne@69: # define ckalloc(x) \ jpayne@69: ((void *) Tcl_Alloc((unsigned)(x))) jpayne@69: # define ckfree(x) \ jpayne@69: Tcl_Free((char *)(x)) jpayne@69: # define ckrealloc(x,y) \ jpayne@69: ((void *) Tcl_Realloc((char *)(x), (unsigned)(y))) jpayne@69: # define attemptckalloc(x) \ jpayne@69: ((void *) Tcl_AttemptAlloc((unsigned)(x))) jpayne@69: # define attemptckrealloc(x,y) \ jpayne@69: ((void *) Tcl_AttemptRealloc((char *)(x), (unsigned)(y))) jpayne@69: # undef Tcl_InitMemory jpayne@69: # define Tcl_InitMemory(x) jpayne@69: # undef Tcl_DumpActiveMemory jpayne@69: # define Tcl_DumpActiveMemory(x) jpayne@69: # undef Tcl_ValidateAllMemory jpayne@69: # define Tcl_ValidateAllMemory(x,y) jpayne@69: jpayne@69: #endif /* !TCL_MEM_DEBUG */ jpayne@69: jpayne@69: #ifdef TCL_MEM_DEBUG jpayne@69: # define Tcl_IncrRefCount(objPtr) \ jpayne@69: Tcl_DbIncrRefCount(objPtr, __FILE__, __LINE__) jpayne@69: # define Tcl_DecrRefCount(objPtr) \ jpayne@69: Tcl_DbDecrRefCount(objPtr, __FILE__, __LINE__) jpayne@69: # define Tcl_IsShared(objPtr) \ jpayne@69: Tcl_DbIsShared(objPtr, __FILE__, __LINE__) jpayne@69: #else jpayne@69: # define Tcl_IncrRefCount(objPtr) \ jpayne@69: ++(objPtr)->refCount jpayne@69: /* jpayne@69: * Use do/while0 idiom for optimum correctness without compiler warnings. jpayne@69: * https://wiki.c2.com/?TrivialDoWhileLoop jpayne@69: */ jpayne@69: # define Tcl_DecrRefCount(objPtr) \ jpayne@69: do { \ jpayne@69: Tcl_Obj *_objPtr = (objPtr); \ jpayne@69: if (_objPtr->refCount-- <= 1) { \ jpayne@69: TclFreeObj(_objPtr); \ jpayne@69: } \ jpayne@69: } while(0) jpayne@69: # define Tcl_IsShared(objPtr) \ jpayne@69: ((objPtr)->refCount > 1) jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Macros and definitions that help to debug the use of Tcl objects. When jpayne@69: * TCL_MEM_DEBUG is defined, the Tcl_New declarations are overridden to call jpayne@69: * debugging versions of the object creation functions. jpayne@69: */ jpayne@69: jpayne@69: #ifdef TCL_MEM_DEBUG jpayne@69: # undef Tcl_NewBignumObj jpayne@69: # define Tcl_NewBignumObj(val) \ jpayne@69: Tcl_DbNewBignumObj(val, __FILE__, __LINE__) jpayne@69: # undef Tcl_NewBooleanObj jpayne@69: # define Tcl_NewBooleanObj(val) \ jpayne@69: Tcl_DbNewBooleanObj(val, __FILE__, __LINE__) jpayne@69: # undef Tcl_NewByteArrayObj jpayne@69: # define Tcl_NewByteArrayObj(bytes, len) \ jpayne@69: Tcl_DbNewByteArrayObj(bytes, len, __FILE__, __LINE__) jpayne@69: # undef Tcl_NewDoubleObj jpayne@69: # define Tcl_NewDoubleObj(val) \ jpayne@69: Tcl_DbNewDoubleObj(val, __FILE__, __LINE__) jpayne@69: # undef Tcl_NewIntObj jpayne@69: # define Tcl_NewIntObj(val) \ jpayne@69: Tcl_DbNewLongObj(val, __FILE__, __LINE__) jpayne@69: # undef Tcl_NewListObj jpayne@69: # define Tcl_NewListObj(objc, objv) \ jpayne@69: Tcl_DbNewListObj(objc, objv, __FILE__, __LINE__) jpayne@69: # undef Tcl_NewLongObj jpayne@69: # define Tcl_NewLongObj(val) \ jpayne@69: Tcl_DbNewLongObj(val, __FILE__, __LINE__) jpayne@69: # undef Tcl_NewObj jpayne@69: # define Tcl_NewObj() \ jpayne@69: Tcl_DbNewObj(__FILE__, __LINE__) jpayne@69: # undef Tcl_NewStringObj jpayne@69: # define Tcl_NewStringObj(bytes, len) \ jpayne@69: Tcl_DbNewStringObj(bytes, len, __FILE__, __LINE__) jpayne@69: # undef Tcl_NewWideIntObj jpayne@69: # define Tcl_NewWideIntObj(val) \ jpayne@69: Tcl_DbNewWideIntObj(val, __FILE__, __LINE__) jpayne@69: #endif /* TCL_MEM_DEBUG */ jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Macros for clients to use to access fields of hash entries: jpayne@69: */ jpayne@69: jpayne@69: #define Tcl_GetHashValue(h) ((h)->clientData) jpayne@69: #define Tcl_SetHashValue(h, value) ((h)->clientData = (ClientData) (value)) jpayne@69: #define Tcl_GetHashKey(tablePtr, h) \ jpayne@69: ((void *) (((tablePtr)->keyType == TCL_ONE_WORD_KEYS || \ jpayne@69: (tablePtr)->keyType == TCL_CUSTOM_PTR_KEYS) \ jpayne@69: ? (h)->key.oneWordValue \ jpayne@69: : (h)->key.string)) jpayne@69: jpayne@69: /* jpayne@69: * Macros to use for clients to use to invoke find and create functions for jpayne@69: * hash tables: jpayne@69: */ jpayne@69: jpayne@69: #undef Tcl_FindHashEntry jpayne@69: #define Tcl_FindHashEntry(tablePtr, key) \ jpayne@69: (*((tablePtr)->findProc))(tablePtr, (const char *)(key)) jpayne@69: #undef Tcl_CreateHashEntry jpayne@69: #define Tcl_CreateHashEntry(tablePtr, key, newPtr) \ jpayne@69: (*((tablePtr)->createProc))(tablePtr, (const char *)(key), newPtr) jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Macros that eliminate the overhead of the thread synchronization functions jpayne@69: * when compiling without thread support. jpayne@69: */ jpayne@69: jpayne@69: #ifndef TCL_THREADS jpayne@69: #undef Tcl_MutexLock jpayne@69: #define Tcl_MutexLock(mutexPtr) jpayne@69: #undef Tcl_MutexUnlock jpayne@69: #define Tcl_MutexUnlock(mutexPtr) jpayne@69: #undef Tcl_MutexFinalize jpayne@69: #define Tcl_MutexFinalize(mutexPtr) jpayne@69: #undef Tcl_ConditionNotify jpayne@69: #define Tcl_ConditionNotify(condPtr) jpayne@69: #undef Tcl_ConditionWait jpayne@69: #define Tcl_ConditionWait(condPtr, mutexPtr, timePtr) jpayne@69: #undef Tcl_ConditionFinalize jpayne@69: #define Tcl_ConditionFinalize(condPtr) jpayne@69: #endif /* TCL_THREADS */ jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Deprecated Tcl functions: jpayne@69: */ jpayne@69: jpayne@69: #ifndef TCL_NO_DEPRECATED jpayne@69: /* jpayne@69: * These function have been renamed. The old names are deprecated, but we jpayne@69: * define these macros for backwards compatibility. jpayne@69: */ jpayne@69: jpayne@69: # define Tcl_Ckalloc Tcl_Alloc jpayne@69: # define Tcl_Ckfree Tcl_Free jpayne@69: # define Tcl_Ckrealloc Tcl_Realloc jpayne@69: # define Tcl_Return Tcl_SetResult jpayne@69: # define Tcl_TildeSubst Tcl_TranslateFileName jpayne@69: #if !defined(__APPLE__) /* On OSX, there is a conflict with "mach/mach.h" */ jpayne@69: # define panic Tcl_Panic jpayne@69: #endif jpayne@69: # define panicVA Tcl_PanicVA jpayne@69: #endif /* !TCL_NO_DEPRECATED */ jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------------- jpayne@69: * Convenience declaration of Tcl_AppInit for backwards compatibility. This jpayne@69: * function is not *implemented* by the tcl library, so the storage class is jpayne@69: * neither DLLEXPORT nor DLLIMPORT. jpayne@69: */ jpayne@69: jpayne@69: extern Tcl_AppInitProc Tcl_AppInit; jpayne@69: jpayne@69: #endif /* RC_INVOKED */ jpayne@69: jpayne@69: /* jpayne@69: * end block for C++ jpayne@69: */ jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: } jpayne@69: #endif jpayne@69: jpayne@69: #endif /* _TCL */ jpayne@69: jpayne@69: /* jpayne@69: * Local Variables: jpayne@69: * mode: c jpayne@69: * c-basic-offset: 4 jpayne@69: * fill-column: 78 jpayne@69: * End: jpayne@69: */