]> git.zerfleddert.de Git - micropolis/blame - src/tcl/tcl.h
Makefile: Micropolis build fixes for recent macOS
[micropolis] / src / tcl / tcl.h
CommitLineData
6a5fa4e0
MG
1/*
2 * tcl.h --
3 *
4 * This header file describes the externally-visible facilities
5 * of the Tcl interpreter.
6 *
7 * Copyright 1987-1991 Regents of the University of California
8 * Permission to use, copy, modify, and distribute this
9 * software and its documentation for any purpose and without
10 * fee is hereby granted, provided that the above copyright
11 * notice appear in all copies. The University of California
12 * makes no representations about the suitability of this
13 * software for any purpose. It is provided "as is" without
14 * express or implied warranty.
15 *
16 * $Header: /user6/ouster/tcl/RCS/tcl.h,v 1.84 92/08/07 08:21:34 ouster Exp $ SPRITE (Berkeley)
17 */
18
19#ifndef _TCL
20#define _TCL
21
22#define TCL_VERSION "6.4"
23
24/*
25 * Definitions that allow this header file to be used either with or
26 * without ANSI C features like function prototypes.
27 */
28
29#undef _ANSI_ARGS_
30#undef const
31#if ((defined(__STDC__) || defined(SABER)) && !defined(NO_PROTOTYPE)) || defined(__cplusplus)
32# define _ANSI_ARGS_(x) x
33# define CONST const
34# ifdef __cplusplus
35# define VARARGS (...)
36# else
37# define VARARGS ()
38# endif
39#else
40# define _ANSI_ARGS_(x) ()
41# define CONST
42#endif
43
44#ifdef __cplusplus
45# define EXTERN extern "C"
46#else
47# define EXTERN extern
48#endif
49
50/*
51 * Miscellaneous declarations (to allow Tcl to be used stand-alone,
52 * without the rest of Sprite).
53 */
54
55#ifndef NULL
56#define NULL 0
57#endif
58
59#ifndef _CLIENTDATA
60typedef int *ClientData;
61#define _CLIENTDATA
62#endif
63
64/*
65 * Data structures defined opaquely in this module. The definitions
66 * below just provide dummy types. A few fields are made visible in
67 * Tcl_Interp structures, namely those for returning string values.
68 * Note: any change to the Tcl_Interp definition below must be mirrored
69 * in the "real" definition in tclInt.h.
70 */
71
72typedef struct Tcl_Interp{
73 char *result; /* Points to result string returned by last
74 * command. */
75 void (*freeProc) _ANSI_ARGS_((char *blockPtr));
76 /* Zero means result is statically allocated.
77 * If non-zero, gives address of procedure
78 * to invoke to free the result. Must be
79 * freed by Tcl_Eval before executing next
80 * command. */
81 int errorLine; /* When TCL_ERROR is returned, this gives
82 * the line number within the command where
83 * the error occurred (1 means first line). */
84} Tcl_Interp;
85
86typedef int *Tcl_Trace;
87typedef int *Tcl_CmdBuf;
88
89/*
90 * When a TCL command returns, the string pointer interp->result points to
91 * a string containing return information from the command. In addition,
92 * the command procedure returns an integer value, which is one of the
93 * following:
94 *
95 * TCL_OK Command completed normally; interp->result contains
96 * the command's result.
97 * TCL_ERROR The command couldn't be completed successfully;
98 * interp->result describes what went wrong.
99 * TCL_RETURN The command requests that the current procedure
100 * return; interp->result contains the procedure's
101 * return value.
102 * TCL_BREAK The command requests that the innermost loop
103 * be exited; interp->result is meaningless.
104 * TCL_CONTINUE Go on to the next iteration of the current loop;
105 * interp->result is meaninless.
106 */
107
108#define TCL_OK 0
109#define TCL_ERROR 1
110#define TCL_RETURN 2
111#define TCL_BREAK 3
112#define TCL_CONTINUE 4
113
114#define TCL_RESULT_SIZE 199
115
116/*
117 * Procedure types defined by Tcl:
118 */
119
120typedef void (Tcl_CmdDeleteProc) _ANSI_ARGS_((ClientData clientData));
121typedef int (Tcl_CmdProc) _ANSI_ARGS_((ClientData clientData,
122 Tcl_Interp *interp, int argc, char *argv[]));
123typedef void (Tcl_CmdTraceProc) _ANSI_ARGS_((ClientData clientData,
124 Tcl_Interp *interp, int level, char *command, Tcl_CmdProc *proc,
125 ClientData cmdClientData, int argc, char *argv[]));
126typedef void (Tcl_FreeProc) _ANSI_ARGS_((char *blockPtr));
127typedef char *(Tcl_VarTraceProc) _ANSI_ARGS_((ClientData clientData,
128 Tcl_Interp *interp, char *name1, char *name2, int flags));
129
130/*
131 * Flag values passed to Tcl_Eval (see the man page for details; also
132 * see tclInt.h for additional flags that are only used internally by
133 * Tcl):
134 */
135
136#define TCL_BRACKET_TERM 1
137
138/*
139 * Flag that may be passed to Tcl_ConvertElement to force it not to
140 * output braces (careful! if you change this flag be sure to change
141 * the definitions at the front of tclUtil.c).
142 */
143
144#define TCL_DONT_USE_BRACES 1
145
146/*
147 * Flag value passed to Tcl_RecordAndEval to request no evaluation
148 * (record only).
149 */
150
151#define TCL_NO_EVAL -1
152
153/*
154 * Specil freeProc values that may be passed to Tcl_SetResult (see
155 * the man page for details):
156 */
157
158#define TCL_VOLATILE ((Tcl_FreeProc *) -1)
159#define TCL_STATIC ((Tcl_FreeProc *) 0)
160#define TCL_DYNAMIC ((Tcl_FreeProc *) free)
161
162/*
163 * Flag values passed to variable-related procedures.
164 */
165
166#define TCL_GLOBAL_ONLY 1
167#define TCL_APPEND_VALUE 2
168#define TCL_LIST_ELEMENT 4
169#define TCL_NO_SPACE 8
170#define TCL_TRACE_READS 0x10
171#define TCL_TRACE_WRITES 0x20
172#define TCL_TRACE_UNSETS 0x40
173#define TCL_TRACE_DESTROYED 0x80
174#define TCL_INTERP_DESTROYED 0x100
175#define TCL_LEAVE_ERR_MSG 0x200
176
177/*
178 * Additional flag passed back to variable watchers. This flag must
179 * not overlap any of the TCL_TRACE_* flags defined above or the
180 * TRACE_* flags defined in tclInt.h.
181 */
182
183#define TCL_VARIABLE_UNDEFINED 8
184
185/*
186 * The following declarations either map ckalloc and ckfree to
187 * malloc and free, or they map them to procedures with all sorts
188 * of debugging hooks defined in tclCkalloc.c.
189 */
190
191#ifdef TCL_MEM_DEBUG
192
193EXTERN char * Tcl_DbCkalloc _ANSI_ARGS_((unsigned int size,
194 char *file, int line));
195EXTERN int Tcl_DbCkfree _ANSI_ARGS_((char *ptr,
196 char *file, int line));
197# define ckalloc(x) Tcl_DbCkalloc(x, __FILE__, __LINE__)
198# define ckfree(x) Tcl_DbCkfree(x, __FILE__, __LINE__)
199
200#else
201
202# define ckalloc(x) malloc(x)
203# define ckfree(x) free(x)
204
205#endif /* TCL_MEM_DEBUG */
206
207/*
208 * Macro to free up result of interpreter.
209 */
210
211#define Tcl_FreeResult(interp) \
212 if ((interp)->freeProc != 0) { \
213 if ((interp)->freeProc == (Tcl_FreeProc *) free) { \
214 ckfree((interp)->result); \
215 } else { \
216 (*(interp)->freeProc)((interp)->result); \
217 } \
218 (interp)->freeProc = 0; \
219 }
220
221/*
222 * Exported Tcl procedures:
223 */
224
225EXTERN void Tcl_AppendElement _ANSI_ARGS_((Tcl_Interp *interp,
226 char *string, int noSep));
227EXTERN void Tcl_AppendResult _ANSI_ARGS_((Tcl_Interp *interp, ...));
228EXTERN char * Tcl_AssembleCmd _ANSI_ARGS_((Tcl_CmdBuf buffer,
229 char *string));
230EXTERN void Tcl_AddErrorInfo _ANSI_ARGS_((Tcl_Interp *interp,
231 char *message));
232EXTERN char Tcl_Backslash _ANSI_ARGS_((char *src,
233 int *readPtr));
234EXTERN char * Tcl_Concat _ANSI_ARGS_((int argc, char **argv));
235EXTERN int Tcl_ConvertElement _ANSI_ARGS_((char *src,
236 char *dst, int flags));
237EXTERN Tcl_CmdBuf Tcl_CreateCmdBuf _ANSI_ARGS_((void));
238EXTERN void Tcl_CreateCommand _ANSI_ARGS_((Tcl_Interp *interp,
239 char *cmdName, Tcl_CmdProc *proc,
240 ClientData clientData,
241 Tcl_CmdDeleteProc *deleteProc));
242EXTERN Tcl_Interp * Tcl_CreateInterp _ANSI_ARGS_((void));
243EXTERN int Tcl_CreatePipeline _ANSI_ARGS_((Tcl_Interp *interp,
244 int argc, char **argv, int **pidArrayPtr,
245 int *inPipePtr, int *outPipePtr,
246 int *errFilePtr));
247EXTERN Tcl_Trace Tcl_CreateTrace _ANSI_ARGS_((Tcl_Interp *interp,
248 int level, Tcl_CmdTraceProc *proc,
249 ClientData clientData));
250EXTERN void Tcl_DeleteCmdBuf _ANSI_ARGS_((Tcl_CmdBuf buffer));
251EXTERN int Tcl_DeleteCommand _ANSI_ARGS_((Tcl_Interp *interp,
252 char *cmdName));
253EXTERN void Tcl_DeleteInterp _ANSI_ARGS_((Tcl_Interp *interp));
254EXTERN void Tcl_DeleteTrace _ANSI_ARGS_((Tcl_Interp *interp,
255 Tcl_Trace trace));
256EXTERN void Tcl_DetachPids _ANSI_ARGS_((int numPids, int *pidPtr));
257EXTERN int Tcl_DumpActiveMemory _ANSI_ARGS_((char *fileName));
258EXTERN char * Tcl_ErrnoId _ANSI_ARGS_((void));
259EXTERN int Tcl_Eval _ANSI_ARGS_((Tcl_Interp *interp, char *cmd,
260 int flags, char **termPtr));
261EXTERN int Tcl_EvalFile _ANSI_ARGS_((Tcl_Interp *interp,
262 char *fileName));
263EXTERN int Tcl_ExprBoolean _ANSI_ARGS_((Tcl_Interp *interp,
264 char *string, int *ptr));
265EXTERN int Tcl_ExprDouble _ANSI_ARGS_((Tcl_Interp *interp,
266 char *string, double *ptr));
267EXTERN int Tcl_ExprLong _ANSI_ARGS_((Tcl_Interp *interp,
268 char *string, long *ptr));
269EXTERN int Tcl_ExprString _ANSI_ARGS_((Tcl_Interp *interp,
270 char *string));
271EXTERN int Tcl_Fork _ANSI_ARGS_((void));
272EXTERN int Tcl_GetBoolean _ANSI_ARGS_((Tcl_Interp *interp,
273 char *string, int *boolPtr));
274EXTERN int Tcl_GetDouble _ANSI_ARGS_((Tcl_Interp *interp,
275 char *string, double *doublePtr));
276EXTERN int Tcl_GetInt _ANSI_ARGS_((Tcl_Interp *interp,
277 char *string, int *intPtr));
278EXTERN char * Tcl_GetVar _ANSI_ARGS_((Tcl_Interp *interp,
279 char *varName, int flags));
280EXTERN char * Tcl_GetVar2 _ANSI_ARGS_((Tcl_Interp *interp,
281 char *name1, char *name2, int flags));
282EXTERN int Tcl_GlobalEval _ANSI_ARGS_((Tcl_Interp *interp,
283 char *command));
284EXTERN void Tcl_InitHistory _ANSI_ARGS_((Tcl_Interp *interp));
285EXTERN void Tcl_InitMemory _ANSI_ARGS_((Tcl_Interp *interp));
286EXTERN char * Tcl_Merge _ANSI_ARGS_((int argc, char **argv));
287EXTERN char * Tcl_ParseVar _ANSI_ARGS_((Tcl_Interp *interp,
288 char *string, char **termPtr));
289EXTERN int Tcl_RecordAndEval _ANSI_ARGS_((Tcl_Interp *interp,
290 char *cmd, int flags));
291EXTERN void Tcl_ResetResult _ANSI_ARGS_((Tcl_Interp *interp));
292#define Tcl_Return Tcl_SetResult
293EXTERN int Tcl_ScanElement _ANSI_ARGS_((char *string,
294 int *flagPtr));
295EXTERN void Tcl_SetErrorCode _ANSI_ARGS_((Tcl_Interp *interp, ...));
296EXTERN void Tcl_SetResult _ANSI_ARGS_((Tcl_Interp *interp,
297 char *string, Tcl_FreeProc *freeProc));
298EXTERN char * Tcl_SetVar _ANSI_ARGS_((Tcl_Interp *interp,
299 char *varName, char *newValue, int flags));
300EXTERN char * Tcl_SetVar2 _ANSI_ARGS_((Tcl_Interp *interp,
301 char *name1, char *name2, char *newValue,
302 int flags));
303EXTERN char * Tcl_SignalId _ANSI_ARGS_((int sig));
304EXTERN char * Tcl_SignalMsg _ANSI_ARGS_((int sig));
305EXTERN int Tcl_SplitList _ANSI_ARGS_((Tcl_Interp *interp,
306 char *list, int *argcPtr, char ***argvPtr));
307EXTERN int Tcl_StringMatch _ANSI_ARGS_((char *string,
308 char *pattern));
309EXTERN char * Tcl_TildeSubst _ANSI_ARGS_((Tcl_Interp *interp,
310 char *name));
311EXTERN int Tcl_TraceVar _ANSI_ARGS_((Tcl_Interp *interp,
312 char *varName, int flags, Tcl_VarTraceProc *proc,
313 ClientData clientData));
314EXTERN int Tcl_TraceVar2 _ANSI_ARGS_((Tcl_Interp *interp,
315 char *name1, char *name2, int flags,
316 Tcl_VarTraceProc *proc, ClientData clientData));
317EXTERN char * Tcl_UnixError _ANSI_ARGS_((Tcl_Interp *interp));
318EXTERN int Tcl_UnsetVar _ANSI_ARGS_((Tcl_Interp *interp,
319 char *varName, int flags));
320EXTERN int Tcl_UnsetVar2 _ANSI_ARGS_((Tcl_Interp *interp,
321 char *name1, char *name2, int flags));
322EXTERN void Tcl_UntraceVar _ANSI_ARGS_((Tcl_Interp *interp,
323 char *varName, int flags, Tcl_VarTraceProc *proc,
324 ClientData clientData));
325EXTERN void Tcl_UntraceVar2 _ANSI_ARGS_((Tcl_Interp *interp,
326 char *name1, char *name2, int flags,
327 Tcl_VarTraceProc *proc, ClientData clientData));
328EXTERN int Tcl_VarEval _ANSI_ARGS_((Tcl_Interp *interp, ...));
329EXTERN ClientData Tcl_VarTraceInfo _ANSI_ARGS_((Tcl_Interp *interp,
330 char *varName, int flags,
331 Tcl_VarTraceProc *procPtr,
332 ClientData prevClientData));
333EXTERN ClientData Tcl_VarTraceInfo2 _ANSI_ARGS_((Tcl_Interp *interp,
334 char *name1, char *name2, int flags,
335 Tcl_VarTraceProc *procPtr,
336 ClientData prevClientData));
337EXTERN int Tcl_WaitPids _ANSI_ARGS_((int numPids, int *pidPtr,
338 int *statusPtr));
339
340#endif /* _TCL */
Impressum, Datenschutz