/share/tcltk: add private .gitignore
[msysgit.git] / mingw / include / tcl.h
blob696076b9428ece2f04cd58c1ea459b9a841e14a2
1 /*
2 * tcl.h --
4 * This header file describes the externally-visible facilities
5 * of the Tcl interpreter.
7 * Copyright (c) 1987-1994 The Regents of the University of California.
8 * Copyright (c) 1993-1996 Lucent Technologies.
9 * Copyright (c) 1994-1998 Sun Microsystems, Inc.
10 * Copyright (c) 1998-2000 by Scriptics Corporation.
11 * Copyright (c) 2002 by Kevin B. Kenny. All rights reserved.
13 * See the file "license.terms" for information on usage and redistribution
14 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
16 * RCS: @(#) $Id: tcl.h,v 1.153.2.29 2006/10/05 21:24:56 hobbs Exp $
19 #ifndef _TCL
20 #define _TCL
23 * For C++ compilers, use extern "C"
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
31 * The following defines are used to indicate the various release levels.
34 #define TCL_ALPHA_RELEASE 0
35 #define TCL_BETA_RELEASE 1
36 #define TCL_FINAL_RELEASE 2
39 * When version numbers change here, must also go into the following files
40 * and update the version numbers:
42 * library/init.tcl (only if Major.minor changes, not patchlevel) 1 LOC
43 * unix/configure.in (2 LOC Major, 2 LOC minor, 1 LOC patch)
44 * win/configure.in (as above)
45 * win/tcl.m4 (not patchlevel)
46 * win/makefile.vc (not patchlevel) 2 LOC
47 * README (sections 0 and 2)
48 * mac/README (2 LOC, not patchlevel)
49 * macosx/Tcl.pbproj/project.pbxproj (not patchlevel) 1 LOC
50 * macosx/Tcl.pbproj/default.pbxuser (not patchlevel) 1 LOC
51 * win/README.binary (sections 0-4)
52 * win/README (not patchlevel) (sections 0 and 2)
53 * unix/tcl.spec (2 LOC Major/Minor, 1 LOC patch)
54 * tests/basic.test (1 LOC M/M, not patchlevel)
55 * tools/tcl.hpj.in (not patchlevel, for windows installer)
56 * tools/tcl.wse.in (for windows installer)
57 * tools/tclSplash.bmp (not patchlevel)
59 #define TCL_MAJOR_VERSION 8
60 #define TCL_MINOR_VERSION 4
61 #define TCL_RELEASE_LEVEL TCL_FINAL_RELEASE
62 #define TCL_RELEASE_SERIAL 14
64 #define TCL_VERSION "8.4"
65 #define TCL_PATCH_LEVEL "8.4.14"
68 * The following definitions set up the proper options for Windows
69 * compilers. We use this method because there is no autoconf equivalent.
72 #ifndef __WIN32__
73 # if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__) || defined(__BORLANDC__)
74 # define __WIN32__
75 # ifndef WIN32
76 # define WIN32
77 # endif
78 # endif
79 #endif
82 * STRICT: See MSDN Article Q83456
84 #ifdef __WIN32__
85 # ifndef STRICT
86 # define STRICT
87 # endif
88 #endif /* __WIN32__ */
91 * The following definitions set up the proper options for Macintosh
92 * compilers. We use this method because there is no autoconf equivalent.
95 #ifdef MAC_TCL
96 #include <ConditionalMacros.h>
97 # ifndef USE_TCLALLOC
98 # define USE_TCLALLOC 1
99 # endif
100 # ifndef NO_STRERROR
101 # define NO_STRERROR 1
102 # endif
103 # define INLINE
104 #endif
108 * Utility macros: STRINGIFY takes an argument and wraps it in "" (double
109 * quotation marks), JOIN joins two arguments.
111 #ifndef STRINGIFY
112 # define STRINGIFY(x) STRINGIFY1(x)
113 # define STRINGIFY1(x) #x
114 #endif
115 #ifndef JOIN
116 # define JOIN(a,b) JOIN1(a,b)
117 # define JOIN1(a,b) a##b
118 #endif
121 * A special definition used to allow this header file to be included
122 * from windows or mac resource files so that they can obtain version
123 * information. RC_INVOKED is defined by default by the windows RC tool
124 * and manually set for macintosh.
126 * Resource compilers don't like all the C stuff, like typedefs and
127 * procedure declarations, that occur below, so block them out.
130 #ifndef RC_INVOKED
133 * Special macro to define mutexes, that doesn't do anything
134 * if we are not using threads.
137 #ifdef TCL_THREADS
138 #define TCL_DECLARE_MUTEX(name) static Tcl_Mutex name;
139 #else
140 #define TCL_DECLARE_MUTEX(name)
141 #endif
144 * Macros that eliminate the overhead of the thread synchronization
145 * functions when compiling without thread support.
148 #ifndef TCL_THREADS
149 #define Tcl_MutexLock(mutexPtr)
150 #define Tcl_MutexUnlock(mutexPtr)
151 #define Tcl_MutexFinalize(mutexPtr)
152 #define Tcl_ConditionNotify(condPtr)
153 #define Tcl_ConditionWait(condPtr, mutexPtr, timePtr)
154 #define Tcl_ConditionFinalize(condPtr)
155 #endif /* TCL_THREADS */
158 #ifndef BUFSIZ
159 # include <stdio.h>
160 #endif
164 * Definitions that allow Tcl functions with variable numbers of
165 * arguments to be used with either varargs.h or stdarg.h. TCL_VARARGS
166 * is used in procedure prototypes. TCL_VARARGS_DEF is used to declare
167 * the arguments in a function definiton: it takes the type and name of
168 * the first argument and supplies the appropriate argument declaration
169 * string for use in the function definition. TCL_VARARGS_START
170 * initializes the va_list data structure and returns the first argument.
172 #if !defined(NO_STDARG)
173 # include <stdarg.h>
174 # define TCL_VARARGS(type, name) (type name, ...)
175 # define TCL_VARARGS_DEF(type, name) (type name, ...)
176 # define TCL_VARARGS_START(type, name, list) (va_start(list, name), name)
177 #else
178 # include <varargs.h>
179 # define TCL_VARARGS(type, name) ()
180 # define TCL_VARARGS_DEF(type, name) (va_alist)
181 # define TCL_VARARGS_START(type, name, list) \
182 (va_start(list), va_arg(list, type))
183 #endif
186 * Macros used to declare a function to be exported by a DLL.
187 * Used by Windows, maps to no-op declarations on non-Windows systems.
188 * The default build on windows is for a DLL, which causes the DLLIMPORT
189 * and DLLEXPORT macros to be nonempty. To build a static library, the
190 * macro STATIC_BUILD should be defined.
193 #ifdef STATIC_BUILD
194 # define DLLIMPORT
195 # define DLLEXPORT
196 #else
197 # if (defined(__WIN32__) && (defined(_MSC_VER) || (__BORLANDC__ >= 0x0550) || (defined(__GNUC__) && defined(__declspec)))) || (defined(MAC_TCL) && FUNCTION_DECLSPEC)
198 # define DLLIMPORT __declspec(dllimport)
199 # define DLLEXPORT __declspec(dllexport)
200 # else
201 # define DLLIMPORT
202 # define DLLEXPORT
203 # endif
204 #endif
207 * These macros are used to control whether functions are being declared for
208 * import or export. If a function is being declared while it is being built
209 * to be included in a shared library, then it should have the DLLEXPORT
210 * storage class. If is being declared for use by a module that is going to
211 * link against the shared library, then it should have the DLLIMPORT storage
212 * class. If the symbol is beind declared for a static build or for use from a
213 * stub library, then the storage class should be empty.
215 * The convention is that a macro called BUILD_xxxx, where xxxx is the
216 * name of a library we are building, is set on the compile line for sources
217 * that are to be placed in the library. When this macro is set, the
218 * storage class will be set to DLLEXPORT. At the end of the header file, the
219 * storage class will be reset to DLLIMPORT.
221 #undef TCL_STORAGE_CLASS
222 #ifdef BUILD_tcl
223 # define TCL_STORAGE_CLASS DLLEXPORT
224 #else
225 # ifdef USE_TCL_STUBS
226 # define TCL_STORAGE_CLASS
227 # else
228 # define TCL_STORAGE_CLASS DLLIMPORT
229 # endif
230 #endif
234 * Definitions that allow this header file to be used either with or
235 * without ANSI C features like function prototypes.
237 #undef _ANSI_ARGS_
238 #undef CONST
239 #ifndef INLINE
240 # define INLINE
241 #endif
243 #ifndef NO_CONST
244 # define CONST const
245 #else
246 # define CONST
247 #endif
249 #ifndef NO_PROTOTYPES
250 # define _ANSI_ARGS_(x) x
251 #else
252 # define _ANSI_ARGS_(x) ()
253 #endif
255 #ifdef USE_NON_CONST
256 # ifdef USE_COMPAT_CONST
257 # error define at most one of USE_NON_CONST and USE_COMPAT_CONST
258 # endif
259 # define CONST84
260 # define CONST84_RETURN
261 #else
262 # ifdef USE_COMPAT_CONST
263 # define CONST84
264 # define CONST84_RETURN CONST
265 # else
266 # define CONST84 CONST
267 # define CONST84_RETURN CONST
268 # endif
269 #endif
273 * Make sure EXTERN isn't defined elsewhere
275 #ifdef EXTERN
276 # undef EXTERN
277 #endif /* EXTERN */
279 #ifdef __cplusplus
280 # define EXTERN extern "C" TCL_STORAGE_CLASS
281 #else
282 # define EXTERN extern TCL_STORAGE_CLASS
283 #endif
287 * The following code is copied from winnt.h.
288 * If we don't replicate it here, then <windows.h> can't be included
289 * after tcl.h, since tcl.h also defines VOID.
290 * This block is skipped under Cygwin and Mingw.
294 #if defined(__WIN32__) && !defined(HAVE_WINNT_IGNORE_VOID)
295 #ifndef VOID
296 #define VOID void
297 typedef char CHAR;
298 typedef short SHORT;
299 typedef long LONG;
300 #endif
301 #endif /* __WIN32__ && !HAVE_WINNT_IGNORE_VOID */
304 * Macro to use instead of "void" for arguments that must have
305 * type "void *" in ANSI C; maps them to type "char *" in
306 * non-ANSI systems.
309 #ifndef NO_VOID
310 # define VOID void
311 #else
312 # define VOID char
313 #endif
316 * Miscellaneous declarations.
319 #ifndef _CLIENTDATA
320 # ifndef NO_VOID
321 typedef void *ClientData;
322 # else
323 typedef int *ClientData;
324 # endif
325 # define _CLIENTDATA
326 #endif
329 * Darwin specifc configure overrides (to support fat compiles, where
330 * configure runs only once for multiple architectures):
333 #ifdef __APPLE__
334 # ifdef __LP64__
335 # undef TCL_WIDE_INT_TYPE
336 # define TCL_WIDE_INT_IS_LONG 1
337 # else /* !__LP64__ */
338 # define TCL_WIDE_INT_TYPE long long
339 # undef TCL_WIDE_INT_IS_LONG
340 # endif /* __LP64__ */
341 # undef HAVE_STRUCT_STAT64
342 #endif /* __APPLE__ */
345 * Define Tcl_WideInt to be a type that is (at least) 64-bits wide,
346 * and define Tcl_WideUInt to be the unsigned variant of that type
347 * (assuming that where we have one, we can have the other.)
349 * Also defines the following macros:
350 * TCL_WIDE_INT_IS_LONG - if wide ints are really longs (i.e. we're on
351 * a real 64-bit system.)
352 * Tcl_WideAsLong - forgetful converter from wideInt to long.
353 * Tcl_LongAsWide - sign-extending converter from long to wideInt.
354 * Tcl_WideAsDouble - converter from wideInt to double.
355 * Tcl_DoubleAsWide - converter from double to wideInt.
357 * The following invariant should hold for any long value 'longVal':
358 * longVal == Tcl_WideAsLong(Tcl_LongAsWide(longVal))
360 * Note on converting between Tcl_WideInt and strings. This
361 * implementation (in tclObj.c) depends on the functions strtoull()
362 * and sprintf(...,"%" TCL_LL_MODIFIER "d",...). TCL_LL_MODIFIER_SIZE
363 * is the length of the modifier string, which is "ll" on most 32-bit
364 * Unix systems. It has to be split up like this to allow for the more
365 * complex formats sometimes needed (e.g. in the format(n) command.)
368 #if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG)
369 # if defined(__GNUC__)
370 # define TCL_WIDE_INT_TYPE long long
371 # if defined(__WIN32__) && !defined(__CYGWIN__)
372 # define TCL_LL_MODIFIER "I64"
373 # define TCL_LL_MODIFIER_SIZE 3
374 # else
375 # define TCL_LL_MODIFIER "L"
376 # define TCL_LL_MODIFIER_SIZE 1
377 # endif
378 typedef struct stat Tcl_StatBuf;
379 # elif defined(__WIN32__)
380 # define TCL_WIDE_INT_TYPE __int64
381 # ifdef __BORLANDC__
382 typedef struct stati64 Tcl_StatBuf;
383 # define TCL_LL_MODIFIER "L"
384 # define TCL_LL_MODIFIER_SIZE 1
385 # else /* __BORLANDC__ */
386 # if _MSC_VER < 1400 || !defined(_M_IX86)
387 typedef struct _stati64 Tcl_StatBuf;
388 # else
389 typedef struct _stat64 Tcl_StatBuf;
390 # endif /* _MSC_VER < 1400 */
391 # define TCL_LL_MODIFIER "I64"
392 # define TCL_LL_MODIFIER_SIZE 3
393 # endif /* __BORLANDC__ */
394 # else /* __WIN32__ */
396 * Don't know what platform it is and configure hasn't discovered what
397 * is going on for us. Try to guess...
399 # ifdef NO_LIMITS_H
400 # error please define either TCL_WIDE_INT_TYPE or TCL_WIDE_INT_IS_LONG
401 # else /* !NO_LIMITS_H */
402 # include <limits.h>
403 # if (INT_MAX < LONG_MAX)
404 # define TCL_WIDE_INT_IS_LONG 1
405 # else
406 # define TCL_WIDE_INT_TYPE long long
407 # endif
408 # endif /* NO_LIMITS_H */
409 # endif /* __WIN32__ */
410 #endif /* !TCL_WIDE_INT_TYPE & !TCL_WIDE_INT_IS_LONG */
411 #ifdef TCL_WIDE_INT_IS_LONG
412 # undef TCL_WIDE_INT_TYPE
413 # define TCL_WIDE_INT_TYPE long
414 #endif /* TCL_WIDE_INT_IS_LONG */
416 typedef TCL_WIDE_INT_TYPE Tcl_WideInt;
417 typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt;
419 #ifdef TCL_WIDE_INT_IS_LONG
420 typedef struct stat Tcl_StatBuf;
421 # define Tcl_WideAsLong(val) ((long)(val))
422 # define Tcl_LongAsWide(val) ((long)(val))
423 # define Tcl_WideAsDouble(val) ((double)((long)(val)))
424 # define Tcl_DoubleAsWide(val) ((long)((double)(val)))
425 # ifndef TCL_LL_MODIFIER
426 # define TCL_LL_MODIFIER "l"
427 # define TCL_LL_MODIFIER_SIZE 1
428 # endif /* !TCL_LL_MODIFIER */
429 #else /* TCL_WIDE_INT_IS_LONG */
431 * The next short section of defines are only done when not running on
432 * Windows or some other strange platform.
434 # ifndef TCL_LL_MODIFIER
435 # ifdef HAVE_STRUCT_STAT64
436 typedef struct stat64 Tcl_StatBuf;
437 # else
438 typedef struct stat Tcl_StatBuf;
439 # endif /* HAVE_STRUCT_STAT64 */
440 # define TCL_LL_MODIFIER "ll"
441 # define TCL_LL_MODIFIER_SIZE 2
442 # endif /* !TCL_LL_MODIFIER */
443 # define Tcl_WideAsLong(val) ((long)((Tcl_WideInt)(val)))
444 # define Tcl_LongAsWide(val) ((Tcl_WideInt)((long)(val)))
445 # define Tcl_WideAsDouble(val) ((double)((Tcl_WideInt)(val)))
446 # define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val)))
447 #endif /* TCL_WIDE_INT_IS_LONG */
451 * This flag controls whether binary compatability is maintained with
452 * extensions built against a previous version of Tcl. This is true
453 * by default.
455 #ifndef TCL_PRESERVE_BINARY_COMPATABILITY
456 # define TCL_PRESERVE_BINARY_COMPATABILITY 1
457 #endif
461 * Data structures defined opaquely in this module. The definitions below
462 * just provide dummy types. A few fields are made visible in Tcl_Interp
463 * structures, namely those used for returning a string result from
464 * commands. Direct access to the result field is discouraged in Tcl 8.0.
465 * The interpreter result is either an object or a string, and the two
466 * values are kept consistent unless some C code sets interp->result
467 * directly. Programmers should use either the procedure Tcl_GetObjResult()
468 * or Tcl_GetStringResult() to read the interpreter's result. See the
469 * SetResult man page for details.
471 * Note: any change to the Tcl_Interp definition below must be mirrored
472 * in the "real" definition in tclInt.h.
474 * Note: Tcl_ObjCmdProc procedures do not directly set result and freeProc.
475 * Instead, they set a Tcl_Obj member in the "real" structure that can be
476 * accessed with Tcl_GetObjResult() and Tcl_SetObjResult().
479 typedef struct Tcl_Interp {
480 char *result; /* If the last command returned a string
481 * result, this points to it. */
482 void (*freeProc) _ANSI_ARGS_((char *blockPtr));
483 /* Zero means the string result is
484 * statically allocated. TCL_DYNAMIC means
485 * it was allocated with ckalloc and should
486 * be freed with ckfree. Other values give
487 * the address of procedure to invoke to
488 * free the result. Tcl_Eval must free it
489 * before executing next command. */
490 int errorLine; /* When TCL_ERROR is returned, this gives
491 * the line number within the command where
492 * the error occurred (1 if first line). */
493 } Tcl_Interp;
495 typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler;
496 typedef struct Tcl_Channel_ *Tcl_Channel;
497 typedef struct Tcl_Command_ *Tcl_Command;
498 typedef struct Tcl_Condition_ *Tcl_Condition;
499 typedef struct Tcl_EncodingState_ *Tcl_EncodingState;
500 typedef struct Tcl_Encoding_ *Tcl_Encoding;
501 typedef struct Tcl_Event Tcl_Event;
502 typedef struct Tcl_Mutex_ *Tcl_Mutex;
503 typedef struct Tcl_Pid_ *Tcl_Pid;
504 typedef struct Tcl_RegExp_ *Tcl_RegExp;
505 typedef struct Tcl_ThreadDataKey_ *Tcl_ThreadDataKey;
506 typedef struct Tcl_ThreadId_ *Tcl_ThreadId;
507 typedef struct Tcl_TimerToken_ *Tcl_TimerToken;
508 typedef struct Tcl_Trace_ *Tcl_Trace;
509 typedef struct Tcl_Var_ *Tcl_Var;
510 typedef struct Tcl_ChannelTypeVersion_ *Tcl_ChannelTypeVersion;
511 typedef struct Tcl_LoadHandle_ *Tcl_LoadHandle;
514 * Definition of the interface to procedures implementing threads.
515 * A procedure following this definition is given to each call of
516 * 'Tcl_CreateThread' and will be called as the main fuction of
517 * the new thread created by that call.
519 #ifdef MAC_TCL
520 typedef pascal void *(Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData));
521 #elif defined __WIN32__
522 typedef unsigned (__stdcall Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData));
523 #else
524 typedef void (Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData));
525 #endif
529 * Threading function return types used for abstracting away platform
530 * differences when writing a Tcl_ThreadCreateProc. See the NewThread
531 * function in generic/tclThreadTest.c for it's usage.
533 #ifdef MAC_TCL
534 # define Tcl_ThreadCreateType pascal void *
535 # define TCL_THREAD_CREATE_RETURN return NULL
536 #elif defined __WIN32__
537 # define Tcl_ThreadCreateType unsigned __stdcall
538 # define TCL_THREAD_CREATE_RETURN return 0
539 #else
540 # define Tcl_ThreadCreateType void
541 # define TCL_THREAD_CREATE_RETURN
542 #endif
546 * Definition of values for default stacksize and the possible flags to be
547 * given to Tcl_CreateThread.
549 #define TCL_THREAD_STACK_DEFAULT (0) /* Use default size for stack */
550 #define TCL_THREAD_NOFLAGS (0000) /* Standard flags, default behaviour */
551 #define TCL_THREAD_JOINABLE (0001) /* Mark the thread as joinable */
554 * Flag values passed to Tcl_GetRegExpFromObj.
556 #define TCL_REG_BASIC 000000 /* BREs (convenience) */
557 #define TCL_REG_EXTENDED 000001 /* EREs */
558 #define TCL_REG_ADVF 000002 /* advanced features in EREs */
559 #define TCL_REG_ADVANCED 000003 /* AREs (which are also EREs) */
560 #define TCL_REG_QUOTE 000004 /* no special characters, none */
561 #define TCL_REG_NOCASE 000010 /* ignore case */
562 #define TCL_REG_NOSUB 000020 /* don't care about subexpressions */
563 #define TCL_REG_EXPANDED 000040 /* expanded format, white space &
564 * comments */
565 #define TCL_REG_NLSTOP 000100 /* \n doesn't match . or [^ ] */
566 #define TCL_REG_NLANCH 000200 /* ^ matches after \n, $ before */
567 #define TCL_REG_NEWLINE 000300 /* newlines are line terminators */
568 #define TCL_REG_CANMATCH 001000 /* report details on partial/limited
569 * matches */
572 * The following flag is experimental and only intended for use by Expect. It
573 * will probably go away in a later release.
575 #define TCL_REG_BOSONLY 002000 /* prepend \A to pattern so it only
576 * matches at the beginning of the
577 * string. */
580 * Flags values passed to Tcl_RegExpExecObj.
582 #define TCL_REG_NOTBOL 0001 /* Beginning of string does not match ^. */
583 #define TCL_REG_NOTEOL 0002 /* End of string does not match $. */
586 * Structures filled in by Tcl_RegExpInfo. Note that all offset values are
587 * relative to the start of the match string, not the beginning of the
588 * entire string.
590 typedef struct Tcl_RegExpIndices {
591 long start; /* character offset of first character in match */
592 long end; /* character offset of first character after the
593 * match. */
594 } Tcl_RegExpIndices;
596 typedef struct Tcl_RegExpInfo {
597 int nsubs; /* number of subexpressions in the
598 * compiled expression */
599 Tcl_RegExpIndices *matches; /* array of nsubs match offset
600 * pairs */
601 long extendStart; /* The offset at which a subsequent
602 * match might begin. */
603 long reserved; /* Reserved for later use. */
604 } Tcl_RegExpInfo;
607 * Picky compilers complain if this typdef doesn't appear before the
608 * struct's reference in tclDecls.h.
610 typedef Tcl_StatBuf *Tcl_Stat_;
611 typedef struct stat *Tcl_OldStat_;
614 * When a TCL command returns, the interpreter contains a result from the
615 * command. Programmers are strongly encouraged to use one of the
616 * procedures Tcl_GetObjResult() or Tcl_GetStringResult() to read the
617 * interpreter's result. See the SetResult man page for details. Besides
618 * this result, the command procedure returns an integer code, which is
619 * one of the following:
621 * TCL_OK Command completed normally; the interpreter's
622 * result contains the command's result.
623 * TCL_ERROR The command couldn't be completed successfully;
624 * the interpreter's result describes what went wrong.
625 * TCL_RETURN The command requests that the current procedure
626 * return; the interpreter's result contains the
627 * procedure's return value.
628 * TCL_BREAK The command requests that the innermost loop
629 * be exited; the interpreter's result is meaningless.
630 * TCL_CONTINUE Go on to the next iteration of the current loop;
631 * the interpreter's result is meaningless.
633 #define TCL_OK 0
634 #define TCL_ERROR 1
635 #define TCL_RETURN 2
636 #define TCL_BREAK 3
637 #define TCL_CONTINUE 4
639 #define TCL_RESULT_SIZE 200
642 * Flags to control what substitutions are performed by Tcl_SubstObj():
644 #define TCL_SUBST_COMMANDS 001
645 #define TCL_SUBST_VARIABLES 002
646 #define TCL_SUBST_BACKSLASHES 004
647 #define TCL_SUBST_ALL 007
651 * Argument descriptors for math function callbacks in expressions:
653 typedef enum {
654 TCL_INT, TCL_DOUBLE, TCL_EITHER, TCL_WIDE_INT
655 } Tcl_ValueType;
656 typedef struct Tcl_Value {
657 Tcl_ValueType type; /* Indicates intValue or doubleValue is
658 * valid, or both. */
659 long intValue; /* Integer value. */
660 double doubleValue; /* Double-precision floating value. */
661 Tcl_WideInt wideValue; /* Wide (min. 64-bit) integer value. */
662 } Tcl_Value;
665 * Forward declaration of Tcl_Obj to prevent an error when the forward
666 * reference to Tcl_Obj is encountered in the procedure types declared
667 * below.
669 struct Tcl_Obj;
673 * Procedure types defined by Tcl:
676 typedef int (Tcl_AppInitProc) _ANSI_ARGS_((Tcl_Interp *interp));
677 typedef int (Tcl_AsyncProc) _ANSI_ARGS_((ClientData clientData,
678 Tcl_Interp *interp, int code));
679 typedef void (Tcl_ChannelProc) _ANSI_ARGS_((ClientData clientData, int mask));
680 typedef void (Tcl_CloseProc) _ANSI_ARGS_((ClientData data));
681 typedef void (Tcl_CmdDeleteProc) _ANSI_ARGS_((ClientData clientData));
682 typedef int (Tcl_CmdProc) _ANSI_ARGS_((ClientData clientData,
683 Tcl_Interp *interp, int argc, CONST84 char *argv[]));
684 typedef void (Tcl_CmdTraceProc) _ANSI_ARGS_((ClientData clientData,
685 Tcl_Interp *interp, int level, char *command, Tcl_CmdProc *proc,
686 ClientData cmdClientData, int argc, CONST84 char *argv[]));
687 typedef int (Tcl_CmdObjTraceProc) _ANSI_ARGS_((ClientData clientData,
688 Tcl_Interp *interp, int level, CONST char *command,
689 Tcl_Command commandInfo, int objc, struct Tcl_Obj * CONST * objv));
690 typedef void (Tcl_CmdObjTraceDeleteProc) _ANSI_ARGS_((ClientData clientData));
691 typedef void (Tcl_DupInternalRepProc) _ANSI_ARGS_((struct Tcl_Obj *srcPtr,
692 struct Tcl_Obj *dupPtr));
693 typedef int (Tcl_EncodingConvertProc)_ANSI_ARGS_((ClientData clientData,
694 CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr,
695 char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr,
696 int *dstCharsPtr));
697 typedef void (Tcl_EncodingFreeProc)_ANSI_ARGS_((ClientData clientData));
698 typedef int (Tcl_EventProc) _ANSI_ARGS_((Tcl_Event *evPtr, int flags));
699 typedef void (Tcl_EventCheckProc) _ANSI_ARGS_((ClientData clientData,
700 int flags));
701 typedef int (Tcl_EventDeleteProc) _ANSI_ARGS_((Tcl_Event *evPtr,
702 ClientData clientData));
703 typedef void (Tcl_EventSetupProc) _ANSI_ARGS_((ClientData clientData,
704 int flags));
705 typedef void (Tcl_ExitProc) _ANSI_ARGS_((ClientData clientData));
706 typedef void (Tcl_FileProc) _ANSI_ARGS_((ClientData clientData, int mask));
707 typedef void (Tcl_FileFreeProc) _ANSI_ARGS_((ClientData clientData));
708 typedef void (Tcl_FreeInternalRepProc) _ANSI_ARGS_((struct Tcl_Obj *objPtr));
709 typedef void (Tcl_FreeProc) _ANSI_ARGS_((char *blockPtr));
710 typedef void (Tcl_IdleProc) _ANSI_ARGS_((ClientData clientData));
711 typedef void (Tcl_InterpDeleteProc) _ANSI_ARGS_((ClientData clientData,
712 Tcl_Interp *interp));
713 typedef int (Tcl_MathProc) _ANSI_ARGS_((ClientData clientData,
714 Tcl_Interp *interp, Tcl_Value *args, Tcl_Value *resultPtr));
715 typedef void (Tcl_NamespaceDeleteProc) _ANSI_ARGS_((ClientData clientData));
716 typedef int (Tcl_ObjCmdProc) _ANSI_ARGS_((ClientData clientData,
717 Tcl_Interp *interp, int objc, struct Tcl_Obj * CONST * objv));
718 typedef int (Tcl_PackageInitProc) _ANSI_ARGS_((Tcl_Interp *interp));
719 typedef void (Tcl_PanicProc) _ANSI_ARGS_(TCL_VARARGS(CONST char *, format));
720 typedef void (Tcl_TcpAcceptProc) _ANSI_ARGS_((ClientData callbackData,
721 Tcl_Channel chan, char *address, int port));
722 typedef void (Tcl_TimerProc) _ANSI_ARGS_((ClientData clientData));
723 typedef int (Tcl_SetFromAnyProc) _ANSI_ARGS_((Tcl_Interp *interp,
724 struct Tcl_Obj *objPtr));
725 typedef void (Tcl_UpdateStringProc) _ANSI_ARGS_((struct Tcl_Obj *objPtr));
726 typedef char *(Tcl_VarTraceProc) _ANSI_ARGS_((ClientData clientData,
727 Tcl_Interp *interp, CONST84 char *part1, CONST84 char *part2, int flags));
728 typedef void (Tcl_CommandTraceProc) _ANSI_ARGS_((ClientData clientData,
729 Tcl_Interp *interp, CONST char *oldName, CONST char *newName,
730 int flags));
731 typedef void (Tcl_CreateFileHandlerProc) _ANSI_ARGS_((int fd, int mask,
732 Tcl_FileProc *proc, ClientData clientData));
733 typedef void (Tcl_DeleteFileHandlerProc) _ANSI_ARGS_((int fd));
734 typedef void (Tcl_AlertNotifierProc) _ANSI_ARGS_((ClientData clientData));
735 typedef void (Tcl_ServiceModeHookProc) _ANSI_ARGS_((int mode));
736 typedef ClientData (Tcl_InitNotifierProc) _ANSI_ARGS_((VOID));
737 typedef void (Tcl_FinalizeNotifierProc) _ANSI_ARGS_((ClientData clientData));
738 typedef void (Tcl_MainLoopProc) _ANSI_ARGS_((void));
742 * The following structure represents a type of object, which is a
743 * particular internal representation for an object plus a set of
744 * procedures that provide standard operations on objects of that type.
747 typedef struct Tcl_ObjType {
748 char *name; /* Name of the type, e.g. "int". */
749 Tcl_FreeInternalRepProc *freeIntRepProc;
750 /* Called to free any storage for the type's
751 * internal rep. NULL if the internal rep
752 * does not need freeing. */
753 Tcl_DupInternalRepProc *dupIntRepProc;
754 /* Called to create a new object as a copy
755 * of an existing object. */
756 Tcl_UpdateStringProc *updateStringProc;
757 /* Called to update the string rep from the
758 * type's internal representation. */
759 Tcl_SetFromAnyProc *setFromAnyProc;
760 /* Called to convert the object's internal
761 * rep to this type. Frees the internal rep
762 * of the old type. Returns TCL_ERROR on
763 * failure. */
764 } Tcl_ObjType;
768 * One of the following structures exists for each object in the Tcl
769 * system. An object stores a value as either a string, some internal
770 * representation, or both.
773 typedef struct Tcl_Obj {
774 int refCount; /* When 0 the object will be freed. */
775 char *bytes; /* This points to the first byte of the
776 * object's string representation. The array
777 * must be followed by a null byte (i.e., at
778 * offset length) but may also contain
779 * embedded null characters. The array's
780 * storage is allocated by ckalloc. NULL
781 * means the string rep is invalid and must
782 * be regenerated from the internal rep.
783 * Clients should use Tcl_GetStringFromObj
784 * or Tcl_GetString to get a pointer to the
785 * byte array as a readonly value. */
786 int length; /* The number of bytes at *bytes, not
787 * including the terminating null. */
788 Tcl_ObjType *typePtr; /* Denotes the object's type. Always
789 * corresponds to the type of the object's
790 * internal rep. NULL indicates the object
791 * has no internal rep (has no type). */
792 union { /* The internal representation: */
793 long longValue; /* - an long integer value */
794 double doubleValue; /* - a double-precision floating value */
795 VOID *otherValuePtr; /* - another, type-specific value */
796 Tcl_WideInt wideValue; /* - a long long value */
797 struct { /* - internal rep as two pointers */
798 VOID *ptr1;
799 VOID *ptr2;
800 } twoPtrValue;
801 } internalRep;
802 } Tcl_Obj;
806 * Macros to increment and decrement a Tcl_Obj's reference count, and to
807 * test whether an object is shared (i.e. has reference count > 1).
808 * Note: clients should use Tcl_DecrRefCount() when they are finished using
809 * an object, and should never call TclFreeObj() directly. TclFreeObj() is
810 * only defined and made public in tcl.h to support Tcl_DecrRefCount's macro
811 * definition. Note also that Tcl_DecrRefCount() refers to the parameter
812 * "obj" twice. This means that you should avoid calling it with an
813 * expression that is expensive to compute or has side effects.
815 void Tcl_IncrRefCount _ANSI_ARGS_((Tcl_Obj *objPtr));
816 void Tcl_DecrRefCount _ANSI_ARGS_((Tcl_Obj *objPtr));
817 int Tcl_IsShared _ANSI_ARGS_((Tcl_Obj *objPtr));
819 #ifdef TCL_MEM_DEBUG
820 # define Tcl_IncrRefCount(objPtr) \
821 Tcl_DbIncrRefCount(objPtr, __FILE__, __LINE__)
822 # define Tcl_DecrRefCount(objPtr) \
823 Tcl_DbDecrRefCount(objPtr, __FILE__, __LINE__)
824 # define Tcl_IsShared(objPtr) \
825 Tcl_DbIsShared(objPtr, __FILE__, __LINE__)
826 #else
827 # define Tcl_IncrRefCount(objPtr) \
828 ++(objPtr)->refCount
830 * Use empty if ; else to handle use in unbraced outer if/else conditions
832 # define Tcl_DecrRefCount(objPtr) \
833 if (--(objPtr)->refCount > 0) ; else TclFreeObj(objPtr)
834 # define Tcl_IsShared(objPtr) \
835 ((objPtr)->refCount > 1)
836 #endif
839 * Macros and definitions that help to debug the use of Tcl objects.
840 * When TCL_MEM_DEBUG is defined, the Tcl_New declarations are
841 * overridden to call debugging versions of the object creation procedures.
844 #ifdef TCL_MEM_DEBUG
845 # define Tcl_NewBooleanObj(val) \
846 Tcl_DbNewBooleanObj(val, __FILE__, __LINE__)
847 # define Tcl_NewByteArrayObj(bytes, len) \
848 Tcl_DbNewByteArrayObj(bytes, len, __FILE__, __LINE__)
849 # define Tcl_NewDoubleObj(val) \
850 Tcl_DbNewDoubleObj(val, __FILE__, __LINE__)
851 # define Tcl_NewIntObj(val) \
852 Tcl_DbNewLongObj(val, __FILE__, __LINE__)
853 # define Tcl_NewListObj(objc, objv) \
854 Tcl_DbNewListObj(objc, objv, __FILE__, __LINE__)
855 # define Tcl_NewLongObj(val) \
856 Tcl_DbNewLongObj(val, __FILE__, __LINE__)
857 # define Tcl_NewObj() \
858 Tcl_DbNewObj(__FILE__, __LINE__)
859 # define Tcl_NewStringObj(bytes, len) \
860 Tcl_DbNewStringObj(bytes, len, __FILE__, __LINE__)
861 # define Tcl_NewWideIntObj(val) \
862 Tcl_DbNewWideIntObj(val, __FILE__, __LINE__)
863 #endif /* TCL_MEM_DEBUG */
867 * The following structure contains the state needed by
868 * Tcl_SaveResult. No-one outside of Tcl should access any of these
869 * fields. This structure is typically allocated on the stack.
871 typedef struct Tcl_SavedResult {
872 char *result;
873 Tcl_FreeProc *freeProc;
874 Tcl_Obj *objResultPtr;
875 char *appendResult;
876 int appendAvl;
877 int appendUsed;
878 char resultSpace[TCL_RESULT_SIZE+1];
879 } Tcl_SavedResult;
883 * The following definitions support Tcl's namespace facility.
884 * Note: the first five fields must match exactly the fields in a
885 * Namespace structure (see tclInt.h).
888 typedef struct Tcl_Namespace {
889 char *name; /* The namespace's name within its parent
890 * namespace. This contains no ::'s. The
891 * name of the global namespace is ""
892 * although "::" is an synonym. */
893 char *fullName; /* The namespace's fully qualified name.
894 * This starts with ::. */
895 ClientData clientData; /* Arbitrary value associated with this
896 * namespace. */
897 Tcl_NamespaceDeleteProc* deleteProc;
898 /* Procedure invoked when deleting the
899 * namespace to, e.g., free clientData. */
900 struct Tcl_Namespace* parentPtr;
901 /* Points to the namespace that contains
902 * this one. NULL if this is the global
903 * namespace. */
904 } Tcl_Namespace;
908 * The following structure represents a call frame, or activation record.
909 * A call frame defines a naming context for a procedure call: its local
910 * scope (for local variables) and its namespace scope (used for non-local
911 * variables; often the global :: namespace). A call frame can also define
912 * the naming context for a namespace eval or namespace inscope command:
913 * the namespace in which the command's code should execute. The
914 * Tcl_CallFrame structures exist only while procedures or namespace
915 * eval/inscope's are being executed, and provide a Tcl call stack.
917 * A call frame is initialized and pushed using Tcl_PushCallFrame and
918 * popped using Tcl_PopCallFrame. Storage for a Tcl_CallFrame must be
919 * provided by the Tcl_PushCallFrame caller, and callers typically allocate
920 * them on the C call stack for efficiency. For this reason, Tcl_CallFrame
921 * is defined as a structure and not as an opaque token. However, most
922 * Tcl_CallFrame fields are hidden since applications should not access
923 * them directly; others are declared as "dummyX".
925 * WARNING!! The structure definition must be kept consistent with the
926 * CallFrame structure in tclInt.h. If you change one, change the other.
929 typedef struct Tcl_CallFrame {
930 Tcl_Namespace *nsPtr;
931 int dummy1;
932 int dummy2;
933 char *dummy3;
934 char *dummy4;
935 char *dummy5;
936 int dummy6;
937 char *dummy7;
938 char *dummy8;
939 int dummy9;
940 char* dummy10;
941 } Tcl_CallFrame;
945 * Information about commands that is returned by Tcl_GetCommandInfo and
946 * passed to Tcl_SetCommandInfo. objProc is an objc/objv object-based
947 * command procedure while proc is a traditional Tcl argc/argv
948 * string-based procedure. Tcl_CreateObjCommand and Tcl_CreateCommand
949 * ensure that both objProc and proc are non-NULL and can be called to
950 * execute the command. However, it may be faster to call one instead of
951 * the other. The member isNativeObjectProc is set to 1 if an
952 * object-based procedure was registered by Tcl_CreateObjCommand, and to
953 * 0 if a string-based procedure was registered by Tcl_CreateCommand.
954 * The other procedure is typically set to a compatibility wrapper that
955 * does string-to-object or object-to-string argument conversions then
956 * calls the other procedure.
959 typedef struct Tcl_CmdInfo {
960 int isNativeObjectProc; /* 1 if objProc was registered by a call to
961 * Tcl_CreateObjCommand; 0 otherwise.
962 * Tcl_SetCmdInfo does not modify this
963 * field. */
964 Tcl_ObjCmdProc *objProc; /* Command's object-based procedure. */
965 ClientData objClientData; /* ClientData for object proc. */
966 Tcl_CmdProc *proc; /* Command's string-based procedure. */
967 ClientData clientData; /* ClientData for string proc. */
968 Tcl_CmdDeleteProc *deleteProc;
969 /* Procedure to call when command is
970 * deleted. */
971 ClientData deleteData; /* Value to pass to deleteProc (usually
972 * the same as clientData). */
973 Tcl_Namespace *namespacePtr; /* Points to the namespace that contains
974 * this command. Note that Tcl_SetCmdInfo
975 * will not change a command's namespace;
976 * use Tcl_RenameCommand to do that. */
978 } Tcl_CmdInfo;
981 * The structure defined below is used to hold dynamic strings. The only
982 * field that clients should use is the string field, accessible via the
983 * macro Tcl_DStringValue.
985 #define TCL_DSTRING_STATIC_SIZE 200
986 typedef struct Tcl_DString {
987 char *string; /* Points to beginning of string: either
988 * staticSpace below or a malloced array. */
989 int length; /* Number of non-NULL characters in the
990 * string. */
991 int spaceAvl; /* Total number of bytes available for the
992 * string and its terminating NULL char. */
993 char staticSpace[TCL_DSTRING_STATIC_SIZE];
994 /* Space to use in common case where string
995 * is small. */
996 } Tcl_DString;
998 #define Tcl_DStringLength(dsPtr) ((dsPtr)->length)
999 #define Tcl_DStringValue(dsPtr) ((dsPtr)->string)
1000 #define Tcl_DStringTrunc Tcl_DStringSetLength
1003 * Definitions for the maximum number of digits of precision that may
1004 * be specified in the "tcl_precision" variable, and the number of
1005 * bytes of buffer space required by Tcl_PrintDouble.
1007 #define TCL_MAX_PREC 17
1008 #define TCL_DOUBLE_SPACE (TCL_MAX_PREC+10)
1011 * Definition for a number of bytes of buffer space sufficient to hold the
1012 * string representation of an integer in base 10 (assuming the existence
1013 * of 64-bit integers).
1015 #define TCL_INTEGER_SPACE 24
1018 * Flag that may be passed to Tcl_ConvertElement to force it not to
1019 * output braces (careful! if you change this flag be sure to change
1020 * the definitions at the front of tclUtil.c).
1022 #define TCL_DONT_USE_BRACES 1
1025 * Flag that may be passed to Tcl_GetIndexFromObj to force it to disallow
1026 * abbreviated strings.
1028 #define TCL_EXACT 1
1031 * Flag values passed to Tcl_RecordAndEval and/or Tcl_EvalObj.
1032 * WARNING: these bit choices must not conflict with the bit choices
1033 * for evalFlag bits in tclInt.h!!
1035 #define TCL_NO_EVAL 0x10000
1036 #define TCL_EVAL_GLOBAL 0x20000
1037 #define TCL_EVAL_DIRECT 0x40000
1038 #define TCL_EVAL_INVOKE 0x80000
1041 * Special freeProc values that may be passed to Tcl_SetResult (see
1042 * the man page for details):
1044 #define TCL_VOLATILE ((Tcl_FreeProc *) 1)
1045 #define TCL_STATIC ((Tcl_FreeProc *) 0)
1046 #define TCL_DYNAMIC ((Tcl_FreeProc *) 3)
1049 * Flag values passed to variable-related procedures.
1051 #define TCL_GLOBAL_ONLY 1
1052 #define TCL_NAMESPACE_ONLY 2
1053 #define TCL_APPEND_VALUE 4
1054 #define TCL_LIST_ELEMENT 8
1055 #define TCL_TRACE_READS 0x10
1056 #define TCL_TRACE_WRITES 0x20
1057 #define TCL_TRACE_UNSETS 0x40
1058 #define TCL_TRACE_DESTROYED 0x80
1059 #define TCL_INTERP_DESTROYED 0x100
1060 #define TCL_LEAVE_ERR_MSG 0x200
1061 #define TCL_TRACE_ARRAY 0x800
1062 #ifndef TCL_REMOVE_OBSOLETE_TRACES
1063 /* Required to support old variable/vdelete/vinfo traces */
1064 #define TCL_TRACE_OLD_STYLE 0x1000
1065 #endif
1066 /* Indicate the semantics of the result of a trace */
1067 #define TCL_TRACE_RESULT_DYNAMIC 0x8000
1068 #define TCL_TRACE_RESULT_OBJECT 0x10000
1071 * Flag values passed to command-related procedures.
1074 #define TCL_TRACE_RENAME 0x2000
1075 #define TCL_TRACE_DELETE 0x4000
1077 #define TCL_ALLOW_INLINE_COMPILATION 0x20000
1080 * Flag values passed to Tcl_CreateObjTrace, and used internally
1081 * by command execution traces. Slots 4,8,16 and 32 are
1082 * used internally by execution traces (see tclCmdMZ.c)
1084 #define TCL_TRACE_ENTER_EXEC 1
1085 #define TCL_TRACE_LEAVE_EXEC 2
1088 * The TCL_PARSE_PART1 flag is deprecated and has no effect.
1089 * The part1 is now always parsed whenever the part2 is NULL.
1090 * (This is to avoid a common error when converting code to
1091 * use the new object based APIs and forgetting to give the
1092 * flag)
1094 #ifndef TCL_NO_DEPRECATED
1095 # define TCL_PARSE_PART1 0x400
1096 #endif
1100 * Types for linked variables:
1102 #define TCL_LINK_INT 1
1103 #define TCL_LINK_DOUBLE 2
1104 #define TCL_LINK_BOOLEAN 3
1105 #define TCL_LINK_STRING 4
1106 #define TCL_LINK_WIDE_INT 5
1107 #define TCL_LINK_READ_ONLY 0x80
1111 * Forward declarations of Tcl_HashTable and related types.
1113 typedef struct Tcl_HashKeyType Tcl_HashKeyType;
1114 typedef struct Tcl_HashTable Tcl_HashTable;
1115 typedef struct Tcl_HashEntry Tcl_HashEntry;
1117 typedef unsigned int (Tcl_HashKeyProc) _ANSI_ARGS_((Tcl_HashTable *tablePtr,
1118 VOID *keyPtr));
1119 typedef int (Tcl_CompareHashKeysProc) _ANSI_ARGS_((VOID *keyPtr,
1120 Tcl_HashEntry *hPtr));
1121 typedef Tcl_HashEntry *(Tcl_AllocHashEntryProc) _ANSI_ARGS_((
1122 Tcl_HashTable *tablePtr, VOID *keyPtr));
1123 typedef void (Tcl_FreeHashEntryProc) _ANSI_ARGS_((Tcl_HashEntry *hPtr));
1126 * This flag controls whether the hash table stores the hash of a key, or
1127 * recalculates it. There should be no reason for turning this flag off
1128 * as it is completely binary and source compatible unless you directly
1129 * access the bucketPtr member of the Tcl_HashTableEntry structure. This
1130 * member has been removed and the space used to store the hash value.
1132 #ifndef TCL_HASH_KEY_STORE_HASH
1133 # define TCL_HASH_KEY_STORE_HASH 1
1134 #endif
1137 * Structure definition for an entry in a hash table. No-one outside
1138 * Tcl should access any of these fields directly; use the macros
1139 * defined below.
1142 struct Tcl_HashEntry {
1143 Tcl_HashEntry *nextPtr; /* Pointer to next entry in this
1144 * hash bucket, or NULL for end of
1145 * chain. */
1146 Tcl_HashTable *tablePtr; /* Pointer to table containing entry. */
1147 #if TCL_HASH_KEY_STORE_HASH
1148 # if TCL_PRESERVE_BINARY_COMPATABILITY
1149 VOID *hash; /* Hash value, stored as pointer to
1150 * ensure that the offsets of the
1151 * fields in this structure are not
1152 * changed. */
1153 # else
1154 unsigned int hash; /* Hash value. */
1155 # endif
1156 #else
1157 Tcl_HashEntry **bucketPtr; /* Pointer to bucket that points to
1158 * first entry in this entry's chain:
1159 * used for deleting the entry. */
1160 #endif
1161 ClientData clientData; /* Application stores something here
1162 * with Tcl_SetHashValue. */
1163 union { /* Key has one of these forms: */
1164 char *oneWordValue; /* One-word value for key. */
1165 Tcl_Obj *objPtr; /* Tcl_Obj * key value. */
1166 int words[1]; /* Multiple integer words for key.
1167 * The actual size will be as large
1168 * as necessary for this table's
1169 * keys. */
1170 char string[4]; /* String for key. The actual size
1171 * will be as large as needed to hold
1172 * the key. */
1173 } key; /* MUST BE LAST FIELD IN RECORD!! */
1177 * Flags used in Tcl_HashKeyType.
1179 * TCL_HASH_KEY_RANDOMIZE_HASH:
1180 * There are some things, pointers for example
1181 * which don't hash well because they do not use
1182 * the lower bits. If this flag is set then the
1183 * hash table will attempt to rectify this by
1184 * randomising the bits and then using the upper
1185 * N bits as the index into the table.
1187 #define TCL_HASH_KEY_RANDOMIZE_HASH 0x1
1190 * Structure definition for the methods associated with a hash table
1191 * key type.
1193 #define TCL_HASH_KEY_TYPE_VERSION 1
1194 struct Tcl_HashKeyType {
1195 int version; /* Version of the table. If this structure is
1196 * extended in future then the version can be
1197 * used to distinguish between different
1198 * structures.
1201 int flags; /* Flags, see above for details. */
1203 /* Calculates a hash value for the key. If this is NULL then the pointer
1204 * itself is used as a hash value.
1206 Tcl_HashKeyProc *hashKeyProc;
1208 /* Compares two keys and returns zero if they do not match, and non-zero
1209 * if they do. If this is NULL then the pointers are compared.
1211 Tcl_CompareHashKeysProc *compareKeysProc;
1213 /* Called to allocate memory for a new entry, i.e. if the key is a
1214 * string then this could allocate a single block which contains enough
1215 * space for both the entry and the string. Only the key field of the
1216 * allocated Tcl_HashEntry structure needs to be filled in. If something
1217 * else needs to be done to the key, i.e. incrementing a reference count
1218 * then that should be done by this function. If this is NULL then Tcl_Alloc
1219 * is used to allocate enough space for a Tcl_HashEntry and the key pointer
1220 * is assigned to key.oneWordValue.
1222 Tcl_AllocHashEntryProc *allocEntryProc;
1224 /* Called to free memory associated with an entry. If something else needs
1225 * to be done to the key, i.e. decrementing a reference count then that
1226 * should be done by this function. If this is NULL then Tcl_Free is used
1227 * to free the Tcl_HashEntry.
1229 Tcl_FreeHashEntryProc *freeEntryProc;
1233 * Structure definition for a hash table. Must be in tcl.h so clients
1234 * can allocate space for these structures, but clients should never
1235 * access any fields in this structure.
1238 #define TCL_SMALL_HASH_TABLE 4
1239 struct Tcl_HashTable {
1240 Tcl_HashEntry **buckets; /* Pointer to bucket array. Each
1241 * element points to first entry in
1242 * bucket's hash chain, or NULL. */
1243 Tcl_HashEntry *staticBuckets[TCL_SMALL_HASH_TABLE];
1244 /* Bucket array used for small tables
1245 * (to avoid mallocs and frees). */
1246 int numBuckets; /* Total number of buckets allocated
1247 * at **bucketPtr. */
1248 int numEntries; /* Total number of entries present
1249 * in table. */
1250 int rebuildSize; /* Enlarge table when numEntries gets
1251 * to be this large. */
1252 int downShift; /* Shift count used in hashing
1253 * function. Designed to use high-
1254 * order bits of randomized keys. */
1255 int mask; /* Mask value used in hashing
1256 * function. */
1257 int keyType; /* Type of keys used in this table.
1258 * It's either TCL_CUSTOM_KEYS,
1259 * TCL_STRING_KEYS, TCL_ONE_WORD_KEYS,
1260 * or an integer giving the number of
1261 * ints that is the size of the key.
1263 #if TCL_PRESERVE_BINARY_COMPATABILITY
1264 Tcl_HashEntry *(*findProc) _ANSI_ARGS_((Tcl_HashTable *tablePtr,
1265 CONST char *key));
1266 Tcl_HashEntry *(*createProc) _ANSI_ARGS_((Tcl_HashTable *tablePtr,
1267 CONST char *key, int *newPtr));
1268 #endif
1269 Tcl_HashKeyType *typePtr; /* Type of the keys used in the
1270 * Tcl_HashTable. */
1274 * Structure definition for information used to keep track of searches
1275 * through hash tables:
1278 typedef struct Tcl_HashSearch {
1279 Tcl_HashTable *tablePtr; /* Table being searched. */
1280 int nextIndex; /* Index of next bucket to be
1281 * enumerated after present one. */
1282 Tcl_HashEntry *nextEntryPtr; /* Next entry to be enumerated in the
1283 * the current bucket. */
1284 } Tcl_HashSearch;
1287 * Acceptable key types for hash tables:
1289 * TCL_STRING_KEYS: The keys are strings, they are copied into
1290 * the entry.
1291 * TCL_ONE_WORD_KEYS: The keys are pointers, the pointer is stored
1292 * in the entry.
1293 * TCL_CUSTOM_TYPE_KEYS: The keys are arbitrary types which are copied
1294 * into the entry.
1295 * TCL_CUSTOM_PTR_KEYS: The keys are pointers to arbitrary types, the
1296 * pointer is stored in the entry.
1298 * While maintaining binary compatability the above have to be distinct
1299 * values as they are used to differentiate between old versions of the
1300 * hash table which don't have a typePtr and new ones which do. Once binary
1301 * compatability is discarded in favour of making more wide spread changes
1302 * TCL_STRING_KEYS can be the same as TCL_CUSTOM_TYPE_KEYS, and
1303 * TCL_ONE_WORD_KEYS can be the same as TCL_CUSTOM_PTR_KEYS because they
1304 * simply determine how the key is accessed from the entry and not the
1305 * behaviour.
1308 #define TCL_STRING_KEYS 0
1309 #define TCL_ONE_WORD_KEYS 1
1311 #if TCL_PRESERVE_BINARY_COMPATABILITY
1312 # define TCL_CUSTOM_TYPE_KEYS -2
1313 # define TCL_CUSTOM_PTR_KEYS -1
1314 #else
1315 # define TCL_CUSTOM_TYPE_KEYS TCL_STRING_KEYS
1316 # define TCL_CUSTOM_PTR_KEYS TCL_ONE_WORD_KEYS
1317 #endif
1320 * Macros for clients to use to access fields of hash entries:
1323 #define Tcl_GetHashValue(h) ((h)->clientData)
1324 #define Tcl_SetHashValue(h, value) ((h)->clientData = (ClientData) (value))
1325 #if TCL_PRESERVE_BINARY_COMPATABILITY
1326 # define Tcl_GetHashKey(tablePtr, h) \
1327 ((char *) (((tablePtr)->keyType == TCL_ONE_WORD_KEYS || \
1328 (tablePtr)->keyType == TCL_CUSTOM_PTR_KEYS) \
1329 ? (h)->key.oneWordValue \
1330 : (h)->key.string))
1331 #else
1332 # define Tcl_GetHashKey(tablePtr, h) \
1333 ((char *) (((tablePtr)->keyType == TCL_ONE_WORD_KEYS) \
1334 ? (h)->key.oneWordValue \
1335 : (h)->key.string))
1336 #endif
1339 * Macros to use for clients to use to invoke find and create procedures
1340 * for hash tables:
1343 #if TCL_PRESERVE_BINARY_COMPATABILITY
1344 # define Tcl_FindHashEntry(tablePtr, key) \
1345 (*((tablePtr)->findProc))(tablePtr, key)
1346 # define Tcl_CreateHashEntry(tablePtr, key, newPtr) \
1347 (*((tablePtr)->createProc))(tablePtr, key, newPtr)
1348 #else /* !TCL_PRESERVE_BINARY_COMPATABILITY */
1350 * Macro to use new extended version of Tcl_InitHashTable.
1352 # define Tcl_InitHashTable(tablePtr, keyType) \
1353 Tcl_InitHashTableEx(tablePtr, keyType, NULL)
1354 #endif /* TCL_PRESERVE_BINARY_COMPATABILITY */
1358 * Flag values to pass to Tcl_DoOneEvent to disable searches
1359 * for some kinds of events:
1361 #define TCL_DONT_WAIT (1<<1)
1362 #define TCL_WINDOW_EVENTS (1<<2)
1363 #define TCL_FILE_EVENTS (1<<3)
1364 #define TCL_TIMER_EVENTS (1<<4)
1365 #define TCL_IDLE_EVENTS (1<<5) /* WAS 0x10 ???? */
1366 #define TCL_ALL_EVENTS (~TCL_DONT_WAIT)
1369 * The following structure defines a generic event for the Tcl event
1370 * system. These are the things that are queued in calls to Tcl_QueueEvent
1371 * and serviced later by Tcl_DoOneEvent. There can be many different
1372 * kinds of events with different fields, corresponding to window events,
1373 * timer events, etc. The structure for a particular event consists of
1374 * a Tcl_Event header followed by additional information specific to that
1375 * event.
1377 struct Tcl_Event {
1378 Tcl_EventProc *proc; /* Procedure to call to service this event. */
1379 struct Tcl_Event *nextPtr; /* Next in list of pending events, or NULL. */
1383 * Positions to pass to Tcl_QueueEvent:
1385 typedef enum {
1386 TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, TCL_QUEUE_MARK
1387 } Tcl_QueuePosition;
1390 * Values to pass to Tcl_SetServiceMode to specify the behavior of notifier
1391 * event routines.
1393 #define TCL_SERVICE_NONE 0
1394 #define TCL_SERVICE_ALL 1
1398 * The following structure keeps is used to hold a time value, either as
1399 * an absolute time (the number of seconds from the epoch) or as an
1400 * elapsed time. On Unix systems the epoch is Midnight Jan 1, 1970 GMT.
1401 * On Macintosh systems the epoch is Midnight Jan 1, 1904 GMT.
1403 typedef struct Tcl_Time {
1404 long sec; /* Seconds. */
1405 long usec; /* Microseconds. */
1406 } Tcl_Time;
1408 typedef void (Tcl_SetTimerProc) _ANSI_ARGS_((Tcl_Time *timePtr));
1409 typedef int (Tcl_WaitForEventProc) _ANSI_ARGS_((Tcl_Time *timePtr));
1413 * Bits to pass to Tcl_CreateFileHandler and Tcl_CreateChannelHandler
1414 * to indicate what sorts of events are of interest:
1416 #define TCL_READABLE (1<<1)
1417 #define TCL_WRITABLE (1<<2)
1418 #define TCL_EXCEPTION (1<<3)
1421 * Flag values to pass to Tcl_OpenCommandChannel to indicate the
1422 * disposition of the stdio handles. TCL_STDIN, TCL_STDOUT, TCL_STDERR,
1423 * are also used in Tcl_GetStdChannel.
1425 #define TCL_STDIN (1<<1)
1426 #define TCL_STDOUT (1<<2)
1427 #define TCL_STDERR (1<<3)
1428 #define TCL_ENFORCE_MODE (1<<4)
1431 * Bits passed to Tcl_DriverClose2Proc to indicate which side of a channel
1432 * should be closed.
1434 #define TCL_CLOSE_READ (1<<1)
1435 #define TCL_CLOSE_WRITE (1<<2)
1438 * Value to use as the closeProc for a channel that supports the
1439 * close2Proc interface.
1441 #define TCL_CLOSE2PROC ((Tcl_DriverCloseProc *)1)
1444 * Channel version tag. This was introduced in 8.3.2/8.4.
1446 #define TCL_CHANNEL_VERSION_1 ((Tcl_ChannelTypeVersion) 0x1)
1447 #define TCL_CHANNEL_VERSION_2 ((Tcl_ChannelTypeVersion) 0x2)
1448 #define TCL_CHANNEL_VERSION_3 ((Tcl_ChannelTypeVersion) 0x3)
1449 #define TCL_CHANNEL_VERSION_4 ((Tcl_ChannelTypeVersion) 0x4)
1452 * TIP #218: Channel Actions, Ids for Tcl_DriverThreadActionProc
1455 #define TCL_CHANNEL_THREAD_INSERT (0)
1456 #define TCL_CHANNEL_THREAD_REMOVE (1)
1459 * Typedefs for the various operations in a channel type:
1461 typedef int (Tcl_DriverBlockModeProc) _ANSI_ARGS_((
1462 ClientData instanceData, int mode));
1463 typedef int (Tcl_DriverCloseProc) _ANSI_ARGS_((ClientData instanceData,
1464 Tcl_Interp *interp));
1465 typedef int (Tcl_DriverClose2Proc) _ANSI_ARGS_((ClientData instanceData,
1466 Tcl_Interp *interp, int flags));
1467 typedef int (Tcl_DriverInputProc) _ANSI_ARGS_((ClientData instanceData,
1468 char *buf, int toRead, int *errorCodePtr));
1469 typedef int (Tcl_DriverOutputProc) _ANSI_ARGS_((ClientData instanceData,
1470 CONST84 char *buf, int toWrite, int *errorCodePtr));
1471 typedef int (Tcl_DriverSeekProc) _ANSI_ARGS_((ClientData instanceData,
1472 long offset, int mode, int *errorCodePtr));
1473 typedef int (Tcl_DriverSetOptionProc) _ANSI_ARGS_((
1474 ClientData instanceData, Tcl_Interp *interp,
1475 CONST char *optionName, CONST char *value));
1476 typedef int (Tcl_DriverGetOptionProc) _ANSI_ARGS_((
1477 ClientData instanceData, Tcl_Interp *interp,
1478 CONST84 char *optionName, Tcl_DString *dsPtr));
1479 typedef void (Tcl_DriverWatchProc) _ANSI_ARGS_((
1480 ClientData instanceData, int mask));
1481 typedef int (Tcl_DriverGetHandleProc) _ANSI_ARGS_((
1482 ClientData instanceData, int direction,
1483 ClientData *handlePtr));
1484 typedef int (Tcl_DriverFlushProc) _ANSI_ARGS_((
1485 ClientData instanceData));
1486 typedef int (Tcl_DriverHandlerProc) _ANSI_ARGS_((
1487 ClientData instanceData, int interestMask));
1488 typedef Tcl_WideInt (Tcl_DriverWideSeekProc) _ANSI_ARGS_((
1489 ClientData instanceData, Tcl_WideInt offset,
1490 int mode, int *errorCodePtr));
1492 /* TIP #218, Channel Thread Actions */
1493 typedef void (Tcl_DriverThreadActionProc) _ANSI_ARGS_ ((
1494 ClientData instanceData, int action));
1497 * The following declarations either map ckalloc and ckfree to
1498 * malloc and free, or they map them to procedures with all sorts
1499 * of debugging hooks defined in tclCkalloc.c.
1501 #ifdef TCL_MEM_DEBUG
1503 # define ckalloc(x) Tcl_DbCkalloc(x, __FILE__, __LINE__)
1504 # define ckfree(x) Tcl_DbCkfree(x, __FILE__, __LINE__)
1505 # define ckrealloc(x,y) Tcl_DbCkrealloc((x), (y),__FILE__, __LINE__)
1506 # define attemptckalloc(x) Tcl_AttemptDbCkalloc(x, __FILE__, __LINE__)
1507 # define attemptckrealloc(x,y) Tcl_AttemptDbCkrealloc((x), (y), __FILE__, __LINE__)
1508 #else /* !TCL_MEM_DEBUG */
1511 * If we are not using the debugging allocator, we should call the
1512 * Tcl_Alloc, et al. routines in order to guarantee that every module
1513 * is using the same memory allocator both inside and outside of the
1514 * Tcl library.
1516 # define ckalloc(x) Tcl_Alloc(x)
1517 # define ckfree(x) Tcl_Free(x)
1518 # define ckrealloc(x,y) Tcl_Realloc(x,y)
1519 # define attemptckalloc(x) Tcl_AttemptAlloc(x)
1520 # define attemptckrealloc(x,y) Tcl_AttemptRealloc(x,y)
1521 # define Tcl_InitMemory(x)
1522 # define Tcl_DumpActiveMemory(x)
1523 # define Tcl_ValidateAllMemory(x,y)
1525 #endif /* !TCL_MEM_DEBUG */
1528 * struct Tcl_ChannelType:
1530 * One such structure exists for each type (kind) of channel.
1531 * It collects together in one place all the functions that are
1532 * part of the specific channel type.
1534 * It is recommend that the Tcl_Channel* functions are used to access
1535 * elements of this structure, instead of direct accessing.
1537 typedef struct Tcl_ChannelType {
1538 char *typeName; /* The name of the channel type in Tcl
1539 * commands. This storage is owned by
1540 * channel type. */
1541 Tcl_ChannelTypeVersion version; /* Version of the channel type. */
1542 Tcl_DriverCloseProc *closeProc; /* Procedure to call to close the
1543 * channel, or TCL_CLOSE2PROC if the
1544 * close2Proc should be used
1545 * instead. */
1546 Tcl_DriverInputProc *inputProc; /* Procedure to call for input
1547 * on channel. */
1548 Tcl_DriverOutputProc *outputProc; /* Procedure to call for output
1549 * on channel. */
1550 Tcl_DriverSeekProc *seekProc; /* Procedure to call to seek
1551 * on the channel. May be NULL. */
1552 Tcl_DriverSetOptionProc *setOptionProc;
1553 /* Set an option on a channel. */
1554 Tcl_DriverGetOptionProc *getOptionProc;
1555 /* Get an option from a channel. */
1556 Tcl_DriverWatchProc *watchProc; /* Set up the notifier to watch
1557 * for events on this channel. */
1558 Tcl_DriverGetHandleProc *getHandleProc;
1559 /* Get an OS handle from the channel
1560 * or NULL if not supported. */
1561 Tcl_DriverClose2Proc *close2Proc; /* Procedure to call to close the
1562 * channel if the device supports
1563 * closing the read & write sides
1564 * independently. */
1565 Tcl_DriverBlockModeProc *blockModeProc;
1566 /* Set blocking mode for the
1567 * raw channel. May be NULL. */
1569 * Only valid in TCL_CHANNEL_VERSION_2 channels or later
1571 Tcl_DriverFlushProc *flushProc; /* Procedure to call to flush a
1572 * channel. May be NULL. */
1573 Tcl_DriverHandlerProc *handlerProc; /* Procedure to call to handle a
1574 * channel event. This will be passed
1575 * up the stacked channel chain. */
1577 * Only valid in TCL_CHANNEL_VERSION_3 channels or later
1579 Tcl_DriverWideSeekProc *wideSeekProc;
1580 /* Procedure to call to seek
1581 * on the channel which can
1582 * handle 64-bit offsets. May be
1583 * NULL, and must be NULL if
1584 * seekProc is NULL. */
1587 * Only valid in TCL_CHANNEL_VERSION_4 channels or later
1588 * TIP #218, Channel Thread Actions
1590 Tcl_DriverThreadActionProc *threadActionProc;
1591 /* Procedure to call to notify
1592 * the driver of thread specific
1593 * activity for a channel.
1594 * May be NULL. */
1595 } Tcl_ChannelType;
1598 * The following flags determine whether the blockModeProc above should
1599 * set the channel into blocking or nonblocking mode. They are passed
1600 * as arguments to the blockModeProc procedure in the above structure.
1602 #define TCL_MODE_BLOCKING 0 /* Put channel into blocking mode. */
1603 #define TCL_MODE_NONBLOCKING 1 /* Put channel into nonblocking
1604 * mode. */
1607 * Enum for different types of file paths.
1609 typedef enum Tcl_PathType {
1610 TCL_PATH_ABSOLUTE,
1611 TCL_PATH_RELATIVE,
1612 TCL_PATH_VOLUME_RELATIVE
1613 } Tcl_PathType;
1617 * The following structure is used to pass glob type data amongst
1618 * the various glob routines and Tcl_FSMatchInDirectory.
1620 typedef struct Tcl_GlobTypeData {
1621 /* Corresponds to bcdpfls as in 'find -t' */
1622 int type;
1623 /* Corresponds to file permissions */
1624 int perm;
1625 /* Acceptable mac type */
1626 Tcl_Obj* macType;
1627 /* Acceptable mac creator */
1628 Tcl_Obj* macCreator;
1629 } Tcl_GlobTypeData;
1632 * type and permission definitions for glob command
1634 #define TCL_GLOB_TYPE_BLOCK (1<<0)
1635 #define TCL_GLOB_TYPE_CHAR (1<<1)
1636 #define TCL_GLOB_TYPE_DIR (1<<2)
1637 #define TCL_GLOB_TYPE_PIPE (1<<3)
1638 #define TCL_GLOB_TYPE_FILE (1<<4)
1639 #define TCL_GLOB_TYPE_LINK (1<<5)
1640 #define TCL_GLOB_TYPE_SOCK (1<<6)
1641 #define TCL_GLOB_TYPE_MOUNT (1<<7)
1643 #define TCL_GLOB_PERM_RONLY (1<<0)
1644 #define TCL_GLOB_PERM_HIDDEN (1<<1)
1645 #define TCL_GLOB_PERM_R (1<<2)
1646 #define TCL_GLOB_PERM_W (1<<3)
1647 #define TCL_GLOB_PERM_X (1<<4)
1651 * Typedefs for the various filesystem operations:
1653 typedef int (Tcl_FSStatProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, Tcl_StatBuf *buf));
1654 typedef int (Tcl_FSAccessProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, int mode));
1655 typedef Tcl_Channel (Tcl_FSOpenFileChannelProc)
1656 _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *pathPtr,
1657 int mode, int permissions));
1658 typedef int (Tcl_FSMatchInDirectoryProc) _ANSI_ARGS_((Tcl_Interp* interp,
1659 Tcl_Obj *result, Tcl_Obj *pathPtr, CONST char *pattern,
1660 Tcl_GlobTypeData * types));
1661 typedef Tcl_Obj* (Tcl_FSGetCwdProc) _ANSI_ARGS_((Tcl_Interp *interp));
1662 typedef int (Tcl_FSChdirProc) _ANSI_ARGS_((Tcl_Obj *pathPtr));
1663 typedef int (Tcl_FSLstatProc) _ANSI_ARGS_((Tcl_Obj *pathPtr,
1664 Tcl_StatBuf *buf));
1665 typedef int (Tcl_FSCreateDirectoryProc) _ANSI_ARGS_((Tcl_Obj *pathPtr));
1666 typedef int (Tcl_FSDeleteFileProc) _ANSI_ARGS_((Tcl_Obj *pathPtr));
1667 typedef int (Tcl_FSCopyDirectoryProc) _ANSI_ARGS_((Tcl_Obj *srcPathPtr,
1668 Tcl_Obj *destPathPtr, Tcl_Obj **errorPtr));
1669 typedef int (Tcl_FSCopyFileProc) _ANSI_ARGS_((Tcl_Obj *srcPathPtr,
1670 Tcl_Obj *destPathPtr));
1671 typedef int (Tcl_FSRemoveDirectoryProc) _ANSI_ARGS_((Tcl_Obj *pathPtr,
1672 int recursive, Tcl_Obj **errorPtr));
1673 typedef int (Tcl_FSRenameFileProc) _ANSI_ARGS_((Tcl_Obj *srcPathPtr,
1674 Tcl_Obj *destPathPtr));
1675 typedef void (Tcl_FSUnloadFileProc) _ANSI_ARGS_((Tcl_LoadHandle loadHandle));
1676 typedef Tcl_Obj* (Tcl_FSListVolumesProc) _ANSI_ARGS_((void));
1677 /* We have to declare the utime structure here. */
1678 struct utimbuf;
1679 typedef int (Tcl_FSUtimeProc) _ANSI_ARGS_((Tcl_Obj *pathPtr,
1680 struct utimbuf *tval));
1681 typedef int (Tcl_FSNormalizePathProc) _ANSI_ARGS_((Tcl_Interp *interp,
1682 Tcl_Obj *pathPtr, int nextCheckpoint));
1683 typedef int (Tcl_FSFileAttrsGetProc) _ANSI_ARGS_((Tcl_Interp *interp,
1684 int index, Tcl_Obj *pathPtr,
1685 Tcl_Obj **objPtrRef));
1686 typedef CONST char** (Tcl_FSFileAttrStringsProc) _ANSI_ARGS_((Tcl_Obj *pathPtr,
1687 Tcl_Obj** objPtrRef));
1688 typedef int (Tcl_FSFileAttrsSetProc) _ANSI_ARGS_((Tcl_Interp *interp,
1689 int index, Tcl_Obj *pathPtr,
1690 Tcl_Obj *objPtr));
1691 typedef Tcl_Obj* (Tcl_FSLinkProc) _ANSI_ARGS_((Tcl_Obj *pathPtr,
1692 Tcl_Obj *toPtr, int linkType));
1693 typedef int (Tcl_FSLoadFileProc) _ANSI_ARGS_((Tcl_Interp * interp,
1694 Tcl_Obj *pathPtr,
1695 Tcl_LoadHandle *handlePtr,
1696 Tcl_FSUnloadFileProc **unloadProcPtr));
1697 typedef int (Tcl_FSPathInFilesystemProc) _ANSI_ARGS_((Tcl_Obj *pathPtr,
1698 ClientData *clientDataPtr));
1699 typedef Tcl_Obj* (Tcl_FSFilesystemPathTypeProc)
1700 _ANSI_ARGS_((Tcl_Obj *pathPtr));
1701 typedef Tcl_Obj* (Tcl_FSFilesystemSeparatorProc)
1702 _ANSI_ARGS_((Tcl_Obj *pathPtr));
1703 typedef void (Tcl_FSFreeInternalRepProc) _ANSI_ARGS_((ClientData clientData));
1704 typedef ClientData (Tcl_FSDupInternalRepProc)
1705 _ANSI_ARGS_((ClientData clientData));
1706 typedef Tcl_Obj* (Tcl_FSInternalToNormalizedProc)
1707 _ANSI_ARGS_((ClientData clientData));
1708 typedef ClientData (Tcl_FSCreateInternalRepProc) _ANSI_ARGS_((Tcl_Obj *pathPtr));
1710 typedef struct Tcl_FSVersion_ *Tcl_FSVersion;
1713 *----------------------------------------------------------------
1714 * Data structures related to hooking into the filesystem
1715 *----------------------------------------------------------------
1719 * Filesystem version tag. This was introduced in 8.4.
1721 #define TCL_FILESYSTEM_VERSION_1 ((Tcl_FSVersion) 0x1)
1724 * struct Tcl_Filesystem:
1726 * One such structure exists for each type (kind) of filesystem.
1727 * It collects together in one place all the functions that are
1728 * part of the specific filesystem. Tcl always accesses the
1729 * filesystem through one of these structures.
1731 * Not all entries need be non-NULL; any which are NULL are simply
1732 * ignored. However, a complete filesystem should provide all of
1733 * these functions. The explanations in the structure show
1734 * the importance of each function.
1737 typedef struct Tcl_Filesystem {
1738 CONST char *typeName; /* The name of the filesystem. */
1739 int structureLength; /* Length of this structure, so future
1740 * binary compatibility can be assured. */
1741 Tcl_FSVersion version;
1742 /* Version of the filesystem type. */
1743 Tcl_FSPathInFilesystemProc *pathInFilesystemProc;
1744 /* Function to check whether a path is in
1745 * this filesystem. This is the most
1746 * important filesystem procedure. */
1747 Tcl_FSDupInternalRepProc *dupInternalRepProc;
1748 /* Function to duplicate internal fs rep. May
1749 * be NULL (but then fs is less efficient). */
1750 Tcl_FSFreeInternalRepProc *freeInternalRepProc;
1751 /* Function to free internal fs rep. Must
1752 * be implemented, if internal representations
1753 * need freeing, otherwise it can be NULL. */
1754 Tcl_FSInternalToNormalizedProc *internalToNormalizedProc;
1755 /* Function to convert internal representation
1756 * to a normalized path. Only required if
1757 * the fs creates pure path objects with no
1758 * string/path representation. */
1759 Tcl_FSCreateInternalRepProc *createInternalRepProc;
1760 /* Function to create a filesystem-specific
1761 * internal representation. May be NULL
1762 * if paths have no internal representation,
1763 * or if the Tcl_FSPathInFilesystemProc
1764 * for this filesystem always immediately
1765 * creates an internal representation for
1766 * paths it accepts. */
1767 Tcl_FSNormalizePathProc *normalizePathProc;
1768 /* Function to normalize a path. Should
1769 * be implemented for all filesystems
1770 * which can have multiple string
1771 * representations for the same path
1772 * object. */
1773 Tcl_FSFilesystemPathTypeProc *filesystemPathTypeProc;
1774 /* Function to determine the type of a
1775 * path in this filesystem. May be NULL. */
1776 Tcl_FSFilesystemSeparatorProc *filesystemSeparatorProc;
1777 /* Function to return the separator
1778 * character(s) for this filesystem. Must
1779 * be implemented. */
1780 Tcl_FSStatProc *statProc;
1782 * Function to process a 'Tcl_FSStat()'
1783 * call. Must be implemented for any
1784 * reasonable filesystem.
1786 Tcl_FSAccessProc *accessProc;
1788 * Function to process a 'Tcl_FSAccess()'
1789 * call. Must be implemented for any
1790 * reasonable filesystem.
1792 Tcl_FSOpenFileChannelProc *openFileChannelProc;
1794 * Function to process a
1795 * 'Tcl_FSOpenFileChannel()' call. Must be
1796 * implemented for any reasonable
1797 * filesystem.
1799 Tcl_FSMatchInDirectoryProc *matchInDirectoryProc;
1800 /* Function to process a
1801 * 'Tcl_FSMatchInDirectory()'. If not
1802 * implemented, then glob and recursive
1803 * copy functionality will be lacking in
1804 * the filesystem. */
1805 Tcl_FSUtimeProc *utimeProc;
1806 /* Function to process a
1807 * 'Tcl_FSUtime()' call. Required to
1808 * allow setting (not reading) of times
1809 * with 'file mtime', 'file atime' and
1810 * the open-r/open-w/fcopy implementation
1811 * of 'file copy'. */
1812 Tcl_FSLinkProc *linkProc;
1813 /* Function to process a
1814 * 'Tcl_FSLink()' call. Should be
1815 * implemented only if the filesystem supports
1816 * links (reading or creating). */
1817 Tcl_FSListVolumesProc *listVolumesProc;
1818 /* Function to list any filesystem volumes
1819 * added by this filesystem. Should be
1820 * implemented only if the filesystem adds
1821 * volumes at the head of the filesystem. */
1822 Tcl_FSFileAttrStringsProc *fileAttrStringsProc;
1823 /* Function to list all attributes strings
1824 * which are valid for this filesystem.
1825 * If not implemented the filesystem will
1826 * not support the 'file attributes' command.
1827 * This allows arbitrary additional information
1828 * to be attached to files in the filesystem. */
1829 Tcl_FSFileAttrsGetProc *fileAttrsGetProc;
1830 /* Function to process a
1831 * 'Tcl_FSFileAttrsGet()' call, used by
1832 * 'file attributes'. */
1833 Tcl_FSFileAttrsSetProc *fileAttrsSetProc;
1834 /* Function to process a
1835 * 'Tcl_FSFileAttrsSet()' call, used by
1836 * 'file attributes'. */
1837 Tcl_FSCreateDirectoryProc *createDirectoryProc;
1838 /* Function to process a
1839 * 'Tcl_FSCreateDirectory()' call. Should
1840 * be implemented unless the FS is
1841 * read-only. */
1842 Tcl_FSRemoveDirectoryProc *removeDirectoryProc;
1843 /* Function to process a
1844 * 'Tcl_FSRemoveDirectory()' call. Should
1845 * be implemented unless the FS is
1846 * read-only. */
1847 Tcl_FSDeleteFileProc *deleteFileProc;
1848 /* Function to process a
1849 * 'Tcl_FSDeleteFile()' call. Should
1850 * be implemented unless the FS is
1851 * read-only. */
1852 Tcl_FSCopyFileProc *copyFileProc;
1853 /* Function to process a
1854 * 'Tcl_FSCopyFile()' call. If not
1855 * implemented Tcl will fall back
1856 * on open-r, open-w and fcopy as
1857 * a copying mechanism, for copying
1858 * actions initiated in Tcl (not C). */
1859 Tcl_FSRenameFileProc *renameFileProc;
1860 /* Function to process a
1861 * 'Tcl_FSRenameFile()' call. If not
1862 * implemented, Tcl will fall back on
1863 * a copy and delete mechanism, for
1864 * rename actions initiated in Tcl (not C). */
1865 Tcl_FSCopyDirectoryProc *copyDirectoryProc;
1866 /* Function to process a
1867 * 'Tcl_FSCopyDirectory()' call. If
1868 * not implemented, Tcl will fall back
1869 * on a recursive create-dir, file copy
1870 * mechanism, for copying actions
1871 * initiated in Tcl (not C). */
1872 Tcl_FSLstatProc *lstatProc;
1873 /* Function to process a
1874 * 'Tcl_FSLstat()' call. If not implemented,
1875 * Tcl will attempt to use the 'statProc'
1876 * defined above instead. */
1877 Tcl_FSLoadFileProc *loadFileProc;
1878 /* Function to process a
1879 * 'Tcl_FSLoadFile()' call. If not
1880 * implemented, Tcl will fall back on
1881 * a copy to native-temp followed by a
1882 * Tcl_FSLoadFile on that temporary copy. */
1883 Tcl_FSGetCwdProc *getCwdProc;
1885 * Function to process a 'Tcl_FSGetCwd()'
1886 * call. Most filesystems need not
1887 * implement this. It will usually only be
1888 * called once, if 'getcwd' is called
1889 * before 'chdir'. May be NULL.
1891 Tcl_FSChdirProc *chdirProc;
1893 * Function to process a 'Tcl_FSChdir()'
1894 * call. If filesystems do not implement
1895 * this, it will be emulated by a series of
1896 * directory access checks. Otherwise,
1897 * virtual filesystems which do implement
1898 * it need only respond with a positive
1899 * return result if the dirName is a valid
1900 * directory in their filesystem. They
1901 * need not remember the result, since that
1902 * will be automatically remembered for use
1903 * by GetCwd. Real filesystems should
1904 * carry out the correct action (i.e. call
1905 * the correct system 'chdir' api). If not
1906 * implemented, then 'cd' and 'pwd' will
1907 * fail inside the filesystem.
1909 } Tcl_Filesystem;
1912 * The following definitions are used as values for the 'linkAction' flag
1913 * to Tcl_FSLink, or the linkProc of any filesystem. Any combination
1914 * of flags can be given. For link creation, the linkProc should create
1915 * a link which matches any of the types given.
1917 * TCL_CREATE_SYMBOLIC_LINK: Create a symbolic or soft link.
1918 * TCL_CREATE_HARD_LINK: Create a hard link.
1920 #define TCL_CREATE_SYMBOLIC_LINK 0x01
1921 #define TCL_CREATE_HARD_LINK 0x02
1924 * The following structure represents the Notifier functions that
1925 * you can override with the Tcl_SetNotifier call.
1927 typedef struct Tcl_NotifierProcs {
1928 Tcl_SetTimerProc *setTimerProc;
1929 Tcl_WaitForEventProc *waitForEventProc;
1930 Tcl_CreateFileHandlerProc *createFileHandlerProc;
1931 Tcl_DeleteFileHandlerProc *deleteFileHandlerProc;
1932 Tcl_InitNotifierProc *initNotifierProc;
1933 Tcl_FinalizeNotifierProc *finalizeNotifierProc;
1934 Tcl_AlertNotifierProc *alertNotifierProc;
1935 Tcl_ServiceModeHookProc *serviceModeHookProc;
1936 } Tcl_NotifierProcs;
1940 * The following structure represents a user-defined encoding. It collects
1941 * together all the functions that are used by the specific encoding.
1943 typedef struct Tcl_EncodingType {
1944 CONST char *encodingName; /* The name of the encoding, e.g. "euc-jp".
1945 * This name is the unique key for this
1946 * encoding type. */
1947 Tcl_EncodingConvertProc *toUtfProc;
1948 /* Procedure to convert from external
1949 * encoding into UTF-8. */
1950 Tcl_EncodingConvertProc *fromUtfProc;
1951 /* Procedure to convert from UTF-8 into
1952 * external encoding. */
1953 Tcl_EncodingFreeProc *freeProc;
1954 /* If non-NULL, procedure to call when this
1955 * encoding is deleted. */
1956 ClientData clientData; /* Arbitrary value associated with encoding
1957 * type. Passed to conversion procedures. */
1958 int nullSize; /* Number of zero bytes that signify
1959 * end-of-string in this encoding. This
1960 * number is used to determine the source
1961 * string length when the srcLen argument is
1962 * negative. Must be 1 or 2. */
1963 } Tcl_EncodingType;
1966 * The following definitions are used as values for the conversion control
1967 * flags argument when converting text from one character set to another:
1969 * TCL_ENCODING_START: Signifies that the source buffer is the first
1970 * block in a (potentially multi-block) input
1971 * stream. Tells the conversion procedure to
1972 * reset to an initial state and perform any
1973 * initialization that needs to occur before the
1974 * first byte is converted. If the source
1975 * buffer contains the entire input stream to be
1976 * converted, this flag should be set.
1978 * TCL_ENCODING_END: Signifies that the source buffer is the last
1979 * block in a (potentially multi-block) input
1980 * stream. Tells the conversion routine to
1981 * perform any finalization that needs to occur
1982 * after the last byte is converted and then to
1983 * reset to an initial state. If the source
1984 * buffer contains the entire input stream to be
1985 * converted, this flag should be set.
1987 * TCL_ENCODING_STOPONERROR: If set, then the converter will return
1988 * immediately upon encountering an invalid
1989 * byte sequence or a source character that has
1990 * no mapping in the target encoding. If clear,
1991 * then the converter will skip the problem,
1992 * substituting one or more "close" characters
1993 * in the destination buffer and then continue
1994 * to sonvert the source.
1996 #define TCL_ENCODING_START 0x01
1997 #define TCL_ENCODING_END 0x02
1998 #define TCL_ENCODING_STOPONERROR 0x04
2002 * The following data structures and declarations are for the new Tcl
2003 * parser.
2007 * For each word of a command, and for each piece of a word such as a
2008 * variable reference, one of the following structures is created to
2009 * describe the token.
2011 typedef struct Tcl_Token {
2012 int type; /* Type of token, such as TCL_TOKEN_WORD;
2013 * see below for valid types. */
2014 CONST char *start; /* First character in token. */
2015 int size; /* Number of bytes in token. */
2016 int numComponents; /* If this token is composed of other
2017 * tokens, this field tells how many of
2018 * them there are (including components of
2019 * components, etc.). The component tokens
2020 * immediately follow this one. */
2021 } Tcl_Token;
2024 * Type values defined for Tcl_Token structures. These values are
2025 * defined as mask bits so that it's easy to check for collections of
2026 * types.
2028 * TCL_TOKEN_WORD - The token describes one word of a command,
2029 * from the first non-blank character of
2030 * the word (which may be " or {) up to but
2031 * not including the space, semicolon, or
2032 * bracket that terminates the word.
2033 * NumComponents counts the total number of
2034 * sub-tokens that make up the word. This
2035 * includes, for example, sub-tokens of
2036 * TCL_TOKEN_VARIABLE tokens.
2037 * TCL_TOKEN_SIMPLE_WORD - This token is just like TCL_TOKEN_WORD
2038 * except that the word is guaranteed to
2039 * consist of a single TCL_TOKEN_TEXT
2040 * sub-token.
2041 * TCL_TOKEN_TEXT - The token describes a range of literal
2042 * text that is part of a word.
2043 * NumComponents is always 0.
2044 * TCL_TOKEN_BS - The token describes a backslash sequence
2045 * that must be collapsed. NumComponents
2046 * is always 0.
2047 * TCL_TOKEN_COMMAND - The token describes a command whose result
2048 * must be substituted into the word. The
2049 * token includes the enclosing brackets.
2050 * NumComponents is always 0.
2051 * TCL_TOKEN_VARIABLE - The token describes a variable
2052 * substitution, including the dollar sign,
2053 * variable name, and array index (if there
2054 * is one) up through the right
2055 * parentheses. NumComponents tells how
2056 * many additional tokens follow to
2057 * represent the variable name. The first
2058 * token will be a TCL_TOKEN_TEXT token
2059 * that describes the variable name. If
2060 * the variable is an array reference then
2061 * there will be one or more additional
2062 * tokens, of type TCL_TOKEN_TEXT,
2063 * TCL_TOKEN_BS, TCL_TOKEN_COMMAND, and
2064 * TCL_TOKEN_VARIABLE, that describe the
2065 * array index; numComponents counts the
2066 * total number of nested tokens that make
2067 * up the variable reference, including
2068 * sub-tokens of TCL_TOKEN_VARIABLE tokens.
2069 * TCL_TOKEN_SUB_EXPR - The token describes one subexpression of a
2070 * expression, from the first non-blank
2071 * character of the subexpression up to but not
2072 * including the space, brace, or bracket
2073 * that terminates the subexpression.
2074 * NumComponents counts the total number of
2075 * following subtokens that make up the
2076 * subexpression; this includes all subtokens
2077 * for any nested TCL_TOKEN_SUB_EXPR tokens.
2078 * For example, a numeric value used as a
2079 * primitive operand is described by a
2080 * TCL_TOKEN_SUB_EXPR token followed by a
2081 * TCL_TOKEN_TEXT token. A binary subexpression
2082 * is described by a TCL_TOKEN_SUB_EXPR token
2083 * followed by the TCL_TOKEN_OPERATOR token
2084 * for the operator, then TCL_TOKEN_SUB_EXPR
2085 * tokens for the left then the right operands.
2086 * TCL_TOKEN_OPERATOR - The token describes one expression operator.
2087 * An operator might be the name of a math
2088 * function such as "abs". A TCL_TOKEN_OPERATOR
2089 * token is always preceeded by one
2090 * TCL_TOKEN_SUB_EXPR token for the operator's
2091 * subexpression, and is followed by zero or
2092 * more TCL_TOKEN_SUB_EXPR tokens for the
2093 * operator's operands. NumComponents is
2094 * always 0.
2096 #define TCL_TOKEN_WORD 1
2097 #define TCL_TOKEN_SIMPLE_WORD 2
2098 #define TCL_TOKEN_TEXT 4
2099 #define TCL_TOKEN_BS 8
2100 #define TCL_TOKEN_COMMAND 16
2101 #define TCL_TOKEN_VARIABLE 32
2102 #define TCL_TOKEN_SUB_EXPR 64
2103 #define TCL_TOKEN_OPERATOR 128
2106 * Parsing error types. On any parsing error, one of these values
2107 * will be stored in the error field of the Tcl_Parse structure
2108 * defined below.
2110 #define TCL_PARSE_SUCCESS 0
2111 #define TCL_PARSE_QUOTE_EXTRA 1
2112 #define TCL_PARSE_BRACE_EXTRA 2
2113 #define TCL_PARSE_MISSING_BRACE 3
2114 #define TCL_PARSE_MISSING_BRACKET 4
2115 #define TCL_PARSE_MISSING_PAREN 5
2116 #define TCL_PARSE_MISSING_QUOTE 6
2117 #define TCL_PARSE_MISSING_VAR_BRACE 7
2118 #define TCL_PARSE_SYNTAX 8
2119 #define TCL_PARSE_BAD_NUMBER 9
2122 * A structure of the following type is filled in by Tcl_ParseCommand.
2123 * It describes a single command parsed from an input string.
2125 #define NUM_STATIC_TOKENS 20
2127 typedef struct Tcl_Parse {
2128 CONST char *commentStart; /* Pointer to # that begins the first of
2129 * one or more comments preceding the
2130 * command. */
2131 int commentSize; /* Number of bytes in comments (up through
2132 * newline character that terminates the
2133 * last comment). If there were no
2134 * comments, this field is 0. */
2135 CONST char *commandStart; /* First character in first word of command. */
2136 int commandSize; /* Number of bytes in command, including
2137 * first character of first word, up
2138 * through the terminating newline,
2139 * close bracket, or semicolon. */
2140 int numWords; /* Total number of words in command. May
2141 * be 0. */
2142 Tcl_Token *tokenPtr; /* Pointer to first token representing
2143 * the words of the command. Initially
2144 * points to staticTokens, but may change
2145 * to point to malloc-ed space if command
2146 * exceeds space in staticTokens. */
2147 int numTokens; /* Total number of tokens in command. */
2148 int tokensAvailable; /* Total number of tokens available at
2149 * *tokenPtr. */
2150 int errorType; /* One of the parsing error types defined
2151 * above. */
2154 * The fields below are intended only for the private use of the
2155 * parser. They should not be used by procedures that invoke
2156 * Tcl_ParseCommand.
2159 CONST char *string; /* The original command string passed to
2160 * Tcl_ParseCommand. */
2161 CONST char *end; /* Points to the character just after the
2162 * last one in the command string. */
2163 Tcl_Interp *interp; /* Interpreter to use for error reporting,
2164 * or NULL. */
2165 CONST char *term; /* Points to character in string that
2166 * terminated most recent token. Filled in
2167 * by ParseTokens. If an error occurs,
2168 * points to beginning of region where the
2169 * error occurred (e.g. the open brace if
2170 * the close brace is missing). */
2171 int incomplete; /* This field is set to 1 by Tcl_ParseCommand
2172 * if the command appears to be incomplete.
2173 * This information is used by
2174 * Tcl_CommandComplete. */
2175 Tcl_Token staticTokens[NUM_STATIC_TOKENS];
2176 /* Initial space for tokens for command.
2177 * This space should be large enough to
2178 * accommodate most commands; dynamic
2179 * space is allocated for very large
2180 * commands that don't fit here. */
2181 } Tcl_Parse;
2184 * The following definitions are the error codes returned by the conversion
2185 * routines:
2187 * TCL_OK: All characters were converted.
2189 * TCL_CONVERT_NOSPACE: The output buffer would not have been large
2190 * enough for all of the converted data; as many
2191 * characters as could fit were converted though.
2193 * TCL_CONVERT_MULTIBYTE: The last few bytes in the source string were
2194 * the beginning of a multibyte sequence, but
2195 * more bytes were needed to complete this
2196 * sequence. A subsequent call to the conversion
2197 * routine should pass the beginning of this
2198 * unconverted sequence plus additional bytes
2199 * from the source stream to properly convert
2200 * the formerly split-up multibyte sequence.
2202 * TCL_CONVERT_SYNTAX: The source stream contained an invalid
2203 * character sequence. This may occur if the
2204 * input stream has been damaged or if the input
2205 * encoding method was misidentified. This error
2206 * is reported only if TCL_ENCODING_STOPONERROR
2207 * was specified.
2209 * TCL_CONVERT_UNKNOWN: The source string contained a character
2210 * that could not be represented in the target
2211 * encoding. This error is reported only if
2212 * TCL_ENCODING_STOPONERROR was specified.
2214 #define TCL_CONVERT_MULTIBYTE -1
2215 #define TCL_CONVERT_SYNTAX -2
2216 #define TCL_CONVERT_UNKNOWN -3
2217 #define TCL_CONVERT_NOSPACE -4
2220 * The maximum number of bytes that are necessary to represent a single
2221 * Unicode character in UTF-8. The valid values should be 3 or 6 (or
2222 * perhaps 1 if we want to support a non-unicode enabled core).
2223 * If 3, then Tcl_UniChar must be 2-bytes in size (UCS-2). (default)
2224 * If 6, then Tcl_UniChar must be 4-bytes in size (UCS-4).
2225 * At this time UCS-2 mode is the default and recommended mode.
2226 * UCS-4 is experimental and not recommended. It works for the core,
2227 * but most extensions expect UCS-2.
2229 #ifndef TCL_UTF_MAX
2230 #define TCL_UTF_MAX 3
2231 #endif
2234 * This represents a Unicode character. Any changes to this should
2235 * also be reflected in regcustom.h.
2237 #if TCL_UTF_MAX > 3
2239 * unsigned int isn't 100% accurate as it should be a strict 4-byte
2240 * value (perhaps wchar_t). 64-bit systems may have troubles. The
2241 * size of this value must be reflected correctly in regcustom.h and
2242 * in tclEncoding.c.
2243 * XXX: Tcl is currently UCS-2 and planning UTF-16 for the Unicode
2244 * XXX: string rep that Tcl_UniChar represents. Changing the size
2245 * XXX: of Tcl_UniChar is /not/ supported.
2247 typedef unsigned int Tcl_UniChar;
2248 #else
2249 typedef unsigned short Tcl_UniChar;
2250 #endif
2254 * Deprecated Tcl procedures:
2256 #ifndef TCL_NO_DEPRECATED
2257 # define Tcl_EvalObj(interp,objPtr) \
2258 Tcl_EvalObjEx((interp),(objPtr),0)
2259 # define Tcl_GlobalEvalObj(interp,objPtr) \
2260 Tcl_EvalObjEx((interp),(objPtr),TCL_EVAL_GLOBAL)
2261 #endif
2265 * These function have been renamed. The old names are deprecated, but we
2266 * define these macros for backwards compatibilty.
2268 #define Tcl_Ckalloc Tcl_Alloc
2269 #define Tcl_Ckfree Tcl_Free
2270 #define Tcl_Ckrealloc Tcl_Realloc
2271 #define Tcl_Return Tcl_SetResult
2272 #define Tcl_TildeSubst Tcl_TranslateFileName
2273 #define panic Tcl_Panic
2274 #define panicVA Tcl_PanicVA
2278 * The following constant is used to test for older versions of Tcl
2279 * in the stubs tables.
2281 * Jan Nijtman's plus patch uses 0xFCA1BACF, so we need to pick a different
2282 * value since the stubs tables don't match.
2285 #define TCL_STUB_MAGIC ((int)0xFCA3BACF)
2288 * The following function is required to be defined in all stubs aware
2289 * extensions. The function is actually implemented in the stub
2290 * library, not the main Tcl library, although there is a trivial
2291 * implementation in the main library in case an extension is statically
2292 * linked into an application.
2295 EXTERN CONST char * Tcl_InitStubs _ANSI_ARGS_((Tcl_Interp *interp,
2296 CONST char *version, int exact));
2298 #ifndef USE_TCL_STUBS
2301 * When not using stubs, make it a macro.
2304 #define Tcl_InitStubs(interp, version, exact) \
2305 Tcl_PkgRequire(interp, "Tcl", version, exact)
2307 #endif
2311 * Include the public function declarations that are accessible via
2312 * the stubs table.
2315 #include "tclDecls.h"
2318 * Include platform specific public function declarations that are
2319 * accessible via the stubs table.
2323 * tclPlatDecls.h can't be included here on the Mac, as we need
2324 * Mac specific headers to define the Mac types used in this file,
2325 * but these Mac haders conflict with a number of tk types
2326 * and thus can't be included in the globally read tcl.h
2327 * This header was originally added here as a fix for bug 5241
2328 * (stub link error for symbols in TclPlatStubs table), as a work-
2329 * around for the bug on the mac, tclMac.h is included immediately
2330 * after tcl.h in the tcl precompiled header (with DLLEXPORT set).
2333 #if !defined(MAC_TCL)
2334 #include "tclPlatDecls.h"
2335 #endif
2338 * Public functions that are not accessible via the stubs table.
2341 EXTERN void Tcl_Main _ANSI_ARGS_((int argc, char **argv,
2342 Tcl_AppInitProc *appInitProc));
2345 * Convenience declaration of Tcl_AppInit for backwards compatibility.
2346 * This function is not *implemented* by the tcl library, so the storage
2347 * class is neither DLLEXPORT nor DLLIMPORT
2349 #undef TCL_STORAGE_CLASS
2350 #define TCL_STORAGE_CLASS
2352 EXTERN int Tcl_AppInit _ANSI_ARGS_((Tcl_Interp *interp));
2354 #undef TCL_STORAGE_CLASS
2355 #define TCL_STORAGE_CLASS DLLIMPORT
2357 #endif /* RC_INVOKED */
2360 * end block for C++
2362 #ifdef __cplusplus
2364 #endif
2366 #endif /* _TCL */