tcl.hGo to the documentation of this file.00001 /* 00002 * tcl.h -- 00003 * 00004 * This header file describes the externally-visible facilities of the 00005 * Tcl interpreter. 00006 * 00007 * Copyright (c) 1987-1994 The Regents of the University of California. 00008 * Copyright (c) 1993-1996 Lucent Technologies. 00009 * Copyright (c) 1994-1998 Sun Microsystems, Inc. 00010 * Copyright (c) 1998-2000 by Scriptics Corporation. 00011 * Copyright (c) 2002 by Kevin B. Kenny. All rights reserved. 00012 * 00013 * See the file "license.terms" for information on usage and redistribution of 00014 * this file, and for a DISCLAIMER OF ALL WARRANTIES. 00015 * 00016 * RCS: @(#) $Id: tcl.h,v 1.249 2008/02/04 17:29:10 dgp Exp $ 00017 */ 00018 00019 #ifndef _TCL 00020 #define _TCL 00021 00022 /* 00023 * For C++ compilers, use extern "C" 00024 */ 00025 00026 #ifdef __cplusplus 00027 extern "C" { 00028 #endif 00029 00030 /* 00031 * The following defines are used to indicate the various release levels. 00032 */ 00033 00034 #define TCL_ALPHA_RELEASE 0 00035 #define TCL_BETA_RELEASE 1 00036 #define TCL_FINAL_RELEASE 2 00037 00038 /* 00039 * When version numbers change here, must also go into the following files and 00040 * update the version numbers: 00041 * 00042 * library/init.tcl (1 LOC patch) 00043 * unix/configure.in (2 LOC Major, 2 LOC minor, 1 LOC patch) 00044 * win/configure.in (as above) 00045 * win/tcl.m4 (not patchlevel) 00046 * win/makefile.bc (not patchlevel) 2 LOC 00047 * README (sections 0 and 2, with and without separator) 00048 * macosx/Tcl.pbproj/project.pbxproj (not patchlevel) 1 LOC 00049 * macosx/Tcl.pbproj/default.pbxuser (not patchlevel) 1 LOC 00050 * macosx/Tcl.xcode/project.pbxproj (not patchlevel) 2 LOC 00051 * macosx/Tcl.xcode/default.pbxuser (not patchlevel) 1 LOC 00052 * macosx/Tcl-Common.xcconfig (not patchlevel) 1 LOC 00053 * win/README (not patchlevel) (sections 0 and 2) 00054 * unix/tcl.spec (1 LOC patch) 00055 * tools/tcl.hpj.in (not patchlevel, for windows installer) 00056 * tools/tcl.wse.in (for windows installer) 00057 * tools/tclSplash.bmp (not patchlevel) 00058 */ 00059 00060 #define TCL_MAJOR_VERSION 8 00061 #define TCL_MINOR_VERSION 5 00062 #define TCL_RELEASE_LEVEL TCL_FINAL_RELEASE 00063 #define TCL_RELEASE_SERIAL 1 00064 00065 #define TCL_VERSION "8.5" 00066 #define TCL_PATCH_LEVEL "8.5.1" 00067 00068 /* 00069 * The following definitions set up the proper options for Windows compilers. 00070 * We use this method because there is no autoconf equivalent. 00071 */ 00072 00073 #ifndef __WIN32__ 00074 # if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__) || defined(__BORLANDC__) || (defined(__WATCOMC__) && defined(__WINDOWS_386__)) 00075 # define __WIN32__ 00076 # ifndef WIN32 00077 # define WIN32 00078 # endif 00079 # ifndef _WIN32 00080 # define _WIN32 00081 # endif 00082 # endif 00083 #endif 00084 00085 /* 00086 * STRICT: See MSDN Article Q83456 00087 */ 00088 00089 #ifdef __WIN32__ 00090 # ifndef STRICT 00091 # define STRICT 00092 # endif 00093 #endif /* __WIN32__ */ 00094 00095 /* 00096 * Utility macros: STRINGIFY takes an argument and wraps it in "" (double 00097 * quotation marks), JOIN joins two arguments. 00098 */ 00099 00100 #ifndef STRINGIFY 00101 # define STRINGIFY(x) STRINGIFY1(x) 00102 # define STRINGIFY1(x) #x 00103 #endif 00104 #ifndef JOIN 00105 # define JOIN(a,b) JOIN1(a,b) 00106 # define JOIN1(a,b) a##b 00107 #endif 00108 00109 /* 00110 * A special definition used to allow this header file to be included from 00111 * windows resource files so that they can obtain version information. 00112 * RC_INVOKED is defined by default by the windows RC tool. 00113 * 00114 * Resource compilers don't like all the C stuff, like typedefs and function 00115 * declarations, that occur below, so block them out. 00116 */ 00117 00118 #ifndef RC_INVOKED 00119 00120 /* 00121 * Special macro to define mutexes, that doesn't do anything if we are not 00122 * using threads. 00123 */ 00124 00125 #ifdef TCL_THREADS 00126 #define TCL_DECLARE_MUTEX(name) static Tcl_Mutex name; 00127 #else 00128 #define TCL_DECLARE_MUTEX(name) 00129 #endif 00130 00131 /* 00132 * Tcl's public routine Tcl_FSSeek() uses the values SEEK_SET, SEEK_CUR, and 00133 * SEEK_END, all #define'd by stdio.h . 00134 * 00135 * Also, many extensions need stdio.h, and they've grown accustomed to tcl.h 00136 * providing it for them rather than #include-ing it themselves as they 00137 * should, so also for their sake, we keep the #include to be consistent with 00138 * prior Tcl releases. 00139 */ 00140 00141 #include <stdio.h> 00142 00143 /* 00144 * Support for functions with a variable number of arguments. 00145 * 00146 * The following TCL_VARARGS* macros are to support old extensions 00147 * written for older versions of Tcl where the macros permitted 00148 * support for the varargs.h system as well as stdarg.h . 00149 * 00150 * New code should just directly be written to use stdarg.h conventions. 00151 */ 00152 00153 #include <stdarg.h> 00154 #ifndef TCL_NO_DEPRECATED 00155 # define TCL_VARARGS(type, name) (type name, ...) 00156 # define TCL_VARARGS_DEF(type, name) (type name, ...) 00157 # define TCL_VARARGS_START(type, name, list) (va_start(list, name), name) 00158 #endif 00159 00160 /* 00161 * Macros used to declare a function to be exported by a DLL. Used by Windows, 00162 * maps to no-op declarations on non-Windows systems. The default build on 00163 * windows is for a DLL, which causes the DLLIMPORT and DLLEXPORT macros to be 00164 * nonempty. To build a static library, the macro STATIC_BUILD should be 00165 * defined. 00166 * 00167 * Note: when building static but linking dynamically to MSVCRT we must still 00168 * correctly decorate the C library imported function. Use CRTIMPORT 00169 * for this purpose. _DLL is defined by the compiler when linking to 00170 * MSVCRT. 00171 */ 00172 00173 #if (defined(__WIN32__) && (defined(_MSC_VER) || (__BORLANDC__ >= 0x0550) || defined(__LCC__) || defined(__WATCOMC__) || (defined(__GNUC__) && defined(__declspec)))) 00174 # define HAVE_DECLSPEC 1 00175 #endif 00176 00177 #ifdef STATIC_BUILD 00178 # define DLLIMPORT 00179 # define DLLEXPORT 00180 # if HAVE_DECLSPEC && defined(_DLL) 00181 # define CRTIMPORT __declspec(dllimport) 00182 # else 00183 # define CRTIMPORT 00184 # endif 00185 #else 00186 # if HAVE_DECLSPEC 00187 # define DLLIMPORT __declspec(dllimport) 00188 # define DLLEXPORT __declspec(dllexport) 00189 # define CRTIMPORT __declspec(dllimport) 00190 # else 00191 # define DLLIMPORT 00192 # define DLLEXPORT 00193 # define CRTIMPORT 00194 # endif 00195 #endif 00196 00197 /* 00198 * These macros are used to control whether functions are being declared for 00199 * import or export. If a function is being declared while it is being built 00200 * to be included in a shared library, then it should have the DLLEXPORT 00201 * storage class. If is being declared for use by a module that is going to 00202 * link against the shared library, then it should have the DLLIMPORT storage 00203 * class. If the symbol is beind declared for a static build or for use from a 00204 * stub library, then the storage class should be empty. 00205 * 00206 * The convention is that a macro called BUILD_xxxx, where xxxx is the name of 00207 * a library we are building, is set on the compile line for sources that are 00208 * to be placed in the library. When this macro is set, the storage class will 00209 * be set to DLLEXPORT. At the end of the header file, the storage class will 00210 * be reset to DLLIMPORT. 00211 */ 00212 00213 #undef TCL_STORAGE_CLASS 00214 #ifdef BUILD_tcl 00215 # define TCL_STORAGE_CLASS DLLEXPORT 00216 #else 00217 # ifdef USE_TCL_STUBS 00218 # define TCL_STORAGE_CLASS 00219 # else 00220 # define TCL_STORAGE_CLASS DLLIMPORT 00221 # endif 00222 #endif 00223 00224 /* 00225 * Definitions that allow this header file to be used either with or without 00226 * ANSI C features like function prototypes. 00227 */ 00228 00229 #undef _ANSI_ARGS_ 00230 #undef CONST 00231 #ifndef INLINE 00232 # define INLINE 00233 #endif 00234 00235 #ifndef NO_CONST 00236 # define CONST const 00237 #else 00238 # define CONST 00239 #endif 00240 00241 #ifndef NO_PROTOTYPES 00242 # define _ANSI_ARGS_(x) x 00243 #else 00244 # define _ANSI_ARGS_(x) () 00245 #endif 00246 00247 #ifdef USE_NON_CONST 00248 # ifdef USE_COMPAT_CONST 00249 # error define at most one of USE_NON_CONST and USE_COMPAT_CONST 00250 # endif 00251 # define CONST84 00252 # define CONST84_RETURN 00253 #else 00254 # ifdef USE_COMPAT_CONST 00255 # define CONST84 00256 # define CONST84_RETURN CONST 00257 # else 00258 # define CONST84 CONST 00259 # define CONST84_RETURN CONST 00260 # endif 00261 #endif 00262 00263 /* 00264 * Make sure EXTERN isn't defined elsewhere 00265 */ 00266 00267 #ifdef EXTERN 00268 # undef EXTERN 00269 #endif /* EXTERN */ 00270 00271 #ifdef __cplusplus 00272 # define EXTERN extern "C" TCL_STORAGE_CLASS 00273 #else 00274 # define EXTERN extern TCL_STORAGE_CLASS 00275 #endif 00276 00277 /* 00278 * The following code is copied from winnt.h. If we don't replicate it here, 00279 * then <windows.h> can't be included after tcl.h, since tcl.h also defines 00280 * VOID. This block is skipped under Cygwin and Mingw. 00281 */ 00282 00283 #if defined(__WIN32__) && !defined(HAVE_WINNT_IGNORE_VOID) 00284 #ifndef VOID 00285 #define VOID void 00286 typedef char CHAR; 00287 typedef short SHORT; 00288 typedef long LONG; 00289 #endif 00290 #endif /* __WIN32__ && !HAVE_WINNT_IGNORE_VOID */ 00291 00292 /* 00293 * Macro to use instead of "void" for arguments that must have type "void *" 00294 * in ANSI C; maps them to type "char *" in non-ANSI systems. 00295 */ 00296 00297 #ifndef NO_VOID 00298 #define VOID void 00299 #else 00300 #define VOID char 00301 #endif 00302 00303 /* 00304 * Miscellaneous declarations. 00305 */ 00306 00307 #ifndef _CLIENTDATA 00308 # ifndef NO_VOID 00309 typedef void *ClientData; 00310 # else 00311 typedef int *ClientData; 00312 # endif 00313 # define _CLIENTDATA 00314 #endif 00315 00316 /* 00317 * Darwin specifc configure overrides (to support fat compiles, where 00318 * configure runs only once for multiple architectures): 00319 */ 00320 00321 #ifdef __APPLE__ 00322 # ifdef __LP64__ 00323 # undef TCL_WIDE_INT_TYPE 00324 # define TCL_WIDE_INT_IS_LONG 1 00325 # define TCL_CFG_DO64BIT 1 00326 # else /* !__LP64__ */ 00327 # define TCL_WIDE_INT_TYPE long long 00328 # undef TCL_WIDE_INT_IS_LONG 00329 # undef TCL_CFG_DO64BIT 00330 # endif /* __LP64__ */ 00331 # undef HAVE_STRUCT_STAT64 00332 #endif /* __APPLE__ */ 00333 00334 /* 00335 * Define Tcl_WideInt to be a type that is (at least) 64-bits wide, and define 00336 * Tcl_WideUInt to be the unsigned variant of that type (assuming that where 00337 * we have one, we can have the other.) 00338 * 00339 * Also defines the following macros: 00340 * TCL_WIDE_INT_IS_LONG - if wide ints are really longs (i.e. we're on a real 00341 * 64-bit system.) 00342 * Tcl_WideAsLong - forgetful converter from wideInt to long. 00343 * Tcl_LongAsWide - sign-extending converter from long to wideInt. 00344 * Tcl_WideAsDouble - converter from wideInt to double. 00345 * Tcl_DoubleAsWide - converter from double to wideInt. 00346 * 00347 * The following invariant should hold for any long value 'longVal': 00348 * longVal == Tcl_WideAsLong(Tcl_LongAsWide(longVal)) 00349 * 00350 * Note on converting between Tcl_WideInt and strings. This implementation (in 00351 * tclObj.c) depends on the function 00352 * sprintf(...,"%" TCL_LL_MODIFIER "d",...). 00353 */ 00354 00355 #if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG) 00356 # if defined(__GNUC__) 00357 # define TCL_WIDE_INT_TYPE long long 00358 # if defined(__WIN32__) && !defined(__CYGWIN__) 00359 # define TCL_LL_MODIFIER "I64" 00360 # else 00361 # define TCL_LL_MODIFIER "L" 00362 # endif 00363 typedef struct stat Tcl_StatBuf; 00364 # elif defined(__WIN32__) 00365 # define TCL_WIDE_INT_TYPE __int64 00366 # ifdef __BORLANDC__ 00367 typedef struct stati64 Tcl_StatBuf; 00368 # define TCL_LL_MODIFIER "L" 00369 # else /* __BORLANDC__ */ 00370 # if _MSC_VER < 1400 || !defined(_M_IX86) 00371 typedef struct _stati64 Tcl_StatBuf; 00372 # else 00373 typedef struct _stat64 Tcl_StatBuf; 00374 # endif /* _MSC_VER < 1400 */ 00375 # define TCL_LL_MODIFIER "I64" 00376 # endif /* __BORLANDC__ */ 00377 # else /* __WIN32__ */ 00378 /* 00379 * Don't know what platform it is and configure hasn't discovered what is 00380 * going on for us. Try to guess... 00381 */ 00382 # ifdef NO_LIMITS_H 00383 # error please define either TCL_WIDE_INT_TYPE or TCL_WIDE_INT_IS_LONG 00384 # else /* !NO_LIMITS_H */ 00385 # include <limits.h> 00386 # if (INT_MAX < LONG_MAX) 00387 # define TCL_WIDE_INT_IS_LONG 1 00388 # else 00389 # define TCL_WIDE_INT_TYPE long long 00390 # endif 00391 # endif /* NO_LIMITS_H */ 00392 # endif /* __WIN32__ */ 00393 #endif /* !TCL_WIDE_INT_TYPE & !TCL_WIDE_INT_IS_LONG */ 00394 #ifdef TCL_WIDE_INT_IS_LONG 00395 # undef TCL_WIDE_INT_TYPE 00396 # define TCL_WIDE_INT_TYPE long 00397 #endif /* TCL_WIDE_INT_IS_LONG */ 00398 00399 typedef TCL_WIDE_INT_TYPE Tcl_WideInt; 00400 typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; 00401 00402 #ifdef TCL_WIDE_INT_IS_LONG 00403 typedef struct stat Tcl_StatBuf; 00404 # define Tcl_WideAsLong(val) ((long)(val)) 00405 # define Tcl_LongAsWide(val) ((long)(val)) 00406 # define Tcl_WideAsDouble(val) ((double)((long)(val))) 00407 # define Tcl_DoubleAsWide(val) ((long)((double)(val))) 00408 # ifndef TCL_LL_MODIFIER 00409 # define TCL_LL_MODIFIER "l" 00410 # endif /* !TCL_LL_MODIFIER */ 00411 #else /* TCL_WIDE_INT_IS_LONG */ 00412 /* 00413 * The next short section of defines are only done when not running on Windows 00414 * or some other strange platform. 00415 */ 00416 # ifndef TCL_LL_MODIFIER 00417 # ifdef HAVE_STRUCT_STAT64 00418 typedef struct stat64 Tcl_StatBuf; 00419 # else 00420 typedef struct stat Tcl_StatBuf; 00421 # endif /* HAVE_STRUCT_STAT64 */ 00422 # define TCL_LL_MODIFIER "ll" 00423 # endif /* !TCL_LL_MODIFIER */ 00424 # define Tcl_WideAsLong(val) ((long)((Tcl_WideInt)(val))) 00425 # define Tcl_LongAsWide(val) ((Tcl_WideInt)((long)(val))) 00426 # define Tcl_WideAsDouble(val) ((double)((Tcl_WideInt)(val))) 00427 # define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val))) 00428 #endif /* TCL_WIDE_INT_IS_LONG */ 00429 00430 /* 00431 * Data structures defined opaquely in this module. The definitions below just 00432 * provide dummy types. A few fields are made visible in Tcl_Interp 00433 * structures, namely those used for returning a string result from commands. 00434 * Direct access to the result field is discouraged in Tcl 8.0. The 00435 * interpreter result is either an object or a string, and the two values are 00436 * kept consistent unless some C code sets interp->result directly. 00437 * Programmers should use either the function Tcl_GetObjResult() or 00438 * Tcl_GetStringResult() to read the interpreter's result. See the SetResult 00439 * man page for details. 00440 * 00441 * Note: any change to the Tcl_Interp definition below must be mirrored in the 00442 * "real" definition in tclInt.h. 00443 * 00444 * Note: Tcl_ObjCmdProc functions do not directly set result and freeProc. 00445 * Instead, they set a Tcl_Obj member in the "real" structure that can be 00446 * accessed with Tcl_GetObjResult() and Tcl_SetObjResult(). 00447 */ 00448 00449 typedef struct Tcl_Interp { 00450 char *result; /* If the last command returned a string 00451 * result, this points to it. */ 00452 void (*freeProc) _ANSI_ARGS_((char *blockPtr)); 00453 /* Zero means the string result is statically 00454 * allocated. TCL_DYNAMIC means it was 00455 * allocated with ckalloc and should be freed 00456 * with ckfree. Other values give the address 00457 * of function to invoke to free the result. 00458 * Tcl_Eval must free it before executing next 00459 * command. */ 00460 int errorLine; /* When TCL_ERROR is returned, this gives the 00461 * line number within the command where the 00462 * error occurred (1 if first line). */ 00463 } Tcl_Interp; 00464 00465 typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler; 00466 typedef struct Tcl_Channel_ *Tcl_Channel; 00467 typedef struct Tcl_ChannelTypeVersion_ *Tcl_ChannelTypeVersion; 00468 typedef struct Tcl_Command_ *Tcl_Command; 00469 typedef struct Tcl_Condition_ *Tcl_Condition; 00470 typedef struct Tcl_Dict_ *Tcl_Dict; 00471 typedef struct Tcl_EncodingState_ *Tcl_EncodingState; 00472 typedef struct Tcl_Encoding_ *Tcl_Encoding; 00473 typedef struct Tcl_Event Tcl_Event; 00474 typedef struct Tcl_InterpState_ *Tcl_InterpState; 00475 typedef struct Tcl_LoadHandle_ *Tcl_LoadHandle; 00476 typedef struct Tcl_Mutex_ *Tcl_Mutex; 00477 typedef struct Tcl_Pid_ *Tcl_Pid; 00478 typedef struct Tcl_RegExp_ *Tcl_RegExp; 00479 typedef struct Tcl_ThreadDataKey_ *Tcl_ThreadDataKey; 00480 typedef struct Tcl_ThreadId_ *Tcl_ThreadId; 00481 typedef struct Tcl_TimerToken_ *Tcl_TimerToken; 00482 typedef struct Tcl_Trace_ *Tcl_Trace; 00483 typedef struct Tcl_Var_ *Tcl_Var; 00484 00485 /* 00486 * Definition of the interface to functions implementing threads. A function 00487 * following this definition is given to each call of 'Tcl_CreateThread' and 00488 * will be called as the main fuction of the new thread created by that call. 00489 */ 00490 00491 #if defined __WIN32__ 00492 typedef unsigned (__stdcall Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData)); 00493 #else 00494 typedef void (Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData)); 00495 #endif 00496 00497 /* 00498 * Threading function return types used for abstracting away platform 00499 * differences when writing a Tcl_ThreadCreateProc. See the NewThread function 00500 * in generic/tclThreadTest.c for it's usage. 00501 */ 00502 00503 #if defined __WIN32__ 00504 # define Tcl_ThreadCreateType unsigned __stdcall 00505 # define TCL_THREAD_CREATE_RETURN return 0 00506 #else 00507 # define Tcl_ThreadCreateType void 00508 # define TCL_THREAD_CREATE_RETURN 00509 #endif 00510 00511 /* 00512 * Definition of values for default stacksize and the possible flags to be 00513 * given to Tcl_CreateThread. 00514 */ 00515 00516 #define TCL_THREAD_STACK_DEFAULT (0) /* Use default size for stack */ 00517 #define TCL_THREAD_NOFLAGS (0000) /* Standard flags, default behaviour */ 00518 #define TCL_THREAD_JOINABLE (0001) /* Mark the thread as joinable */ 00519 00520 /* 00521 * Flag values passed to Tcl_StringCaseMatch. 00522 */ 00523 00524 #define TCL_MATCH_NOCASE (1<<0) 00525 00526 /* 00527 * Flag values passed to Tcl_GetRegExpFromObj. 00528 */ 00529 00530 #define TCL_REG_BASIC 000000 /* BREs (convenience) */ 00531 #define TCL_REG_EXTENDED 000001 /* EREs */ 00532 #define TCL_REG_ADVF 000002 /* advanced features in EREs */ 00533 #define TCL_REG_ADVANCED 000003 /* AREs (which are also EREs) */ 00534 #define TCL_REG_QUOTE 000004 /* no special characters, none */ 00535 #define TCL_REG_NOCASE 000010 /* ignore case */ 00536 #define TCL_REG_NOSUB 000020 /* don't care about subexpressions */ 00537 #define TCL_REG_EXPANDED 000040 /* expanded format, white space & 00538 * comments */ 00539 #define TCL_REG_NLSTOP 000100 /* \n doesn't match . or [^ ] */ 00540 #define TCL_REG_NLANCH 000200 /* ^ matches after \n, $ before */ 00541 #define TCL_REG_NEWLINE 000300 /* newlines are line terminators */ 00542 #define TCL_REG_CANMATCH 001000 /* report details on partial/limited 00543 * matches */ 00544 00545 /* 00546 * Flags values passed to Tcl_RegExpExecObj. 00547 */ 00548 00549 #define TCL_REG_NOTBOL 0001 /* Beginning of string does not match ^. */ 00550 #define TCL_REG_NOTEOL 0002 /* End of string does not match $. */ 00551 00552 /* 00553 * Structures filled in by Tcl_RegExpInfo. Note that all offset values are 00554 * relative to the start of the match string, not the beginning of the entire 00555 * string. 00556 */ 00557 00558 typedef struct Tcl_RegExpIndices { 00559 long start; /* Character offset of first character in 00560 * match. */ 00561 long end; /* Character offset of first character after 00562 * the match. */ 00563 } Tcl_RegExpIndices; 00564 00565 typedef struct Tcl_RegExpInfo { 00566 int nsubs; /* Number of subexpressions in the compiled 00567 * expression. */ 00568 Tcl_RegExpIndices *matches; /* Array of nsubs match offset pairs. */ 00569 long extendStart; /* The offset at which a subsequent match 00570 * might begin. */ 00571 long reserved; /* Reserved for later use. */ 00572 } Tcl_RegExpInfo; 00573 00574 /* 00575 * Picky compilers complain if this typdef doesn't appear before the struct's 00576 * reference in tclDecls.h. 00577 */ 00578 00579 typedef Tcl_StatBuf *Tcl_Stat_; 00580 typedef struct stat *Tcl_OldStat_; 00581 00582 /* 00583 * When a TCL command returns, the interpreter contains a result from the 00584 * command. Programmers are strongly encouraged to use one of the functions 00585 * Tcl_GetObjResult() or Tcl_GetStringResult() to read the interpreter's 00586 * result. See the SetResult man page for details. Besides this result, the 00587 * command function returns an integer code, which is one of the following: 00588 * 00589 * TCL_OK Command completed normally; the interpreter's result 00590 * contains the command's result. 00591 * TCL_ERROR The command couldn't be completed successfully; the 00592 * interpreter's result describes what went wrong. 00593 * TCL_RETURN The command requests that the current function return; 00594 * the interpreter's result contains the function's 00595 * return value. 00596 * TCL_BREAK The command requests that the innermost loop be 00597 * exited; the interpreter's result is meaningless. 00598 * TCL_CONTINUE Go on to the next iteration of the current loop; the 00599 * interpreter's result is meaningless. 00600 */ 00601 00602 #define TCL_OK 0 00603 #define TCL_ERROR 1 00604 #define TCL_RETURN 2 00605 #define TCL_BREAK 3 00606 #define TCL_CONTINUE 4 00607 00608 #define TCL_RESULT_SIZE 200 00609 00610 /* 00611 * Flags to control what substitutions are performed by Tcl_SubstObj(): 00612 */ 00613 00614 #define TCL_SUBST_COMMANDS 001 00615 #define TCL_SUBST_VARIABLES 002 00616 #define TCL_SUBST_BACKSLASHES 004 00617 #define TCL_SUBST_ALL 007 00618 00619 /* 00620 * Argument descriptors for math function callbacks in expressions: 00621 */ 00622 00623 typedef enum { 00624 TCL_INT, TCL_DOUBLE, TCL_EITHER, TCL_WIDE_INT 00625 } Tcl_ValueType; 00626 00627 typedef struct Tcl_Value { 00628 Tcl_ValueType type; /* Indicates intValue or doubleValue is valid, 00629 * or both. */ 00630 long intValue; /* Integer value. */ 00631 double doubleValue; /* Double-precision floating value. */ 00632 Tcl_WideInt wideValue; /* Wide (min. 64-bit) integer value. */ 00633 } Tcl_Value; 00634 00635 /* 00636 * Forward declaration of Tcl_Obj to prevent an error when the forward 00637 * reference to Tcl_Obj is encountered in the function types declared below. 00638 */ 00639 00640 struct Tcl_Obj; 00641 00642 /* 00643 * Function types defined by Tcl: 00644 */ 00645 00646 typedef int (Tcl_AppInitProc) _ANSI_ARGS_((Tcl_Interp *interp)); 00647 typedef int (Tcl_AsyncProc) _ANSI_ARGS_((ClientData clientData, 00648 Tcl_Interp *interp, int code)); 00649 typedef void (Tcl_ChannelProc) _ANSI_ARGS_((ClientData clientData, int mask)); 00650 typedef void (Tcl_CloseProc) _ANSI_ARGS_((ClientData data)); 00651 typedef void (Tcl_CmdDeleteProc) _ANSI_ARGS_((ClientData clientData)); 00652 typedef int (Tcl_CmdProc) _ANSI_ARGS_((ClientData clientData, 00653 Tcl_Interp *interp, int argc, CONST84 char *argv[])); 00654 typedef void (Tcl_CmdTraceProc) _ANSI_ARGS_((ClientData clientData, 00655 Tcl_Interp *interp, int level, char *command, Tcl_CmdProc *proc, 00656 ClientData cmdClientData, int argc, CONST84 char *argv[])); 00657 typedef int (Tcl_CmdObjTraceProc) _ANSI_ARGS_((ClientData clientData, 00658 Tcl_Interp *interp, int level, CONST char *command, 00659 Tcl_Command commandInfo, int objc, struct Tcl_Obj * CONST * objv)); 00660 typedef void (Tcl_CmdObjTraceDeleteProc) _ANSI_ARGS_((ClientData clientData)); 00661 typedef void (Tcl_DupInternalRepProc) _ANSI_ARGS_((struct Tcl_Obj *srcPtr, 00662 struct Tcl_Obj *dupPtr)); 00663 typedef int (Tcl_EncodingConvertProc)_ANSI_ARGS_((ClientData clientData, 00664 CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, 00665 char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, 00666 int *dstCharsPtr)); 00667 typedef void (Tcl_EncodingFreeProc)_ANSI_ARGS_((ClientData clientData)); 00668 typedef int (Tcl_EventProc) _ANSI_ARGS_((Tcl_Event *evPtr, int flags)); 00669 typedef void (Tcl_EventCheckProc) _ANSI_ARGS_((ClientData clientData, 00670 int flags)); 00671 typedef int (Tcl_EventDeleteProc) _ANSI_ARGS_((Tcl_Event *evPtr, 00672 ClientData clientData)); 00673 typedef void (Tcl_EventSetupProc) _ANSI_ARGS_((ClientData clientData, 00674 int flags)); 00675 typedef void (Tcl_ExitProc) _ANSI_ARGS_((ClientData clientData)); 00676 typedef void (Tcl_FileProc) _ANSI_ARGS_((ClientData clientData, int mask)); 00677 typedef void (Tcl_FileFreeProc) _ANSI_ARGS_((ClientData clientData)); 00678 typedef void (Tcl_FreeInternalRepProc) _ANSI_ARGS_((struct Tcl_Obj *objPtr)); 00679 typedef void (Tcl_FreeProc) _ANSI_ARGS_((char *blockPtr)); 00680 typedef void (Tcl_IdleProc) _ANSI_ARGS_((ClientData clientData)); 00681 typedef void (Tcl_InterpDeleteProc) _ANSI_ARGS_((ClientData clientData, 00682 Tcl_Interp *interp)); 00683 typedef int (Tcl_MathProc) _ANSI_ARGS_((ClientData clientData, 00684 Tcl_Interp *interp, Tcl_Value *args, Tcl_Value *resultPtr)); 00685 typedef void (Tcl_NamespaceDeleteProc) _ANSI_ARGS_((ClientData clientData)); 00686 typedef int (Tcl_ObjCmdProc) _ANSI_ARGS_((ClientData clientData, 00687 Tcl_Interp *interp, int objc, struct Tcl_Obj * CONST * objv)); 00688 typedef int (Tcl_PackageInitProc) _ANSI_ARGS_((Tcl_Interp *interp)); 00689 typedef int (Tcl_PackageUnloadProc) _ANSI_ARGS_((Tcl_Interp *interp, 00690 int flags)); 00691 typedef void (Tcl_PanicProc) _ANSI_ARGS_((CONST char *format, ...)); 00692 typedef void (Tcl_TcpAcceptProc) _ANSI_ARGS_((ClientData callbackData, 00693 Tcl_Channel chan, char *address, int port)); 00694 typedef void (Tcl_TimerProc) _ANSI_ARGS_((ClientData clientData)); 00695 typedef int (Tcl_SetFromAnyProc) _ANSI_ARGS_((Tcl_Interp *interp, 00696 struct Tcl_Obj *objPtr)); 00697 typedef void (Tcl_UpdateStringProc) _ANSI_ARGS_((struct Tcl_Obj *objPtr)); 00698 typedef char *(Tcl_VarTraceProc) _ANSI_ARGS_((ClientData clientData, 00699 Tcl_Interp *interp, CONST84 char *part1, CONST84 char *part2, 00700 int flags)); 00701 typedef void (Tcl_CommandTraceProc) _ANSI_ARGS_((ClientData clientData, 00702 Tcl_Interp *interp, CONST char *oldName, CONST char *newName, 00703 int flags)); 00704 typedef void (Tcl_CreateFileHandlerProc) _ANSI_ARGS_((int fd, int mask, 00705 Tcl_FileProc *proc, ClientData clientData)); 00706 typedef void (Tcl_DeleteFileHandlerProc) _ANSI_ARGS_((int fd)); 00707 typedef void (Tcl_AlertNotifierProc) _ANSI_ARGS_((ClientData clientData)); 00708 typedef void (Tcl_ServiceModeHookProc) _ANSI_ARGS_((int mode)); 00709 typedef ClientData (Tcl_InitNotifierProc) _ANSI_ARGS_((VOID)); 00710 typedef void (Tcl_FinalizeNotifierProc) _ANSI_ARGS_((ClientData clientData)); 00711 typedef void (Tcl_MainLoopProc) _ANSI_ARGS_((void)); 00712 00713 /* 00714 * The following structure represents a type of object, which is a particular 00715 * internal representation for an object plus a set of functions that provide 00716 * standard operations on objects of that type. 00717 */ 00718 00719 typedef struct Tcl_ObjType { 00720 char *name; /* Name of the type, e.g. "int". */ 00721 Tcl_FreeInternalRepProc *freeIntRepProc; 00722 /* Called to free any storage for the type's 00723 * internal rep. NULL if the internal rep does 00724 * not need freeing. */ 00725 Tcl_DupInternalRepProc *dupIntRepProc; 00726 /* Called to create a new object as a copy of 00727 * an existing object. */ 00728 Tcl_UpdateStringProc *updateStringProc; 00729 /* Called to update the string rep from the 00730 * type's internal representation. */ 00731 Tcl_SetFromAnyProc *setFromAnyProc; 00732 /* Called to convert the object's internal rep 00733 * to this type. Frees the internal rep of the 00734 * old type. Returns TCL_ERROR on failure. */ 00735 } Tcl_ObjType; 00736 00737 /* 00738 * One of the following structures exists for each object in the Tcl system. 00739 * An object stores a value as either a string, some internal representation, 00740 * or both. 00741 */ 00742 00743 typedef struct Tcl_Obj { 00744 int refCount; /* When 0 the object will be freed. */ 00745 char *bytes; /* This points to the first byte of the 00746 * object's string representation. The array 00747 * must be followed by a null byte (i.e., at 00748 * offset length) but may also contain 00749 * embedded null characters. The array's 00750 * storage is allocated by ckalloc. NULL means 00751 * the string rep is invalid and must be 00752 * regenerated from the internal rep. Clients 00753 * should use Tcl_GetStringFromObj or 00754 * Tcl_GetString to get a pointer to the byte 00755 * array as a readonly value. */ 00756 int length; /* The number of bytes at *bytes, not 00757 * including the terminating null. */ 00758 Tcl_ObjType *typePtr; /* Denotes the object's type. Always 00759 * corresponds to the type of the object's 00760 * internal rep. NULL indicates the object has 00761 * no internal rep (has no type). */ 00762 union { /* The internal representation: */ 00763 long longValue; /* - an long integer value */ 00764 double doubleValue; /* - a double-precision floating value */ 00765 VOID *otherValuePtr; /* - another, type-specific value */ 00766 Tcl_WideInt wideValue; /* - a long long value */ 00767 struct { /* - internal rep as two pointers */ 00768 VOID *ptr1; 00769 VOID *ptr2; 00770 } twoPtrValue; 00771 struct { /* - internal rep as a wide int, tightly 00772 * packed fields */ 00773 VOID *ptr; /* Pointer to digits */ 00774 unsigned long value;/* Alloc, used, and signum packed into a 00775 * single word */ 00776 } ptrAndLongRep; 00777 } internalRep; 00778 } Tcl_Obj; 00779 00780 /* 00781 * Macros to increment and decrement a Tcl_Obj's reference count, and to test 00782 * whether an object is shared (i.e. has reference count > 1). Note: clients 00783 * should use Tcl_DecrRefCount() when they are finished using an object, and 00784 * should never call TclFreeObj() directly. TclFreeObj() is only defined and 00785 * made public in tcl.h to support Tcl_DecrRefCount's macro definition. Note 00786 * also that Tcl_DecrRefCount() refers to the parameter "obj" twice. This 00787 * means that you should avoid calling it with an expression that is expensive 00788 * to compute or has side effects. 00789 */ 00790 00791 void Tcl_IncrRefCount _ANSI_ARGS_((Tcl_Obj *objPtr)); 00792 void Tcl_DecrRefCount _ANSI_ARGS_((Tcl_Obj *objPtr)); 00793 int Tcl_IsShared _ANSI_ARGS_((Tcl_Obj *objPtr)); 00794 00795 /* 00796 * The following structure contains the state needed by Tcl_SaveResult. No-one 00797 * outside of Tcl should access any of these fields. This structure is 00798 * typically allocated on the stack. 00799 */ 00800 00801 typedef struct Tcl_SavedResult { 00802 char *result; 00803 Tcl_FreeProc *freeProc; 00804 Tcl_Obj *objResultPtr; 00805 char *appendResult; 00806 int appendAvl; 00807 int appendUsed; 00808 char resultSpace[TCL_RESULT_SIZE+1]; 00809 } Tcl_SavedResult; 00810 00811 /* 00812 * The following definitions support Tcl's namespace facility. Note: the first 00813 * five fields must match exactly the fields in a Namespace structure (see 00814 * tclInt.h). 00815 */ 00816 00817 typedef struct Tcl_Namespace { 00818 char *name; /* The namespace's name within its parent 00819 * namespace. This contains no ::'s. The name 00820 * of the global namespace is "" although "::" 00821 * is an synonym. */ 00822 char *fullName; /* The namespace's fully qualified name. This 00823 * starts with ::. */ 00824 ClientData clientData; /* Arbitrary value associated with this 00825 * namespace. */ 00826 Tcl_NamespaceDeleteProc* deleteProc; 00827 /* Function invoked when deleting the 00828 * namespace to, e.g., free clientData. */ 00829 struct Tcl_Namespace* parentPtr; 00830 /* Points to the namespace that contains this 00831 * one. NULL if this is the global 00832 * namespace. */ 00833 } Tcl_Namespace; 00834 00835 /* 00836 * The following structure represents a call frame, or activation record. A 00837 * call frame defines a naming context for a procedure call: its local scope 00838 * (for local variables) and its namespace scope (used for non-local 00839 * variables; often the global :: namespace). A call frame can also define the 00840 * naming context for a namespace eval or namespace inscope command: the 00841 * namespace in which the command's code should execute. The Tcl_CallFrame 00842 * structures exist only while procedures or namespace eval/inscope's are 00843 * being executed, and provide a Tcl call stack. 00844 * 00845 * A call frame is initialized and pushed using Tcl_PushCallFrame and popped 00846 * using Tcl_PopCallFrame. Storage for a Tcl_CallFrame must be provided by the 00847 * Tcl_PushCallFrame caller, and callers typically allocate them on the C call 00848 * stack for efficiency. For this reason, Tcl_CallFrame is defined as a 00849 * structure and not as an opaque token. However, most Tcl_CallFrame fields 00850 * are hidden since applications should not access them directly; others are 00851 * declared as "dummyX". 00852 * 00853 * WARNING!! The structure definition must be kept consistent with the 00854 * CallFrame structure in tclInt.h. If you change one, change the other. 00855 */ 00856 00857 typedef struct Tcl_CallFrame { 00858 Tcl_Namespace *nsPtr; 00859 int dummy1; 00860 int dummy2; 00861 char *dummy3; 00862 char *dummy4; 00863 char *dummy5; 00864 int dummy6; 00865 char *dummy7; 00866 char *dummy8; 00867 int dummy9; 00868 char *dummy10; 00869 char *dummy11; 00870 char *dummy12; 00871 } Tcl_CallFrame; 00872 00873 /* 00874 * Information about commands that is returned by Tcl_GetCommandInfo and 00875 * passed to Tcl_SetCommandInfo. objProc is an objc/objv object-based command 00876 * function while proc is a traditional Tcl argc/argv string-based function. 00877 * Tcl_CreateObjCommand and Tcl_CreateCommand ensure that both objProc and 00878 * proc are non-NULL and can be called to execute the command. However, it may 00879 * be faster to call one instead of the other. The member isNativeObjectProc 00880 * is set to 1 if an object-based function was registered by 00881 * Tcl_CreateObjCommand, and to 0 if a string-based function was registered by 00882 * Tcl_CreateCommand. The other function is typically set to a compatibility 00883 * wrapper that does string-to-object or object-to-string argument conversions 00884 * then calls the other function. 00885 */ 00886 00887 typedef struct Tcl_CmdInfo { 00888 int isNativeObjectProc; /* 1 if objProc was registered by a call to 00889 * Tcl_CreateObjCommand; 0 otherwise. 00890 * Tcl_SetCmdInfo does not modify this 00891 * field. */ 00892 Tcl_ObjCmdProc *objProc; /* Command's object-based function. */ 00893 ClientData objClientData; /* ClientData for object proc. */ 00894 Tcl_CmdProc *proc; /* Command's string-based function. */ 00895 ClientData clientData; /* ClientData for string proc. */ 00896 Tcl_CmdDeleteProc *deleteProc; 00897 /* Function to call when command is 00898 * deleted. */ 00899 ClientData deleteData; /* Value to pass to deleteProc (usually the 00900 * same as clientData). */ 00901 Tcl_Namespace *namespacePtr;/* Points to the namespace that contains this 00902 * command. Note that Tcl_SetCmdInfo will not 00903 * change a command's namespace; use 00904 * TclRenameCommand or Tcl_Eval (of 'rename') 00905 * to do that. */ 00906 } Tcl_CmdInfo; 00907 00908 /* 00909 * The structure defined below is used to hold dynamic strings. The only 00910 * fields that clients should use are string and length, accessible via the 00911 * macros Tcl_DStringValue and Tcl_DStringLength. 00912 */ 00913 00914 #define TCL_DSTRING_STATIC_SIZE 200 00915 typedef struct Tcl_DString { 00916 char *string; /* Points to beginning of string: either 00917 * staticSpace below or a malloced array. */ 00918 int length; /* Number of non-NULL characters in the 00919 * string. */ 00920 int spaceAvl; /* Total number of bytes available for the 00921 * string and its terminating NULL char. */ 00922 char staticSpace[TCL_DSTRING_STATIC_SIZE]; 00923 /* Space to use in common case where string is 00924 * small. */ 00925 } Tcl_DString; 00926 00927 #define Tcl_DStringLength(dsPtr) ((dsPtr)->length) 00928 #define Tcl_DStringValue(dsPtr) ((dsPtr)->string) 00929 #define Tcl_DStringTrunc Tcl_DStringSetLength 00930 00931 /* 00932 * Definitions for the maximum number of digits of precision that may be 00933 * specified in the "tcl_precision" variable, and the number of bytes of 00934 * buffer space required by Tcl_PrintDouble. 00935 */ 00936 00937 #define TCL_MAX_PREC 17 00938 #define TCL_DOUBLE_SPACE (TCL_MAX_PREC+10) 00939 00940 /* 00941 * Definition for a number of bytes of buffer space sufficient to hold the 00942 * string representation of an integer in base 10 (assuming the existence of 00943 * 64-bit integers). 00944 */ 00945 00946 #define TCL_INTEGER_SPACE 24 00947 00948 /* 00949 * Flag values passed to Tcl_ConvertElement. 00950 * TCL_DONT_USE_BRACES forces it not to enclose the element in braces, but to 00951 * use backslash quoting instead. 00952 * TCL_DONT_QUOTE_HASH disables the default quoting of the '#' character. It 00953 * is safe to leave the hash unquoted when the element is not the first 00954 * element of a list, and this flag can be used by the caller to indicate 00955 * that condition. 00956 * (Careful! If you change these flag values be sure to change the definitions 00957 * at the front of tclUtil.c). 00958 */ 00959 00960 #define TCL_DONT_USE_BRACES 1 00961 #define TCL_DONT_QUOTE_HASH 8 00962 00963 /* 00964 * Flag that may be passed to Tcl_GetIndexFromObj to force it to disallow 00965 * abbreviated strings. 00966 */ 00967 00968 #define TCL_EXACT 1 00969 00970 /* 00971 * Flag values passed to Tcl_RecordAndEval, Tcl_EvalObj, Tcl_EvalObjv. 00972 * WARNING: these bit choices must not conflict with the bit choices for 00973 * evalFlag bits in tclInt.h! 00974 * 00975 * Meanings: 00976 * TCL_NO_EVAL: Just record this command 00977 * TCL_EVAL_GLOBAL: Execute script in global namespace 00978 * TCL_EVAL_DIRECT: Do not compile this script 00979 * TCL_EVAL_INVOKE: Magical Tcl_EvalObjv mode for aliases/ensembles 00980 * o Run in iPtr->lookupNsPtr or global namespace 00981 * o Cut out of error traces 00982 * o Don't reset the flags controlling ensemble 00983 * error message rewriting. 00984 */ 00985 #define TCL_NO_EVAL 0x10000 00986 #define TCL_EVAL_GLOBAL 0x20000 00987 #define TCL_EVAL_DIRECT 0x40000 00988 #define TCL_EVAL_INVOKE 0x80000 00989 00990 /* 00991 * Special freeProc values that may be passed to Tcl_SetResult (see the man 00992 * page for details): 00993 */ 00994 00995 #define TCL_VOLATILE ((Tcl_FreeProc *) 1) 00996 #define TCL_STATIC ((Tcl_FreeProc *) 0) 00997 #define TCL_DYNAMIC ((Tcl_FreeProc *) 3) 00998 00999 /* 01000 * Flag values passed to variable-related functions. 01001 */ 01002 01003 #define TCL_GLOBAL_ONLY 1 01004 #define TCL_NAMESPACE_ONLY 2 01005 #define TCL_APPEND_VALUE 4 01006 #define TCL_LIST_ELEMENT 8 01007 #define TCL_TRACE_READS 0x10 01008 #define TCL_TRACE_WRITES 0x20 01009 #define TCL_TRACE_UNSETS 0x40 01010 #define TCL_TRACE_DESTROYED 0x80 01011 #define TCL_INTERP_DESTROYED 0x100 01012 #define TCL_LEAVE_ERR_MSG 0x200 01013 #define TCL_TRACE_ARRAY 0x800 01014 #ifndef TCL_REMOVE_OBSOLETE_TRACES 01015 /* Required to support old variable/vdelete/vinfo traces */ 01016 #define TCL_TRACE_OLD_STYLE 0x1000 01017 #endif 01018 /* Indicate the semantics of the result of a trace */ 01019 #define TCL_TRACE_RESULT_DYNAMIC 0x8000 01020 #define TCL_TRACE_RESULT_OBJECT 0x10000 01021 01022 /* 01023 * Flag values for ensemble commands. 01024 */ 01025 01026 #define TCL_ENSEMBLE_PREFIX 0x02/* Flag value to say whether to allow 01027 * unambiguous prefixes of commands or to 01028 * require exact matches for command names. */ 01029 01030 /* 01031 * Flag values passed to command-related functions. 01032 */ 01033 01034 #define TCL_TRACE_RENAME 0x2000 01035 #define TCL_TRACE_DELETE 0x4000 01036 01037 #define TCL_ALLOW_INLINE_COMPILATION 0x20000 01038 01039 /* 01040 * The TCL_PARSE_PART1 flag is deprecated and has no effect. The part1 is now 01041 * always parsed whenever the part2 is NULL. (This is to avoid a common error 01042 * when converting code to use the new object based APIs and forgetting to 01043 * give the flag) 01044 */ 01045 01046 #ifndef TCL_NO_DEPRECATED 01047 # define TCL_PARSE_PART1 0x400 01048 #endif 01049 01050 /* 01051 * Types for linked variables: 01052 */ 01053 01054 #define TCL_LINK_INT 1 01055 #define TCL_LINK_DOUBLE 2 01056 #define TCL_LINK_BOOLEAN 3 01057 #define TCL_LINK_STRING 4 01058 #define TCL_LINK_WIDE_INT 5 01059 #define TCL_LINK_CHAR 6 01060 #define TCL_LINK_UCHAR 7 01061 #define TCL_LINK_SHORT 8 01062 #define TCL_LINK_USHORT 9 01063 #define TCL_LINK_UINT 10 01064 #define TCL_LINK_LONG 11 01065 #define TCL_LINK_ULONG 12 01066 #define TCL_LINK_FLOAT 13 01067 #define TCL_LINK_WIDE_UINT 14 01068 #define TCL_LINK_READ_ONLY 0x80 01069 01070 /* 01071 * Forward declarations of Tcl_HashTable and related types. 01072 */ 01073 01074 typedef struct Tcl_HashKeyType Tcl_HashKeyType; 01075 typedef struct Tcl_HashTable Tcl_HashTable; 01076 typedef struct Tcl_HashEntry Tcl_HashEntry; 01077 01078 typedef unsigned int (Tcl_HashKeyProc) _ANSI_ARGS_((Tcl_HashTable *tablePtr, 01079 VOID *keyPtr)); 01080 typedef int (Tcl_CompareHashKeysProc) _ANSI_ARGS_((VOID *keyPtr, 01081 Tcl_HashEntry *hPtr)); 01082 typedef Tcl_HashEntry *(Tcl_AllocHashEntryProc) _ANSI_ARGS_(( 01083 Tcl_HashTable *tablePtr, VOID *keyPtr)); 01084 typedef void (Tcl_FreeHashEntryProc) _ANSI_ARGS_((Tcl_HashEntry *hPtr)); 01085 01086 /* 01087 * This flag controls whether the hash table stores the hash of a key, or 01088 * recalculates it. There should be no reason for turning this flag off as it 01089 * is completely binary and source compatible unless you directly access the 01090 * bucketPtr member of the Tcl_HashTableEntry structure. This member has been 01091 * removed and the space used to store the hash value. 01092 */ 01093 01094 #ifndef TCL_HASH_KEY_STORE_HASH 01095 # define TCL_HASH_KEY_STORE_HASH 1 01096 #endif 01097 01098 /* 01099 * Structure definition for an entry in a hash table. No-one outside Tcl 01100 * should access any of these fields directly; use the macros defined below. 01101 */ 01102 01103 struct Tcl_HashEntry { 01104 Tcl_HashEntry *nextPtr; /* Pointer to next entry in this hash bucket, 01105 * or NULL for end of chain. */ 01106 Tcl_HashTable *tablePtr; /* Pointer to table containing entry. */ 01107 #if TCL_HASH_KEY_STORE_HASH 01108 VOID *hash; /* Hash value, stored as pointer to ensure 01109 * that the offsets of the fields in this 01110 * structure are not changed. */ 01111 #else 01112 Tcl_HashEntry **bucketPtr; /* Pointer to bucket that points to first 01113 * entry in this entry's chain: used for 01114 * deleting the entry. */ 01115 #endif 01116 ClientData clientData; /* Application stores something here with 01117 * Tcl_SetHashValue. */ 01118 union { /* Key has one of these forms: */ 01119 char *oneWordValue; /* One-word value for key. */ 01120 Tcl_Obj *objPtr; /* Tcl_Obj * key value. */ 01121 int words[1]; /* Multiple integer words for key. The actual 01122 * size will be as large as necessary for this 01123 * table's keys. */ 01124 char string[4]; /* String for key. The actual size will be as 01125 * large as needed to hold the key. */ 01126 } key; /* MUST BE LAST FIELD IN RECORD!! */ 01127 }; 01128 01129 /* 01130 * Flags used in Tcl_HashKeyType. 01131 * 01132 * TCL_HASH_KEY_RANDOMIZE_HASH - 01133 * There are some things, pointers for example 01134 * which don't hash well because they do not use 01135 * the lower bits. If this flag is set then the 01136 * hash table will attempt to rectify this by 01137 * randomising the bits and then using the upper 01138 * N bits as the index into the table. 01139 * TCL_HASH_KEY_SYSTEM_HASH - If this flag is set then all memory internally 01140 * allocated for the hash table that is not for an 01141 * entry will use the system heap. 01142 */ 01143 01144 #define TCL_HASH_KEY_RANDOMIZE_HASH 0x1 01145 #define TCL_HASH_KEY_SYSTEM_HASH 0x2 01146 01147 /* 01148 * Structure definition for the methods associated with a hash table key type. 01149 */ 01150 01151 #define TCL_HASH_KEY_TYPE_VERSION 1 01152 struct Tcl_HashKeyType { 01153 int version; /* Version of the table. If this structure is 01154 * extended in future then the version can be 01155 * used to distinguish between different 01156 * structures. */ 01157 int flags; /* Flags, see above for details. */ 01158 Tcl_HashKeyProc *hashKeyProc; 01159 /* Calculates a hash value for the key. If 01160 * this is NULL then the pointer itself is 01161 * used as a hash value. */ 01162 Tcl_CompareHashKeysProc *compareKeysProc; 01163 /* Compares two keys and returns zero if they 01164 * do not match, and non-zero if they do. If 01165 * this is NULL then the pointers are 01166 * compared. */ 01167 Tcl_AllocHashEntryProc *allocEntryProc; 01168 /* Called to allocate memory for a new entry, 01169 * i.e. if the key is a string then this could 01170 * allocate a single block which contains 01171 * enough space for both the entry and the 01172 * string. Only the key field of the allocated 01173 * Tcl_HashEntry structure needs to be filled 01174 * in. If something else needs to be done to 01175 * the key, i.e. incrementing a reference 01176 * count then that should be done by this 01177 * function. If this is NULL then Tcl_Alloc is 01178 * used to allocate enough space for a 01179 * Tcl_HashEntry and the key pointer is 01180 * assigned to key.oneWordValue. */ 01181 Tcl_FreeHashEntryProc *freeEntryProc; 01182 /* Called to free memory associated with an 01183 * entry. If something else needs to be done 01184 * to the key, i.e. decrementing a reference 01185 * count then that should be done by this 01186 * function. If this is NULL then Tcl_Free is 01187 * used to free the Tcl_HashEntry. */ 01188 }; 01189 01190 /* 01191 * Structure definition for a hash table. Must be in tcl.h so clients can 01192 * allocate space for these structures, but clients should never access any 01193 * fields in this structure. 01194 */ 01195 01196 #define TCL_SMALL_HASH_TABLE 4 01197 struct Tcl_HashTable { 01198 Tcl_HashEntry **buckets; /* Pointer to bucket array. Each element 01199 * points to first entry in bucket's hash 01200 * chain, or NULL. */ 01201 Tcl_HashEntry *staticBuckets[TCL_SMALL_HASH_TABLE]; 01202 /* Bucket array used for small tables (to 01203 * avoid mallocs and frees). */ 01204 int numBuckets; /* Total number of buckets allocated at 01205 * **bucketPtr. */ 01206 int numEntries; /* Total number of entries present in 01207 * table. */ 01208 int rebuildSize; /* Enlarge table when numEntries gets to be 01209 * this large. */ 01210 int downShift; /* Shift count used in hashing function. 01211 * Designed to use high-order bits of 01212 * randomized keys. */ 01213 int mask; /* Mask value used in hashing function. */ 01214 int keyType; /* Type of keys used in this table. It's 01215 * either TCL_CUSTOM_KEYS, TCL_STRING_KEYS, 01216 * TCL_ONE_WORD_KEYS, or an integer giving the 01217 * number of ints that is the size of the 01218 * key. */ 01219 Tcl_HashEntry *(*findProc) _ANSI_ARGS_((Tcl_HashTable *tablePtr, 01220 CONST char *key)); 01221 Tcl_HashEntry *(*createProc) _ANSI_ARGS_((Tcl_HashTable *tablePtr, 01222 CONST char *key, int *newPtr)); 01223 Tcl_HashKeyType *typePtr; /* Type of the keys used in the 01224 * Tcl_HashTable. */ 01225 }; 01226 01227 /* 01228 * Structure definition for information used to keep track of searches through 01229 * hash tables: 01230 */ 01231 01232 typedef struct Tcl_HashSearch { 01233 Tcl_HashTable *tablePtr; /* Table being searched. */ 01234 int nextIndex; /* Index of next bucket to be enumerated after 01235 * present one. */ 01236 Tcl_HashEntry *nextEntryPtr;/* Next entry to be enumerated in the current 01237 * bucket. */ 01238 } Tcl_HashSearch; 01239 01240 /* 01241 * Acceptable key types for hash tables: 01242 * 01243 * TCL_STRING_KEYS: The keys are strings, they are copied into the 01244 * entry. 01245 * TCL_ONE_WORD_KEYS: The keys are pointers, the pointer is stored 01246 * in the entry. 01247 * TCL_CUSTOM_TYPE_KEYS: The keys are arbitrary types which are copied 01248 * into the entry. 01249 * TCL_CUSTOM_PTR_KEYS: The keys are pointers to arbitrary types, the 01250 * pointer is stored in the entry. 01251 * 01252 * While maintaining binary compatability the above have to be distinct values 01253 * as they are used to differentiate between old versions of the hash table 01254 * which don't have a typePtr and new ones which do. Once binary compatability 01255 * is discarded in favour of making more wide spread changes TCL_STRING_KEYS 01256 * can be the same as TCL_CUSTOM_TYPE_KEYS, and TCL_ONE_WORD_KEYS can be the 01257 * same as TCL_CUSTOM_PTR_KEYS because they simply determine how the key is 01258 * accessed from the entry and not the behaviour. 01259 */ 01260 01261 #define TCL_STRING_KEYS 0 01262 #define TCL_ONE_WORD_KEYS 1 01263 #define TCL_CUSTOM_TYPE_KEYS -2 01264 #define TCL_CUSTOM_PTR_KEYS -1 01265 01266 /* 01267 * Structure definition for information used to keep track of searches through 01268 * dictionaries. These fields should not be accessed by code outside 01269 * tclDictObj.c 01270 */ 01271 01272 typedef struct { 01273 void *next; /* Search position for underlying hash 01274 * table. */ 01275 int epoch; /* Epoch marker for dictionary being searched, 01276 * or -1 if search has terminated. */ 01277 Tcl_Dict dictionaryPtr; /* Reference to dictionary being searched. */ 01278 } Tcl_DictSearch; 01279 01280 /* 01281 * Flag values to pass to Tcl_DoOneEvent to disable searches for some kinds of 01282 * events: 01283 */ 01284 01285 #define TCL_DONT_WAIT (1<<1) 01286 #define TCL_WINDOW_EVENTS (1<<2) 01287 #define TCL_FILE_EVENTS (1<<3) 01288 #define TCL_TIMER_EVENTS (1<<4) 01289 #define TCL_IDLE_EVENTS (1<<5) /* WAS 0x10 ???? */ 01290 #define TCL_ALL_EVENTS (~TCL_DONT_WAIT) 01291 01292 /* 01293 * The following structure defines a generic event for the Tcl event system. 01294 * These are the things that are queued in calls to Tcl_QueueEvent and 01295 * serviced later by Tcl_DoOneEvent. There can be many different kinds of 01296 * events with different fields, corresponding to window events, timer events, 01297 * etc. The structure for a particular event consists of a Tcl_Event header 01298 * followed by additional information specific to that event. 01299 */ 01300 01301 struct Tcl_Event { 01302 Tcl_EventProc *proc; /* Function to call to service this event. */ 01303 struct Tcl_Event *nextPtr; /* Next in list of pending events, or NULL. */ 01304 }; 01305 01306 /* 01307 * Positions to pass to Tcl_QueueEvent: 01308 */ 01309 01310 typedef enum { 01311 TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, TCL_QUEUE_MARK 01312 } Tcl_QueuePosition; 01313 01314 /* 01315 * Values to pass to Tcl_SetServiceMode to specify the behavior of notifier 01316 * event routines. 01317 */ 01318 01319 #define TCL_SERVICE_NONE 0 01320 #define TCL_SERVICE_ALL 1 01321 01322 /* 01323 * The following structure keeps is used to hold a time value, either as an 01324 * absolute time (the number of seconds from the epoch) or as an elapsed time. 01325 * On Unix systems the epoch is Midnight Jan 1, 1970 GMT. 01326 */ 01327 01328 typedef struct Tcl_Time { 01329 long sec; /* Seconds. */ 01330 long usec; /* Microseconds. */ 01331 } Tcl_Time; 01332 01333 typedef void (Tcl_SetTimerProc) _ANSI_ARGS_((Tcl_Time *timePtr)); 01334 typedef int (Tcl_WaitForEventProc) _ANSI_ARGS_((Tcl_Time *timePtr)); 01335 01336 /* 01337 * TIP #233 (Virtualized Time) 01338 */ 01339 01340 typedef void (Tcl_GetTimeProc) _ANSI_ARGS_ ((Tcl_Time* timebuf, ClientData clientData)); 01341 typedef void (Tcl_ScaleTimeProc) _ANSI_ARGS_ ((Tcl_Time* timebuf, ClientData clientData)); 01342 01343 /* 01344 * Bits to pass to Tcl_CreateFileHandler and Tcl_CreateChannelHandler to 01345 * indicate what sorts of events are of interest: 01346 */ 01347 01348 #define TCL_READABLE (1<<1) 01349 #define TCL_WRITABLE (1<<2) 01350 #define TCL_EXCEPTION (1<<3) 01351 01352 /* 01353 * Flag values to pass to Tcl_OpenCommandChannel to indicate the disposition 01354 * of the stdio handles. TCL_STDIN, TCL_STDOUT, TCL_STDERR, are also used in 01355 * Tcl_GetStdChannel. 01356 */ 01357 01358 #define TCL_STDIN (1<<1) 01359 #define TCL_STDOUT (1<<2) 01360 #define TCL_STDERR (1<<3) 01361 #define TCL_ENFORCE_MODE (1<<4) 01362 01363 /* 01364 * Bits passed to Tcl_DriverClose2Proc to indicate which side of a channel 01365 * should be closed. 01366 */ 01367 01368 #define TCL_CLOSE_READ (1<<1) 01369 #define TCL_CLOSE_WRITE (1<<2) 01370 01371 /* 01372 * Value to use as the closeProc for a channel that supports the close2Proc 01373 * interface. 01374 */ 01375 01376 #define TCL_CLOSE2PROC ((Tcl_DriverCloseProc *)1) 01377 01378 /* 01379 * Channel version tag. This was introduced in 8.3.2/8.4. 01380 */ 01381 01382 #define TCL_CHANNEL_VERSION_1 ((Tcl_ChannelTypeVersion) 0x1) 01383 #define TCL_CHANNEL_VERSION_2 ((Tcl_ChannelTypeVersion) 0x2) 01384 #define TCL_CHANNEL_VERSION_3 ((Tcl_ChannelTypeVersion) 0x3) 01385 #define TCL_CHANNEL_VERSION_4 ((Tcl_ChannelTypeVersion) 0x4) 01386 #define TCL_CHANNEL_VERSION_5 ((Tcl_ChannelTypeVersion) 0x5) 01387 01388 /* 01389 * TIP #218: Channel Actions, Ids for Tcl_DriverThreadActionProc 01390 */ 01391 01392 #define TCL_CHANNEL_THREAD_INSERT (0) 01393 #define TCL_CHANNEL_THREAD_REMOVE (1) 01394 01395 /* 01396 * Typedefs for the various operations in a channel type: 01397 */ 01398 01399 typedef int (Tcl_DriverBlockModeProc) _ANSI_ARGS_(( 01400 ClientData instanceData, int mode)); 01401 typedef int (Tcl_DriverCloseProc) _ANSI_ARGS_((ClientData instanceData, 01402 Tcl_Interp *interp)); 01403 typedef int (Tcl_DriverClose2Proc) _ANSI_ARGS_((ClientData instanceData, 01404 Tcl_Interp *interp, int flags)); 01405 typedef int (Tcl_DriverInputProc) _ANSI_ARGS_((ClientData instanceData, 01406 char *buf, int toRead, int *errorCodePtr)); 01407 typedef int (Tcl_DriverOutputProc) _ANSI_ARGS_((ClientData instanceData, 01408 CONST84 char *buf, int toWrite, int *errorCodePtr)); 01409 typedef int (Tcl_DriverSeekProc) _ANSI_ARGS_((ClientData instanceData, 01410 long offset, int mode, int *errorCodePtr)); 01411 typedef int (Tcl_DriverSetOptionProc) _ANSI_ARGS_(( 01412 ClientData instanceData, Tcl_Interp *interp, 01413 CONST char *optionName, CONST char *value)); 01414 typedef int (Tcl_DriverGetOptionProc) _ANSI_ARGS_(( 01415 ClientData instanceData, Tcl_Interp *interp, 01416 CONST84 char *optionName, Tcl_DString *dsPtr)); 01417 typedef void (Tcl_DriverWatchProc) _ANSI_ARGS_(( 01418 ClientData instanceData, int mask)); 01419 typedef int (Tcl_DriverGetHandleProc) _ANSI_ARGS_(( 01420 ClientData instanceData, int direction, 01421 ClientData *handlePtr)); 01422 typedef int (Tcl_DriverFlushProc) _ANSI_ARGS_((ClientData instanceData)); 01423 typedef int (Tcl_DriverHandlerProc) _ANSI_ARGS_(( 01424 ClientData instanceData, int interestMask)); 01425 typedef Tcl_WideInt (Tcl_DriverWideSeekProc) _ANSI_ARGS_(( 01426 ClientData instanceData, Tcl_WideInt offset, 01427 int mode, int *errorCodePtr)); 01428 /* 01429 * TIP #218, Channel Thread Actions 01430 */ 01431 typedef void (Tcl_DriverThreadActionProc) _ANSI_ARGS_ (( 01432 ClientData instanceData, int action)); 01433 /* 01434 * TIP #208, File Truncation (etc.) 01435 */ 01436 typedef int (Tcl_DriverTruncateProc) _ANSI_ARGS_(( 01437 ClientData instanceData, Tcl_WideInt length)); 01438 01439 /* 01440 * struct Tcl_ChannelType: 01441 * 01442 * One such structure exists for each type (kind) of channel. It collects 01443 * together in one place all the functions that are part of the specific 01444 * channel type. 01445 * 01446 * It is recommend that the Tcl_Channel* functions are used to access elements 01447 * of this structure, instead of direct accessing. 01448 */ 01449 01450 typedef struct Tcl_ChannelType { 01451 char *typeName; /* The name of the channel type in Tcl 01452 * commands. This storage is owned by channel 01453 * type. */ 01454 Tcl_ChannelTypeVersion version; 01455 /* Version of the channel type. */ 01456 Tcl_DriverCloseProc *closeProc; 01457 /* Function to call to close the channel, or 01458 * TCL_CLOSE2PROC if the close2Proc should be 01459 * used instead. */ 01460 Tcl_DriverInputProc *inputProc; 01461 /* Function to call for input on channel. */ 01462 Tcl_DriverOutputProc *outputProc; 01463 /* Function to call for output on channel. */ 01464 Tcl_DriverSeekProc *seekProc; 01465 /* Function to call to seek on the channel. 01466 * May be NULL. */ 01467 Tcl_DriverSetOptionProc *setOptionProc; 01468 /* Set an option on a channel. */ 01469 Tcl_DriverGetOptionProc *getOptionProc; 01470 /* Get an option from a channel. */ 01471 Tcl_DriverWatchProc *watchProc; 01472 /* Set up the notifier to watch for events on 01473 * this channel. */ 01474 Tcl_DriverGetHandleProc *getHandleProc; 01475 /* Get an OS handle from the channel or NULL 01476 * if not supported. */ 01477 Tcl_DriverClose2Proc *close2Proc; 01478 /* Function to call to close the channel if 01479 * the device supports closing the read & 01480 * write sides independently. */ 01481 Tcl_DriverBlockModeProc *blockModeProc; 01482 /* Set blocking mode for the raw channel. May 01483 * be NULL. */ 01484 /* 01485 * Only valid in TCL_CHANNEL_VERSION_2 channels or later 01486 */ 01487 Tcl_DriverFlushProc *flushProc; 01488 /* Function to call to flush a channel. May be 01489 * NULL. */ 01490 Tcl_DriverHandlerProc *handlerProc; 01491 /* Function to call to handle a channel event. 01492 * This will be passed up the stacked channel 01493 * chain. */ 01494 /* 01495 * Only valid in TCL_CHANNEL_VERSION_3 channels or later 01496 */ 01497 Tcl_DriverWideSeekProc *wideSeekProc; 01498 /* Function to call to seek on the channel 01499 * which can handle 64-bit offsets. May be 01500 * NULL, and must be NULL if seekProc is 01501 * NULL. */ 01502 /* 01503 * Only valid in TCL_CHANNEL_VERSION_4 channels or later 01504 * TIP #218, Channel Thread Actions 01505 */ 01506 Tcl_DriverThreadActionProc *threadActionProc; 01507 /* Function to call to notify the driver of 01508 * thread specific activity for a channel. May 01509 * be NULL. */ 01510 01511 /* 01512 * Only valid in TCL_CHANNEL_VERSION_5 channels or later 01513 * TIP #208, File Truncation 01514 */ 01515 Tcl_DriverTruncateProc *truncateProc; 01516 /* Function to call to truncate the underlying 01517 * file to a particular length. May be NULL if 01518 * the channel does not support truncation. */ 01519 } Tcl_ChannelType; 01520 01521 /* 01522 * The following flags determine whether the blockModeProc above should set 01523 * the channel into blocking or nonblocking mode. They are passed as arguments 01524 * to the blockModeProc function in the above structure. 01525 */ 01526 01527 #define TCL_MODE_BLOCKING 0 /* Put channel into blocking mode. */ 01528 #define TCL_MODE_NONBLOCKING 1 /* Put channel into nonblocking 01529 * mode. */ 01530 01531 /* 01532 * Enum for different types of file paths. 01533 */ 01534 01535 typedef enum Tcl_PathType { 01536 TCL_PATH_ABSOLUTE, 01537 TCL_PATH_RELATIVE, 01538 TCL_PATH_VOLUME_RELATIVE 01539 } Tcl_PathType; 01540 01541 /* 01542 * The following structure is used to pass glob type data amongst the various 01543 * glob routines and Tcl_FSMatchInDirectory. 01544 */ 01545 01546 typedef struct Tcl_GlobTypeData { 01547 int type; /* Corresponds to bcdpfls as in 'find -t' */ 01548 int perm; /* Corresponds to file permissions */ 01549 Tcl_Obj *macType; /* Acceptable mac type */ 01550 Tcl_Obj *macCreator; /* Acceptable mac creator */ 01551 } Tcl_GlobTypeData; 01552 01553 /* 01554 * Type and permission definitions for glob command 01555 */ 01556 01557 #define TCL_GLOB_TYPE_BLOCK (1<<0) 01558 #define TCL_GLOB_TYPE_CHAR (1<<1) 01559 #define TCL_GLOB_TYPE_DIR (1<<2) 01560 #define TCL_GLOB_TYPE_PIPE (1<<3) 01561 #define TCL_GLOB_TYPE_FILE (1<<4) 01562 #define TCL_GLOB_TYPE_LINK (1<<5) 01563 #define TCL_GLOB_TYPE_SOCK (1<<6) 01564 #define TCL_GLOB_TYPE_MOUNT (1<<7) 01565 01566 #define TCL_GLOB_PERM_RONLY (1<<0) 01567 #define TCL_GLOB_PERM_HIDDEN (1<<1) 01568 #define TCL_GLOB_PERM_R (1<<2) 01569 #define TCL_GLOB_PERM_W (1<<3) 01570 #define TCL_GLOB_PERM_X (1<<4) 01571 01572 /* 01573 * Flags for the unload callback function 01574 */ 01575 01576 #define TCL_UNLOAD_DETACH_FROM_INTERPRETER (1<<0) 01577 #define TCL_UNLOAD_DETACH_FROM_PROCESS (1<<1) 01578 01579 /* 01580 * Typedefs for the various filesystem operations: 01581 */ 01582 01583 typedef int (Tcl_FSStatProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, Tcl_StatBuf *buf)); 01584 typedef int (Tcl_FSAccessProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, int mode)); 01585 typedef Tcl_Channel (Tcl_FSOpenFileChannelProc) _ANSI_ARGS_(( 01586 Tcl_Interp *interp, Tcl_Obj *pathPtr, int mode, int permissions)); 01587 typedef int (Tcl_FSMatchInDirectoryProc) _ANSI_ARGS_((Tcl_Interp* interp, 01588 Tcl_Obj *result, Tcl_Obj *pathPtr, CONST char *pattern, 01589 Tcl_GlobTypeData * types)); 01590 typedef Tcl_Obj* (Tcl_FSGetCwdProc) _ANSI_ARGS_((Tcl_Interp *interp)); 01591 typedef int (Tcl_FSChdirProc) _ANSI_ARGS_((Tcl_Obj *pathPtr)); 01592 typedef int (Tcl_FSLstatProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, 01593 Tcl_StatBuf *buf)); 01594 typedef int (Tcl_FSCreateDirectoryProc) _ANSI_ARGS_((Tcl_Obj *pathPtr)); 01595 typedef int (Tcl_FSDeleteFileProc) _ANSI_ARGS_((Tcl_Obj *pathPtr)); 01596 typedef int (Tcl_FSCopyDirectoryProc) _ANSI_ARGS_((Tcl_Obj *srcPathPtr, 01597 Tcl_Obj *destPathPtr, Tcl_Obj **errorPtr)); 01598 typedef int (Tcl_FSCopyFileProc) _ANSI_ARGS_((Tcl_Obj *srcPathPtr, 01599 Tcl_Obj *destPathPtr)); 01600 typedef int (Tcl_FSRemoveDirectoryProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, 01601 int recursive, Tcl_Obj **errorPtr)); 01602 typedef int (Tcl_FSRenameFileProc) _ANSI_ARGS_((Tcl_Obj *srcPathPtr, 01603 Tcl_Obj *destPathPtr)); 01604 typedef void (Tcl_FSUnloadFileProc) _ANSI_ARGS_((Tcl_LoadHandle loadHandle)); 01605 typedef Tcl_Obj* (Tcl_FSListVolumesProc) _ANSI_ARGS_((void)); 01606 /* We have to declare the utime structure here. */ 01607 struct utimbuf; 01608 typedef int (Tcl_FSUtimeProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, 01609 struct utimbuf *tval)); 01610 typedef int (Tcl_FSNormalizePathProc) _ANSI_ARGS_((Tcl_Interp *interp, 01611 Tcl_Obj *pathPtr, int nextCheckpoint)); 01612 typedef int (Tcl_FSFileAttrsGetProc) _ANSI_ARGS_((Tcl_Interp *interp, 01613 int index, Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef)); 01614 typedef CONST char** (Tcl_FSFileAttrStringsProc) _ANSI_ARGS_(( 01615 Tcl_Obj *pathPtr, Tcl_Obj** objPtrRef)); 01616 typedef int (Tcl_FSFileAttrsSetProc) _ANSI_ARGS_((Tcl_Interp *interp, 01617 int index, Tcl_Obj *pathPtr, Tcl_Obj *objPtr)); 01618 typedef Tcl_Obj* (Tcl_FSLinkProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, 01619 Tcl_Obj *toPtr, int linkType)); 01620 typedef int (Tcl_FSLoadFileProc) _ANSI_ARGS_((Tcl_Interp * interp, 01621 Tcl_Obj *pathPtr, Tcl_LoadHandle *handlePtr, 01622 Tcl_FSUnloadFileProc **unloadProcPtr)); 01623 typedef int (Tcl_FSPathInFilesystemProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, 01624 ClientData *clientDataPtr)); 01625 typedef Tcl_Obj* (Tcl_FSFilesystemPathTypeProc) _ANSI_ARGS_(( 01626 Tcl_Obj *pathPtr)); 01627 typedef Tcl_Obj* (Tcl_FSFilesystemSeparatorProc) _ANSI_ARGS_(( 01628 Tcl_Obj *pathPtr)); 01629 typedef void (Tcl_FSFreeInternalRepProc) _ANSI_ARGS_((ClientData clientData)); 01630 typedef ClientData (Tcl_FSDupInternalRepProc) _ANSI_ARGS_(( 01631 ClientData clientData)); 01632 typedef Tcl_Obj* (Tcl_FSInternalToNormalizedProc) _ANSI_ARGS_(( 01633 ClientData clientData)); 01634 typedef ClientData (Tcl_FSCreateInternalRepProc) _ANSI_ARGS_(( 01635 Tcl_Obj *pathPtr)); 01636 01637 typedef struct Tcl_FSVersion_ *Tcl_FSVersion; 01638 01639 /* 01640 *---------------------------------------------------------------- 01641 * Data structures related to hooking into the filesystem 01642 *---------------------------------------------------------------- 01643 */ 01644 01645 /* 01646 * Filesystem version tag. This was introduced in 8.4. 01647 */ 01648 #define TCL_FILESYSTEM_VERSION_1 ((Tcl_FSVersion) 0x1) 01649 01650 /* 01651 * struct Tcl_Filesystem: 01652 * 01653 * One such structure exists for each type (kind) of filesystem. It collects 01654 * together in one place all the functions that are part of the specific 01655 * filesystem. Tcl always accesses the filesystem through one of these 01656 * structures. 01657 * 01658 * Not all entries need be non-NULL; any which are NULL are simply ignored. 01659 * However, a complete filesystem should provide all of these functions. The 01660 * explanations in the structure show the importance of each function. 01661 */ 01662 01663 typedef struct Tcl_Filesystem { 01664 CONST char *typeName; /* The name of the filesystem. */ 01665 int structureLength; /* Length of this structure, so future binary 01666 * compatibility can be assured. */ 01667 Tcl_FSVersion version; /* Version of the filesystem type. */ 01668 Tcl_FSPathInFilesystemProc *pathInFilesystemProc; 01669 /* Function to check whether a path is in this 01670 * filesystem. This is the most important 01671 * filesystem function. */ 01672 Tcl_FSDupInternalRepProc *dupInternalRepProc; 01673 /* Function to duplicate internal fs rep. May 01674 * be NULL (but then fs is less efficient). */ 01675 Tcl_FSFreeInternalRepProc *freeInternalRepProc; 01676 /* Function to free internal fs rep. Must be 01677 * implemented if internal representations 01678 * need freeing, otherwise it can be NULL. */ 01679 Tcl_FSInternalToNormalizedProc *internalToNormalizedProc; 01680 /* Function to convert internal representation 01681 * to a normalized path. Only required if the 01682 * fs creates pure path objects with no 01683 * string/path representation. */ 01684 Tcl_FSCreateInternalRepProc *createInternalRepProc; 01685 /* Function to create a filesystem-specific 01686 * internal representation. May be NULL if 01687 * paths have no internal representation, or 01688 * if the Tcl_FSPathInFilesystemProc for this 01689 * filesystem always immediately creates an 01690 * internal representation for paths it 01691 * accepts. */ 01692 Tcl_FSNormalizePathProc *normalizePathProc; 01693 /* Function to normalize a path. Should be 01694 * implemented for all filesystems which can 01695 * have multiple string representations for 01696 * the same path object. */ 01697 Tcl_FSFilesystemPathTypeProc *filesystemPathTypeProc; 01698 /* Function to determine the type of a path in 01699 * this filesystem. May be NULL. */ 01700 Tcl_FSFilesystemSeparatorProc *filesystemSeparatorProc; 01701 /* Function to return the separator 01702 * character(s) for this filesystem. Must be 01703 * implemented. */ 01704 Tcl_FSStatProc *statProc; /* Function to process a 'Tcl_FSStat()' call. 01705 * Must be implemented for any reasonable 01706 * filesystem. */ 01707 Tcl_FSAccessProc *accessProc; 01708 /* Function to process a 'Tcl_FSAccess()' 01709 * call. Must be implemented for any 01710 * reasonable filesystem. */ 01711 Tcl_FSOpenFileChannelProc *openFileChannelProc; 01712 /* Function to process a 01713 * 'Tcl_FSOpenFileChannel()' call. Must be 01714 * implemented for any reasonable 01715 * filesystem. */ 01716 Tcl_FSMatchInDirectoryProc *matchInDirectoryProc; 01717 /* Function to process a 01718 * 'Tcl_FSMatchInDirectory()'. If not 01719 * implemented, then glob and recursive copy 01720 * functionality will be lacking in the 01721 * filesystem. */ 01722 Tcl_FSUtimeProc *utimeProc; /* Function to process a 'Tcl_FSUtime()' call. 01723 * Required to allow setting (not reading) of 01724 * times with 'file mtime', 'file atime' and 01725 * the open-r/open-w/fcopy implementation of 01726 * 'file copy'. */ 01727 Tcl_FSLinkProc *linkProc; /* Function to process a 'Tcl_FSLink()' call. 01728 * Should be implemented only if the 01729 * filesystem supports links (reading or 01730 * creating). */ 01731 Tcl_FSListVolumesProc *listVolumesProc; 01732 /* Function to list any filesystem volumes 01733 * added by this filesystem. Should be 01734 * implemented only if the filesystem adds 01735 * volumes at the head of the filesystem. */ 01736 Tcl_FSFileAttrStringsProc *fileAttrStringsProc; 01737 /* Function to list all attributes strings 01738 * which are valid for this filesystem. If not 01739 * implemented the filesystem will not support 01740 * the 'file attributes' command. This allows 01741 * arbitrary additional information to be 01742 * attached to files in the filesystem. */ 01743 Tcl_FSFileAttrsGetProc *fileAttrsGetProc; 01744 /* Function to process a 01745 * 'Tcl_FSFileAttrsGet()' call, used by 'file 01746 * attributes'. */ 01747 Tcl_FSFileAttrsSetProc *fileAttrsSetProc; 01748 /* Function to process a 01749 * 'Tcl_FSFileAttrsSet()' call, used by 'file 01750 * attributes'. */ 01751 Tcl_FSCreateDirectoryProc *createDirectoryProc; 01752 /* Function to process a 01753 * 'Tcl_FSCreateDirectory()' call. Should be 01754 * implemented unless the FS is read-only. */ 01755 Tcl_FSRemoveDirectoryProc *removeDirectoryProc; 01756 /* Function to process a 01757 * 'Tcl_FSRemoveDirectory()' call. Should be 01758 * implemented unless the FS is read-only. */ 01759 Tcl_FSDeleteFileProc *deleteFileProc; 01760 /* Function to process a 'Tcl_FSDeleteFile()' 01761 * call. Should be implemented unless the FS 01762 * is read-only. */ 01763 Tcl_FSCopyFileProc *copyFileProc; 01764 /* Function to process a 'Tcl_FSCopyFile()' 01765 * call. If not implemented Tcl will fall back 01766 * on open-r, open-w and fcopy as a copying 01767 * mechanism, for copying actions initiated in 01768 * Tcl (not C). */ 01769 Tcl_FSRenameFileProc *renameFileProc; 01770 /* Function to process a 'Tcl_FSRenameFile()' 01771 * call. If not implemented, Tcl will fall 01772 * back on a copy and delete mechanism, for 01773 * rename actions initiated in Tcl (not C). */ 01774 Tcl_FSCopyDirectoryProc *copyDirectoryProc; 01775 /* Function to process a 01776 * 'Tcl_FSCopyDirectory()' call. If not 01777 * implemented, Tcl will fall back on a 01778 * recursive create-dir, file copy mechanism, 01779 * for copying actions initiated in Tcl (not 01780 * C). */ 01781 Tcl_FSLstatProc *lstatProc; /* Function to process a 'Tcl_FSLstat()' call. 01782 * If not implemented, Tcl will attempt to use 01783 * the 'statProc' defined above instead. */ 01784 Tcl_FSLoadFileProc *loadFileProc; 01785 /* Function to process a 'Tcl_FSLoadFile()' 01786 * call. If not implemented, Tcl will fall 01787 * back on a copy to native-temp followed by a 01788 * Tcl_FSLoadFile on that temporary copy. */ 01789 Tcl_FSGetCwdProc *getCwdProc; 01790 /* Function to process a 'Tcl_FSGetCwd()' 01791 * call. Most filesystems need not implement 01792 * this. It will usually only be called once, 01793 * if 'getcwd' is called before 'chdir'. May 01794 * be NULL. */ 01795 Tcl_FSChdirProc *chdirProc; /* Function to process a 'Tcl_FSChdir()' call. 01796 * If filesystems do not implement this, it 01797 * will be emulated by a series of directory 01798 * access checks. Otherwise, virtual 01799 * filesystems which do implement it need only 01800 * respond with a positive return result if 01801 * the dirName is a valid directory in their 01802 * filesystem. They need not remember the 01803 * result, since that will be automatically 01804 * remembered for use by GetCwd. Real 01805 * filesystems should carry out the correct 01806 * action (i.e. call the correct system 01807 * 'chdir' api). If not implemented, then 'cd' 01808 * and 'pwd' will fail inside the 01809 * filesystem. */ 01810 } Tcl_Filesystem; 01811 01812 /* 01813 * The following definitions are used as values for the 'linkAction' flag to 01814 * Tcl_FSLink, or the linkProc of any filesystem. Any combination of flags can 01815 * be given. For link creation, the linkProc should create a link which 01816 * matches any of the types given. 01817 * 01818 * TCL_CREATE_SYMBOLIC_LINK - Create a symbolic or soft link. 01819 * TCL_CREATE_HARD_LINK - Create a hard link. 01820 */ 01821 01822 #define TCL_CREATE_SYMBOLIC_LINK 0x01 01823 #define TCL_CREATE_HARD_LINK 0x02 01824 01825 /* 01826 * The following structure represents the Notifier functions that you can 01827 * override with the Tcl_SetNotifier call. 01828 */ 01829 01830 typedef struct Tcl_NotifierProcs { 01831 Tcl_SetTimerProc *setTimerProc; 01832 Tcl_WaitForEventProc *waitForEventProc; 01833 Tcl_CreateFileHandlerProc *createFileHandlerProc; 01834 Tcl_DeleteFileHandlerProc *deleteFileHandlerProc; 01835 Tcl_InitNotifierProc *initNotifierProc; 01836 Tcl_FinalizeNotifierProc *finalizeNotifierProc; 01837 Tcl_AlertNotifierProc *alertNotifierProc; 01838 Tcl_ServiceModeHookProc *serviceModeHookProc; 01839 } Tcl_NotifierProcs; 01840 01841 /* 01842 * The following structure represents a user-defined encoding. It collects 01843 * together all the functions that are used by the specific encoding. 01844 */ 01845 01846 typedef struct Tcl_EncodingType { 01847 CONST char *encodingName; /* The name of the encoding, e.g. "euc-jp". 01848 * This name is the unique key for this 01849 * encoding type. */ 01850 Tcl_EncodingConvertProc *toUtfProc; 01851 /* Function to convert from external encoding 01852 * into UTF-8. */ 01853 Tcl_EncodingConvertProc *fromUtfProc; 01854 /* Function to convert from UTF-8 into 01855 * external encoding. */ 01856 Tcl_EncodingFreeProc *freeProc; 01857 /* If non-NULL, function to call when this 01858 * encoding is deleted. */ 01859 ClientData clientData; /* Arbitrary value associated with encoding 01860 * type. Passed to conversion functions. */ 01861 int nullSize; /* Number of zero bytes that signify 01862 * end-of-string in this encoding. This number 01863 * is used to determine the source string 01864 * length when the srcLen argument is 01865 * negative. Must be 1 or 2. */ 01866 } Tcl_EncodingType; 01867 01868 /* 01869 * The following definitions are used as values for the conversion control 01870 * flags argument when converting text from one character set to another: 01871 * 01872 * TCL_ENCODING_START - Signifies that the source buffer is the first 01873 * block in a (potentially multi-block) input 01874 * stream. Tells the conversion function to reset 01875 * to an initial state and perform any 01876 * initialization that needs to occur before the 01877 * first byte is converted. If the source buffer 01878 * contains the entire input stream to be 01879 * converted, this flag should be set. 01880 * TCL_ENCODING_END - Signifies that the source buffer is the last 01881 * block in a (potentially multi-block) input 01882 * stream. Tells the conversion routine to 01883 * perform any finalization that needs to occur 01884 * after the last byte is converted and then to 01885 * reset to an initial state. If the source 01886 * buffer contains the entire input stream to be 01887 * converted, this flag should be set. 01888 * TCL_ENCODING_STOPONERROR - If set, then the converter will return 01889 * immediately upon encountering an invalid byte 01890 * sequence or a source character that has no 01891 * mapping in the target encoding. If clear, then 01892 * the converter will skip the problem, 01893 * substituting one or more "close" characters in 01894 * the destination buffer and then continue to 01895 * convert the source. 01896 */ 01897 01898 #define TCL_ENCODING_START 0x01 01899 #define TCL_ENCODING_END 0x02 01900 #define TCL_ENCODING_STOPONERROR 0x04 01901 01902 /* 01903 * The following data structures and declarations are for the new Tcl parser. 01904 */ 01905 01906 /* 01907 * For each word of a command, and for each piece of a word such as a variable 01908 * reference, one of the following structures is created to describe the 01909 * token. 01910 */ 01911 01912 typedef struct Tcl_Token { 01913 int type; /* Type of token, such as TCL_TOKEN_WORD; see 01914 * below for valid types. */ 01915 CONST char *start; /* First character in token. */ 01916 int size; /* Number of bytes in token. */ 01917 int numComponents; /* If this token is composed of other tokens, 01918 * this field tells how many of them there are 01919 * (including components of components, etc.). 01920 * The component tokens immediately follow 01921 * this one. */ 01922 } Tcl_Token; 01923 01924 /* 01925 * Type values defined for Tcl_Token structures. These values are defined as 01926 * mask bits so that it's easy to check for collections of types. 01927 * 01928 * TCL_TOKEN_WORD - The token describes one word of a command, 01929 * from the first non-blank character of the word 01930 * (which may be " or {) up to but not including 01931 * the space, semicolon, or bracket that 01932 * terminates the word. NumComponents counts the 01933 * total number of sub-tokens that make up the 01934 * word. This includes, for example, sub-tokens 01935 * of TCL_TOKEN_VARIABLE tokens. 01936 * TCL_TOKEN_SIMPLE_WORD - This token is just like TCL_TOKEN_WORD except 01937 * that the word is guaranteed to consist of a 01938 * single TCL_TOKEN_TEXT sub-token. 01939 * TCL_TOKEN_TEXT - The token describes a range of literal text 01940 * that is part of a word. NumComponents is 01941 * always 0. 01942 * TCL_TOKEN_BS - The token describes a backslash sequence that 01943 * must be collapsed. NumComponents is always 0. 01944 * TCL_TOKEN_COMMAND - The token describes a command whose result 01945 * must be substituted into the word. The token 01946 * includes the enclosing brackets. NumComponents 01947 * is always 0. 01948 * TCL_TOKEN_VARIABLE - The token describes a variable substitution, 01949 * including the dollar sign, variable name, and 01950 * array index (if there is one) up through the 01951 * right parentheses. NumComponents tells how 01952 * many additional tokens follow to represent the 01953 * variable name. The first token will be a 01954 * TCL_TOKEN_TEXT token that describes the 01955 * variable name. If the variable is an array 01956 * reference then there will be one or more 01957 * additional tokens, of type TCL_TOKEN_TEXT, 01958 * TCL_TOKEN_BS, TCL_TOKEN_COMMAND, and 01959 * TCL_TOKEN_VARIABLE, that describe the array 01960 * index; numComponents counts the total number 01961 * of nested tokens that make up the variable 01962 * reference, including sub-tokens of 01963 * TCL_TOKEN_VARIABLE tokens. 01964 * TCL_TOKEN_SUB_EXPR - The token describes one subexpression of an 01965 * expression, from the first non-blank character 01966 * of the subexpression up to but not including 01967 * the space, brace, or bracket that terminates 01968 * the subexpression. NumComponents counts the 01969 * total number of following subtokens that make 01970 * up the subexpression; this includes all 01971 * subtokens for any nested TCL_TOKEN_SUB_EXPR 01972 * tokens. For example, a numeric value used as a 01973 * primitive operand is described by a 01974 * TCL_TOKEN_SUB_EXPR token followed by a 01975 * TCL_TOKEN_TEXT token. A binary subexpression 01976 * is described by a TCL_TOKEN_SUB_EXPR token 01977 * followed by the TCL_TOKEN_OPERATOR token for 01978 * the operator, then TCL_TOKEN_SUB_EXPR tokens 01979 * for the left then the right operands. 01980 * TCL_TOKEN_OPERATOR - The token describes one expression operator. 01981 * An operator might be the name of a math 01982 * function such as "abs". A TCL_TOKEN_OPERATOR 01983 * token is always preceeded by one 01984 * TCL_TOKEN_SUB_EXPR token for the operator's 01985 * subexpression, and is followed by zero or more 01986 * TCL_TOKEN_SUB_EXPR tokens for the operator's 01987 * operands. NumComponents is always 0. 01988 * TCL_TOKEN_EXPAND_WORD - This token is just like TCL_TOKEN_WORD except 01989 * that it marks a word that began with the 01990 * literal character prefix "{*}". This word is 01991 * marked to be expanded - that is, broken into 01992 * words after substitution is complete. 01993 */ 01994 01995 #define TCL_TOKEN_WORD 1 01996 #define TCL_TOKEN_SIMPLE_WORD 2 01997 #define TCL_TOKEN_TEXT 4 01998 #define TCL_TOKEN_BS 8 01999 #define TCL_TOKEN_COMMAND 16 02000 #define TCL_TOKEN_VARIABLE 32 02001 #define TCL_TOKEN_SUB_EXPR 64 02002 #define TCL_TOKEN_OPERATOR 128 02003 #define TCL_TOKEN_EXPAND_WORD 256 02004 02005 /* 02006 * Parsing error types. On any parsing error, one of these values will be 02007 * stored in the error field of the Tcl_Parse structure defined below. 02008 */ 02009 02010 #define TCL_PARSE_SUCCESS 0 02011 #define TCL_PARSE_QUOTE_EXTRA 1 02012 #define TCL_PARSE_BRACE_EXTRA 2 02013 #define TCL_PARSE_MISSING_BRACE 3 02014 #define TCL_PARSE_MISSING_BRACKET 4 02015 #define TCL_PARSE_MISSING_PAREN 5 02016 #define TCL_PARSE_MISSING_QUOTE 6 02017 #define TCL_PARSE_MISSING_VAR_BRACE 7 02018 #define TCL_PARSE_SYNTAX 8 02019 #define TCL_PARSE_BAD_NUMBER 9 02020 02021 /* 02022 * A structure of the following type is filled in by Tcl_ParseCommand. It 02023 * describes a single command parsed from an input string. 02024 */ 02025 02026 #define NUM_STATIC_TOKENS 20 02027 02028 typedef struct Tcl_Parse { 02029 CONST char *commentStart; /* Pointer to # that begins the first of one 02030 * or more comments preceding the command. */ 02031 int commentSize; /* Number of bytes in comments (up through 02032 * newline character that terminates the last 02033 * comment). If there were no comments, this 02034 * field is 0. */ 02035 CONST char *commandStart; /* First character in first word of 02036 * command. */ 02037 int commandSize; /* Number of bytes in command, including first 02038 * character of first word, up through the 02039 * terminating newline, close bracket, or 02040 * semicolon. */ 02041 int numWords; /* Total number of words in command. May be 02042 * 0. */ 02043 Tcl_Token *tokenPtr; /* Pointer to first token representing the 02044 * words of the command. Initially points to 02045 * staticTokens, but may change to point to 02046 * malloc-ed space if command exceeds space in 02047 * staticTokens. */ 02048 int numTokens; /* Total number of tokens in command. */ 02049 int tokensAvailable; /* Total number of tokens available at 02050 * *tokenPtr. */ 02051 int errorType; /* One of the parsing error types defined 02052 * above. */ 02053 02054 /* 02055 * The fields below are intended only for the private use of the parser. 02056 * They should not be used by functions that invoke Tcl_ParseCommand. 02057 */ 02058 02059 CONST char *string; /* The original command string passed to 02060 * Tcl_ParseCommand. */ 02061 CONST char *end; /* Points to the character just after the last 02062 * one in the command string. */ 02063 Tcl_Interp *interp; /* Interpreter to use for error reporting, or 02064 * NULL. */ 02065 CONST char *term; /* Points to character in string that 02066 * terminated most recent token. Filled in by 02067 * ParseTokens. If an error occurs, points to 02068 * beginning of region where the error 02069 * occurred (e.g. the open brace if the close 02070 * brace is missing). */ 02071 int incomplete; /* This field is set to 1 by Tcl_ParseCommand 02072 * if the command appears to be incomplete. 02073 * This information is used by 02074 * Tcl_CommandComplete. */ 02075 Tcl_Token staticTokens[NUM_STATIC_TOKENS]; 02076 /* Initial space for tokens for command. This 02077 * space should be large enough to accommodate 02078 * most commands; dynamic space is allocated 02079 * for very large commands that don't fit 02080 * here. */ 02081 } Tcl_Parse; 02082 02083 /* 02084 * The following definitions are the error codes returned by the conversion 02085 * routines: 02086 * 02087 * TCL_OK - All characters were converted. 02088 * TCL_CONVERT_NOSPACE - The output buffer would not have been large 02089 * enough for all of the converted data; as many 02090 * characters as could fit were converted though. 02091 * TCL_CONVERT_MULTIBYTE - The last few bytes in the source string were 02092 * the beginning of a multibyte sequence, but 02093 * more bytes were needed to complete this 02094 * sequence. A subsequent call to the conversion 02095 * routine should pass the beginning of this 02096 * unconverted sequence plus additional bytes 02097 * from the source stream to properly convert the 02098 * formerly split-up multibyte sequence. 02099 * TCL_CONVERT_SYNTAX - The source stream contained an invalid 02100 * character sequence. This may occur if the 02101 * input stream has been damaged or if the input 02102 * encoding method was misidentified. This error 02103 * is reported only if TCL_ENCODING_STOPONERROR 02104 * was specified. 02105 * TCL_CONVERT_UNKNOWN - The source string contained a character that 02106 * could not be represented in the target 02107 * encoding. This error is reported only if 02108 * TCL_ENCODING_STOPONERROR was specified. 02109 */ 02110 02111 #define TCL_CONVERT_MULTIBYTE -1 02112 #define TCL_CONVERT_SYNTAX -2 02113 #define TCL_CONVERT_UNKNOWN -3 02114 #define TCL_CONVERT_NOSPACE -4 02115 02116 /* 02117 * The maximum number of bytes that are necessary to represent a single 02118 * Unicode character in UTF-8. The valid values should be 3 or 6 (or perhaps 1 02119 * if we want to support a non-unicode enabled core). If 3, then Tcl_UniChar 02120 * must be 2-bytes in size (UCS-2) (the default). If 6, then Tcl_UniChar must 02121 * be 4-bytes in size (UCS-4). At this time UCS-2 mode is the default and 02122 * recommended mode. UCS-4 is experimental and not recommended. It works for 02123 * the core, but most extensions expect UCS-2. 02124 */ 02125 02126 #ifndef TCL_UTF_MAX 02127 #define TCL_UTF_MAX 3 02128 #endif 02129 02130 /* 02131 * This represents a Unicode character. Any changes to this should also be 02132 * reflected in regcustom.h. 02133 */ 02134 02135 #if TCL_UTF_MAX > 3 02136 /* 02137 * unsigned int isn't 100% accurate as it should be a strict 4-byte value 02138 * (perhaps wchar_t). 64-bit systems may have troubles. The size of this 02139 * value must be reflected correctly in regcustom.h and 02140 * in tclEncoding.c. 02141 * XXX: Tcl is currently UCS-2 and planning UTF-16 for the Unicode 02142 * XXX: string rep that Tcl_UniChar represents. Changing the size 02143 * XXX: of Tcl_UniChar is /not/ supported. 02144 */ 02145 typedef unsigned int Tcl_UniChar; 02146 #else 02147 typedef unsigned short Tcl_UniChar; 02148 #endif 02149 02150 /* 02151 * TIP #59: The following structure is used in calls 'Tcl_RegisterConfig' to 02152 * provide the system with the embedded configuration data. 02153 */ 02154 02155 typedef struct Tcl_Config { 02156 CONST char *key; /* Configuration key to register. ASCII 02157 * encoded, thus UTF-8 */ 02158 CONST char *value; /* The value associated with the key. System 02159 * encoding */ 02160 } Tcl_Config; 02161 02162 /* 02163 * Flags for TIP#143 limits, detailing which limits are active in an 02164 * interpreter. Used for Tcl_{Add,Remove}LimitHandler type argument. 02165 */ 02166 02167 #define TCL_LIMIT_COMMANDS 0x01 02168 #define TCL_LIMIT_TIME 0x02 02169 02170 /* 02171 * Structure containing information about a limit handler to be called when a 02172 * command- or time-limit is exceeded by an interpreter. 02173 */ 02174 02175 typedef void (Tcl_LimitHandlerProc) _ANSI_ARGS_((ClientData clientData, 02176 Tcl_Interp *interp)); 02177 typedef void (Tcl_LimitHandlerDeleteProc) _ANSI_ARGS_((ClientData clientData)); 02178 02179 #ifndef MP_INT_DECLARED 02180 typedef struct mp_int mp_int; 02181 #define MP_INT_DECLARED 02182 #endif 02183 #ifndef MP_DIGIT_DECLARED 02184 typedef unsigned long mp_digit; 02185 #define MP_DIGIT_DECLARED 02186 #endif 02187 02188 /* 02189 * The following constant is used to test for older versions of Tcl in the 02190 * stubs tables. 02191 * 02192 * Jan Nijtman's plus patch uses 0xFCA1BACF, so we need to pick a different 02193 * value since the stubs tables don't match. 02194 */ 02195 02196 #define TCL_STUB_MAGIC ((int)0xFCA3BACF) 02197 02198 /* 02199 * The following function is required to be defined in all stubs aware 02200 * extensions. The function is actually implemented in the stub library, not 02201 * the main Tcl library, although there is a trivial implementation in the 02202 * main library in case an extension is statically linked into an application. 02203 */ 02204 02205 EXTERN CONST char * Tcl_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, 02206 CONST char *version, int exact)); 02207 EXTERN CONST char* TclTomMathInitializeStubs(Tcl_Interp* interp, 02208 CONST char* version, int epoch, int revision); 02209 02210 #ifndef USE_TCL_STUBS 02211 02212 /* 02213 * When not using stubs, make it a macro. 02214 */ 02215 02216 #define Tcl_InitStubs(interp, version, exact) \ 02217 Tcl_PkgInitStubsCheck(interp, version, exact) 02218 02219 #endif 02220 02221 /* 02222 * TODO - tommath stubs export goes here! 02223 */ 02224 02225 02226 /* 02227 * Public functions that are not accessible via the stubs table. 02228 */ 02229 02230 EXTERN void Tcl_Main _ANSI_ARGS_((int argc, char **argv, 02231 Tcl_AppInitProc *appInitProc)); 02232 02233 EXTERN CONST char *Tcl_PkgInitStubsCheck _ANSI_ARGS_((Tcl_Interp *interp, 02234 CONST char *version, int exact)); 02235 02236 /* 02237 * Include the public function declarations that are accessible via the stubs 02238 * table. 02239 */ 02240 02241 #include "tclDecls.h" 02242 02243 /* 02244 * Include platform specific public function declarations that are accessible 02245 * via the stubs table. 02246 */ 02247 02248 #include "tclPlatDecls.h" 02249 02250 /* 02251 * The following declarations either map ckalloc and ckfree to malloc and 02252 * free, or they map them to functions with all sorts of debugging hooks 02253 * defined in tclCkalloc.c. 02254 */ 02255 02256 #ifdef TCL_MEM_DEBUG 02257 02258 # define ckalloc(x) Tcl_DbCkalloc(x, __FILE__, __LINE__) 02259 # define ckfree(x) Tcl_DbCkfree(x, __FILE__, __LINE__) 02260 # define ckrealloc(x,y) Tcl_DbCkrealloc((x), (y),__FILE__, __LINE__) 02261 # define attemptckalloc(x) Tcl_AttemptDbCkalloc(x, __FILE__, __LINE__) 02262 # define attemptckrealloc(x,y) Tcl_AttemptDbCkrealloc((x), (y), __FILE__, __LINE__) 02263 02264 #else /* !TCL_MEM_DEBUG */ 02265 02266 /* 02267 * If we are not using the debugging allocator, we should call the Tcl_Alloc, 02268 * et al. routines in order to guarantee that every module is using the same 02269 * memory allocator both inside and outside of the Tcl library. 02270 */ 02271 02272 # define ckalloc(x) Tcl_Alloc(x) 02273 # define ckfree(x) Tcl_Free(x) 02274 # define ckrealloc(x,y) Tcl_Realloc(x,y) 02275 # define attemptckalloc(x) Tcl_AttemptAlloc(x) 02276 # define attemptckrealloc(x,y) Tcl_AttemptRealloc(x,y) 02277 # undef Tcl_InitMemory 02278 # define Tcl_InitMemory(x) 02279 # undef Tcl_DumpActiveMemory 02280 # define Tcl_DumpActiveMemory(x) 02281 # undef Tcl_ValidateAllMemory 02282 # define Tcl_ValidateAllMemory(x,y) 02283 02284 #endif /* !TCL_MEM_DEBUG */ 02285 02286 #ifdef TCL_MEM_DEBUG 02287 # define Tcl_IncrRefCount(objPtr) \ 02288 Tcl_DbIncrRefCount(objPtr, __FILE__, __LINE__) 02289 # define Tcl_DecrRefCount(objPtr) \ 02290 Tcl_DbDecrRefCount(objPtr, __FILE__, __LINE__) 02291 # define Tcl_IsShared(objPtr) \ 02292 Tcl_DbIsShared(objPtr, __FILE__, __LINE__) 02293 #else 02294 # define Tcl_IncrRefCount(objPtr) \ 02295 ++(objPtr)->refCount 02296 /* 02297 * Use do/while0 idiom for optimum correctness without compiler warnings 02298 * http://c2.com/cgi/wiki?TrivialDoWhileLoop 02299 */ 02300 # define Tcl_DecrRefCount(objPtr) \ 02301 do { if (--(objPtr)->refCount <= 0) TclFreeObj(objPtr); } while(0) 02302 # define Tcl_IsShared(objPtr) \ 02303 ((objPtr)->refCount > 1) 02304 #endif 02305 02306 /* 02307 * Macros and definitions that help to debug the use of Tcl objects. When 02308 * TCL_MEM_DEBUG is defined, the Tcl_New declarations are overridden to call 02309 * debugging versions of the object creation functions. 02310 */ 02311 02312 #ifdef TCL_MEM_DEBUG 02313 # undef Tcl_NewBignumObj 02314 # define Tcl_NewBignumObj(val) \ 02315 Tcl_DbNewBignumObj(val, __FILE__, __LINE__) 02316 # undef Tcl_NewBooleanObj 02317 # define Tcl_NewBooleanObj(val) \ 02318 Tcl_DbNewBooleanObj(val, __FILE__, __LINE__) 02319 # undef Tcl_NewByteArrayObj 02320 # define Tcl_NewByteArrayObj(bytes, len) \ 02321 Tcl_DbNewByteArrayObj(bytes, len, __FILE__, __LINE__) 02322 # undef Tcl_NewDoubleObj 02323 # define Tcl_NewDoubleObj(val) \ 02324 Tcl_DbNewDoubleObj(val, __FILE__, __LINE__) 02325 # undef Tcl_NewIntObj 02326 # define Tcl_NewIntObj(val) \ 02327 Tcl_DbNewLongObj(val, __FILE__, __LINE__) 02328 # undef Tcl_NewListObj 02329 # define Tcl_NewListObj(objc, objv) \ 02330 Tcl_DbNewListObj(objc, objv, __FILE__, __LINE__) 02331 # undef Tcl_NewLongObj 02332 # define Tcl_NewLongObj(val) \ 02333 Tcl_DbNewLongObj(val, __FILE__, __LINE__) 02334 # undef Tcl_NewObj 02335 # define Tcl_NewObj() \ 02336 Tcl_DbNewObj(__FILE__, __LINE__) 02337 # undef Tcl_NewStringObj 02338 # define Tcl_NewStringObj(bytes, len) \ 02339 Tcl_DbNewStringObj(bytes, len, __FILE__, __LINE__) 02340 # undef Tcl_NewWideIntObj 02341 # define Tcl_NewWideIntObj(val) \ 02342 Tcl_DbNewWideIntObj(val, __FILE__, __LINE__) 02343 #endif /* TCL_MEM_DEBUG */ 02344 02345 /* 02346 * Macros for clients to use to access fields of hash entries: 02347 */ 02348 02349 #define Tcl_GetHashValue(h) ((h)->clientData) 02350 #define Tcl_SetHashValue(h, value) ((h)->clientData = (ClientData) (value)) 02351 #define Tcl_GetHashKey(tablePtr, h) \ 02352 ((char *) (((tablePtr)->keyType == TCL_ONE_WORD_KEYS || \ 02353 (tablePtr)->keyType == TCL_CUSTOM_PTR_KEYS) \ 02354 ? (h)->key.oneWordValue \ 02355 : (h)->key.string)) 02356 02357 /* 02358 * Macros to use for clients to use to invoke find and create functions for 02359 * hash tables: 02360 */ 02361 02362 #undef Tcl_FindHashEntry 02363 #define Tcl_FindHashEntry(tablePtr, key) \ 02364 (*((tablePtr)->findProc))(tablePtr, key) 02365 #undef Tcl_CreateHashEntry 02366 #define Tcl_CreateHashEntry(tablePtr, key, newPtr) \ 02367 (*((tablePtr)->createProc))(tablePtr, key, newPtr) 02368 02369 /* 02370 * Macros that eliminate the overhead of the thread synchronization functions 02371 * when compiling without thread support. 02372 */ 02373 02374 #ifndef TCL_THREADS 02375 #undef Tcl_MutexLock 02376 #define Tcl_MutexLock(mutexPtr) 02377 #undef Tcl_MutexUnlock 02378 #define Tcl_MutexUnlock(mutexPtr) 02379 #undef Tcl_MutexFinalize 02380 #define Tcl_MutexFinalize(mutexPtr) 02381 #undef Tcl_ConditionNotify 02382 #define Tcl_ConditionNotify(condPtr) 02383 #undef Tcl_ConditionWait 02384 #define Tcl_ConditionWait(condPtr, mutexPtr, timePtr) 02385 #undef Tcl_ConditionFinalize 02386 #define Tcl_ConditionFinalize(condPtr) 02387 #endif /* TCL_THREADS */ 02388 02389 #ifndef TCL_NO_DEPRECATED 02390 /* 02391 * Deprecated Tcl functions: 02392 */ 02393 02394 # undef Tcl_EvalObj 02395 # define Tcl_EvalObj(interp,objPtr) \ 02396 Tcl_EvalObjEx((interp),(objPtr),0) 02397 # undef Tcl_GlobalEvalObj 02398 # define Tcl_GlobalEvalObj(interp,objPtr) \ 02399 Tcl_EvalObjEx((interp),(objPtr),TCL_EVAL_GLOBAL) 02400 02401 /* 02402 * These function have been renamed. The old names are deprecated, but we 02403 * define these macros for backwards compatibilty. 02404 */ 02405 02406 # define Tcl_Ckalloc Tcl_Alloc 02407 # define Tcl_Ckfree Tcl_Free 02408 # define Tcl_Ckrealloc Tcl_Realloc 02409 # define Tcl_Return Tcl_SetResult 02410 # define Tcl_TildeSubst Tcl_TranslateFileName 02411 # define panic Tcl_Panic 02412 # define panicVA Tcl_PanicVA 02413 #endif 02414 02415 /* 02416 * Convenience declaration of Tcl_AppInit for backwards compatibility. This 02417 * function is not *implemented* by the tcl library, so the storage class is 02418 * neither DLLEXPORT nor DLLIMPORT. 02419 */ 02420 02421 #undef TCL_STORAGE_CLASS 02422 #define TCL_STORAGE_CLASS 02423 02424 EXTERN int Tcl_AppInit _ANSI_ARGS_((Tcl_Interp *interp)); 02425 02426 #undef TCL_STORAGE_CLASS 02427 #define TCL_STORAGE_CLASS DLLIMPORT 02428 02429 #endif /* RC_INVOKED */ 02430 02431 /* 02432 * end block for C++ 02433 */ 02434 02435 #ifdef __cplusplus 02436 } 02437 #endif 02438 02439 #endif /* _TCL */ 02440 02441 /* 02442 * Local Variables: 02443 * mode: c 02444 * c-basic-offset: 4 02445 * fill-column: 78 02446 * End: 02447 */
Generated on Wed Mar 12 12:18:11 2008 by 1.5.1 |