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