1/* 2 * tcl.h -- 3 * 4 * This header file describes the externally-visible facilities 5 * of the Tcl interpreter. 6 * 7 * Copyright (c) 1987-1994 The Regents of the University of California. 8 * Copyright (c) 1994-1996 Sun Microsystems, Inc. 9 * 10 * See the file "license.terms" for information on usage and redistribution 11 * of this file, and for a DISCLAIMER OF ALL WARRANTIES. 12 * 13 * SCCS: @(#) tcl.h 1.296 96/12/17 15:30:07 14 */ 15 16#ifndef _TCL 17#define _TCL 18 19/* 20 * When version numbers change here, must also go into the following files 21 * and update the version numbers: 22 * 23 * library/init.tcl 24 * unix/configure.in 25 * unix/pkginfo 26 * win/makefile.bc 27 * win/makefile.vc 28 * 29 * The release level should be 0 for alpha, 1 for beta, and 2 for 30 * final/patch. The release serial value is the number that follows the 31 * "a", "b", or "p" in the patch level; for example, if the patch level 32 * is 7.6b2, TCL_RELEASE_SERIAL is 2. It restarts at 1 whenever the 33 * release level is changed, except for the final release which is 0 34 * (the first patch will start at 1). 35 */ 36 37#define TCL_MAJOR_VERSION 8 38#define TCL_MINOR_VERSION 0 39#define TCL_RELEASE_LEVEL 0 40#define TCL_RELEASE_SERIAL 1 41 42#define TCL_VERSION "8.0" 43#define TCL_PATCH_LEVEL "8.0a1" 44 45/* 46 * The following definitions set up the proper options for Windows 47 * compilers. We use this method because there is no autoconf equivalent. 48 */ 49 50#ifndef __WIN32__ 51# if defined(_WIN32) || defined(WIN32) 52# define __WIN32__ 53# endif 54#endif 55 56#ifdef __WIN32__ 57# ifndef STRICT 58# define STRICT 59# endif 60# ifndef USE_PROTOTYPE 61# define USE_PROTOTYPE 1 62# endif 63# ifndef HAS_STDARG 64# define HAS_STDARG 1 65# endif 66# ifndef USE_PROTOTYPE 67# define USE_PROTOTYPE 1 68# endif 69# ifndef USE_TCLALLOC 70# define USE_TCLALLOC 1 71# endif 72# ifndef STRINGIFY 73# define STRINGIFY(x) STRINGIFY1(x) 74# define STRINGIFY1(x) #x 75# endif 76#endif /* __WIN32__ */ 77 78/* 79 * The following definitions set up the proper options for Macintosh 80 * compilers. We use this method because there is no autoconf equivalent. 81 */ 82 83#ifdef MAC_TCL 84# ifndef HAS_STDARG 85# define HAS_STDARG 1 86# endif 87# ifndef USE_TCLALLOC 88# define USE_TCLALLOC 1 89# endif 90# ifndef NO_STRERROR 91# define NO_STRERROR 1 92# endif 93#endif 94 95/* 96 * A special definition used to allow this header file to be included 97 * in resource files so that they can get obtain version information from 98 * this file. Resource compilers don't like all the C stuff, like typedefs 99 * and procedure declarations, that occur below. 100 */ 101 102#ifndef RESOURCE_INCLUDED 103 104#ifndef BUFSIZ 105#include <stdio.h> 106#endif 107 108/* 109 * Definitions that allow Tcl functions with variable numbers of 110 * arguments to be used with either varargs.h or stdarg.h. TCL_VARARGS 111 * is used in procedure prototypes. TCL_VARARGS_DEF is used to declare 112 * the arguments in a function definiton: it takes the type and name of 113 * the first argument and supplies the appropriate argument declaration 114 * string for use in the function definition. TCL_VARARGS_START 115 * initializes the va_list data structure and returns the first argument. 116 */ 117 118#if defined(__STDC__) || defined(HAS_STDARG) 119# define TCL_VARARGS(type, name) (type name, ...) 120# define TCL_VARARGS_DEF(type, name) (type name, ...) 121# define TCL_VARARGS_START(type, name, list) (va_start(list, name), name) 122#else 123# ifdef __cplusplus 124# define TCL_VARARGS(type, name) (type name, ...) 125# define TCL_VARARGS_DEF(type, name) (type va_alist, ...) 126# else 127# define TCL_VARARGS(type, name) () 128# define TCL_VARARGS_DEF(type, name) (va_alist) 129# endif 130# define TCL_VARARGS_START(type, name, list) \ 131 (va_start(list), va_arg(list, type)) 132#endif 133 134/* 135 * Definitions that allow this header file to be used either with or 136 * without ANSI C features like function prototypes. 137 */ 138 139#undef _ANSI_ARGS_ 140#undef CONST 141 142#if ((defined(__STDC__) || defined(SABER)) && !defined(NO_PROTOTYPE)) || defined(__cplusplus) || defined(USE_PROTOTYPE) 143# define _USING_PROTOTYPES_ 1 144# define _ANSI_ARGS_(x) x 145# define CONST const 146#else 147# define _ANSI_ARGS_(x) () 148# define CONST 149#endif 150 151#ifdef __cplusplus 152# define EXTERN extern "C" 153#else 154# define EXTERN extern 155#endif 156 157/* 158 * Macro to use instead of "void" for arguments that must have 159 * type "void *" in ANSI C; maps them to type "char *" in 160 * non-ANSI systems. 161 */ 162#ifndef __WIN32__ 163#ifndef VOID 164# ifdef __STDC__ 165# define VOID void 166# else 167# define VOID char 168# endif 169#endif 170#else /* __WIN32__ */ 171/* 172 * The following code is copied from winnt.h 173 */ 174#ifndef VOID 175#define VOID void 176typedef char CHAR; 177typedef short SHORT; 178typedef long LONG; 179#endif 180#endif /* __WIN32__ */ 181 182/* 183 * Miscellaneous declarations. 184 */ 185 186#ifndef NULL 187#define NULL 0 188#endif 189 190#ifndef _CLIENTDATA 191# if defined(__STDC__) || defined(__cplusplus) 192 typedef void *ClientData; 193# else 194 typedef int *ClientData; 195# endif /* __STDC__ */ 196#define _CLIENTDATA 197#endif 198 199/* 200 * Data structures defined opaquely in this module. The definitions 201 * below just provide dummy types. A few fields are made visible in 202 * Tcl_Interp structures, namely those for returning string values. 203 * Note: any change to the Tcl_Interp definition below must be mirrored 204 * in the "real" definition in tclInt.h. 205 * Note: Tcl_ObjCmdProc procedures do not directly set result and freeProc. 206 * Instead, they set a Tcl_Obj member in the "real" structure that can be 207 * accessed with Tcl_GetObjResult() and Tcl_SetObjResult(). 208 */ 209 210typedef struct Tcl_Interp { 211 char *result; /* Points to result string returned by last 212 * command. */ 213 void (*freeProc) _ANSI_ARGS_((char *blockPtr)); 214 /* Zero means result is statically allocated. 215 * TCL_DYNAMIC means result was allocated with 216 * ckalloc and should be freed with ckfree. 217 * Other values give address of procedure 218 * to invoke to free the result. Must be 219 * freed by Tcl_Eval before executing next 220 * command. */ 221 int errorLine; /* When TCL_ERROR is returned, this gives 222 * the line number within the command where 223 * the error occurred (1 means first line). */ 224} Tcl_Interp; 225 226typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler; 227typedef struct Tcl_Command_ *Tcl_Command; 228typedef struct Tcl_Event Tcl_Event; 229typedef struct Tcl_File_ *Tcl_File; 230typedef struct Tcl_Channel_ *Tcl_Channel; 231typedef struct Tcl_RegExp_ *Tcl_RegExp; 232typedef struct Tcl_TimerToken_ *Tcl_TimerToken; 233typedef struct Tcl_Trace_ *Tcl_Trace; 234typedef struct Tcl_Pid_ *Tcl_Pid; 235 236/* 237 * When a TCL command returns, the string pointer interp->result points to 238 * a string containing return information from the command. In addition, 239 * the command procedure returns an integer value, which is one of the 240 * following: 241 * 242 * TCL_OK Command completed normally; interp->result contains 243 * the command's result. 244 * TCL_ERROR The command couldn't be completed successfully; 245 * interp->result describes what went wrong. 246 * TCL_RETURN The command requests that the current procedure 247 * return; interp->result contains the procedure's 248 * return value. 249 * TCL_BREAK The command requests that the innermost loop 250 * be exited; interp->result is meaningless. 251 * TCL_CONTINUE Go on to the next iteration of the current loop; 252 * interp->result is meaningless. 253 */ 254 255#define TCL_OK 0 256#define TCL_ERROR 1 257#define TCL_RETURN 2 258#define TCL_BREAK 3 259#define TCL_CONTINUE 4 260 261#define TCL_RESULT_SIZE 200 262 263/* 264 * Argument descriptors for math function callbacks in expressions: 265 */ 266 267typedef enum {TCL_INT, TCL_DOUBLE, TCL_EITHER} Tcl_ValueType; 268typedef struct Tcl_Value { 269 Tcl_ValueType type; /* Indicates intValue or doubleValue is 270 * valid, or both. */ 271 long intValue; /* Integer value. */ 272 double doubleValue; /* Double-precision floating value. */ 273} Tcl_Value; 274 275/* 276 * Forward declaration of Tcl_Obj to prevent an error when the forward 277 * reference to Tcl_Obj is encountered in the procedure types declared 278 * below. 279 */ 280 281struct Tcl_Obj; 282 283/* 284 * Procedure types defined by Tcl: 285 */ 286 287typedef int (Tcl_AppInitProc) _ANSI_ARGS_((Tcl_Interp *interp)); 288typedef int (Tcl_AsyncProc) _ANSI_ARGS_((ClientData clientData, 289 Tcl_Interp *interp, int code)); 290typedef void (Tcl_ChannelProc) _ANSI_ARGS_((ClientData clientData, int mask)); 291typedef void (Tcl_CloseProc) _ANSI_ARGS_((ClientData data)); 292typedef void (Tcl_CmdDeleteProc) _ANSI_ARGS_((ClientData clientData)); 293typedef int (Tcl_CmdProc) _ANSI_ARGS_((ClientData clientData, 294 Tcl_Interp *interp, int argc, char *argv[])); 295typedef void (Tcl_CmdTraceProc) _ANSI_ARGS_((ClientData clientData, 296 Tcl_Interp *interp, int level, char *command, Tcl_CmdProc *proc, 297 ClientData cmdClientData, int argc, char *argv[])); 298typedef void (Tcl_DupInternalRepProc) _ANSI_ARGS_((struct Tcl_Obj *srcPtr, 299 struct Tcl_Obj *dupPtr)); 300typedef int (Tcl_EventProc) _ANSI_ARGS_((Tcl_Event *evPtr, int flags)); 301typedef void (Tcl_EventCheckProc) _ANSI_ARGS_((ClientData clientData, 302 int flags)); 303typedef int (Tcl_EventDeleteProc) _ANSI_ARGS_((Tcl_Event *evPtr, 304 ClientData clientData)); 305typedef void (Tcl_EventSetupProc) _ANSI_ARGS_((ClientData clientData, 306 int flags)); 307typedef void (Tcl_ExitProc) _ANSI_ARGS_((ClientData clientData)); 308typedef void (Tcl_FileProc) _ANSI_ARGS_((ClientData clientData, int mask)); 309typedef void (Tcl_FileFreeProc) _ANSI_ARGS_((ClientData clientData)); 310typedef void (Tcl_FreeInternalRepProc) _ANSI_ARGS_((struct Tcl_Obj *objPtr)); 311typedef void (Tcl_FreeProc) _ANSI_ARGS_((char *blockPtr)); 312typedef void (Tcl_IdleProc) _ANSI_ARGS_((ClientData clientData)); 313typedef void (Tcl_InterpDeleteProc) _ANSI_ARGS_((ClientData clientData, 314 Tcl_Interp *interp)); 315typedef int (Tcl_MathProc) _ANSI_ARGS_((ClientData clientData, 316 Tcl_Interp *interp, Tcl_Value *args, Tcl_Value *resultPtr)); 317typedef int (Tcl_ObjCmdProc) _ANSI_ARGS_((ClientData clientData, 318 Tcl_Interp *interp, int objc, struct Tcl_Obj *objv[])); 319typedef int (Tcl_PackageInitProc) _ANSI_ARGS_((Tcl_Interp *interp)); 320typedef void (Tcl_TcpAcceptProc) _ANSI_ARGS_((ClientData callbackData, 321 Tcl_Channel chan, char *address, int port)); 322typedef void (Tcl_TimerProc) _ANSI_ARGS_((ClientData clientData)); 323typedef int (Tcl_SetFromAnyProc) _ANSI_ARGS_((Tcl_Interp *interp, 324 struct Tcl_Obj *objPtr)); 325typedef void (Tcl_UpdateStringProc) _ANSI_ARGS_((Tcl_Interp *interp, 326 struct Tcl_Obj *objPtr)); 327typedef char *(Tcl_VarTraceProc) _ANSI_ARGS_((ClientData clientData, 328 Tcl_Interp *interp, char *part1, char *part2, int flags)); 329 330/* 331 * Tcl_Objs provide a general-purpose mechanism for storing and exchanging 332 * Tcl values. A Tcl_Obj has two representations: a string and an internal 333 * representation such as an integer or bytecode structure. The two 334 * representations are a cache of each other and are regenerated lazily: 335 * changing one invalidates the other, which will only be recomputed when 336 * necessary. As an example, a Tcl program doing integer calculations can 337 * operate directly on a variable's internal (machine) integer 338 * representation without having to constantly convert between integers and 339 * strings. Only when it needs a string representing the variable's value, 340 * say to print it, will the program regenerate the string representation 341 * from the integer. 342 * 343 * The internal representation is created and manipulated by 344 * Tcl_ConvertToType and the various type-specific procedures such as 345 * Tcl_StringObjAppend and Tcl_GetBooleanFromObj. Whenever the internal 346 * representation is changed, the string rep is invalidated by setting its 347 * char * byte pointer NULL. The string rep will be regenerated, if needed 348 * later, by procedures such as Tcl_GetStringFromObj. Similarly, whenever 349 * the string is changed, the internal form is invalidated by setting its 350 * type pointer NULL. Because of this invalidation and regeneration, it is 351 * dangerous for clients to access Tcl_Obj fields directly; they should only 352 * use procedures like Tcl_GetStringFromObj to access Tcl_Obj information. 353 * 354 * The string representation is not the traditional NULL-terminated C 355 * string. Instead, it is a counted string: a pointer to an array of bytes 356 * allocated on the heap and a length. This allows a Tcl object's string to 357 * contain binary data with embedded NULLs. We require the byte array to 358 * have a NULL after the last byte. This makes it possible to pass the byte 359 * pointer directly to procedures that expect a NULL-terminated C string 360 * without copying the byte array. Of course this can only be done when the 361 * byte array does not contain an embedded NULL. Note that this requirement 362 * forces programs to allocate enough storage for the string's bytes and 363 * the terminating NULL. 364 * 365 * By convention, an object representing an empty string is represented by 366 * an object with a NULL string rep "bytes" pointer and a NULL type pointer. 367 */ 368 369typedef struct Tcl_ObjType { 370 char *name; /* Name of the type, e.g. "int". */ 371 Tcl_FreeInternalRepProc *freeIntRepProc; 372 /* Called to free any storage for the type's 373 * internal rep. NULL if the internal rep 374 * does not need freeing. */ 375 Tcl_DupInternalRepProc *dupIntRepProc; 376 /* Called to create a new object as a copy 377 * of an existing object. */ 378 Tcl_UpdateStringProc *updateStringProc; 379 /* Called to update the string rep from the 380 * type's internal representation. */ 381 Tcl_SetFromAnyProc *setFromAnyProc; 382 /* Called to convert the object's internal 383 * rep to this type. Frees the internal rep 384 * of the old type. Returns TCL_ERROR on 385 * failure. */ 386} Tcl_ObjType; 387 388typedef struct Tcl_Obj { 389 int refCount; /* When 0 the object will be freed. */ 390 char *bytes; /* This points to the first byte of the 391 * object's string rep. The "length" member 392 * gives the number of bytes in the byte 393 * array. The array must be followed by a 394 * NULL byte (i.e., at offset length). The 395 * array's storage is allocated by ckalloc. 396 * NULL indicates the string rep is empty or 397 * invalid and must be regenerated from the 398 * internal rep. Clients should use 399 * Tcl_GetStringFromObj to get a 400 * pointer to the byte array as a readonly 401 * value. As a special case, if both bytes 402 * and typePtr are NULL, the object 403 * represents an empty string. */ 404 int length; /* The number of bytes in the string rep's 405 * byte array. */ 406 Tcl_ObjType *typePtr; /* Denotes the object's type. Always 407 * corresponds to the type of the object's 408 * internal rep. NULL indicates the object 409 * has no internal rep (has no type). If 410 * both string and typePtr are NULL, the 411 * Tcl_Obj represents an empty string. */ 412 union { /* The internal representation: */ 413 long intValue; /* - an integer value */ 414 double doubleValue; /* - a double-precision floating value */ 415 VOID *otherValuePtr; /* - another, type-specific value */ 416 struct { /* - internal rep as two pointers */ 417 VOID *ptr1; 418 VOID *ptr2; 419 } twoPtrValue; 420 } internalRep; 421} Tcl_Obj; 422 423/* 424 * Macros to increment and decrement a Tcl_Obj's reference count, and to 425 * test whether an object is shared (i.e. has reference count > 1). 426 * Note: clients should use Tcl_DecrRefCount() when they are finished using 427 * an object, and should never call TclFreeObj() directly. TclFreeObj() is 428 * only defined and made public in tcl.h to support Tcl_DecrRefCount's macro 429 * definition. Note also that Tcl_DecrRefCount() refers to the parameter 430 * "obj" twice. This means that you should avoid calling it with an 431 * expression that is expensive to compute or has side effects. 432 */ 433 434#define Tcl_IncrRefCount(objPtr) \ 435 ++(objPtr)->refCount 436#define Tcl_DecrRefCount(objPtr) \ 437 if (--(objPtr)->refCount <= 0) TclFreeObj(objPtr) 438#define Tcl_IsShared(objPtr) \ 439 ((objPtr)->refCount > 1) 440 441/* 442 * Information about commands that is returned by Tcl_GetCmdInfo and passed 443 * to Tcl_SetCmdInfo. proc is a traditional Tcl argc/argv string-based 444 * command procedure while objProc is an objc/objv object-based procedure. 445 * objProc is called directly by the bytecode interpreter whenever the 446 * command is invoked. proc is only called by the compatibility routine 447 * TclInvokeStringCommand when no object-based procedure was otherwise 448 * defined for a command. Tcl_CreateCommand and Tcl_CreateObjCommand 449 * ensure that both proc and objProc are non-NULL. 450 */ 451 452typedef struct Tcl_CmdInfo { 453 Tcl_CmdProc *proc; /* Command's string-based procedure. */ 454 Tcl_ObjCmdProc *objProc; /* Command's object-based procedure. */ 455 ClientData clientData; /* ClientData for string proc. */ 456 ClientData objClientData; /* ClientData for object proc. */ 457 Tcl_CmdDeleteProc *deleteProc; 458 /* Procedure to call when command is 459 * deleted. */ 460 ClientData deleteData; /* Value to pass to deleteProc (usually 461 * the same as clientData). */ 462} Tcl_CmdInfo; 463 464/* 465 * The structure defined below is used to hold dynamic strings. The only 466 * field that clients should use is the string field, and they should 467 * never modify it. 468 */ 469 470#define TCL_DSTRING_STATIC_SIZE 200 471typedef struct Tcl_DString { 472 char *string; /* Points to beginning of string: either 473 * staticSpace below or a malloc'ed array. */ 474 int length; /* Number of non-NULL characters in the 475 * string. */ 476 int spaceAvl; /* Total number of bytes available for the 477 * string and its terminating NULL char. */ 478 char staticSpace[TCL_DSTRING_STATIC_SIZE]; 479 /* Space to use in common case where string 480 * is small. */ 481} Tcl_DString; 482 483#define Tcl_DStringLength(dsPtr) ((dsPtr)->length) 484#define Tcl_DStringValue(dsPtr) ((dsPtr)->string) 485#define Tcl_DStringTrunc Tcl_DStringSetLength 486 487/* 488 * Definitions for the maximum number of digits of precision that may 489 * be specified in the "tcl_precision" variable, and the number of 490 * characters of buffer space required by Tcl_PrintDouble. 491 */ 492 493#define TCL_MAX_PREC 17 494#define TCL_DOUBLE_SPACE (TCL_MAX_PREC+10) 495 496/* 497 * Flag that may be passed to Tcl_ConvertElement to force it not to 498 * output braces (careful! if you change this flag be sure to change 499 * the definitions at the front of tclUtil.c). 500 */ 501 502#define TCL_DONT_USE_BRACES 1 503 504/* 505 * Flag values passed to Tcl_RecordAndEval. 506 * WARNING: these bit choices must not conflict with the bit choices 507 * for evalFlag bits in tclInt.h!! 508 */ 509 510#define TCL_NO_EVAL 0x10000 511#define TCL_EVAL_GLOBAL 0x20000 512 513/* 514 * Special freeProc values that may be passed to Tcl_SetResult (see 515 * the man page for details): 516 */ 517 518#define TCL_VOLATILE ((Tcl_FreeProc *) 1) 519#define TCL_STATIC ((Tcl_FreeProc *) 0) 520#define TCL_DYNAMIC ((Tcl_FreeProc *) 3) 521 522/* 523 * Flag values passed to variable-related procedures. 524 */ 525 526#define TCL_GLOBAL_ONLY 1 527#define TCL_APPEND_VALUE 2 528#define TCL_LIST_ELEMENT 4 529#define TCL_TRACE_READS 0x10 530#define TCL_TRACE_WRITES 0x20 531#define TCL_TRACE_UNSETS 0x40 532#define TCL_TRACE_DESTROYED 0x80 533#define TCL_INTERP_DESTROYED 0x100 534#define TCL_LEAVE_ERR_MSG 0x200 535#define TCL_PART1_NOT_PARSED 0x400 536 537/* 538 * Types for linked variables: 539 */ 540 541#define TCL_LINK_INT 1 542#define TCL_LINK_DOUBLE 2 543#define TCL_LINK_BOOLEAN 3 544#define TCL_LINK_STRING 4 545#define TCL_LINK_READ_ONLY 0x80 546 547/* 548 * The following declarations either map ckalloc and ckfree to 549 * malloc and free, or they map them to procedures with all sorts 550 * of debugging hooks defined in tclCkalloc.c. 551 */ 552 553EXTERN char * Tcl_Alloc _ANSI_ARGS_((unsigned int size)); 554EXTERN void Tcl_Free _ANSI_ARGS_((char *ptr)); 555EXTERN char * Tcl_Realloc _ANSI_ARGS_((char *ptr, 556 unsigned int size)); 557 558#ifdef TCL_MEM_DEBUG 559 560# define Tcl_Alloc(x) Tcl_DbCkalloc(x, __FILE__, __LINE__) 561# define Tcl_Free(x) Tcl_DbCkfree(x, __FILE__, __LINE__) 562# define Tcl_Realloc(x,y) Tcl_DbCkrealloc((x), (y),__FILE__, __LINE__) 563# define ckalloc(x) Tcl_DbCkalloc(x, __FILE__, __LINE__) 564# define ckfree(x) Tcl_DbCkfree(x, __FILE__, __LINE__) 565# define ckrealloc(x,y) Tcl_DbCkrealloc((x), (y),__FILE__, __LINE__) 566 567EXTERN int Tcl_DumpActiveMemory _ANSI_ARGS_((char *fileName)); 568EXTERN void Tcl_ValidateAllMemory _ANSI_ARGS_((char *file, 569 int line)); 570 571#else 572 573# if USE_TCLALLOC 574# define ckalloc(x) Tcl_Alloc(x) 575# define ckfree(x) Tcl_Free(x) 576# define ckrealloc(x,y) Tcl_Realloc(x,y) 577# else 578# define ckalloc(x) malloc(x) 579# define ckfree(x) free(x) 580# define ckrealloc(x,y) realloc(x,y) 581# endif 582# define Tcl_DumpActiveMemory(x) 583# define Tcl_ValidateAllMemory(x,y) 584 585#endif /* TCL_MEM_DEBUG */ 586 587/* 588 * Macros to free up result of interpreter. 589 */ 590 591#define Tcl_FreeResult(interp) \ 592 if ((interp)->freeProc != 0) { \ 593 if (((interp)->freeProc == TCL_DYNAMIC) \ 594 || ((interp)->freeProc == (Tcl_FreeProc *) free)) { \ 595 ckfree((interp)->result); \ 596 } else { \ 597 (*(interp)->freeProc)((interp)->result); \ 598 } \ 599 (interp)->freeProc = 0; \ 600 } 601 602/* 603 * Forward declaration of Tcl_HashTable. Needed by some C++ compilers 604 * to prevent errors when the forward reference to Tcl_HashTable is 605 * encountered in the Tcl_HashEntry structure. 606 */ 607 608#ifdef __cplusplus 609struct Tcl_HashTable; 610#endif 611 612/* 613 * Structure definition for an entry in a hash table. No-one outside 614 * Tcl should access any of these fields directly; use the macros 615 * defined below. 616 */ 617 618typedef struct Tcl_HashEntry { 619 struct Tcl_HashEntry *nextPtr; /* Pointer to next entry in this 620 * hash bucket, or NULL for end of 621 * chain. */ 622 struct Tcl_HashTable *tablePtr; /* Pointer to table containing entry. */ 623 struct Tcl_HashEntry **bucketPtr; /* Pointer to bucket that points to 624 * first entry in this entry's chain: 625 * used for deleting the entry. */ 626 ClientData clientData; /* Application stores something here 627 * with Tcl_SetHashValue. */ 628 union { /* Key has one of these forms: */ 629 char *oneWordValue; /* One-word value for key. */ 630 int words[1]; /* Multiple integer words for key. 631 * The actual size will be as large 632 * as necessary for this table's 633 * keys. */ 634 char string[4]; /* String for key. The actual size 635 * will be as large as needed to hold 636 * the key. */ 637 } key; /* MUST BE LAST FIELD IN RECORD!! */ 638} Tcl_HashEntry; 639 640/* 641 * Structure definition for a hash table. Must be in tcl.h so clients 642 * can allocate space for these structures, but clients should never 643 * access any fields in this structure. 644 */ 645 646#define TCL_SMALL_HASH_TABLE 4 647typedef struct Tcl_HashTable { 648 Tcl_HashEntry **buckets; /* Pointer to bucket array. Each 649 * element points to first entry in 650 * bucket's hash chain, or NULL. */ 651 Tcl_HashEntry *staticBuckets[TCL_SMALL_HASH_TABLE]; 652 /* Bucket array used for small tables 653 * (to avoid mallocs and frees). */ 654 int numBuckets; /* Total number of buckets allocated 655 * at **bucketPtr. */ 656 int numEntries; /* Total number of entries present 657 * in table. */ 658 int rebuildSize; /* Enlarge table when numEntries gets 659 * to be this large. */ 660 int downShift; /* Shift count used in hashing 661 * function. Designed to use high- 662 * order bits of randomized keys. */ 663 int mask; /* Mask value used in hashing 664 * function. */ 665 int keyType; /* Type of keys used in this table. 666 * It's either TCL_STRING_KEYS, 667 * TCL_ONE_WORD_KEYS, or an integer 668 * giving the number of ints that 669 * is the size of the key. 670 */ 671 Tcl_HashEntry *(*findProc) _ANSI_ARGS_((struct Tcl_HashTable *tablePtr, 672 CONST char *key)); 673 Tcl_HashEntry *(*createProc) _ANSI_ARGS_((struct Tcl_HashTable *tablePtr, 674 CONST char *key, int *newPtr)); 675} Tcl_HashTable; 676 677/* 678 * Structure definition for information used to keep track of searches 679 * through hash tables: 680 */ 681 682typedef struct Tcl_HashSearch { 683 Tcl_HashTable *tablePtr; /* Table being searched. */ 684 int nextIndex; /* Index of next bucket to be 685 * enumerated after present one. */ 686 Tcl_HashEntry *nextEntryPtr; /* Next entry to be enumerated in the 687 * the current bucket. */ 688} Tcl_HashSearch; 689 690/* 691 * Acceptable key types for hash tables: 692 */ 693 694#define TCL_STRING_KEYS 0 695#define TCL_ONE_WORD_KEYS 1 696 697/* 698 * Macros for clients to use to access fields of hash entries: 699 */ 700 701#define Tcl_GetHashValue(h) ((h)->clientData) 702#define Tcl_SetHashValue(h, value) ((h)->clientData = (ClientData) (value)) 703#define Tcl_GetHashKey(tablePtr, h) \ 704 ((char *) (((tablePtr)->keyType == TCL_ONE_WORD_KEYS) ? (h)->key.oneWordValue \ 705 : (h)->key.string)) 706 707/* 708 * Macros to use for clients to use to invoke find and create procedures 709 * for hash tables: 710 */ 711 712#define Tcl_FindHashEntry(tablePtr, key) \ 713 (*((tablePtr)->findProc))(tablePtr, key) 714#define Tcl_CreateHashEntry(tablePtr, key, newPtr) \ 715 (*((tablePtr)->createProc))(tablePtr, key, newPtr) 716 717/* 718 * Flag values to pass to Tcl_DoOneEvent to disable searches 719 * for some kinds of events: 720 */ 721 722#define TCL_DONT_WAIT (1<<1) 723#define TCL_WINDOW_EVENTS (1<<2) 724#define TCL_FILE_EVENTS (1<<3) 725#define TCL_TIMER_EVENTS (1<<4) 726#define TCL_IDLE_EVENTS (1<<5) /* WAS 0x10 ???? */ 727#define TCL_ALL_EVENTS (~TCL_DONT_WAIT) 728 729/* 730 * The following structure defines a generic event for the Tcl event 731 * system. These are the things that are queued in calls to Tcl_QueueEvent 732 * and serviced later by Tcl_DoOneEvent. There can be many different 733 * kinds of events with different fields, corresponding to window events, 734 * timer events, etc. The structure for a particular event consists of 735 * a Tcl_Event header followed by additional information specific to that 736 * event. 737 */ 738 739struct Tcl_Event { 740 Tcl_EventProc *proc; /* Procedure to call to service this event. */ 741 struct Tcl_Event *nextPtr; /* Next in list of pending events, or NULL. */ 742}; 743 744/* 745 * Positions to pass to Tk_QueueEvent: 746 */ 747 748typedef enum { 749 TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, TCL_QUEUE_MARK 750} Tcl_QueuePosition; 751 752/* 753 * The following structure keeps is used to hold a time value, either as 754 * an absolute time (the number of seconds from the epoch) or as an 755 * elapsed time. On Unix systems the epoch is Midnight Jan 1, 1970 GMT. 756 * On Macintosh systems the epoch is Midnight Jan 1, 1904 GMT. 757 */ 758 759typedef struct Tcl_Time { 760 long sec; /* Seconds. */ 761 long usec; /* Microseconds. */ 762} Tcl_Time; 763 764/* 765 * Bits to pass to Tcl_CreateFileHandler and Tcl_CreateChannelHandler 766 * to indicate what sorts of events are of interest: 767 */ 768 769#define TCL_READABLE (1<<1) 770#define TCL_WRITABLE (1<<2) 771#define TCL_EXCEPTION (1<<3) 772 773/* 774 * Flag values to pass to Tcl_OpenCommandChannel to indicate the 775 * disposition of the stdio handles. TCL_STDIN, TCL_STDOUT, TCL_STDERR, 776 * are also used in Tcl_GetStdChannel. 777 */ 778 779#define TCL_STDIN (1<<1) 780#define TCL_STDOUT (1<<2) 781#define TCL_STDERR (1<<3) 782#define TCL_ENFORCE_MODE (1<<4) 783 784/* 785 * Typedefs for the various operations in a channel type: 786 */ 787 788typedef int (Tcl_DriverBlockModeProc) _ANSI_ARGS_((ClientData instanceData, 789 int mode)); 790typedef int (Tcl_DriverCloseProc) _ANSI_ARGS_((ClientData instanceData, 791 Tcl_Interp *interp)); 792typedef int (Tcl_DriverInputProc) _ANSI_ARGS_((ClientData instanceData, 793 char *buf, int toRead, int *errorCodePtr)); 794typedef int (Tcl_DriverOutputProc) _ANSI_ARGS_((ClientData instanceData, 795 char *buf, int toWrite, int *errorCodePtr)); 796typedef int (Tcl_DriverSeekProc) _ANSI_ARGS_((ClientData instanceData, 797 long offset, int mode, int *errorCodePtr)); 798typedef int (Tcl_DriverSetOptionProc) _ANSI_ARGS_(( 799 ClientData instanceData, Tcl_Interp *interp, 800 char *optionName, char *value)); 801typedef int (Tcl_DriverGetOptionProc) _ANSI_ARGS_(( 802 ClientData instanceData, char *optionName, 803 Tcl_DString *dsPtr)); 804typedef void (Tcl_DriverWatchChannelProc) _ANSI_ARGS_(( 805 ClientData instanceData, int mask)); 806typedef int (Tcl_DriverChannelReadyProc) _ANSI_ARGS_(( 807 ClientData instanceData, int mask)); 808typedef Tcl_File (Tcl_DriverGetFileProc) _ANSI_ARGS_((ClientData instanceData, 809 int mask)); 810 811/* 812 * Enum for different end of line translation and recognition modes. 813 */ 814 815typedef enum Tcl_EolTranslation { 816 TCL_TRANSLATE_AUTO, /* Eol == \r, \n and \r\n. */ 817 TCL_TRANSLATE_CR, /* Eol == \r. */ 818 TCL_TRANSLATE_LF, /* Eol == \n. */ 819 TCL_TRANSLATE_CRLF /* Eol == \r\n. */ 820} Tcl_EolTranslation; 821 822/* 823 * Enum for different byteorders. 824 */ 825 826typedef enum Tcl_ByteOrder { 827 TCL_BIGENDIAN, /* Multibyte words are stored with MSB first */ 828 TCL_SMALLENDIAN /* Multibyte words are stored with MSB last */ 829} Tcl_ByteOrder; 830 831/* 832 * struct Tcl_ChannelType: 833 * 834 * One such structure exists for each type (kind) of channel. 835 * It collects together in one place all the functions that are 836 * part of the specific channel type. 837 */ 838 839typedef struct Tcl_ChannelType { 840 char *typeName; /* The name of the channel type in Tcl 841 * commands. This storage is owned by 842 * channel type. */ 843 Tcl_DriverBlockModeProc *blockModeProc; 844 /* Set blocking mode for the 845 * raw channel. May be NULL. */ 846 Tcl_DriverCloseProc *closeProc; /* Procedure to call to close 847 * the channel. */ 848 Tcl_DriverInputProc *inputProc; /* Procedure to call for input 849 * on channel. */ 850 Tcl_DriverOutputProc *outputProc; /* Procedure to call for output 851 * on channel. */ 852 Tcl_DriverSeekProc *seekProc; /* Procedure to call to seek 853 * on the channel. May be NULL. */ 854 Tcl_DriverSetOptionProc *setOptionProc; 855 /* Set an option on a channel. */ 856 Tcl_DriverGetOptionProc *getOptionProc; 857 /* Get an option from a channel. */ 858 Tcl_DriverWatchChannelProc *watchChannelProc; 859 /* Set up the notifier to watch 860 * for events on this channel. */ 861 Tcl_DriverChannelReadyProc *channelReadyProc; 862 /* Check for events of interest on 863 * this channel. */ 864 Tcl_DriverGetFileProc *getFileProc; /* Get a Tcl_File from the channel 865 * or NULL if not supported. */ 866} Tcl_ChannelType; 867 868/* 869 * The following flags determine whether the blockModeProc above should 870 * set the channel into blocking or nonblocking mode. They are passed 871 * as arguments to the blockModeProc procedure in the above structure. 872 */ 873 874#define TCL_MODE_BLOCKING 0 /* Put channel into blocking mode. */ 875#define TCL_MODE_NONBLOCKING 1 /* Put channel into nonblocking 876 * mode. */ 877 878/* 879 * Types for file handles: 880 */ 881 882#define TCL_UNIX_FD 1 883#define TCL_MAC_FILE 2 884#define TCL_MAC_SOCKET 3 885#define TCL_WIN_PIPE 4 886#define TCL_WIN_FILE 5 887#define TCL_WIN_SOCKET 6 888#define TCL_WIN_CONSOLE 7 889#define TCL_WIN32S_PIPE 8 890 891/* 892 * Enum for different types of file paths. 893 */ 894 895typedef enum Tcl_PathType { 896 TCL_PATH_ABSOLUTE, 897 TCL_PATH_RELATIVE, 898 TCL_PATH_VOLUME_RELATIVE 899} Tcl_PathType; 900 901/* 902 * The following interface is exported for backwards compatibility, but 903 * is only implemented on Unix. Portable applications should use 904 * Tcl_OpenCommandChannel, instead. 905 */ 906 907EXTERN int Tcl_CreatePipeline _ANSI_ARGS_((Tcl_Interp *interp, 908 int argc, char **argv, Tcl_Pid **pidArrayPtr, 909 int *inPipePtr, int *outPipePtr, 910 int *errFilePtr)); 911 912/* 913 * Exported Tcl procedures: 914 */ 915 916EXTERN void Tcl_AddErrorInfo _ANSI_ARGS_((Tcl_Interp *interp, 917 char *message)); 918EXTERN void Tcl_AddObjErrorInfo _ANSI_ARGS_((Tcl_Interp *interp, 919 char *message, int length)); 920EXTERN void Tcl_AllowExceptions _ANSI_ARGS_((Tcl_Interp *interp)); 921EXTERN void Tcl_AppendElement _ANSI_ARGS_((Tcl_Interp *interp, 922 char *string)); 923EXTERN void Tcl_AppendResult _ANSI_ARGS_( 924 TCL_VARARGS(Tcl_Interp *,interp)); 925EXTERN int Tcl_AppInit _ANSI_ARGS_((Tcl_Interp *interp)); 926EXTERN Tcl_AsyncHandler Tcl_AsyncCreate _ANSI_ARGS_((Tcl_AsyncProc *proc, 927 ClientData clientData)); 928EXTERN void Tcl_AsyncDelete _ANSI_ARGS_((Tcl_AsyncHandler async)); 929EXTERN int Tcl_AsyncInvoke _ANSI_ARGS_((Tcl_Interp *interp, 930 int code)); 931EXTERN void Tcl_AsyncMark _ANSI_ARGS_((Tcl_AsyncHandler async)); 932EXTERN int Tcl_AsyncReady _ANSI_ARGS_((void)); 933EXTERN void Tcl_BackgroundError _ANSI_ARGS_((Tcl_Interp *interp)); 934EXTERN char Tcl_Backslash _ANSI_ARGS_((char *src, 935 int *readPtr)); 936EXTERN void Tcl_CallWhenDeleted _ANSI_ARGS_((Tcl_Interp *interp, 937 Tcl_InterpDeleteProc *proc, 938 ClientData clientData)); 939EXTERN void Tcl_CancelIdleCall _ANSI_ARGS_((Tcl_IdleProc *idleProc, 940 ClientData clientData)); 941#define Tcl_Ckalloc Tcl_Alloc 942#define Tcl_Ckfree Tcl_Free 943#define Tcl_Ckrealloc Tcl_Realloc 944EXTERN int Tcl_Close _ANSI_ARGS_((Tcl_Interp *interp, 945 Tcl_Channel chan)); 946EXTERN int Tcl_CommandComplete _ANSI_ARGS_((char *cmd)); 947EXTERN char * Tcl_Concat _ANSI_ARGS_((int argc, char **argv)); 948EXTERN int Tcl_ConvertElement _ANSI_ARGS_((char *src, 949 char *dst, int flags)); 950EXTERN int Tcl_ConvertToType _ANSI_ARGS_((Tcl_Interp *interp, 951 Tcl_Obj *objPtr, Tcl_ObjType *typePtr)); 952EXTERN int Tcl_CreateAlias _ANSI_ARGS_((Tcl_Interp *slave, 953 char *slaveCmd, Tcl_Interp *target, 954 char *targetCmd, int argc, char **argv)); 955EXTERN Tcl_Channel Tcl_CreateChannel _ANSI_ARGS_(( 956 Tcl_ChannelType *typePtr, char *chanName, 957 ClientData instanceData, int mask)); 958EXTERN void Tcl_CreateChannelHandler _ANSI_ARGS_(( 959 Tcl_Channel chan, int mask, 960 Tcl_ChannelProc *proc, ClientData clientData)); 961EXTERN void Tcl_CreateCloseHandler _ANSI_ARGS_(( 962 Tcl_Channel chan, Tcl_CloseProc *proc, 963 ClientData clientData)); 964EXTERN Tcl_Command Tcl_CreateCommand _ANSI_ARGS_((Tcl_Interp *interp, 965 char *cmdName, Tcl_CmdProc *proc, 966 ClientData clientData, 967 Tcl_CmdDeleteProc *deleteProc)); 968EXTERN void Tcl_CreateEventSource _ANSI_ARGS_(( 969 Tcl_EventSetupProc *setupProc, Tcl_EventCheckProc 970 *checkProc, ClientData clientData)); 971EXTERN void Tcl_CreateExitHandler _ANSI_ARGS_((Tcl_ExitProc *proc, 972 ClientData clientData)); 973EXTERN void Tcl_CreateFileHandler _ANSI_ARGS_(( 974 Tcl_File file, int mask, Tcl_FileProc *proc, 975 ClientData clientData)); 976EXTERN Tcl_Interp * Tcl_CreateInterp _ANSI_ARGS_((void)); 977EXTERN void Tcl_CreateMathFunc _ANSI_ARGS_((Tcl_Interp *interp, 978 char *name, int numArgs, Tcl_ValueType *argTypes, 979 Tcl_MathProc *proc, ClientData clientData)); 980EXTERN void Tcl_CreateModalTimeout _ANSI_ARGS_((int milliseconds, 981 Tcl_TimerProc *proc, ClientData clientData)); 982EXTERN Tcl_Command Tcl_CreateObjCommand _ANSI_ARGS_(( 983 Tcl_Interp *interp, char *name, int nameLength, 984 Tcl_ObjCmdProc *proc, ClientData clientData, 985 Tcl_CmdDeleteProc *deleteProc)); 986EXTERN Tcl_Interp * Tcl_CreateSlave _ANSI_ARGS_((Tcl_Interp *interp, 987 char *slaveName, int isSafe)); 988EXTERN Tcl_TimerToken Tcl_CreateTimerHandler _ANSI_ARGS_((int milliseconds, 989 Tcl_TimerProc *proc, ClientData clientData)); 990EXTERN Tcl_Trace Tcl_CreateTrace _ANSI_ARGS_((Tcl_Interp *interp, 991 int level, Tcl_CmdTraceProc *proc, 992 ClientData clientData)); 993EXTERN char * Tcl_DbCkalloc _ANSI_ARGS_((unsigned int size, 994 char *file, int line)); 995EXTERN int Tcl_DbCkfree _ANSI_ARGS_((char *ptr, 996 char *file, int line)); 997EXTERN char * Tcl_DbCkrealloc _ANSI_ARGS_((char *ptr, 998 unsigned int size, char *file, int line)); 999EXTERN void Tcl_DeleteAssocData _ANSI_ARGS_((Tcl_Interp *interp, 1000 char *name)); 1001EXTERN int Tcl_DeleteCommand _ANSI_ARGS_((Tcl_Interp *interp, 1002 char *cmdName)); 1003EXTERN void Tcl_DeleteChannelHandler _ANSI_ARGS_(( 1004 Tcl_Channel chan, Tcl_ChannelProc *proc, 1005 ClientData clientData)); 1006EXTERN void Tcl_DeleteCloseHandler _ANSI_ARGS_(( 1007 Tcl_Channel chan, Tcl_CloseProc *proc, 1008 ClientData clientData)); 1009EXTERN void Tcl_DeleteEventSource _ANSI_ARGS_(( 1010 Tcl_EventSetupProc *setupProc, 1011 Tcl_EventCheckProc *checkProc, 1012 ClientData clientData)); 1013EXTERN void Tcl_DeleteEvents _ANSI_ARGS_(( 1014 Tcl_EventDeleteProc *proc, 1015 ClientData clientData)); 1016EXTERN void Tcl_DeleteExitHandler _ANSI_ARGS_(( 1017 Tcl_ExitProc *proc, ClientData clientData)); 1018EXTERN void Tcl_DeleteFileHandler _ANSI_ARGS_(( 1019 Tcl_File file)); 1020EXTERN void Tcl_DeleteHashEntry _ANSI_ARGS_(( 1021 Tcl_HashEntry *entryPtr)); 1022EXTERN void Tcl_DeleteHashTable _ANSI_ARGS_(( 1023 Tcl_HashTable *tablePtr)); 1024EXTERN void Tcl_DeleteInterp _ANSI_ARGS_((Tcl_Interp *interp)); 1025EXTERN void Tcl_DeleteModalTimeout _ANSI_ARGS_(( 1026 Tcl_TimerProc *proc, ClientData clientData)); 1027EXTERN void Tcl_DeleteTimerHandler _ANSI_ARGS_(( 1028 Tcl_TimerToken token)); 1029EXTERN void Tcl_DeleteTrace _ANSI_ARGS_((Tcl_Interp *interp, 1030 Tcl_Trace trace)); 1031EXTERN void Tcl_DetachPids _ANSI_ARGS_((int numPids, Tcl_Pid *pidPtr)); 1032EXTERN void Tcl_DontCallWhenDeleted _ANSI_ARGS_(( 1033 Tcl_Interp *interp, Tcl_InterpDeleteProc *proc, 1034 ClientData clientData)); 1035EXTERN int Tcl_DoOneEvent _ANSI_ARGS_((int flags)); 1036EXTERN void Tcl_DoWhenIdle _ANSI_ARGS_((Tcl_IdleProc *proc, 1037 ClientData clientData)); 1038EXTERN char * Tcl_DStringAppend _ANSI_ARGS_((Tcl_DString *dsPtr, 1039 char *string, int length)); 1040EXTERN char * Tcl_DStringAppendElement _ANSI_ARGS_(( 1041 Tcl_DString *dsPtr, char *string)); 1042EXTERN void Tcl_DStringEndSublist _ANSI_ARGS_((Tcl_DString *dsPtr)); 1043EXTERN void Tcl_DStringFree _ANSI_ARGS_((Tcl_DString *dsPtr)); 1044EXTERN void Tcl_DStringGetResult _ANSI_ARGS_((Tcl_Interp *interp, 1045 Tcl_DString *dsPtr)); 1046EXTERN void Tcl_DStringInit _ANSI_ARGS_((Tcl_DString *dsPtr)); 1047EXTERN void Tcl_DStringResult _ANSI_ARGS_((Tcl_Interp *interp, 1048 Tcl_DString *dsPtr)); 1049EXTERN void Tcl_DStringSetLength _ANSI_ARGS_((Tcl_DString *dsPtr, 1050 int length)); 1051EXTERN void Tcl_DStringStartSublist _ANSI_ARGS_(( 1052 Tcl_DString *dsPtr)); 1053EXTERN Tcl_Obj * Tcl_DuplicateObj _ANSI_ARGS_((Tcl_Obj *objPtr)); 1054EXTERN int Tcl_Eof _ANSI_ARGS_((Tcl_Channel chan)); 1055EXTERN char * Tcl_ErrnoId _ANSI_ARGS_((void)); 1056EXTERN char * Tcl_ErrnoMsg _ANSI_ARGS_((int err)); 1057EXTERN int Tcl_Eval _ANSI_ARGS_((Tcl_Interp *interp, 1058 char *string)); 1059EXTERN int Tcl_EvalFile _ANSI_ARGS_((Tcl_Interp *interp, 1060 char *fileName)); 1061EXTERN void Tcl_EventuallyFree _ANSI_ARGS_((ClientData clientData, 1062 Tcl_FreeProc *freeProc)); 1063EXTERN int Tcl_EvalObj _ANSI_ARGS_((Tcl_Interp *interp, 1064 Tcl_Obj *objPtr)); 1065EXTERN void Tcl_Exit _ANSI_ARGS_((int status)); 1066EXTERN int Tcl_ExposeCommand _ANSI_ARGS_((Tcl_Interp *interp, 1067 char *hiddenCmdName, char *cmdName)); 1068EXTERN int Tcl_ExprBoolean _ANSI_ARGS_((Tcl_Interp *interp, 1069 char *string, int *ptr)); 1070EXTERN int Tcl_ExprBooleanObj _ANSI_ARGS_((Tcl_Interp *interp, 1071 Tcl_Obj *objPtr, int *ptr)); 1072EXTERN int Tcl_ExprDouble _ANSI_ARGS_((Tcl_Interp *interp, 1073 char *string, double *ptr)); 1074EXTERN int Tcl_ExprLong _ANSI_ARGS_((Tcl_Interp *interp, 1075 char *string, long *ptr)); 1076EXTERN int Tcl_ExprString _ANSI_ARGS_((Tcl_Interp *interp, 1077 char *string)); 1078EXTERN int Tcl_ExprStringObj _ANSI_ARGS_((Tcl_Interp *interp, 1079 Tcl_Obj *objPtr)); 1080EXTERN int Tcl_FileReady _ANSI_ARGS_((Tcl_File file, 1081 int mask)); 1082EXTERN void Tcl_Finalize _ANSI_ARGS_((void)); 1083EXTERN void Tcl_FindExecutable _ANSI_ARGS_((char *argv0)); 1084EXTERN Tcl_HashEntry * Tcl_FirstHashEntry _ANSI_ARGS_(( 1085 Tcl_HashTable *tablePtr, 1086 Tcl_HashSearch *searchPtr)); 1087EXTERN int Tcl_Flush _ANSI_ARGS_((Tcl_Channel chan)); 1088EXTERN void Tcl_FreeFile _ANSI_ARGS_(( 1089 Tcl_File file)); 1090EXTERN void TclFreeObj _ANSI_ARGS_((Tcl_Obj *objPtr)); 1091EXTERN int Tcl_GetAlias _ANSI_ARGS_((Tcl_Interp *interp, 1092 char *slaveCmd, Tcl_Interp **targetInterpPtr, 1093 char **targetCmdPtr, int *argcPtr, 1094 char ***argvPtr)); 1095EXTERN int Tcl_GetAllObjTypes _ANSI_ARGS_((Tcl_Interp *interp, 1096 Tcl_Obj **objPtrPtr)); 1097EXTERN ClientData Tcl_GetAssocData _ANSI_ARGS_((Tcl_Interp *interp, 1098 char *name, Tcl_InterpDeleteProc **procPtr)); 1099EXTERN int Tcl_GetBoolean _ANSI_ARGS_((Tcl_Interp *interp, 1100 char *string, int *boolPtr)); 1101EXTERN int Tcl_GetBooleanFromObj _ANSI_ARGS_(( 1102 Tcl_Interp *interp, Tcl_Obj *objPtr, 1103 int *boolPtr)); 1104EXTERN Tcl_Channel Tcl_GetChannel _ANSI_ARGS_((Tcl_Interp *interp, 1105 char *chanName, int *modePtr)); 1106EXTERN int Tcl_GetChannelBufferSize _ANSI_ARGS_(( 1107 Tcl_Channel chan)); 1108EXTERN Tcl_ByteOrder Tcl_GetChannelByteorder _ANSI_ARGS_(( 1109 Tcl_Channel chan)); 1110EXTERN Tcl_ByteOrder Tcl_GetHostByteorder _ANSI_ARGS_(()); 1111EXTERN Tcl_File Tcl_GetChannelFile _ANSI_ARGS_((Tcl_Channel chan, 1112 int direction)); 1113EXTERN ClientData Tcl_GetChannelInstanceData _ANSI_ARGS_(( 1114 Tcl_Channel chan)); 1115EXTERN int Tcl_GetChannelMode _ANSI_ARGS_((Tcl_Channel chan)); 1116EXTERN char * Tcl_GetChannelName _ANSI_ARGS_((Tcl_Channel chan)); 1117EXTERN int Tcl_GetChannelOption _ANSI_ARGS_((Tcl_Channel chan, 1118 char *optionName, Tcl_DString *dsPtr)); 1119EXTERN Tcl_ChannelType * Tcl_GetChannelType _ANSI_ARGS_((Tcl_Channel chan)); 1120EXTERN int Tcl_GetCommandInfo _ANSI_ARGS_((Tcl_Interp *interp, 1121 char *cmdName, Tcl_CmdInfo *infoPtr)); 1122EXTERN char * Tcl_GetCommandName _ANSI_ARGS_((Tcl_Interp *interp, 1123 Tcl_Command command)); 1124EXTERN char * Tcl_GetCwd _ANSI_ARGS_((char *buf, int len)); 1125EXTERN int Tcl_GetDouble _ANSI_ARGS_((Tcl_Interp *interp, 1126 char *string, double *doublePtr)); 1127EXTERN int Tcl_GetDoubleFromObj _ANSI_ARGS_(( 1128 Tcl_Interp *interp, Tcl_Obj *objPtr, 1129 double *doublePtr)); 1130EXTERN int Tcl_GetErrno _ANSI_ARGS_((void)); 1131EXTERN int Tcl_GetErrorLine _ANSI_ARGS_((Tcl_Interp *interp)); 1132EXTERN Tcl_File Tcl_GetFile _ANSI_ARGS_((ClientData fileData, 1133 int type)); 1134EXTERN ClientData Tcl_GetFileInfo _ANSI_ARGS_((Tcl_File file, 1135 int *typePtr)); 1136EXTERN char * Tcl_GetHostName _ANSI_ARGS_((void)); 1137EXTERN int Tcl_GetInt _ANSI_ARGS_((Tcl_Interp *interp, 1138 char *string, int *intPtr)); 1139EXTERN int Tcl_GetInterpPath _ANSI_ARGS_((Tcl_Interp *askInterp, 1140 Tcl_Interp *slaveInterp)); 1141EXTERN int Tcl_GetIntFromObj _ANSI_ARGS_((Tcl_Interp *interp, 1142 Tcl_Obj *objPtr, long *intPtr)); 1143EXTERN Tcl_Interp * Tcl_GetMaster _ANSI_ARGS_((Tcl_Interp *interp)); 1144EXTERN ClientData Tcl_GetNotifierData _ANSI_ARGS_((Tcl_File file, 1145 Tcl_FileFreeProc **freeProcPtr)); 1146EXTERN Tcl_Obj * Tcl_GetObjResult _ANSI_ARGS_((Tcl_Interp *interp)); 1147EXTERN Tcl_ObjType * Tcl_GetObjType _ANSI_ARGS_((char *typeName)); 1148EXTERN int Tcl_GetOpenFile _ANSI_ARGS_((Tcl_Interp *interp, 1149 char *string, int write, int checkUsage, 1150 ClientData *filePtr)); 1151EXTERN Tcl_PathType Tcl_GetPathType _ANSI_ARGS_((char *path)); 1152EXTERN int Tcl_Gets _ANSI_ARGS_((Tcl_Channel chan, 1153 Tcl_DString *dsPtr)); 1154EXTERN Tcl_Interp * Tcl_GetSlave _ANSI_ARGS_((Tcl_Interp *interp, 1155 char *slaveName)); 1156EXTERN Tcl_Channel Tcl_GetStdChannel _ANSI_ARGS_((int type)); 1157EXTERN char * Tcl_GetStringFromObj _ANSI_ARGS_(( 1158 Tcl_Interp *interp, Tcl_Obj *objPtr, 1159 int *lengthPtr)); 1160EXTERN char * Tcl_GetVar _ANSI_ARGS_((Tcl_Interp *interp, 1161 char *varName, int flags)); 1162EXTERN char * Tcl_GetVar2 _ANSI_ARGS_((Tcl_Interp *interp, 1163 char *part1, char *part2, int flags)); 1164EXTERN int Tcl_GlobalEval _ANSI_ARGS_((Tcl_Interp *interp, 1165 char *command)); 1166EXTERN int Tcl_GlobalEvalObj _ANSI_ARGS_((Tcl_Interp *interp, 1167 Tcl_Obj *objPtr)); 1168EXTERN char * Tcl_HashStats _ANSI_ARGS_((Tcl_HashTable *tablePtr)); 1169EXTERN int Tcl_HideCommand _ANSI_ARGS_((Tcl_Interp *interp, 1170 char *cmdName, char *hiddenCmdName)); 1171EXTERN int Tcl_Init _ANSI_ARGS_((Tcl_Interp *interp)); 1172EXTERN void Tcl_InitHashTable _ANSI_ARGS_((Tcl_HashTable *tablePtr, 1173 int keyType)); 1174EXTERN void Tcl_InitMemory _ANSI_ARGS_((Tcl_Interp *interp)); 1175EXTERN int Tcl_InputBlocked _ANSI_ARGS_((Tcl_Channel chan)); 1176EXTERN int Tcl_InputBuffered _ANSI_ARGS_((Tcl_Channel chan)); 1177EXTERN int Tcl_InterpDeleted _ANSI_ARGS_((Tcl_Interp *interp)); 1178EXTERN int Tcl_IsSafe _ANSI_ARGS_((Tcl_Interp *interp)); 1179EXTERN char * Tcl_JoinPath _ANSI_ARGS_((int argc, char **argv, 1180 Tcl_DString *resultPtr)); 1181EXTERN int Tcl_LinkVar _ANSI_ARGS_((Tcl_Interp *interp, 1182 char *varName, char *addr, int type)); 1183EXTERN int Tcl_ListObjAppendList _ANSI_ARGS_(( 1184 Tcl_Interp *interp, Tcl_Obj *listPtr, 1185 Tcl_Obj *elemListPtr)); 1186EXTERN int Tcl_ListObjAppendElement _ANSI_ARGS_(( 1187 Tcl_Interp *interp, Tcl_Obj *listPtr, 1188 Tcl_Obj *objPtr)); 1189EXTERN int Tcl_ListObjGetElements _ANSI_ARGS_(( 1190 Tcl_Interp *interp, Tcl_Obj *listPtr, 1191 int *objcPtr, Tcl_Obj ***objvPtr)); 1192EXTERN int Tcl_ListObjIndex _ANSI_ARGS_((Tcl_Interp *interp, 1193 Tcl_Obj *listPtr, int index, 1194 Tcl_Obj **objPtrPtr)); 1195EXTERN int Tcl_ListObjLength _ANSI_ARGS_((Tcl_Interp *interp, 1196 Tcl_Obj *listPtr, int *intPtr)); 1197EXTERN int Tcl_ListObjReplace _ANSI_ARGS_((Tcl_Interp *interp, 1198 Tcl_Obj *listPtr, int first, int count, 1199 int objc, Tcl_Obj **objv)); 1200EXTERN void Tcl_Main _ANSI_ARGS_((int argc, char **argv, 1201 Tcl_AppInitProc *appInitProc)); 1202EXTERN Tcl_Channel Tcl_MakeFileChannel _ANSI_ARGS_((ClientData inFile, 1203 ClientData outFile, int mode)); 1204EXTERN int Tcl_MakeSafe _ANSI_ARGS_((Tcl_Interp *interp)); 1205EXTERN Tcl_Channel Tcl_MakeTcpClientChannel _ANSI_ARGS_(( 1206 ClientData tcpSocket)); 1207EXTERN char * Tcl_Merge _ANSI_ARGS_((int argc, char **argv)); 1208EXTERN Tcl_Obj * Tcl_NewBooleanObj _ANSI_ARGS_((int boolValue)); 1209EXTERN Tcl_Obj * Tcl_NewDoubleObj _ANSI_ARGS_((double doubleValue)); 1210EXTERN Tcl_Obj * Tcl_NewIntObj _ANSI_ARGS_((long intValue)); 1211EXTERN Tcl_Obj * Tcl_NewListObj _ANSI_ARGS_((int objc, Tcl_Obj **objv)); 1212EXTERN Tcl_Obj * Tcl_NewObj _ANSI_ARGS_((void)); 1213EXTERN Tcl_Obj * Tcl_NewStringObj _ANSI_ARGS_((char *bytes, 1214 int length)); 1215EXTERN Tcl_HashEntry * Tcl_NextHashEntry _ANSI_ARGS_(( 1216 Tcl_HashSearch *searchPtr)); 1217EXTERN Tcl_Obj * Tcl_ObjGetVar2 _ANSI_ARGS_((Tcl_Interp *interp, 1218 Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, 1219 int flags)); 1220EXTERN Tcl_Obj * Tcl_ObjSetVar2 _ANSI_ARGS_((Tcl_Interp *interp, 1221 Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, 1222 Tcl_Obj *newValuePtr, int flags)); 1223EXTERN Tcl_Channel Tcl_OpenCommandChannel _ANSI_ARGS_(( 1224 Tcl_Interp *interp, int argc, char **argv, 1225 int flags)); 1226EXTERN Tcl_Channel Tcl_OpenFileChannel _ANSI_ARGS_((Tcl_Interp *interp, 1227 char *fileName, char *modeString, 1228 int permissions)); 1229EXTERN Tcl_Channel Tcl_OpenTcpClient _ANSI_ARGS_((Tcl_Interp *interp, 1230 int port, char *address, char *myaddr, 1231 int myport, int async)); 1232EXTERN Tcl_Channel Tcl_OpenTcpServer _ANSI_ARGS_((Tcl_Interp *interp, 1233 int port, char *host, 1234 Tcl_TcpAcceptProc *acceptProc, 1235 ClientData callbackData)); 1236EXTERN char * Tcl_ParseVar _ANSI_ARGS_((Tcl_Interp *interp, 1237 char *string, char **termPtr)); 1238EXTERN int Tcl_PkgProvide _ANSI_ARGS_((Tcl_Interp *interp, 1239 char *name, char *version)); 1240EXTERN char * Tcl_PkgRequire _ANSI_ARGS_((Tcl_Interp *interp, 1241 char *name, char *version, int exact)); 1242EXTERN char * Tcl_PosixError _ANSI_ARGS_((Tcl_Interp *interp)); 1243EXTERN void Tcl_Preserve _ANSI_ARGS_((ClientData data)); 1244EXTERN void Tcl_PrintDouble _ANSI_ARGS_((Tcl_Interp *interp, 1245 double value, char *dst)); 1246EXTERN int Tcl_PutEnv _ANSI_ARGS_((CONST char *string)); 1247EXTERN void Tcl_QueueEvent _ANSI_ARGS_((Tcl_Event *evPtr, 1248 Tcl_QueuePosition position)); 1249EXTERN int Tcl_Read _ANSI_ARGS_((Tcl_Channel chan, 1250 char *bufPtr, int toRead)); 1251EXTERN void Tcl_ReapDetachedProcs _ANSI_ARGS_((void)); 1252EXTERN int Tcl_RecordAndEval _ANSI_ARGS_((Tcl_Interp *interp, 1253 char *cmd, int flags)); 1254EXTERN Tcl_RegExp Tcl_RegExpCompile _ANSI_ARGS_((Tcl_Interp *interp, 1255 char *string)); 1256EXTERN int Tcl_RegExpExec _ANSI_ARGS_((Tcl_Interp *interp, 1257 Tcl_RegExp regexp, char *string, char *start)); 1258EXTERN int Tcl_RegExpMatch _ANSI_ARGS_((Tcl_Interp *interp, 1259 char *string, char *pattern)); 1260EXTERN void Tcl_RegExpRange _ANSI_ARGS_((Tcl_RegExp regexp, 1261 int index, char **startPtr, char **endPtr)); 1262EXTERN void Tcl_RegisterChannel _ANSI_ARGS_((Tcl_Interp *interp, 1263 Tcl_Channel chan)); 1264EXTERN void Tcl_RegisterObjType _ANSI_ARGS_(( 1265 Tcl_ObjType *typePtr)); 1266EXTERN void Tcl_Release _ANSI_ARGS_((ClientData clientData)); 1267EXTERN void Tcl_ResetObjResult _ANSI_ARGS_((Tcl_Interp *interp)); 1268EXTERN void Tcl_ResetResult _ANSI_ARGS_((Tcl_Interp *interp)); 1269#define Tcl_Return Tcl_SetResult 1270EXTERN int Tcl_ScanElement _ANSI_ARGS_((char *string, 1271 int *flagPtr)); 1272EXTERN int Tcl_Seek _ANSI_ARGS_((Tcl_Channel chan, 1273 int offset, int mode)); 1274EXTERN void Tcl_SetAssocData _ANSI_ARGS_((Tcl_Interp *interp, 1275 char *name, Tcl_InterpDeleteProc *proc, 1276 ClientData clientData)); 1277EXTERN void Tcl_SetBooleanObj _ANSI_ARGS_((Tcl_Obj *objPtr, 1278 int boolValue)); 1279EXTERN void Tcl_SetChannelBufferSize _ANSI_ARGS_(( 1280 Tcl_Channel chan, int sz)); 1281EXTERN int Tcl_SetChannelOption _ANSI_ARGS_(( 1282 Tcl_Interp *interp, Tcl_Channel chan, 1283 char *optionName, char *newValue)); 1284EXTERN int Tcl_SetCommandInfo _ANSI_ARGS_((Tcl_Interp *interp, 1285 char *cmdName, Tcl_CmdInfo *infoPtr)); 1286EXTERN void Tcl_SetDoubleObj _ANSI_ARGS_((Tcl_Obj *objPtr, 1287 double doubleValue)); 1288EXTERN void Tcl_SetErrno _ANSI_ARGS_((int err)); 1289EXTERN void Tcl_SetErrorCode _ANSI_ARGS_( 1290 TCL_VARARGS(Tcl_Interp *,interp)); 1291EXTERN void Tcl_SetIntObj _ANSI_ARGS_((Tcl_Obj *objPtr, 1292 long intValue)); 1293EXTERN void Tcl_SetMaxBlockTime _ANSI_ARGS_((Tcl_Time *timePtr)); 1294EXTERN void Tcl_SetNotifierData _ANSI_ARGS_((Tcl_File file, 1295 Tcl_FileFreeProc *freeProcPtr, ClientData data)); 1296EXTERN void Tcl_SetObjResult _ANSI_ARGS_((Tcl_Interp *interp, 1297 Tcl_Obj *resultObjPtr)); 1298EXTERN void Tcl_SetPanicProc _ANSI_ARGS_((void (*proc) 1299 _ANSI_ARGS_(TCL_VARARGS(char *, format)))); 1300EXTERN int Tcl_SetRecursionLimit _ANSI_ARGS_((Tcl_Interp *interp, 1301 int depth)); 1302EXTERN void Tcl_SetResult _ANSI_ARGS_((Tcl_Interp *interp, 1303 char *string, Tcl_FreeProc *freeProc)); 1304EXTERN void Tcl_SetStdChannel _ANSI_ARGS_((Tcl_Channel channel, 1305 int type)); 1306EXTERN void Tcl_SetStringObj _ANSI_ARGS_((Tcl_Obj *objPtr, 1307 char *bytes, int length)); 1308EXTERN char * Tcl_SetVar _ANSI_ARGS_((Tcl_Interp *interp, 1309 char *varName, char *newValue, int flags)); 1310EXTERN char * Tcl_SetVar2 _ANSI_ARGS_((Tcl_Interp *interp, 1311 char *part1, char *part2, char *newValue, 1312 int flags)); 1313EXTERN char * Tcl_SignalId _ANSI_ARGS_((int sig)); 1314EXTERN char * Tcl_SignalMsg _ANSI_ARGS_((int sig)); 1315EXTERN void Tcl_Sleep _ANSI_ARGS_((int ms)); 1316EXTERN void Tcl_SourceRCFile _ANSI_ARGS_((Tcl_Interp *interp)); 1317EXTERN int Tcl_SplitList _ANSI_ARGS_((Tcl_Interp *interp, 1318 char *list, int *argcPtr, char ***argvPtr)); 1319EXTERN void Tcl_SplitPath _ANSI_ARGS_((char *path, 1320 int *argcPtr, char ***argvPtr)); 1321EXTERN void Tcl_StaticPackage _ANSI_ARGS_((Tcl_Interp *interp, 1322 char *pkgName, Tcl_PackageInitProc *initProc, 1323 Tcl_PackageInitProc *safeInitProc)); 1324EXTERN int Tcl_StringMatch _ANSI_ARGS_((char *string, 1325 char *pattern)); 1326EXTERN void Tcl_StringObjAppend _ANSI_ARGS_(( 1327 Tcl_Interp *interp, Tcl_Obj *objPtr, 1328 char *bytes, int length)); 1329EXTERN void Tcl_StringObjAppendObj _ANSI_ARGS_(( 1330 Tcl_Interp *interp, Tcl_Obj *objPtr, 1331 Tcl_Obj *srcPtr)); 1332EXTERN int Tcl_Tell _ANSI_ARGS_((Tcl_Channel chan)); 1333#define Tcl_TildeSubst Tcl_TranslateFileName 1334EXTERN int Tcl_TraceVar _ANSI_ARGS_((Tcl_Interp *interp, 1335 char *varName, int flags, Tcl_VarTraceProc *proc, 1336 ClientData clientData)); 1337EXTERN int Tcl_TraceVar2 _ANSI_ARGS_((Tcl_Interp *interp, 1338 char *part1, char *part2, int flags, 1339 Tcl_VarTraceProc *proc, ClientData clientData)); 1340EXTERN char * Tcl_TranslateFileName _ANSI_ARGS_((Tcl_Interp *interp, 1341 char *name, Tcl_DString *bufferPtr)); 1342EXTERN int Tcl_Ungets _ANSI_ARGS_((Tcl_Channel chan, char *str, 1343 int len, int atHead)); 1344EXTERN void Tcl_UnlinkVar _ANSI_ARGS_((Tcl_Interp *interp, 1345 char *varName)); 1346EXTERN int Tcl_UnregisterChannel _ANSI_ARGS_((Tcl_Interp *interp, 1347 Tcl_Channel chan)); 1348EXTERN int Tcl_UnsetVar _ANSI_ARGS_((Tcl_Interp *interp, 1349 char *varName, int flags)); 1350EXTERN int Tcl_UnsetVar2 _ANSI_ARGS_((Tcl_Interp *interp, 1351 char *part1, char *part2, int flags)); 1352EXTERN void Tcl_UntraceVar _ANSI_ARGS_((Tcl_Interp *interp, 1353 char *varName, int flags, Tcl_VarTraceProc *proc, 1354 ClientData clientData)); 1355EXTERN void Tcl_UntraceVar2 _ANSI_ARGS_((Tcl_Interp *interp, 1356 char *part1, char *part2, int flags, 1357 Tcl_VarTraceProc *proc, ClientData clientData)); 1358EXTERN void Tcl_UpdateLinkedVar _ANSI_ARGS_((Tcl_Interp *interp, 1359 char *varName)); 1360EXTERN int Tcl_UpVar _ANSI_ARGS_((Tcl_Interp *interp, 1361 char *frameName, char *varName, 1362 char *localName, int flags)); 1363EXTERN int Tcl_UpVar2 _ANSI_ARGS_((Tcl_Interp *interp, 1364 char *frameName, char *part1, char *part2, 1365 char *localName, int flags)); 1366EXTERN int Tcl_VarEval _ANSI_ARGS_( 1367 TCL_VARARGS(Tcl_Interp *,interp)); 1368EXTERN ClientData Tcl_VarTraceInfo _ANSI_ARGS_((Tcl_Interp *interp, 1369 char *varName, int flags, 1370 Tcl_VarTraceProc *procPtr, 1371 ClientData prevClientData)); 1372EXTERN ClientData Tcl_VarTraceInfo2 _ANSI_ARGS_((Tcl_Interp *interp, 1373 char *part1, char *part2, int flags, 1374 Tcl_VarTraceProc *procPtr, 1375 ClientData prevClientData)); 1376EXTERN int Tcl_WaitForEvent _ANSI_ARGS_((Tcl_Time *timePtr)); 1377EXTERN Tcl_Pid Tcl_WaitPid _ANSI_ARGS_((Tcl_Pid pid, int *statPtr, 1378 int options)); 1379EXTERN void Tcl_WatchFile _ANSI_ARGS_((Tcl_File file, 1380 int mask)); 1381EXTERN int Tcl_Write _ANSI_ARGS_((Tcl_Channel chan, 1382 char *s, int slen)); 1383 1384EXTERN Tcl_Channel Tcl_ReplaceChannel _ANSI_ARGS_ ((Tcl_Interp* interp, 1385 Tcl_ChannelType* typePtr, ClientData instanceData, 1386 int mask, Tcl_Channel prevChan)); 1387 1388EXTERN void Tcl_UndoReplaceChannel _ANSI_ARGS_ ((Tcl_Interp* interp, 1389 Tcl_Channel chan)); 1390 1391#endif /* RESOURCE_INCLUDED */ 1392#endif /* _TCL */ 1393