/[dtapublic]/projs/trunk/shared_source/c_tcl_base_7_5_w_mods/tcl.h
ViewVC logotype

Annotation of /projs/trunk/shared_source/c_tcl_base_7_5_w_mods/tcl.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 29 - (hide annotations) (download)
Sat Oct 8 07:08:47 2016 UTC (7 years, 5 months ago) by dashley
Original Path: to_be_filed/sf_code/esrgpcpj/shared/tcl_base/tcl.h
File MIME type: text/plain
File size: 59355 byte(s)
Directories relocated.
1 dashley 25 /* $Header: /cvsroot/esrg/sfesrg/esrgpcpj/shared/tcl_base/tcl.h,v 1.1.1.1 2001/06/13 04:32:55 dtashley Exp $ */
2    
3     /*
4     * tcl.h --
5     *
6     * This header file describes the externally-visible facilities
7     * of the Tcl interpreter.
8     *
9     * Copyright (c) 1987-1994 The Regents of the University of California.
10     * Copyright (c) 1993-1996 Lucent Technologies.
11     * Copyright (c) 1994-1998 Sun Microsystems, Inc.
12     * Copyright (c) 1998-2000 by Scriptics Corporation.
13     *
14     * See the file "license.terms" for information on usage and redistribution
15     * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
16     *
17     * RCS: @(#) $Id: tcl.h,v 1.1.1.1 2001/06/13 04:32:55 dtashley Exp $
18     */
19    
20     #ifndef _TCL
21     #define _TCL
22    
23     /*
24     * For C++ compilers, use extern "C"
25     */
26    
27     #ifdef __cplusplus
28     extern "C" {
29     #endif
30    
31     /*
32     * The following defines are used to indicate the various release levels.
33     */
34    
35     #define TCL_ALPHA_RELEASE 0
36     #define TCL_BETA_RELEASE 1
37     #define TCL_FINAL_RELEASE 2
38    
39     /*
40     * When version numbers change here, must also go into the following files
41     * and update the version numbers:
42     *
43     * library/init.tcl (only if Major.minor changes, not patchlevel) 1 LOC
44     * unix/configure.in (2 LOC Major, 2 LOC minor, 1 LOC patch)
45     * win/configure.in (as above)
46     * win/tcl.m4 (not patchlevel)
47     * win/makefile.vc (not patchlevel) 2 LOC
48     * win/pkgIndex.tcl (not patchlevel, for tclregNN.dll)
49     * README (sections 0 and 2)
50     * mac/README (2 LOC, not patchlevel)
51     * win/README.binary (sections 0-4)
52     * win/README (not patchlevel) (sections 0 and 2)
53     * unix/README (not patchlevel) (part (h))
54     * unix/tcl.spec (2 LOC Major/Minor, 1 LOC patch)
55     * tests/basic.test (not patchlevel) (version checks)
56     * tools/tcl.hpj.in (not patchlevel, for windows installer)
57     * tools/tcl.wse.in (for windows installer)
58     * tools/tclSplash.bmp (not patchlevel)
59     */
60    
61     #define TCL_MAJOR_VERSION 8
62     #define TCL_MINOR_VERSION 3
63     #define TCL_RELEASE_LEVEL TCL_FINAL_RELEASE
64     #define TCL_RELEASE_SERIAL 1
65    
66     #define TCL_VERSION "8.3"
67     #define TCL_PATCH_LEVEL "8.3.1"
68    
69     /*
70     * The following definitions set up the proper options for Windows
71     * compilers. We use this method because there is no autoconf equivalent.
72     */
73    
74     #ifndef __WIN32__
75     # if defined(_WIN32) || defined(WIN32)
76     # define __WIN32__
77     # endif
78     #endif
79    
80     #ifdef __WIN32__
81     # ifndef STRICT
82     # define STRICT
83     # endif
84     # ifndef USE_PROTOTYPE
85     # define USE_PROTOTYPE 1
86     # endif
87     # ifndef HAS_STDARG
88     # define HAS_STDARG 1
89     # endif
90     # ifndef USE_PROTOTYPE
91     # define USE_PROTOTYPE 1
92     # endif
93    
94     /*
95     * Under Windows we need to call Tcl_Alloc in all cases to avoid competing
96     * C run-time library issues.
97     */
98    
99     # ifndef USE_TCLALLOC
100     # define USE_TCLALLOC 0
101     /* Changed to 0 so could swap in new alloc module, DTA,
102     ** 07/06/00.
103     */
104     # endif
105     #endif /* __WIN32__ */
106    
107     /*
108     * The following definitions set up the proper options for Macintosh
109     * compilers. We use this method because there is no autoconf equivalent.
110     */
111    
112     #ifdef MAC_TCL
113     # ifndef HAS_STDARG
114     # define HAS_STDARG 1
115     # endif
116     # ifndef USE_TCLALLOC
117     # define USE_TCLALLOC 1
118     # endif
119     # ifndef NO_STRERROR
120     # define NO_STRERROR 1
121     # endif
122     # define INLINE
123     #endif
124    
125     /*
126     * Utility macros: STRINGIFY takes an argument and wraps it in "" (double
127     * quotation marks), JOIN joins two arguments.
128     */
129    
130     #define VERBATIM(x) x
131     #ifdef _MSC_VER
132     # define STRINGIFY(x) STRINGIFY1(x)
133     # define STRINGIFY1(x) #x
134     # define JOIN(a,b) JOIN1(a,b)
135     # define JOIN1(a,b) a##b
136     #else
137     # ifdef RESOURCE_INCLUDED
138     # define STRINGIFY(x) STRINGIFY1(x)
139     # define STRINGIFY1(x) #x
140     # define JOIN(a,b) JOIN1(a,b)
141     # define JOIN1(a,b) a##b
142     # else
143     # ifdef __STDC__
144     # define STRINGIFY(x) #x
145     # define JOIN(a,b) a##b
146     # else
147     # define STRINGIFY(x) "x"
148     # define JOIN(a,b) VERBATIM(a)VERBATIM(b)
149     # endif
150     # endif
151     #endif
152    
153     /*
154     * Special macro to define mutexes, that doesn't do anything
155     * if we are not using threads.
156     */
157    
158     #ifdef TCL_THREADS
159     #define TCL_DECLARE_MUTEX(name) static Tcl_Mutex name;
160     #else
161     #define TCL_DECLARE_MUTEX(name)
162     #endif
163    
164     /*
165     * Macros that eliminate the overhead of the thread synchronization
166     * functions when compiling without thread support.
167     */
168    
169     #ifndef TCL_THREADS
170     #define Tcl_MutexLock(mutexPtr)
171     #define Tcl_MutexUnlock(mutexPtr)
172     #define Tcl_MutexFinalize(mutexPtr)
173     #define Tcl_ConditionNotify(condPtr)
174     #define Tcl_ConditionWait(condPtr, mutexPtr, timePtr)
175     #define Tcl_ConditionFinalize(condPtr)
176     #endif /* TCL_THREADS */
177    
178     /*
179     * A special definition used to allow this header file to be included
180     * in resource files so that they can get obtain version information from
181     * this file. Resource compilers don't like all the C stuff, like typedefs
182     * and procedure declarations, that occur below.
183     */
184    
185     #ifndef RESOURCE_INCLUDED
186    
187     #ifndef BUFSIZ
188     #include <stdio.h>
189     #endif
190    
191     /*
192     * Definitions that allow Tcl functions with variable numbers of
193     * arguments to be used with either varargs.h or stdarg.h. TCL_VARARGS
194     * is used in procedure prototypes. TCL_VARARGS_DEF is used to declare
195     * the arguments in a function definiton: it takes the type and name of
196     * the first argument and supplies the appropriate argument declaration
197     * string for use in the function definition. TCL_VARARGS_START
198     * initializes the va_list data structure and returns the first argument.
199     */
200    
201     #if defined(__STDC__) || defined(HAS_STDARG)
202     # include <stdarg.h>
203    
204     # define TCL_VARARGS(type, name) (type name, ...)
205     # define TCL_VARARGS_DEF(type, name) (type name, ...)
206     # define TCL_VARARGS_START(type, name, list) (va_start(list, name), name)
207     #else
208     # include <varargs.h>
209    
210     # ifdef __cplusplus
211     # define TCL_VARARGS(type, name) (type name, ...)
212     # define TCL_VARARGS_DEF(type, name) (type va_alist, ...)
213     # else
214     # define TCL_VARARGS(type, name) ()
215     # define TCL_VARARGS_DEF(type, name) (va_alist)
216     # endif
217     # define TCL_VARARGS_START(type, name, list) \
218     (va_start(list), va_arg(list, type))
219     #endif
220    
221     /*
222     * Macros used to declare a function to be exported by a DLL.
223     * Used by Windows, maps to no-op declarations on non-Windows systems.
224     * The default build on windows is for a DLL, which causes the DLLIMPORT
225     * and DLLEXPORT macros to be nonempty. To build a static library, the
226     * macro STATIC_BUILD should be defined.
227     */
228    
229     #ifdef STATIC_BUILD
230     # define DLLIMPORT
231     # define DLLEXPORT
232     #else
233     # if defined(__WIN32__) && (defined(_MSC_VER) || (defined(__GNUC__) && defined(__declspec)))
234     # define DLLIMPORT __declspec(dllimport)
235     # define DLLEXPORT __declspec(dllexport)
236     # else
237     # define DLLIMPORT
238     # define DLLEXPORT
239     # endif
240     #endif
241    
242     /*
243     * These macros are used to control whether functions are being declared for
244     * import or export. If a function is being declared while it is being built
245     * to be included in a shared library, then it should have the DLLEXPORT
246     * storage class. If is being declared for use by a module that is going to
247     * link against the shared library, then it should have the DLLIMPORT storage
248     * class. If the symbol is beind declared for a static build or for use from a
249     * stub library, then the storage class should be empty.
250     *
251     * The convention is that a macro called BUILD_xxxx, where xxxx is the
252     * name of a library we are building, is set on the compile line for sources
253     * that are to be placed in the library. When this macro is set, the
254     * storage class will be set to DLLEXPORT. At the end of the header file, the
255     * storage class will be reset to DLLIMPORt.
256     */
257    
258     #undef TCL_STORAGE_CLASS
259     #ifdef BUILD_tcl
260     # define TCL_STORAGE_CLASS DLLEXPORT
261     #else
262     # ifdef USE_TCL_STUBS
263     # define TCL_STORAGE_CLASS
264     # else
265     # define TCL_STORAGE_CLASS DLLIMPORT
266     # endif
267     #endif
268    
269     /*
270     * Definitions that allow this header file to be used either with or
271     * without ANSI C features like function prototypes.
272     */
273    
274     #undef _ANSI_ARGS_
275     #undef CONST
276     #ifndef INLINE
277     # define INLINE
278     #endif
279    
280     #if ((defined(__STDC__) || defined(SABER)) && !defined(NO_PROTOTYPE)) || defined(__cplusplus) || defined(USE_PROTOTYPE)
281     # define _USING_PROTOTYPES_ 1
282     # define _ANSI_ARGS_(x) x
283     # define CONST const
284     #else
285     # define _ANSI_ARGS_(x) ()
286     # define CONST
287     #endif
288    
289     /*
290     * Make sure EXTERN isn't defined elsewhere
291     */
292     #ifdef EXTERN
293     #undef EXTERN
294     #endif /* EXTERN */
295    
296     #ifdef __cplusplus
297     # define EXTERN extern "C" TCL_STORAGE_CLASS
298     #else
299     # define EXTERN extern TCL_STORAGE_CLASS
300     #endif
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     #ifndef __WIN32__
308     #ifndef VOID
309     # ifdef __STDC__
310     # define VOID void
311     # else
312     # define VOID char
313     # endif
314     #endif
315     #else /* __WIN32__ */
316     /*
317     * The following code is copied from winnt.h
318     */
319     #ifndef VOID
320     #define VOID void
321     typedef char CHAR;
322     typedef short SHORT;
323     typedef long LONG;
324     #endif
325     #endif /* __WIN32__ */
326    
327     /*
328     * Miscellaneous declarations.
329     */
330    
331     #ifndef NULL
332     #define NULL 0
333     #endif
334    
335     #ifndef _CLIENTDATA
336     # if defined(__STDC__) || defined(__cplusplus)
337     typedef void *ClientData;
338     # else
339     typedef int *ClientData;
340     # endif /* __STDC__ */
341     #define _CLIENTDATA
342     #endif
343    
344     /*
345     * Data structures defined opaquely in this module. The definitions below
346     * just provide dummy types. A few fields are made visible in Tcl_Interp
347     * structures, namely those used for returning a string result from
348     * commands. Direct access to the result field is discouraged in Tcl 8.0.
349     * The interpreter result is either an object or a string, and the two
350     * values are kept consistent unless some C code sets interp->result
351     * directly. Programmers should use either the procedure Tcl_GetObjResult()
352     * or Tcl_GetStringResult() to read the interpreter's result. See the
353     * SetResult man page for details.
354     *
355     * Note: any change to the Tcl_Interp definition below must be mirrored
356     * in the "real" definition in tclInt.h.
357     *
358     * Note: Tcl_ObjCmdProc procedures do not directly set result and freeProc.
359     * Instead, they set a Tcl_Obj member in the "real" structure that can be
360     * accessed with Tcl_GetObjResult() and Tcl_SetObjResult().
361     */
362    
363     typedef struct Tcl_Interp {
364     char *result; /* If the last command returned a string
365     * result, this points to it. */
366     void (*freeProc) _ANSI_ARGS_((char *blockPtr));
367     /* Zero means the string result is
368     * statically allocated. TCL_DYNAMIC means
369     * it was allocated with ckalloc and should
370     * be freed with ckfree. Other values give
371     * the address of procedure to invoke to
372     * free the result. Tcl_Eval must free it
373     * before executing next command. */
374     int errorLine; /* When TCL_ERROR is returned, this gives
375     * the line number within the command where
376     * the error occurred (1 if first line). */
377     } Tcl_Interp;
378    
379     typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler;
380     typedef struct Tcl_Channel_ *Tcl_Channel;
381     typedef struct Tcl_Command_ *Tcl_Command;
382     typedef struct Tcl_Condition_ *Tcl_Condition;
383     typedef struct Tcl_EncodingState_ *Tcl_EncodingState;
384     typedef struct Tcl_Encoding_ *Tcl_Encoding;
385     typedef struct Tcl_Event Tcl_Event;
386     typedef struct Tcl_Mutex_ *Tcl_Mutex;
387     typedef struct Tcl_Pid_ *Tcl_Pid;
388     typedef struct Tcl_RegExp_ *Tcl_RegExp;
389     typedef struct Tcl_ThreadDataKey_ *Tcl_ThreadDataKey;
390     typedef struct Tcl_ThreadId_ *Tcl_ThreadId;
391     typedef struct Tcl_TimerToken_ *Tcl_TimerToken;
392     typedef struct Tcl_Trace_ *Tcl_Trace;
393     typedef struct Tcl_Var_ *Tcl_Var;
394    
395     /*
396     * Definition of the interface to procedures implementing threads.
397     * A procedure following this definition is given to each call of
398     * 'Tcl_CreateThread' and will be called as the main fuction of
399     * the new thread created by that call.
400     */
401    
402     #ifdef MAC_TCL
403     typedef pascal void *(Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData));
404     #elif defined __WIN32__
405     typedef unsigned (__stdcall Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData));
406     #else
407     typedef void (Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData));
408     #endif
409    
410    
411     /*
412     * Threading function return types used for abstracting away platform
413     * differences when writing a Tcl_ThreadCreateProc. See the NewThread
414     * function in generic/tclThreadTest.c for it's usage.
415     */
416     #ifdef MAC_TCL
417     # define Tcl_ThreadCreateType pascal void *
418     # define TCL_THREAD_CREATE_RETURN return NULL
419     #elif defined __WIN32__
420     # define Tcl_ThreadCreateType unsigned __stdcall
421     # define TCL_THREAD_CREATE_RETURN return 0
422     #else
423     # define Tcl_ThreadCreateType void
424     # define TCL_THREAD_CREATE_RETURN
425     #endif
426    
427    
428    
429     /*
430     * Definition of values for default stacksize and the possible flags to be
431     * given to Tcl_CreateThread.
432     */
433    
434     #define TCL_THREAD_STACK_DEFAULT (0) /* Use default size for stack */
435     #define TCL_THREAD_NOFLAGS (0000) /* Standard flags, default behaviour */
436     #define TCL_THREAD_JOINABLE (0001) /* Mark the thread as joinable */
437    
438     /*
439     * Flag values passed to Tcl_GetRegExpFromObj.
440     */
441    
442     #define TCL_REG_BASIC 000000 /* BREs (convenience) */
443     #define TCL_REG_EXTENDED 000001 /* EREs */
444     #define TCL_REG_ADVF 000002 /* advanced features in EREs */
445     #define TCL_REG_ADVANCED 000003 /* AREs (which are also EREs) */
446     #define TCL_REG_QUOTE 000004 /* no special characters, none */
447     #define TCL_REG_NOCASE 000010 /* ignore case */
448     #define TCL_REG_NOSUB 000020 /* don't care about subexpressions */
449     #define TCL_REG_EXPANDED 000040 /* expanded format, white space &
450     * comments */
451     #define TCL_REG_NLSTOP 000100 /* \n doesn't match . or [^ ] */
452     #define TCL_REG_NLANCH 000200 /* ^ matches after \n, $ before */
453     #define TCL_REG_NEWLINE 000300 /* newlines are line terminators */
454     #define TCL_REG_CANMATCH 001000 /* report details on partial/limited
455     * matches */
456    
457     /*
458     * The following flag is experimental and only intended for use by Expect. It
459     * will probably go away in a later release.
460     */
461    
462     #define TCL_REG_BOSONLY 002000 /* prepend \A to pattern so it only
463     * matches at the beginning of the
464     * string. */
465    
466     /*
467     * Flags values passed to Tcl_RegExpExecObj.
468     */
469    
470     #define TCL_REG_NOTBOL 0001 /* Beginning of string does not match ^. */
471     #define TCL_REG_NOTEOL 0002 /* End of string does not match $. */
472    
473     /*
474     * Structures filled in by Tcl_RegExpInfo. Note that all offset values are
475     * relative to the start of the match string, not the beginning of the
476     * entire string.
477     */
478    
479     typedef struct Tcl_RegExpIndices {
480     long start; /* character offset of first character in match */
481     long end; /* character offset of first character after the
482     * match. */
483     } Tcl_RegExpIndices;
484    
485     typedef struct Tcl_RegExpInfo {
486     int nsubs; /* number of subexpressions in the
487     * compiled expression */
488     Tcl_RegExpIndices *matches; /* array of nsubs match offset
489     * pairs */
490     long extendStart; /* The offset at which a subsequent
491     * match might begin. */
492     long reserved; /* Reserved for later use. */
493     } Tcl_RegExpInfo;
494    
495     /*
496     * Picky compilers complain if this typdef doesn't appear before the
497     * struct's reference in tclDecls.h.
498     */
499    
500     typedef struct stat *Tcl_Stat_;
501    
502     /*
503     * When a TCL command returns, the interpreter contains a result from the
504     * command. Programmers are strongly encouraged to use one of the
505     * procedures Tcl_GetObjResult() or Tcl_GetStringResult() to read the
506     * interpreter's result. See the SetResult man page for details. Besides
507     * this result, the command procedure returns an integer code, which is
508     * one of the following:
509     *
510     * TCL_OK Command completed normally; the interpreter's
511     * result contains the command's result.
512     * TCL_ERROR The command couldn't be completed successfully;
513     * the interpreter's result describes what went wrong.
514     * TCL_RETURN The command requests that the current procedure
515     * return; the interpreter's result contains the
516     * procedure's return value.
517     * TCL_BREAK The command requests that the innermost loop
518     * be exited; the interpreter's result is meaningless.
519     * TCL_CONTINUE Go on to the next iteration of the current loop;
520     * the interpreter's result is meaningless.
521     */
522    
523     #define TCL_OK 0
524     #define TCL_ERROR 1
525     #define TCL_RETURN 2
526     #define TCL_BREAK 3
527     #define TCL_CONTINUE 4
528    
529     #define TCL_RESULT_SIZE 200
530    
531     /*
532     * Argument descriptors for math function callbacks in expressions:
533     */
534    
535     typedef enum {TCL_INT, TCL_DOUBLE, TCL_EITHER} Tcl_ValueType;
536     typedef struct Tcl_Value {
537     Tcl_ValueType type; /* Indicates intValue or doubleValue is
538     * valid, or both. */
539     long intValue; /* Integer value. */
540     double doubleValue; /* Double-precision floating value. */
541     } Tcl_Value;
542    
543     /*
544     * Forward declaration of Tcl_Obj to prevent an error when the forward
545     * reference to Tcl_Obj is encountered in the procedure types declared
546     * below.
547     */
548    
549     struct Tcl_Obj;
550    
551     /*
552     * Procedure types defined by Tcl:
553     */
554    
555     typedef int (Tcl_AppInitProc) _ANSI_ARGS_((Tcl_Interp *interp));
556     typedef int (Tcl_AsyncProc) _ANSI_ARGS_((ClientData clientData,
557     Tcl_Interp *interp, int code));
558     typedef void (Tcl_ChannelProc) _ANSI_ARGS_((ClientData clientData, int mask));
559     typedef void (Tcl_CloseProc) _ANSI_ARGS_((ClientData data));
560     typedef void (Tcl_CmdDeleteProc) _ANSI_ARGS_((ClientData clientData));
561     typedef int (Tcl_CmdProc) _ANSI_ARGS_((ClientData clientData,
562     Tcl_Interp *interp, int argc, char *argv[]));
563     typedef void (Tcl_CmdTraceProc) _ANSI_ARGS_((ClientData clientData,
564     Tcl_Interp *interp, int level, char *command, Tcl_CmdProc *proc,
565     ClientData cmdClientData, int argc, char *argv[]));
566     typedef void (Tcl_DupInternalRepProc) _ANSI_ARGS_((struct Tcl_Obj *srcPtr,
567     struct Tcl_Obj *dupPtr));
568     typedef int (Tcl_EncodingConvertProc)_ANSI_ARGS_((ClientData clientData,
569     CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr,
570     char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr,
571     int *dstCharsPtr));
572     typedef void (Tcl_EncodingFreeProc)_ANSI_ARGS_((ClientData clientData));
573     typedef int (Tcl_EventProc) _ANSI_ARGS_((Tcl_Event *evPtr, int flags));
574     typedef void (Tcl_EventCheckProc) _ANSI_ARGS_((ClientData clientData,
575     int flags));
576     typedef int (Tcl_EventDeleteProc) _ANSI_ARGS_((Tcl_Event *evPtr,
577     ClientData clientData));
578     typedef void (Tcl_EventSetupProc) _ANSI_ARGS_((ClientData clientData,
579     int flags));
580     typedef void (Tcl_ExitProc) _ANSI_ARGS_((ClientData clientData));
581     typedef void (Tcl_FileProc) _ANSI_ARGS_((ClientData clientData, int mask));
582     typedef void (Tcl_FileFreeProc) _ANSI_ARGS_((ClientData clientData));
583     typedef void (Tcl_FreeInternalRepProc) _ANSI_ARGS_((struct Tcl_Obj *objPtr));
584     typedef void (Tcl_FreeProc) _ANSI_ARGS_((char *blockPtr));
585     typedef void (Tcl_IdleProc) _ANSI_ARGS_((ClientData clientData));
586     typedef void (Tcl_InterpDeleteProc) _ANSI_ARGS_((ClientData clientData,
587     Tcl_Interp *interp));
588     typedef int (Tcl_MathProc) _ANSI_ARGS_((ClientData clientData,
589     Tcl_Interp *interp, Tcl_Value *args, Tcl_Value *resultPtr));
590     typedef void (Tcl_NamespaceDeleteProc) _ANSI_ARGS_((ClientData clientData));
591     typedef int (Tcl_ObjCmdProc) _ANSI_ARGS_((ClientData clientData,
592     Tcl_Interp *interp, int objc, struct Tcl_Obj *CONST objv[]));
593     typedef int (Tcl_PackageInitProc) _ANSI_ARGS_((Tcl_Interp *interp));
594     typedef void (Tcl_PanicProc) _ANSI_ARGS_(TCL_VARARGS(char *, format));
595     typedef void (Tcl_TcpAcceptProc) _ANSI_ARGS_((ClientData callbackData,
596     Tcl_Channel chan, char *address, int port));
597     typedef void (Tcl_TimerProc) _ANSI_ARGS_((ClientData clientData));
598     typedef int (Tcl_SetFromAnyProc) _ANSI_ARGS_((Tcl_Interp *interp,
599     struct Tcl_Obj *objPtr));
600     typedef void (Tcl_UpdateStringProc) _ANSI_ARGS_((struct Tcl_Obj *objPtr));
601     typedef char *(Tcl_VarTraceProc) _ANSI_ARGS_((ClientData clientData,
602     Tcl_Interp *interp, char *part1, char *part2, int flags));
603     typedef void (Tcl_CreateFileHandlerProc) _ANSI_ARGS_((int fd, int mask,
604     Tcl_FileProc *proc, ClientData clientData));
605     typedef void (Tcl_DeleteFileHandlerProc) _ANSI_ARGS_((int fd));
606    
607     /*
608     * The following structure represents a type of object, which is a
609     * particular internal representation for an object plus a set of
610     * procedures that provide standard operations on objects of that type.
611     */
612    
613     typedef struct Tcl_ObjType {
614     char *name; /* Name of the type, e.g. "int". */
615     Tcl_FreeInternalRepProc *freeIntRepProc;
616     /* Called to free any storage for the type's
617     * internal rep. NULL if the internal rep
618     * does not need freeing. */
619     Tcl_DupInternalRepProc *dupIntRepProc;
620     /* Called to create a new object as a copy
621     * of an existing object. */
622     Tcl_UpdateStringProc *updateStringProc;
623     /* Called to update the string rep from the
624     * type's internal representation. */
625     Tcl_SetFromAnyProc *setFromAnyProc;
626     /* Called to convert the object's internal
627     * rep to this type. Frees the internal rep
628     * of the old type. Returns TCL_ERROR on
629     * failure. */
630     } Tcl_ObjType;
631    
632     /*
633     * One of the following structures exists for each object in the Tcl
634     * system. An object stores a value as either a string, some internal
635     * representation, or both.
636     */
637    
638     typedef struct Tcl_Obj {
639     int refCount; /* When 0 the object will be freed. */
640     char *bytes; /* This points to the first byte of the
641     * object's string representation. The array
642     * must be followed by a null byte (i.e., at
643     * offset length) but may also contain
644     * embedded null characters. The array's
645     * storage is allocated by ckalloc. NULL
646     * means the string rep is invalid and must
647     * be regenerated from the internal rep.
648     * Clients should use Tcl_GetStringFromObj
649     * or Tcl_GetString to get a pointer to the
650     * byte array as a readonly value. */
651     int length; /* The number of bytes at *bytes, not
652     * including the terminating null. */
653     Tcl_ObjType *typePtr; /* Denotes the object's type. Always
654     * corresponds to the type of the object's
655     * internal rep. NULL indicates the object
656     * has no internal rep (has no type). */
657     union { /* The internal representation: */
658     long longValue; /* - an long integer value */
659     double doubleValue; /* - a double-precision floating value */
660     VOID *otherValuePtr; /* - another, type-specific value */
661     struct { /* - internal rep as two pointers */
662     VOID *ptr1;
663     VOID *ptr2;
664     } twoPtrValue;
665     } internalRep;
666     } Tcl_Obj;
667    
668     /*
669     * Macros to increment and decrement a Tcl_Obj's reference count, and to
670     * test whether an object is shared (i.e. has reference count > 1).
671     * Note: clients should use Tcl_DecrRefCount() when they are finished using
672     * an object, and should never call TclFreeObj() directly. TclFreeObj() is
673     * only defined and made public in tcl.h to support Tcl_DecrRefCount's macro
674     * definition. Note also that Tcl_DecrRefCount() refers to the parameter
675     * "obj" twice. This means that you should avoid calling it with an
676     * expression that is expensive to compute or has side effects.
677     */
678    
679     void Tcl_IncrRefCount _ANSI_ARGS_((Tcl_Obj *objPtr));
680     void Tcl_DecrRefCount _ANSI_ARGS_((Tcl_Obj *objPtr));
681     int Tcl_IsShared _ANSI_ARGS_((Tcl_Obj *objPtr));
682    
683     #ifdef TCL_MEM_DEBUG
684     # define Tcl_IncrRefCount(objPtr) \
685     Tcl_DbIncrRefCount(objPtr, __FILE__, __LINE__)
686     # define Tcl_DecrRefCount(objPtr) \
687     Tcl_DbDecrRefCount(objPtr, __FILE__, __LINE__)
688     # define Tcl_IsShared(objPtr) \
689     Tcl_DbIsShared(objPtr, __FILE__, __LINE__)
690     #else
691     # define Tcl_IncrRefCount(objPtr) \
692     ++(objPtr)->refCount
693     # define Tcl_DecrRefCount(objPtr) \
694     if (--(objPtr)->refCount <= 0) TclFreeObj(objPtr)
695     # define Tcl_IsShared(objPtr) \
696     ((objPtr)->refCount > 1)
697     #endif
698    
699     /*
700     * Macros and definitions that help to debug the use of Tcl objects.
701     * When TCL_MEM_DEBUG is defined, the Tcl_New declarations are
702     * overridden to call debugging versions of the object creation procedures.
703     */
704    
705     #ifdef TCL_MEM_DEBUG
706     # define Tcl_NewBooleanObj(val) \
707     Tcl_DbNewBooleanObj(val, __FILE__, __LINE__)
708     # define Tcl_NewByteArrayObj(bytes, len) \
709     Tcl_DbNewByteArrayObj(bytes, len, __FILE__, __LINE__)
710     # define Tcl_NewDoubleObj(val) \
711     Tcl_DbNewDoubleObj(val, __FILE__, __LINE__)
712     # define Tcl_NewIntObj(val) \
713     Tcl_DbNewLongObj(val, __FILE__, __LINE__)
714     # define Tcl_NewListObj(objc, objv) \
715     Tcl_DbNewListObj(objc, objv, __FILE__, __LINE__)
716     # define Tcl_NewLongObj(val) \
717     Tcl_DbNewLongObj(val, __FILE__, __LINE__)
718     # define Tcl_NewObj() \
719     Tcl_DbNewObj(__FILE__, __LINE__)
720     # define Tcl_NewStringObj(bytes, len) \
721     Tcl_DbNewStringObj(bytes, len, __FILE__, __LINE__)
722     #endif /* TCL_MEM_DEBUG */
723    
724     /*
725     * The following structure contains the state needed by
726     * Tcl_SaveResult. No-one outside of Tcl should access any of these
727     * fields. This structure is typically allocated on the stack.
728     */
729    
730     typedef struct Tcl_SavedResult {
731     char *result;
732     Tcl_FreeProc *freeProc;
733     Tcl_Obj *objResultPtr;
734     char *appendResult;
735     int appendAvl;
736     int appendUsed;
737     char resultSpace[TCL_RESULT_SIZE+1];
738     } Tcl_SavedResult;
739    
740    
741     /*
742     * The following definitions support Tcl's namespace facility.
743     * Note: the first five fields must match exactly the fields in a
744     * Namespace structure (see tclInt.h).
745     */
746    
747     typedef struct Tcl_Namespace {
748     char *name; /* The namespace's name within its parent
749     * namespace. This contains no ::'s. The
750     * name of the global namespace is ""
751     * although "::" is an synonym. */
752     char *fullName; /* The namespace's fully qualified name.
753     * This starts with ::. */
754     ClientData clientData; /* Arbitrary value associated with this
755     * namespace. */
756     Tcl_NamespaceDeleteProc* deleteProc;
757     /* Procedure invoked when deleting the
758     * namespace to, e.g., free clientData. */
759     struct Tcl_Namespace* parentPtr;
760     /* Points to the namespace that contains
761     * this one. NULL if this is the global
762     * namespace. */
763     } Tcl_Namespace;
764    
765     /*
766     * The following structure represents a call frame, or activation record.
767     * A call frame defines a naming context for a procedure call: its local
768     * scope (for local variables) and its namespace scope (used for non-local
769     * variables; often the global :: namespace). A call frame can also define
770     * the naming context for a namespace eval or namespace inscope command:
771     * the namespace in which the command's code should execute. The
772     * Tcl_CallFrame structures exist only while procedures or namespace
773     * eval/inscope's are being executed, and provide a Tcl call stack.
774     *
775     * A call frame is initialized and pushed using Tcl_PushCallFrame and
776     * popped using Tcl_PopCallFrame. Storage for a Tcl_CallFrame must be
777     * provided by the Tcl_PushCallFrame caller, and callers typically allocate
778     * them on the C call stack for efficiency. For this reason, Tcl_CallFrame
779     * is defined as a structure and not as an opaque token. However, most
780     * Tcl_CallFrame fields are hidden since applications should not access
781     * them directly; others are declared as "dummyX".
782     *
783     * WARNING!! The structure definition must be kept consistent with the
784     * CallFrame structure in tclInt.h. If you change one, change the other.
785     */
786    
787     typedef struct Tcl_CallFrame {
788     Tcl_Namespace *nsPtr;
789     int dummy1;
790     int dummy2;
791     char *dummy3;
792     char *dummy4;
793     char *dummy5;
794     int dummy6;
795     char *dummy7;
796     char *dummy8;
797     int dummy9;
798     char* dummy10;
799     } Tcl_CallFrame;
800    
801     /*
802     * Information about commands that is returned by Tcl_GetCommandInfo and
803     * passed to Tcl_SetCommandInfo. objProc is an objc/objv object-based
804     * command procedure while proc is a traditional Tcl argc/argv
805     * string-based procedure. Tcl_CreateObjCommand and Tcl_CreateCommand
806     * ensure that both objProc and proc are non-NULL and can be called to
807     * execute the command. However, it may be faster to call one instead of
808     * the other. The member isNativeObjectProc is set to 1 if an
809     * object-based procedure was registered by Tcl_CreateObjCommand, and to
810     * 0 if a string-based procedure was registered by Tcl_CreateCommand.
811     * The other procedure is typically set to a compatibility wrapper that
812     * does string-to-object or object-to-string argument conversions then
813     * calls the other procedure.
814     */
815    
816     typedef struct Tcl_CmdInfo {
817     int isNativeObjectProc; /* 1 if objProc was registered by a call to
818     * Tcl_CreateObjCommand; 0 otherwise.
819     * Tcl_SetCmdInfo does not modify this
820     * field. */
821     Tcl_ObjCmdProc *objProc; /* Command's object-based procedure. */
822     ClientData objClientData; /* ClientData for object proc. */
823     Tcl_CmdProc *proc; /* Command's string-based procedure. */
824     ClientData clientData; /* ClientData for string proc. */
825     Tcl_CmdDeleteProc *deleteProc;
826     /* Procedure to call when command is
827     * deleted. */
828     ClientData deleteData; /* Value to pass to deleteProc (usually
829     * the same as clientData). */
830     Tcl_Namespace *namespacePtr; /* Points to the namespace that contains
831     * this command. Note that Tcl_SetCmdInfo
832     * will not change a command's namespace;
833     * use Tcl_RenameCommand to do that. */
834    
835     } Tcl_CmdInfo;
836    
837     /*
838     * The structure defined below is used to hold dynamic strings. The only
839     * field that clients should use is the string field, and they should
840     * never modify it.
841     */
842    
843     #define TCL_DSTRING_STATIC_SIZE 200
844     typedef struct Tcl_DString {
845     char *string; /* Points to beginning of string: either
846     * staticSpace below or a malloced array. */
847     int length; /* Number of non-NULL characters in the
848     * string. */
849     int spaceAvl; /* Total number of bytes available for the
850     * string and its terminating NULL char. */
851     char staticSpace[TCL_DSTRING_STATIC_SIZE];
852     /* Space to use in common case where string
853     * is small. */
854     } Tcl_DString;
855    
856     #define Tcl_DStringLength(dsPtr) ((dsPtr)->length)
857     #define Tcl_DStringValue(dsPtr) ((dsPtr)->string)
858     #define Tcl_DStringTrunc Tcl_DStringSetLength
859    
860     /*
861     * Definitions for the maximum number of digits of precision that may
862     * be specified in the "tcl_precision" variable, and the number of
863     * bytes of buffer space required by Tcl_PrintDouble.
864     */
865    
866     #define TCL_MAX_PREC 17
867     #define TCL_DOUBLE_SPACE (TCL_MAX_PREC+10)
868    
869     /*
870     * Definition for a number of bytes of buffer space sufficient to hold the
871     * string representation of an integer in base 10 (assuming the existence
872     * of 64-bit integers).
873     */
874    
875     #define TCL_INTEGER_SPACE 24
876    
877     /*
878     * Flag that may be passed to Tcl_ConvertElement to force it not to
879     * output braces (careful! if you change this flag be sure to change
880     * the definitions at the front of tclUtil.c).
881     */
882    
883     #define TCL_DONT_USE_BRACES 1
884    
885     /*
886     * Flag that may be passed to Tcl_GetIndexFromObj to force it to disallow
887     * abbreviated strings.
888     */
889    
890     #define TCL_EXACT 1
891    
892     /*
893     * Flag values passed to Tcl_RecordAndEval and/or Tcl_EvalObj.
894     * WARNING: these bit choices must not conflict with the bit choices
895     * for evalFlag bits in tclInt.h!!
896     */
897    
898     #define TCL_NO_EVAL 0x10000
899     #define TCL_EVAL_GLOBAL 0x20000
900     #define TCL_EVAL_DIRECT 0x40000
901    
902     /*
903     * Special freeProc values that may be passed to Tcl_SetResult (see
904     * the man page for details):
905     */
906    
907     #define TCL_VOLATILE ((Tcl_FreeProc *) 1)
908     #define TCL_STATIC ((Tcl_FreeProc *) 0)
909     #define TCL_DYNAMIC ((Tcl_FreeProc *) 3)
910    
911     /*
912     * Flag values passed to variable-related procedures.
913     */
914    
915     #define TCL_GLOBAL_ONLY 1
916     #define TCL_NAMESPACE_ONLY 2
917     #define TCL_APPEND_VALUE 4
918     #define TCL_LIST_ELEMENT 8
919     #define TCL_TRACE_READS 0x10
920     #define TCL_TRACE_WRITES 0x20
921     #define TCL_TRACE_UNSETS 0x40
922     #define TCL_TRACE_DESTROYED 0x80
923     #define TCL_INTERP_DESTROYED 0x100
924     #define TCL_LEAVE_ERR_MSG 0x200
925     #define TCL_TRACE_ARRAY 0x800
926    
927     /*
928     * The TCL_PARSE_PART1 flag is deprecated and has no effect.
929     * The part1 is now always parsed whenever the part2 is NULL.
930     * (This is to avoid a common error when converting code to
931     * use the new object based APIs and forgetting to give the
932     * flag)
933     */
934     #ifndef TCL_NO_DEPRECATED
935     #define TCL_PARSE_PART1 0x400
936     #endif
937    
938    
939     /*
940     * Types for linked variables:
941     */
942    
943     #define TCL_LINK_INT 1
944     #define TCL_LINK_DOUBLE 2
945     #define TCL_LINK_BOOLEAN 3
946     #define TCL_LINK_STRING 4
947     #define TCL_LINK_READ_ONLY 0x80
948    
949     /*
950     * Forward declaration of Tcl_HashTable. Needed by some C++ compilers
951     * to prevent errors when the forward reference to Tcl_HashTable is
952     * encountered in the Tcl_HashEntry structure.
953     */
954    
955     #ifdef __cplusplus
956     struct Tcl_HashTable;
957     #endif
958    
959     /*
960     * Structure definition for an entry in a hash table. No-one outside
961     * Tcl should access any of these fields directly; use the macros
962     * defined below.
963     */
964    
965     typedef struct Tcl_HashEntry {
966     struct Tcl_HashEntry *nextPtr; /* Pointer to next entry in this
967     * hash bucket, or NULL for end of
968     * chain. */
969     struct Tcl_HashTable *tablePtr; /* Pointer to table containing entry. */
970     struct Tcl_HashEntry **bucketPtr; /* Pointer to bucket that points to
971     * first entry in this entry's chain:
972     * used for deleting the entry. */
973     ClientData clientData; /* Application stores something here
974     * with Tcl_SetHashValue. */
975     union { /* Key has one of these forms: */
976     char *oneWordValue; /* One-word value for key. */
977     int words[1]; /* Multiple integer words for key.
978     * The actual size will be as large
979     * as necessary for this table's
980     * keys. */
981     char string[4]; /* String for key. The actual size
982     * will be as large as needed to hold
983     * the key. */
984     } key; /* MUST BE LAST FIELD IN RECORD!! */
985     } Tcl_HashEntry;
986    
987     /*
988     * Structure definition for a hash table. Must be in tcl.h so clients
989     * can allocate space for these structures, but clients should never
990     * access any fields in this structure.
991     */
992    
993     #define TCL_SMALL_HASH_TABLE 4
994     typedef struct Tcl_HashTable {
995     Tcl_HashEntry **buckets; /* Pointer to bucket array. Each
996     * element points to first entry in
997     * bucket's hash chain, or NULL. */
998     Tcl_HashEntry *staticBuckets[TCL_SMALL_HASH_TABLE];
999     /* Bucket array used for small tables
1000     * (to avoid mallocs and frees). */
1001     int numBuckets; /* Total number of buckets allocated
1002     * at **bucketPtr. */
1003     int numEntries; /* Total number of entries present
1004     * in table. */
1005     int rebuildSize; /* Enlarge table when numEntries gets
1006     * to be this large. */
1007     int downShift; /* Shift count used in hashing
1008     * function. Designed to use high-
1009     * order bits of randomized keys. */
1010     int mask; /* Mask value used in hashing
1011     * function. */
1012     int keyType; /* Type of keys used in this table.
1013     * It's either TCL_STRING_KEYS,
1014     * TCL_ONE_WORD_KEYS, or an integer
1015     * giving the number of ints that
1016     * is the size of the key.
1017     */
1018     Tcl_HashEntry *(*findProc) _ANSI_ARGS_((struct Tcl_HashTable *tablePtr,
1019     CONST char *key));
1020     Tcl_HashEntry *(*createProc) _ANSI_ARGS_((struct Tcl_HashTable *tablePtr,
1021     CONST char *key, int *newPtr));
1022     } Tcl_HashTable;
1023    
1024     /*
1025     * Structure definition for information used to keep track of searches
1026     * through hash tables:
1027     */
1028    
1029     typedef struct Tcl_HashSearch {
1030     Tcl_HashTable *tablePtr; /* Table being searched. */
1031     int nextIndex; /* Index of next bucket to be
1032     * enumerated after present one. */
1033     Tcl_HashEntry *nextEntryPtr; /* Next entry to be enumerated in the
1034     * the current bucket. */
1035     } Tcl_HashSearch;
1036    
1037     /*
1038     * Acceptable key types for hash tables:
1039     */
1040    
1041     #define TCL_STRING_KEYS 0
1042     #define TCL_ONE_WORD_KEYS 1
1043    
1044     /*
1045     * Macros for clients to use to access fields of hash entries:
1046     */
1047    
1048     #define Tcl_GetHashValue(h) ((h)->clientData)
1049     #define Tcl_SetHashValue(h, value) ((h)->clientData = (ClientData) (value))
1050     #define Tcl_GetHashKey(tablePtr, h) \
1051     ((char *) (((tablePtr)->keyType == TCL_ONE_WORD_KEYS) ? (h)->key.oneWordValue \
1052     : (h)->key.string))
1053    
1054     /*
1055     * Macros to use for clients to use to invoke find and create procedures
1056     * for hash tables:
1057     */
1058    
1059     #define Tcl_FindHashEntry(tablePtr, key) \
1060     (*((tablePtr)->findProc))(tablePtr, key)
1061     #define Tcl_CreateHashEntry(tablePtr, key, newPtr) \
1062     (*((tablePtr)->createProc))(tablePtr, key, newPtr)
1063    
1064     /*
1065     * Flag values to pass to Tcl_DoOneEvent to disable searches
1066     * for some kinds of events:
1067     */
1068    
1069     #define TCL_DONT_WAIT (1<<1)
1070     #define TCL_WINDOW_EVENTS (1<<2)
1071     #define TCL_FILE_EVENTS (1<<3)
1072     #define TCL_TIMER_EVENTS (1<<4)
1073     #define TCL_IDLE_EVENTS (1<<5) /* WAS 0x10 ???? */
1074     #define TCL_ALL_EVENTS (~TCL_DONT_WAIT)
1075    
1076     /*
1077     * The following structure defines a generic event for the Tcl event
1078     * system. These are the things that are queued in calls to Tcl_QueueEvent
1079     * and serviced later by Tcl_DoOneEvent. There can be many different
1080     * kinds of events with different fields, corresponding to window events,
1081     * timer events, etc. The structure for a particular event consists of
1082     * a Tcl_Event header followed by additional information specific to that
1083     * event.
1084     */
1085    
1086     struct Tcl_Event {
1087     Tcl_EventProc *proc; /* Procedure to call to service this event. */
1088     struct Tcl_Event *nextPtr; /* Next in list of pending events, or NULL. */
1089     };
1090    
1091     /*
1092     * Positions to pass to Tcl_QueueEvent:
1093     */
1094    
1095     typedef enum {
1096     TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, TCL_QUEUE_MARK
1097     } Tcl_QueuePosition;
1098    
1099     /*
1100     * Values to pass to Tcl_SetServiceMode to specify the behavior of notifier
1101     * event routines.
1102     */
1103    
1104     #define TCL_SERVICE_NONE 0
1105     #define TCL_SERVICE_ALL 1
1106    
1107     /*
1108     * The following structure keeps is used to hold a time value, either as
1109     * an absolute time (the number of seconds from the epoch) or as an
1110     * elapsed time. On Unix systems the epoch is Midnight Jan 1, 1970 GMT.
1111     * On Macintosh systems the epoch is Midnight Jan 1, 1904 GMT.
1112     */
1113    
1114     typedef struct Tcl_Time {
1115     long sec; /* Seconds. */
1116     long usec; /* Microseconds. */
1117     } Tcl_Time;
1118    
1119     typedef void (Tcl_SetTimerProc) _ANSI_ARGS_((Tcl_Time *timePtr));
1120     typedef int (Tcl_WaitForEventProc) _ANSI_ARGS_((Tcl_Time *timePtr));
1121    
1122     /*
1123     * Bits to pass to Tcl_CreateFileHandler and Tcl_CreateChannelHandler
1124     * to indicate what sorts of events are of interest:
1125     */
1126    
1127     #define TCL_READABLE (1<<1)
1128     #define TCL_WRITABLE (1<<2)
1129     #define TCL_EXCEPTION (1<<3)
1130    
1131     /*
1132     * Flag values to pass to Tcl_OpenCommandChannel to indicate the
1133     * disposition of the stdio handles. TCL_STDIN, TCL_STDOUT, TCL_STDERR,
1134     * are also used in Tcl_GetStdChannel.
1135     */
1136    
1137     #define TCL_STDIN (1<<1)
1138     #define TCL_STDOUT (1<<2)
1139     #define TCL_STDERR (1<<3)
1140     #define TCL_ENFORCE_MODE (1<<4)
1141    
1142     /*
1143     * Bits passed to Tcl_DriverClose2Proc to indicate which side of a channel
1144     * should be closed.
1145     */
1146    
1147     #define TCL_CLOSE_READ (1<<1)
1148     #define TCL_CLOSE_WRITE (1<<2)
1149    
1150     /*
1151     * Value to use as the closeProc for a channel that supports the
1152     * close2Proc interface.
1153     */
1154    
1155     #define TCL_CLOSE2PROC ((Tcl_DriverCloseProc *)1)
1156    
1157     /*
1158     * Typedefs for the various operations in a channel type:
1159     */
1160    
1161     typedef int (Tcl_DriverBlockModeProc) _ANSI_ARGS_((
1162     ClientData instanceData, int mode));
1163     typedef int (Tcl_DriverCloseProc) _ANSI_ARGS_((ClientData instanceData,
1164     Tcl_Interp *interp));
1165     typedef int (Tcl_DriverClose2Proc) _ANSI_ARGS_((ClientData instanceData,
1166     Tcl_Interp *interp, int flags));
1167     typedef int (Tcl_DriverInputProc) _ANSI_ARGS_((ClientData instanceData,
1168     char *buf, int toRead, int *errorCodePtr));
1169     typedef int (Tcl_DriverOutputProc) _ANSI_ARGS_((ClientData instanceData,
1170     char *buf, int toWrite, int *errorCodePtr));
1171     typedef int (Tcl_DriverSeekProc) _ANSI_ARGS_((ClientData instanceData,
1172     long offset, int mode, int *errorCodePtr));
1173     typedef int (Tcl_DriverSetOptionProc) _ANSI_ARGS_((
1174     ClientData instanceData, Tcl_Interp *interp,
1175     char *optionName, char *value));
1176     typedef int (Tcl_DriverGetOptionProc) _ANSI_ARGS_((
1177     ClientData instanceData, Tcl_Interp *interp,
1178     char *optionName, Tcl_DString *dsPtr));
1179     typedef void (Tcl_DriverWatchProc) _ANSI_ARGS_((
1180     ClientData instanceData, int mask));
1181     typedef int (Tcl_DriverGetHandleProc) _ANSI_ARGS_((
1182     ClientData instanceData, int direction,
1183     ClientData *handlePtr));
1184    
1185     /*
1186     * The following declarations either map ckalloc and ckfree to
1187     * malloc and free, or they map them to procedures with all sorts
1188     * of debugging hooks defined in tclCkalloc.c.
1189     */
1190    
1191     #ifdef TCL_MEM_DEBUG
1192    
1193     # define ckalloc(x) Tcl_DbCkalloc(x, __FILE__, __LINE__)
1194     # define ckfree(x) Tcl_DbCkfree(x, __FILE__, __LINE__)
1195     # define ckrealloc(x,y) Tcl_DbCkrealloc((x), (y),__FILE__, __LINE__)
1196    
1197     #else /* !TCL_MEM_DEBUG */
1198    
1199     /*
1200     * If we are not using the debugging allocator, we should call the
1201     * Tcl_Alloc, et al. routines in order to guarantee that every module
1202     * is using the same memory allocator both inside and outside of the
1203     * Tcl library.
1204     */
1205    
1206     # define ckalloc(x) Tcl_Alloc(x)
1207     # define ckfree(x) Tcl_Free(x)
1208     # define ckrealloc(x,y) Tcl_Realloc(x,y)
1209     # define Tcl_InitMemory(x)
1210     # define Tcl_DumpActiveMemory(x)
1211     # define Tcl_ValidateAllMemory(x,y)
1212    
1213     #endif /* !TCL_MEM_DEBUG */
1214    
1215     /*
1216     * Enum for different end of line translation and recognition modes.
1217     */
1218    
1219     typedef enum Tcl_EolTranslation {
1220     TCL_TRANSLATE_AUTO, /* Eol == \r, \n and \r\n. */
1221     TCL_TRANSLATE_CR, /* Eol == \r. */
1222     TCL_TRANSLATE_LF, /* Eol == \n. */
1223     TCL_TRANSLATE_CRLF /* Eol == \r\n. */
1224     } Tcl_EolTranslation;
1225    
1226     /*
1227     * struct Tcl_ChannelType:
1228     *
1229     * One such structure exists for each type (kind) of channel.
1230     * It collects together in one place all the functions that are
1231     * part of the specific channel type.
1232     */
1233    
1234     typedef struct Tcl_ChannelType {
1235     char *typeName; /* The name of the channel type in Tcl
1236     * commands. This storage is owned by
1237     * channel type. */
1238     Tcl_DriverBlockModeProc *blockModeProc;
1239     /* Set blocking mode for the
1240     * raw channel. May be NULL. */
1241     Tcl_DriverCloseProc *closeProc; /* Procedure to call to close the
1242     * channel, or TCL_CLOSE2PROC if the
1243     * close2Proc should be used
1244     * instead. */
1245     Tcl_DriverInputProc *inputProc; /* Procedure to call for input
1246     * on channel. */
1247     Tcl_DriverOutputProc *outputProc; /* Procedure to call for output
1248     * on channel. */
1249     Tcl_DriverSeekProc *seekProc; /* Procedure to call to seek
1250     * on the channel. May be NULL. */
1251     Tcl_DriverSetOptionProc *setOptionProc;
1252     /* Set an option on a channel. */
1253     Tcl_DriverGetOptionProc *getOptionProc;
1254     /* Get an option from a channel. */
1255     Tcl_DriverWatchProc *watchProc; /* Set up the notifier to watch
1256     * for events on this channel. */
1257     Tcl_DriverGetHandleProc *getHandleProc;
1258     /* Get an OS handle from the channel
1259     * or NULL if not supported. */
1260     Tcl_DriverClose2Proc *close2Proc; /* Procedure to call to close the
1261     * channel if the device supports
1262     * closing the read & write sides
1263     * independently. */
1264     } Tcl_ChannelType;
1265    
1266     /*
1267     * The following flags determine whether the blockModeProc above should
1268     * set the channel into blocking or nonblocking mode. They are passed
1269     * as arguments to the blockModeProc procedure in the above structure.
1270     */
1271    
1272     #define TCL_MODE_BLOCKING 0 /* Put channel into blocking mode. */
1273     #define TCL_MODE_NONBLOCKING 1 /* Put channel into nonblocking
1274     * mode. */
1275    
1276     /*
1277     * Enum for different types of file paths.
1278     */
1279    
1280     typedef enum Tcl_PathType {
1281     TCL_PATH_ABSOLUTE,
1282     TCL_PATH_RELATIVE,
1283     TCL_PATH_VOLUME_RELATIVE
1284     } Tcl_PathType;
1285    
1286     /*
1287     * The following structure represents the Notifier functions that
1288     * you can override with the Tcl_SetNotifier call.
1289     */
1290    
1291     typedef struct Tcl_NotifierProcs {
1292     Tcl_SetTimerProc *setTimerProc;
1293     Tcl_WaitForEventProc *waitForEventProc;
1294     Tcl_CreateFileHandlerProc *createFileHandlerProc;
1295     Tcl_DeleteFileHandlerProc *deleteFileHandlerProc;
1296     } Tcl_NotifierProcs;
1297    
1298     /*
1299     * The following structure represents a user-defined encoding. It collects
1300     * together all the functions that are used by the specific encoding.
1301     */
1302    
1303     typedef struct Tcl_EncodingType {
1304     CONST char *encodingName; /* The name of the encoding, e.g. "euc-jp".
1305     * This name is the unique key for this
1306     * encoding type. */
1307     Tcl_EncodingConvertProc *toUtfProc;
1308     /* Procedure to convert from external
1309     * encoding into UTF-8. */
1310     Tcl_EncodingConvertProc *fromUtfProc;
1311     /* Procedure to convert from UTF-8 into
1312     * external encoding. */
1313     Tcl_EncodingFreeProc *freeProc;
1314     /* If non-NULL, procedure to call when this
1315     * encoding is deleted. */
1316     ClientData clientData; /* Arbitrary value associated with encoding
1317     * type. Passed to conversion procedures. */
1318     int nullSize; /* Number of zero bytes that signify
1319     * end-of-string in this encoding. This
1320     * number is used to determine the source
1321     * string length when the srcLen argument is
1322     * negative. Must be 1 or 2. */
1323     } Tcl_EncodingType;
1324    
1325     /*
1326     * The following definitions are used as values for the conversion control
1327     * flags argument when converting text from one character set to another:
1328     *
1329     * TCL_ENCODING_START: Signifies that the source buffer is the first
1330     * block in a (potentially multi-block) input
1331     * stream. Tells the conversion procedure to
1332     * reset to an initial state and perform any
1333     * initialization that needs to occur before the
1334     * first byte is converted. If the source
1335     * buffer contains the entire input stream to be
1336     * converted, this flag should be set.
1337     *
1338     * TCL_ENCODING_END: Signifies that the source buffer is the last
1339     * block in a (potentially multi-block) input
1340     * stream. Tells the conversion routine to
1341     * perform any finalization that needs to occur
1342     * after the last byte is converted and then to
1343     * reset to an initial state. If the source
1344     * buffer contains the entire input stream to be
1345     * converted, this flag should be set.
1346     *
1347     * TCL_ENCODING_STOPONERROR: If set, then the converter will return
1348     * immediately upon encountering an invalid
1349     * byte sequence or a source character that has
1350     * no mapping in the target encoding. If clear,
1351     * then the converter will skip the problem,
1352     * substituting one or more "close" characters
1353     * in the destination buffer and then continue
1354     * to sonvert the source.
1355     */
1356    
1357     #define TCL_ENCODING_START 0x01
1358     #define TCL_ENCODING_END 0x02
1359     #define TCL_ENCODING_STOPONERROR 0x04
1360    
1361     /*
1362     *----------------------------------------------------------------
1363     * The following data structures and declarations are for the new
1364     * Tcl parser. This stuff should all move to tcl.h eventually.
1365     *----------------------------------------------------------------
1366     */
1367    
1368     /*
1369     * For each word of a command, and for each piece of a word such as a
1370     * variable reference, one of the following structures is created to
1371     * describe the token.
1372     */
1373    
1374     typedef struct Tcl_Token {
1375     int type; /* Type of token, such as TCL_TOKEN_WORD;
1376     * see below for valid types. */
1377     char *start; /* First character in token. */
1378     int size; /* Number of bytes in token. */
1379     int numComponents; /* If this token is composed of other
1380     * tokens, this field tells how many of
1381     * them there are (including components of
1382     * components, etc.). The component tokens
1383     * immediately follow this one. */
1384     } Tcl_Token;
1385    
1386     /*
1387     * Type values defined for Tcl_Token structures. These values are
1388     * defined as mask bits so that it's easy to check for collections of
1389     * types.
1390     *
1391     * TCL_TOKEN_WORD - The token describes one word of a command,
1392     * from the first non-blank character of
1393     * the word (which may be " or {) up to but
1394     * not including the space, semicolon, or
1395     * bracket that terminates the word.
1396     * NumComponents counts the total number of
1397     * sub-tokens that make up the word. This
1398     * includes, for example, sub-tokens of
1399     * TCL_TOKEN_VARIABLE tokens.
1400     * TCL_TOKEN_SIMPLE_WORD - This token is just like TCL_TOKEN_WORD
1401     * except that the word is guaranteed to
1402     * consist of a single TCL_TOKEN_TEXT
1403     * sub-token.
1404     * TCL_TOKEN_TEXT - The token describes a range of literal
1405     * text that is part of a word.
1406     * NumComponents is always 0.
1407     * TCL_TOKEN_BS - The token describes a backslash sequence
1408     * that must be collapsed. NumComponents
1409     * is always 0.
1410     * TCL_TOKEN_COMMAND - The token describes a command whose result
1411     * must be substituted into the word. The
1412     * token includes the enclosing brackets.
1413     * NumComponents is always 0.
1414     * TCL_TOKEN_VARIABLE - The token describes a variable
1415     * substitution, including the dollar sign,
1416     * variable name, and array index (if there
1417     * is one) up through the right
1418     * parentheses. NumComponents tells how
1419     * many additional tokens follow to
1420     * represent the variable name. The first
1421     * token will be a TCL_TOKEN_TEXT token
1422     * that describes the variable name. If
1423     * the variable is an array reference then
1424     * there will be one or more additional
1425     * tokens, of type TCL_TOKEN_TEXT,
1426     * TCL_TOKEN_BS, TCL_TOKEN_COMMAND, and
1427     * TCL_TOKEN_VARIABLE, that describe the
1428     * array index; numComponents counts the
1429     * total number of nested tokens that make
1430     * up the variable reference, including
1431     * sub-tokens of TCL_TOKEN_VARIABLE tokens.
1432     * TCL_TOKEN_SUB_EXPR - The token describes one subexpression of a
1433     * expression, from the first non-blank
1434     * character of the subexpression up to but not
1435     * including the space, brace, or bracket
1436     * that terminates the subexpression.
1437     * NumComponents counts the total number of
1438     * following subtokens that make up the
1439     * subexpression; this includes all subtokens
1440     * for any nested TCL_TOKEN_SUB_EXPR tokens.
1441     * For example, a numeric value used as a
1442     * primitive operand is described by a
1443     * TCL_TOKEN_SUB_EXPR token followed by a
1444     * TCL_TOKEN_TEXT token. A binary subexpression
1445     * is described by a TCL_TOKEN_SUB_EXPR token
1446     * followed by the TCL_TOKEN_OPERATOR token
1447     * for the operator, then TCL_TOKEN_SUB_EXPR
1448     * tokens for the left then the right operands.
1449     * TCL_TOKEN_OPERATOR - The token describes one expression operator.
1450     * An operator might be the name of a math
1451     * function such as "abs". A TCL_TOKEN_OPERATOR
1452     * token is always preceeded by one
1453     * TCL_TOKEN_SUB_EXPR token for the operator's
1454     * subexpression, and is followed by zero or
1455     * more TCL_TOKEN_SUB_EXPR tokens for the
1456     * operator's operands. NumComponents is
1457     * always 0.
1458     */
1459    
1460     #define TCL_TOKEN_WORD 1
1461     #define TCL_TOKEN_SIMPLE_WORD 2
1462     #define TCL_TOKEN_TEXT 4
1463     #define TCL_TOKEN_BS 8
1464     #define TCL_TOKEN_COMMAND 16
1465     #define TCL_TOKEN_VARIABLE 32
1466     #define TCL_TOKEN_SUB_EXPR 64
1467     #define TCL_TOKEN_OPERATOR 128
1468    
1469     /*
1470     * Parsing error types. On any parsing error, one of these values
1471     * will be stored in the error field of the Tcl_Parse structure
1472     * defined below.
1473     */
1474    
1475     #define TCL_PARSE_SUCCESS 0
1476     #define TCL_PARSE_QUOTE_EXTRA 1
1477     #define TCL_PARSE_BRACE_EXTRA 2
1478     #define TCL_PARSE_MISSING_BRACE 3
1479     #define TCL_PARSE_MISSING_BRACKET 4
1480     #define TCL_PARSE_MISSING_PAREN 5
1481     #define TCL_PARSE_MISSING_QUOTE 6
1482     #define TCL_PARSE_MISSING_VAR_BRACE 7
1483     #define TCL_PARSE_SYNTAX 8
1484     #define TCL_PARSE_BAD_NUMBER 9
1485    
1486     /*
1487     * A structure of the following type is filled in by Tcl_ParseCommand.
1488     * It describes a single command parsed from an input string.
1489     */
1490    
1491     #define NUM_STATIC_TOKENS 20
1492    
1493     typedef struct Tcl_Parse {
1494     char *commentStart; /* Pointer to # that begins the first of
1495     * one or more comments preceding the
1496     * command. */
1497     int commentSize; /* Number of bytes in comments (up through
1498     * newline character that terminates the
1499     * last comment). If there were no
1500     * comments, this field is 0. */
1501     char *commandStart; /* First character in first word of command. */
1502     int commandSize; /* Number of bytes in command, including
1503     * first character of first word, up
1504     * through the terminating newline,
1505     * close bracket, or semicolon. */
1506     int numWords; /* Total number of words in command. May
1507     * be 0. */
1508     Tcl_Token *tokenPtr; /* Pointer to first token representing
1509     * the words of the command. Initially
1510     * points to staticTokens, but may change
1511     * to point to malloc-ed space if command
1512     * exceeds space in staticTokens. */
1513     int numTokens; /* Total number of tokens in command. */
1514     int tokensAvailable; /* Total number of tokens available at
1515     * *tokenPtr. */
1516     int errorType; /* One of the parsing error types defined
1517     * above. */
1518    
1519     /*
1520     * The fields below are intended only for the private use of the
1521     * parser. They should not be used by procedures that invoke
1522     * Tcl_ParseCommand.
1523     */
1524    
1525     char *string; /* The original command string passed to
1526     * Tcl_ParseCommand. */
1527     char *end; /* Points to the character just after the
1528     * last one in the command string. */
1529     Tcl_Interp *interp; /* Interpreter to use for error reporting,
1530     * or NULL. */
1531     char *term; /* Points to character in string that
1532     * terminated most recent token. Filled in
1533     * by ParseTokens. If an error occurs,
1534     * points to beginning of region where the
1535     * error occurred (e.g. the open brace if
1536     * the close brace is missing). */
1537     int incomplete; /* This field is set to 1 by Tcl_ParseCommand
1538     * if the command appears to be incomplete.
1539     * This information is used by
1540     * Tcl_CommandComplete. */
1541     Tcl_Token staticTokens[NUM_STATIC_TOKENS];
1542     /* Initial space for tokens for command.
1543     * This space should be large enough to
1544     * accommodate most commands; dynamic
1545     * space is allocated for very large
1546     * commands that don't fit here. */
1547     } Tcl_Parse;
1548    
1549     /*
1550     * The following definitions are the error codes returned by the conversion
1551     * routines:
1552     *
1553     * TCL_OK: All characters were converted.
1554     *
1555     * TCL_CONVERT_NOSPACE: The output buffer would not have been large
1556     * enough for all of the converted data; as many
1557     * characters as could fit were converted though.
1558     *
1559     * TCL_CONVERT_MULTIBYTE: The last few bytes in the source string were
1560     * the beginning of a multibyte sequence, but
1561     * more bytes were needed to complete this
1562     * sequence. A subsequent call to the conversion
1563     * routine should pass the beginning of this
1564     * unconverted sequence plus additional bytes
1565     * from the source stream to properly convert
1566     * the formerly split-up multibyte sequence.
1567     *
1568     * TCL_CONVERT_SYNTAX: The source stream contained an invalid
1569     * character sequence. This may occur if the
1570     * input stream has been damaged or if the input
1571     * encoding method was misidentified. This error
1572     * is reported only if TCL_ENCODING_STOPONERROR
1573     * was specified.
1574     *
1575     * TCL_CONVERT_UNKNOWN: The source string contained a character
1576     * that could not be represented in the target
1577     * encoding. This error is reported only if
1578     * TCL_ENCODING_STOPONERROR was specified.
1579     */
1580    
1581     #define TCL_CONVERT_MULTIBYTE -1
1582     #define TCL_CONVERT_SYNTAX -2
1583     #define TCL_CONVERT_UNKNOWN -3
1584     #define TCL_CONVERT_NOSPACE -4
1585    
1586     /*
1587     * The maximum number of bytes that are necessary to represent a single
1588     * Unicode character in UTF-8.
1589     */
1590    
1591     #define TCL_UTF_MAX 3
1592    
1593     /*
1594     * This represents a Unicode character.
1595     */
1596    
1597     typedef unsigned short Tcl_UniChar;
1598    
1599     /*
1600     * Deprecated Tcl procedures:
1601     */
1602    
1603     #ifndef TCL_NO_DEPRECATED
1604     #define Tcl_EvalObj(interp,objPtr) Tcl_EvalObjEx((interp),(objPtr),0)
1605     #define Tcl_GlobalEvalObj(interp,objPtr) \
1606     Tcl_EvalObjEx((interp),(objPtr),TCL_EVAL_GLOBAL)
1607     #endif
1608    
1609     /*
1610     * These function have been renamed. The old names are deprecated, but we
1611     * define these macros for backwards compatibilty.
1612     */
1613    
1614     #define Tcl_Ckalloc Tcl_Alloc
1615     #define Tcl_Ckfree Tcl_Free
1616     #define Tcl_Ckrealloc Tcl_Realloc
1617     #define Tcl_Return Tcl_SetResult
1618     #define Tcl_TildeSubst Tcl_TranslateFileName
1619     #define panic Tcl_Panic
1620     #define panicVA Tcl_PanicVA
1621    
1622     /*
1623     * The following constant is used to test for older versions of Tcl
1624     * in the stubs tables.
1625     *
1626     * Jan Nijtman's plus patch uses 0xFCA1BACF, so we need to pick a different
1627     * value since the stubs tables don't match.
1628     */
1629    
1630     #define TCL_STUB_MAGIC 0xFCA3BACF
1631    
1632     /*
1633     * The following function is required to be defined in all stubs aware
1634     * extensions. The function is actually implemented in the stub
1635     * library, not the main Tcl library, although there is a trivial
1636     * implementation in the main library in case an extension is statically
1637     * linked into an application.
1638     */
1639    
1640     EXTERN char * Tcl_InitStubs _ANSI_ARGS_((Tcl_Interp *interp,
1641     char *version, int exact));
1642    
1643     #ifndef USE_TCL_STUBS
1644    
1645     /*
1646     * When not using stubs, make it a macro.
1647     */
1648    
1649     #define Tcl_InitStubs(interp, version, exact) \
1650     Tcl_PkgRequire(interp, "Tcl", version, exact)
1651    
1652     #endif
1653    
1654    
1655     /*
1656     * Include the public function declarations that are accessible via
1657     * the stubs table.
1658     */
1659    
1660     #include "tclDecls.h"
1661    
1662     /*
1663     * Public functions that are not accessible via the stubs table.
1664     */
1665    
1666     EXTERN void Tcl_Main _ANSI_ARGS_((int argc, char **argv,
1667     Tcl_AppInitProc *appInitProc));
1668    
1669     /*
1670     * Convenience declaration of Tcl_AppInit for backwards compatibility.
1671     * This function is not *implemented* by the tcl library, so the storage
1672     * class is neither DLLEXPORT nor DLLIMPORT
1673     */
1674    
1675     #undef TCL_STORAGE_CLASS
1676     #define TCL_STORAGE_CLASS
1677    
1678     EXTERN int Tcl_AppInit _ANSI_ARGS_((Tcl_Interp *interp));
1679    
1680     #endif /* RESOURCE_INCLUDED */
1681    
1682     #undef TCL_STORAGE_CLASS
1683     #define TCL_STORAGE_CLASS DLLIMPORT
1684    
1685     /*
1686     * end block for C++
1687     */
1688    
1689     #ifdef __cplusplus
1690     }
1691     #endif
1692    
1693     #endif /* _TCL */
1694    
1695     /* $History: tcl.h $
1696     *
1697     * ***************** Version 1 *****************
1698     * User: Dtashley Date: 1/02/01 Time: 12:16a
1699     * Created in $/IjuScripter, IjuConsole/Source/Tcl Base
1700     * Initial check-in.
1701     */
1702    
1703     /* End of TCL.H */

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25