jpayne@69
|
1 /*
|
jpayne@69
|
2 * itclInt.h --
|
jpayne@69
|
3 *
|
jpayne@69
|
4 * This file contains internal definitions for the C-implemented part of a
|
jpayne@69
|
5 * Itcl
|
jpayne@69
|
6 *
|
jpayne@69
|
7 * Copyright (c) 2007 by Arnulf P. Wiedemann
|
jpayne@69
|
8 *
|
jpayne@69
|
9 * See the file "license.terms" for information on usage and redistribution of
|
jpayne@69
|
10 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
jpayne@69
|
11 */
|
jpayne@69
|
12
|
jpayne@69
|
13 #ifdef HAVE_UNISTD_H
|
jpayne@69
|
14 #include <unistd.h>
|
jpayne@69
|
15 #endif
|
jpayne@69
|
16 #ifdef HAVE_STDINT_H
|
jpayne@69
|
17 #include <stdint.h>
|
jpayne@69
|
18 #endif
|
jpayne@69
|
19 #include <stddef.h>
|
jpayne@69
|
20
|
jpayne@69
|
21 /*
|
jpayne@69
|
22 * Used to tag functions that are only to be visible within the module being
|
jpayne@69
|
23 * built and not outside it (where this is supported by the linker).
|
jpayne@69
|
24 */
|
jpayne@69
|
25
|
jpayne@69
|
26 #ifndef MODULE_SCOPE
|
jpayne@69
|
27 # ifdef __cplusplus
|
jpayne@69
|
28 # define MODULE_SCOPE extern "C"
|
jpayne@69
|
29 # else
|
jpayne@69
|
30 # define MODULE_SCOPE extern
|
jpayne@69
|
31 # endif
|
jpayne@69
|
32 #endif
|
jpayne@69
|
33
|
jpayne@69
|
34 #include <string.h>
|
jpayne@69
|
35 #include <ctype.h>
|
jpayne@69
|
36 #include <tclOO.h>
|
jpayne@69
|
37 #include "itcl.h"
|
jpayne@69
|
38 #include "itclMigrate2TclCore.h"
|
jpayne@69
|
39 #include "itclTclIntStubsFcn.h"
|
jpayne@69
|
40
|
jpayne@69
|
41 /*
|
jpayne@69
|
42 * Utility macros: STRINGIFY takes an argument and wraps it in "" (double
|
jpayne@69
|
43 * quotation marks).
|
jpayne@69
|
44 */
|
jpayne@69
|
45
|
jpayne@69
|
46 #ifndef STRINGIFY
|
jpayne@69
|
47 # define STRINGIFY(x) STRINGIFY1(x)
|
jpayne@69
|
48 # define STRINGIFY1(x) #x
|
jpayne@69
|
49 #endif
|
jpayne@69
|
50
|
jpayne@69
|
51 /*
|
jpayne@69
|
52 * MSVC 8.0 started to mark many standard C library functions depreciated
|
jpayne@69
|
53 * including the *printf family and others. Tell it to shut up.
|
jpayne@69
|
54 * (_MSC_VER is 1200 for VC6, 1300 or 1310 for vc7.net, 1400 for 8.0)
|
jpayne@69
|
55 */
|
jpayne@69
|
56 #if defined(_MSC_VER)
|
jpayne@69
|
57 # pragma warning(disable:4244)
|
jpayne@69
|
58 # if _MSC_VER >= 1400
|
jpayne@69
|
59 # pragma warning(disable:4267)
|
jpayne@69
|
60 # pragma warning(disable:4996)
|
jpayne@69
|
61 # endif
|
jpayne@69
|
62 #endif
|
jpayne@69
|
63
|
jpayne@69
|
64 #ifndef JOIN
|
jpayne@69
|
65 # define JOIN(a,b) JOIN1(a,b)
|
jpayne@69
|
66 # define JOIN1(a,b) a##b
|
jpayne@69
|
67 #endif
|
jpayne@69
|
68
|
jpayne@69
|
69 #ifndef TCL_UNUSED
|
jpayne@69
|
70 # if defined(__cplusplus)
|
jpayne@69
|
71 # define TCL_UNUSED(T) T
|
jpayne@69
|
72 # elif defined(__GNUC__) && (__GNUC__ > 2)
|
jpayne@69
|
73 # define TCL_UNUSED(T) T JOIN(dummy, __LINE__) __attribute__((unused))
|
jpayne@69
|
74 # else
|
jpayne@69
|
75 # define TCL_UNUSED(T) T JOIN(dummy, __LINE__)
|
jpayne@69
|
76 # endif
|
jpayne@69
|
77 #endif
|
jpayne@69
|
78
|
jpayne@69
|
79 #if TCL_MAJOR_VERSION == 8
|
jpayne@69
|
80 # define ITCL_Z_MODIFIER ""
|
jpayne@69
|
81 #else
|
jpayne@69
|
82 # define ITCL_Z_MODIFIER TCL_Z_MODIFIER
|
jpayne@69
|
83 #endif
|
jpayne@69
|
84
|
jpayne@69
|
85 /*
|
jpayne@69
|
86 * Since the Tcl/Tk distribution doesn't perform any asserts,
|
jpayne@69
|
87 * dynamic loading can fail to find the __assert function.
|
jpayne@69
|
88 * As a workaround, we'll include our own.
|
jpayne@69
|
89 */
|
jpayne@69
|
90
|
jpayne@69
|
91 #undef assert
|
jpayne@69
|
92 #if defined(NDEBUG) && !defined(DEBUG)
|
jpayne@69
|
93 #define assert(EX) ((void)0)
|
jpayne@69
|
94 #else /* !NDEBUG || DEBUG */
|
jpayne@69
|
95 #define assert(EX) (void)((EX) || (Itcl_Assert(STRINGIFY(EX), __FILE__, __LINE__), 0))
|
jpayne@69
|
96 #endif
|
jpayne@69
|
97
|
jpayne@69
|
98 #define ITCL_INTERP_DATA "itcl_data"
|
jpayne@69
|
99 #define ITCL_TK_VERSION "8.6"
|
jpayne@69
|
100
|
jpayne@69
|
101 /*
|
jpayne@69
|
102 * Convenience macros for iterating through hash tables. FOREACH_HASH_DECLS
|
jpayne@69
|
103 * sets up the declarations needed for the main macro, FOREACH_HASH, which
|
jpayne@69
|
104 * does the actual iteration. FOREACH_HASH_VALUE is a restricted version that
|
jpayne@69
|
105 * only iterates over values.
|
jpayne@69
|
106 */
|
jpayne@69
|
107
|
jpayne@69
|
108 #define FOREACH_HASH_DECLS \
|
jpayne@69
|
109 Tcl_HashEntry *hPtr;Tcl_HashSearch search
|
jpayne@69
|
110 #define FOREACH_HASH(key,val,tablePtr) \
|
jpayne@69
|
111 for(hPtr=Tcl_FirstHashEntry((tablePtr),&search); hPtr!=NULL ? \
|
jpayne@69
|
112 (*(void **)&(key)=Tcl_GetHashKey((tablePtr),hPtr),\
|
jpayne@69
|
113 *(void **)&(val)=Tcl_GetHashValue(hPtr),1):0; hPtr=Tcl_NextHashEntry(&search))
|
jpayne@69
|
114 #define FOREACH_HASH_VALUE(val,tablePtr) \
|
jpayne@69
|
115 for(hPtr=Tcl_FirstHashEntry((tablePtr),&search); hPtr!=NULL ? \
|
jpayne@69
|
116 (*(void **)&(val)=Tcl_GetHashValue(hPtr),1):0;hPtr=Tcl_NextHashEntry(&search))
|
jpayne@69
|
117
|
jpayne@69
|
118 /*
|
jpayne@69
|
119 * What sort of size of things we like to allocate.
|
jpayne@69
|
120 */
|
jpayne@69
|
121
|
jpayne@69
|
122 #define ALLOC_CHUNK 8
|
jpayne@69
|
123
|
jpayne@69
|
124 #define ITCL_INT_NAMESPACE ITCL_NAMESPACE"::internal"
|
jpayne@69
|
125 #define ITCL_INTDICTS_NAMESPACE ITCL_INT_NAMESPACE"::dicts"
|
jpayne@69
|
126 #define ITCL_VARIABLES_NAMESPACE ITCL_INT_NAMESPACE"::variables"
|
jpayne@69
|
127 #define ITCL_COMMANDS_NAMESPACE ITCL_INT_NAMESPACE"::commands"
|
jpayne@69
|
128
|
jpayne@69
|
129 typedef struct ItclFoundation {
|
jpayne@69
|
130 Itcl_Stack methodCallStack;
|
jpayne@69
|
131 Tcl_Command dispatchCommand;
|
jpayne@69
|
132 } ItclFoundation;
|
jpayne@69
|
133
|
jpayne@69
|
134 typedef struct ItclArgList {
|
jpayne@69
|
135 struct ItclArgList *nextPtr; /* pointer to next argument */
|
jpayne@69
|
136 Tcl_Obj *namePtr; /* name of the argument */
|
jpayne@69
|
137 Tcl_Obj *defaultValuePtr; /* default value or NULL if none */
|
jpayne@69
|
138 } ItclArgList;
|
jpayne@69
|
139
|
jpayne@69
|
140 /*
|
jpayne@69
|
141 * Common info for managing all known objects.
|
jpayne@69
|
142 * Each interpreter has one of these data structures stored as
|
jpayne@69
|
143 * clientData in the "itcl" namespace. It is also accessible
|
jpayne@69
|
144 * as associated data via the key ITCL_INTERP_DATA.
|
jpayne@69
|
145 */
|
jpayne@69
|
146 struct ItclClass;
|
jpayne@69
|
147 struct ItclObject;
|
jpayne@69
|
148 struct ItclMemberFunc;
|
jpayne@69
|
149 struct EnsembleInfo;
|
jpayne@69
|
150 struct ItclDelegatedOption;
|
jpayne@69
|
151 struct ItclDelegatedFunction;
|
jpayne@69
|
152
|
jpayne@69
|
153 typedef struct ItclObjectInfo {
|
jpayne@69
|
154 Tcl_Interp *interp; /* interpreter that manages this info */
|
jpayne@69
|
155 Tcl_HashTable objects; /* list of all known objects key is
|
jpayne@69
|
156 * ioPtr */
|
jpayne@69
|
157 Tcl_HashTable objectCmds; /* list of known objects using accessCmd */
|
jpayne@69
|
158 Tcl_HashTable unused5; /* list of known objects using namePtr */
|
jpayne@69
|
159 Tcl_HashTable classes; /* list of all known classes,
|
jpayne@69
|
160 * key is iclsPtr */
|
jpayne@69
|
161 Tcl_HashTable nameClasses; /* maps from fullNamePtr to iclsPtr */
|
jpayne@69
|
162 Tcl_HashTable namespaceClasses; /* maps from nsPtr to iclsPtr */
|
jpayne@69
|
163 Tcl_HashTable procMethods; /* maps from procPtr to mFunc */
|
jpayne@69
|
164 Tcl_HashTable instances; /* maps from instanceNumber to ioPtr */
|
jpayne@69
|
165 Tcl_HashTable unused8; /* maps from ioPtr to instanceNumber */
|
jpayne@69
|
166 Tcl_HashTable frameContext; /* maps frame to context stack */
|
jpayne@69
|
167 Tcl_HashTable classTypes; /* maps from class type i.e. "widget"
|
jpayne@69
|
168 * to define value i.e. ITCL_WIDGET */
|
jpayne@69
|
169 int protection; /* protection level currently in effect */
|
jpayne@69
|
170 int useOldResolvers; /* whether to use the "old" style
|
jpayne@69
|
171 * resolvers or the CallFrame resolvers */
|
jpayne@69
|
172 Itcl_Stack clsStack; /* stack of class definitions currently
|
jpayne@69
|
173 * being parsed */
|
jpayne@69
|
174 Itcl_Stack unused; /* Removed */
|
jpayne@69
|
175 Itcl_Stack unused6; /* obsolete field */
|
jpayne@69
|
176 struct ItclObject *currIoPtr; /* object currently being constructed
|
jpayne@69
|
177 * set only during calling of constructors
|
jpayne@69
|
178 * otherwise NULL */
|
jpayne@69
|
179 Tcl_ObjectMetadataType *class_meta_type;
|
jpayne@69
|
180 /* type for getting the Itcl class info
|
jpayne@69
|
181 * from a TclOO Tcl_Object */
|
jpayne@69
|
182 const Tcl_ObjectMetadataType *object_meta_type;
|
jpayne@69
|
183 /* type for getting the Itcl object info
|
jpayne@69
|
184 * from a TclOO Tcl_Object */
|
jpayne@69
|
185 Tcl_Object clazzObjectPtr; /* the root object of Itcl */
|
jpayne@69
|
186 Tcl_Class clazzClassPtr; /* the root class of Itcl */
|
jpayne@69
|
187 struct EnsembleInfo *ensembleInfo;
|
jpayne@69
|
188 struct ItclClass *currContextIclsPtr;
|
jpayne@69
|
189 /* context class for delegated option
|
jpayne@69
|
190 * handling */
|
jpayne@69
|
191 int currClassFlags; /* flags for the class just in creation */
|
jpayne@69
|
192 int buildingWidget; /* set if in construction of a widget */
|
jpayne@69
|
193 Tcl_Size unparsedObjc; /* number options not parsed by
|
jpayne@69
|
194 ItclExtendedConfigure/-Cget function */
|
jpayne@69
|
195 Tcl_Obj **unparsedObjv; /* options not parsed by
|
jpayne@69
|
196 ItclExtendedConfigure/-Cget function */
|
jpayne@69
|
197 int functionFlags; /* used for creating of ItclMemberCode */
|
jpayne@69
|
198 int unused7;
|
jpayne@69
|
199 struct ItclDelegatedOption *currIdoPtr;
|
jpayne@69
|
200 /* the current delegated option info */
|
jpayne@69
|
201 int inOptionHandling; /* used to indicate for type/widget ...
|
jpayne@69
|
202 * that there is an option processing
|
jpayne@69
|
203 * and methods are allowed to be called */
|
jpayne@69
|
204 /* these are the Tcl_Obj Ptrs for the clazz unknown procedure */
|
jpayne@69
|
205 /* need to store them to be able to free them at the end */
|
jpayne@69
|
206 int itclWidgetInitted; /* set to 1 if itclWidget.tcl has already
|
jpayne@69
|
207 * been called
|
jpayne@69
|
208 */
|
jpayne@69
|
209 int itclHullCmdsInitted; /* set to 1 if itclHullCmds.tcl has already
|
jpayne@69
|
210 * been called
|
jpayne@69
|
211 */
|
jpayne@69
|
212 Tcl_Obj *unused2;
|
jpayne@69
|
213 Tcl_Obj *unused3;
|
jpayne@69
|
214 Tcl_Obj *unused4;
|
jpayne@69
|
215 Tcl_Obj *infoVarsPtr;
|
jpayne@69
|
216 Tcl_Obj *unused9;
|
jpayne@69
|
217 Tcl_Obj *infoVars4Ptr;
|
jpayne@69
|
218 Tcl_Obj *typeDestructorArgumentPtr;
|
jpayne@69
|
219 struct ItclObject *lastIoPtr; /* last object constructed */
|
jpayne@69
|
220 Tcl_Command infoCmd;
|
jpayne@69
|
221 } ItclObjectInfo;
|
jpayne@69
|
222
|
jpayne@69
|
223 typedef struct EnsembleInfo {
|
jpayne@69
|
224 Tcl_HashTable ensembles; /* list of all known ensembles */
|
jpayne@69
|
225 Tcl_HashTable subEnsembles; /* list of all known subensembles */
|
jpayne@69
|
226 Tcl_Size numEnsembles;
|
jpayne@69
|
227 Tcl_Namespace *ensembleNsPtr;
|
jpayne@69
|
228 } EnsembleInfo;
|
jpayne@69
|
229 /*
|
jpayne@69
|
230 * Representation for each [incr Tcl] class.
|
jpayne@69
|
231 */
|
jpayne@69
|
232 #define ITCL_CLASS 0x1
|
jpayne@69
|
233 #define ITCL_TYPE 0x2
|
jpayne@69
|
234 #define ITCL_WIDGET 0x4
|
jpayne@69
|
235 #define ITCL_WIDGETADAPTOR 0x8
|
jpayne@69
|
236 #define ITCL_ECLASS 0x10
|
jpayne@69
|
237 #define ITCL_NWIDGET 0x20
|
jpayne@69
|
238 #define ITCL_WIDGET_FRAME 0x40
|
jpayne@69
|
239 #define ITCL_WIDGET_LABEL_FRAME 0x80
|
jpayne@69
|
240 #define ITCL_WIDGET_TOPLEVEL 0x100
|
jpayne@69
|
241 #define ITCL_WIDGET_TTK_FRAME 0x200
|
jpayne@69
|
242 #define ITCL_WIDGET_TTK_LABEL_FRAME 0x400
|
jpayne@69
|
243 #define ITCL_WIDGET_TTK_TOPLEVEL 0x800
|
jpayne@69
|
244 #define ITCL_CLASS_IS_DELETED 0x1000
|
jpayne@69
|
245 #define ITCL_CLASS_IS_DESTROYED 0x2000
|
jpayne@69
|
246 #define ITCL_CLASS_NS_IS_DESTROYED 0x4000
|
jpayne@69
|
247 #define ITCL_CLASS_IS_RENAMED 0x8000 /* unused */
|
jpayne@69
|
248 #define ITCL_CLASS_IS_FREED 0x10000
|
jpayne@69
|
249 #define ITCL_CLASS_DERIVED_RELEASED 0x20000
|
jpayne@69
|
250 #define ITCL_CLASS_NS_TEARDOWN 0x40000
|
jpayne@69
|
251 #define ITCL_CLASS_NO_VARNS_DELETE 0x80000
|
jpayne@69
|
252 #define ITCL_CLASS_SHOULD_VARNS_DELETE 0x100000
|
jpayne@69
|
253 #define ITCL_CLASS_DESTRUCTOR_CALLED 0x400000
|
jpayne@69
|
254
|
jpayne@69
|
255
|
jpayne@69
|
256 typedef struct ItclClass {
|
jpayne@69
|
257 Tcl_Obj *namePtr; /* class name */
|
jpayne@69
|
258 Tcl_Obj *fullNamePtr; /* fully qualified class name */
|
jpayne@69
|
259 Tcl_Interp *interp; /* interpreter that manages this info */
|
jpayne@69
|
260 Tcl_Namespace *nsPtr; /* namespace representing class scope */
|
jpayne@69
|
261 Tcl_Command accessCmd; /* access command for creating instances */
|
jpayne@69
|
262 Tcl_Command thisCmd; /* needed for deletion of class */
|
jpayne@69
|
263
|
jpayne@69
|
264 struct ItclObjectInfo *infoPtr;
|
jpayne@69
|
265 /* info about all known objects
|
jpayne@69
|
266 * and other stuff like stacks */
|
jpayne@69
|
267 Itcl_List bases; /* list of base classes */
|
jpayne@69
|
268 Itcl_List derived; /* list of all derived classes */
|
jpayne@69
|
269 Tcl_HashTable heritage; /* table of all base classes. Look up
|
jpayne@69
|
270 * by pointer to class definition. This
|
jpayne@69
|
271 * provides fast lookup for inheritance
|
jpayne@69
|
272 * tests. */
|
jpayne@69
|
273 Tcl_Obj *initCode; /* initialization code for new objs */
|
jpayne@69
|
274 Tcl_HashTable variables; /* definitions for all data members
|
jpayne@69
|
275 in this class. Look up simple string
|
jpayne@69
|
276 names and get back ItclVariable* ptrs */
|
jpayne@69
|
277 Tcl_HashTable options; /* definitions for all option members
|
jpayne@69
|
278 in this class. Look up simple string
|
jpayne@69
|
279 names and get back ItclOption* ptrs */
|
jpayne@69
|
280 Tcl_HashTable components; /* definitions for all component members
|
jpayne@69
|
281 in this class. Look up simple string
|
jpayne@69
|
282 names and get back ItclComponent* ptrs */
|
jpayne@69
|
283 Tcl_HashTable functions; /* definitions for all member functions
|
jpayne@69
|
284 in this class. Look up simple string
|
jpayne@69
|
285 names and get back ItclMemberFunc* ptrs */
|
jpayne@69
|
286 Tcl_HashTable delegatedOptions; /* definitions for all delegated options
|
jpayne@69
|
287 in this class. Look up simple string
|
jpayne@69
|
288 names and get back
|
jpayne@69
|
289 ItclDelegatedOption * ptrs */
|
jpayne@69
|
290 Tcl_HashTable delegatedFunctions; /* definitions for all delegated methods
|
jpayne@69
|
291 or procs in this class. Look up simple
|
jpayne@69
|
292 string names and get back
|
jpayne@69
|
293 ItclDelegatedFunction * ptrs */
|
jpayne@69
|
294 Tcl_HashTable methodVariables; /* definitions for all methodvariable members
|
jpayne@69
|
295 in this class. Look up simple string
|
jpayne@69
|
296 names and get back
|
jpayne@69
|
297 ItclMethodVariable* ptrs */
|
jpayne@69
|
298 Tcl_Size numInstanceVars; /* number of instance vars in variables
|
jpayne@69
|
299 table */
|
jpayne@69
|
300 Tcl_HashTable classCommons; /* used for storing variable namespace
|
jpayne@69
|
301 * string for Tcl_Resolve */
|
jpayne@69
|
302 Tcl_HashTable resolveVars; /* all possible names for variables in
|
jpayne@69
|
303 * this class (e.g., x, foo::x, etc.) */
|
jpayne@69
|
304 Tcl_HashTable resolveCmds; /* all possible names for functions in
|
jpayne@69
|
305 * this class (e.g., x, foo::x, etc.) */
|
jpayne@69
|
306 Tcl_HashTable contextCache; /* cache for function contexts */
|
jpayne@69
|
307 struct ItclMemberFunc *unused2;
|
jpayne@69
|
308 /* the class constructor or NULL */
|
jpayne@69
|
309 struct ItclMemberFunc *unused3;
|
jpayne@69
|
310 /* the class destructor or NULL */
|
jpayne@69
|
311 struct ItclMemberFunc *unused1;
|
jpayne@69
|
312 Tcl_Resolve *resolvePtr;
|
jpayne@69
|
313 Tcl_Obj *widgetClassPtr; /* class name for widget if class is a
|
jpayne@69
|
314 * ::itcl::widget */
|
jpayne@69
|
315 Tcl_Obj *hullTypePtr; /* hulltype name for widget if class is a
|
jpayne@69
|
316 * ::itcl::widget */
|
jpayne@69
|
317 Tcl_Object oPtr; /* TclOO class object */
|
jpayne@69
|
318 Tcl_Class clsPtr; /* TclOO class */
|
jpayne@69
|
319 Tcl_Size numCommons; /* number of commons in this class */
|
jpayne@69
|
320 Tcl_Size numVariables; /* number of variables in this class */
|
jpayne@69
|
321 Tcl_Size numOptions; /* number of options in this class */
|
jpayne@69
|
322 Tcl_Size unique; /* unique number for #auto generation */
|
jpayne@69
|
323 int flags; /* maintains class status */
|
jpayne@69
|
324 Tcl_Size callRefCount; /* prevent deleting of class if refcount>1 */
|
jpayne@69
|
325 Tcl_Obj *typeConstructorPtr; /* initialization for types */
|
jpayne@69
|
326 int destructorHasBeenCalled; /* prevent multiple invocations of destrcutor */
|
jpayne@69
|
327 Tcl_Size refCount;
|
jpayne@69
|
328 } ItclClass;
|
jpayne@69
|
329
|
jpayne@69
|
330 typedef struct ItclHierIter {
|
jpayne@69
|
331 ItclClass *current; /* current position in hierarchy */
|
jpayne@69
|
332 Itcl_Stack stack; /* stack used for traversal */
|
jpayne@69
|
333 } ItclHierIter;
|
jpayne@69
|
334
|
jpayne@69
|
335 #define ITCL_OBJECT_IS_DELETED 0x01
|
jpayne@69
|
336 #define ITCL_OBJECT_IS_DESTRUCTED 0x02
|
jpayne@69
|
337 #define ITCL_OBJECT_IS_DESTROYED 0x04
|
jpayne@69
|
338 #define ITCL_OBJECT_IS_RENAMED 0x08
|
jpayne@69
|
339 #define ITCL_OBJECT_CLASS_DESTRUCTED 0x10
|
jpayne@69
|
340 #define ITCL_TCLOO_OBJECT_IS_DELETED 0x20
|
jpayne@69
|
341 #define ITCL_OBJECT_DESTRUCT_ERROR 0x40
|
jpayne@69
|
342 #define ITCL_OBJECT_SHOULD_VARNS_DELETE 0x80
|
jpayne@69
|
343 #define ITCL_OBJECT_ROOT_METHOD 0x8000
|
jpayne@69
|
344
|
jpayne@69
|
345 /*
|
jpayne@69
|
346 * Representation for each [incr Tcl] object.
|
jpayne@69
|
347 */
|
jpayne@69
|
348 typedef struct ItclObject {
|
jpayne@69
|
349 ItclClass *iclsPtr; /* most-specific class */
|
jpayne@69
|
350 Tcl_Command accessCmd; /* object access command */
|
jpayne@69
|
351
|
jpayne@69
|
352 Tcl_HashTable *constructed; /* temp storage used during construction */
|
jpayne@69
|
353 Tcl_HashTable *destructed; /* temp storage used during destruction */
|
jpayne@69
|
354 Tcl_HashTable objectVariables;
|
jpayne@69
|
355 /* used for storing Tcl_Var entries for
|
jpayne@69
|
356 * variable resolving, key is ivPtr of
|
jpayne@69
|
357 * variable, value is varPtr */
|
jpayne@69
|
358 Tcl_HashTable objectOptions; /* definitions for all option members
|
jpayne@69
|
359 in this object. Look up option namePtr
|
jpayne@69
|
360 names and get back ItclOption* ptrs */
|
jpayne@69
|
361 Tcl_HashTable objectComponents; /* definitions for all component members
|
jpayne@69
|
362 in this object. Look up component namePtr
|
jpayne@69
|
363 names and get back ItclComponent* ptrs */
|
jpayne@69
|
364 Tcl_HashTable objectMethodVariables;
|
jpayne@69
|
365 /* definitions for all methodvariable members
|
jpayne@69
|
366 in this object. Look up methodvariable
|
jpayne@69
|
367 namePtr names and get back
|
jpayne@69
|
368 ItclMethodVariable* ptrs */
|
jpayne@69
|
369 Tcl_HashTable objectDelegatedOptions;
|
jpayne@69
|
370 /* definitions for all delegated option
|
jpayne@69
|
371 members in this object. Look up option
|
jpayne@69
|
372 namePtr names and get back
|
jpayne@69
|
373 ItclOption* ptrs */
|
jpayne@69
|
374 Tcl_HashTable objectDelegatedFunctions;
|
jpayne@69
|
375 /* definitions for all delegated function
|
jpayne@69
|
376 members in this object. Look up function
|
jpayne@69
|
377 namePtr names and get back
|
jpayne@69
|
378 ItclMemberFunc * ptrs */
|
jpayne@69
|
379 Tcl_HashTable contextCache; /* cache for function contexts */
|
jpayne@69
|
380 Tcl_Obj *namePtr;
|
jpayne@69
|
381 Tcl_Obj *origNamePtr; /* the original name before any rename */
|
jpayne@69
|
382 Tcl_Obj *createNamePtr; /* the temp name before any rename
|
jpayne@69
|
383 * mostly used for widgetadaptor
|
jpayne@69
|
384 * because that hijackes the name
|
jpayne@69
|
385 * often when installing the hull */
|
jpayne@69
|
386 Tcl_Interp *interp;
|
jpayne@69
|
387 ItclObjectInfo *infoPtr;
|
jpayne@69
|
388 Tcl_Obj *varNsNamePtr;
|
jpayne@69
|
389 Tcl_Object oPtr; /* the TclOO object */
|
jpayne@69
|
390 Tcl_Resolve *resolvePtr;
|
jpayne@69
|
391 int flags;
|
jpayne@69
|
392 Tcl_Size callRefCount; /* prevent deleting of object if refcount > 1 */
|
jpayne@69
|
393 Tcl_Obj *hullWindowNamePtr; /* the window path name for the hull
|
jpayne@69
|
394 * (before renaming in installhull) */
|
jpayne@69
|
395 int destructorHasBeenCalled; /* is set when the destructor is called
|
jpayne@69
|
396 * to avoid callin destructor twice */
|
jpayne@69
|
397 int noComponentTrace; /* don't call component traces if
|
jpayne@69
|
398 * setting components in DelegationInstall */
|
jpayne@69
|
399 int hadConstructorError; /* needed for multiple calls of CallItclObjectCmd */
|
jpayne@69
|
400 } ItclObject;
|
jpayne@69
|
401
|
jpayne@69
|
402 #define ITCL_IGNORE_ERRS 0x002 /* useful for construction/destruction */
|
jpayne@69
|
403
|
jpayne@69
|
404 typedef struct ItclResolveInfo {
|
jpayne@69
|
405 int flags;
|
jpayne@69
|
406 ItclClass *iclsPtr;
|
jpayne@69
|
407 ItclObject *ioPtr;
|
jpayne@69
|
408 } ItclResolveInfo;
|
jpayne@69
|
409
|
jpayne@69
|
410 #define ITCL_RESOLVE_CLASS 0x01
|
jpayne@69
|
411 #define ITCL_RESOLVE_OBJECT 0x02
|
jpayne@69
|
412
|
jpayne@69
|
413 /*
|
jpayne@69
|
414 * Implementation for any code body in an [incr Tcl] class.
|
jpayne@69
|
415 */
|
jpayne@69
|
416 typedef struct ItclMemberCode {
|
jpayne@69
|
417 int flags; /* flags describing implementation */
|
jpayne@69
|
418 Tcl_Size argcount; /* number of args in arglist */
|
jpayne@69
|
419 Tcl_Size maxargcount; /* max number of args in arglist */
|
jpayne@69
|
420 Tcl_Obj *usagePtr; /* usage string for error messages */
|
jpayne@69
|
421 Tcl_Obj *argumentPtr; /* the function arguments */
|
jpayne@69
|
422 Tcl_Obj *bodyPtr; /* the function body */
|
jpayne@69
|
423 ItclArgList *argListPtr; /* the parsed arguments */
|
jpayne@69
|
424 union {
|
jpayne@69
|
425 Tcl_CmdProc *argCmd; /* (argc,argv) C implementation */
|
jpayne@69
|
426 Tcl_ObjCmdProc *objCmd; /* (objc,objv) C implementation */
|
jpayne@69
|
427 } cfunc;
|
jpayne@69
|
428 void *clientData; /* client data for C implementations */
|
jpayne@69
|
429 } ItclMemberCode;
|
jpayne@69
|
430
|
jpayne@69
|
431 /*
|
jpayne@69
|
432 * Flag bits for ItclMemberCode:
|
jpayne@69
|
433 */
|
jpayne@69
|
434 #define ITCL_IMPLEMENT_NONE 0x001 /* no implementation */
|
jpayne@69
|
435 #define ITCL_IMPLEMENT_TCL 0x002 /* Tcl implementation */
|
jpayne@69
|
436 #define ITCL_IMPLEMENT_ARGCMD 0x004 /* (argc,argv) C implementation */
|
jpayne@69
|
437 #define ITCL_IMPLEMENT_OBJCMD 0x008 /* (objc,objv) C implementation */
|
jpayne@69
|
438 #define ITCL_IMPLEMENT_C 0x00c /* either kind of C implementation */
|
jpayne@69
|
439
|
jpayne@69
|
440 #define Itcl_IsMemberCodeImplemented(mcode) \
|
jpayne@69
|
441 (((mcode)->flags & ITCL_IMPLEMENT_NONE) == 0)
|
jpayne@69
|
442
|
jpayne@69
|
443 /*
|
jpayne@69
|
444 * Flag bits for ItclMember: functions and variables
|
jpayne@69
|
445 */
|
jpayne@69
|
446 #define ITCL_COMMON 0x010 /* non-zero => is a "proc" or common
|
jpayne@69
|
447 * variable */
|
jpayne@69
|
448
|
jpayne@69
|
449 /*
|
jpayne@69
|
450 * Flag bits for ItclMember: functions
|
jpayne@69
|
451 */
|
jpayne@69
|
452 #define ITCL_CONSTRUCTOR 0x020 /* non-zero => is a constructor */
|
jpayne@69
|
453 #define ITCL_DESTRUCTOR 0x040 /* non-zero => is a destructor */
|
jpayne@69
|
454 #define ITCL_ARG_SPEC 0x080 /* non-zero => has an argument spec */
|
jpayne@69
|
455 #define ITCL_BODY_SPEC 0x100 /* non-zero => has an body spec */
|
jpayne@69
|
456 #define ITCL_BUILTIN 0x400 /* non-zero => built-in method */
|
jpayne@69
|
457 #define ITCL_COMPONENT 0x800 /* non-zero => component */
|
jpayne@69
|
458 #define ITCL_TYPE_METHOD 0x1000 /* non-zero => typemethod */
|
jpayne@69
|
459 #define ITCL_METHOD 0x2000 /* non-zero => method */
|
jpayne@69
|
460
|
jpayne@69
|
461 /*
|
jpayne@69
|
462 * Flag bits for ItclMember: variables
|
jpayne@69
|
463 */
|
jpayne@69
|
464 #define ITCL_THIS_VAR 0x20 /* non-zero => built-in "this" variable */
|
jpayne@69
|
465 #define ITCL_OPTIONS_VAR 0x40 /* non-zero => built-in "itcl_options"
|
jpayne@69
|
466 * variable */
|
jpayne@69
|
467 #define ITCL_TYPE_VAR 0x80 /* non-zero => built-in "type" variable */
|
jpayne@69
|
468 /* no longer used ??? */
|
jpayne@69
|
469 #define ITCL_SELF_VAR 0x100 /* non-zero => built-in "self" variable */
|
jpayne@69
|
470 #define ITCL_SELFNS_VAR 0x200 /* non-zero => built-in "selfns"
|
jpayne@69
|
471 * variable */
|
jpayne@69
|
472 #define ITCL_WIN_VAR 0x400 /* non-zero => built-in "win" variable */
|
jpayne@69
|
473 #define ITCL_COMPONENT_VAR 0x800 /* non-zero => component variable */
|
jpayne@69
|
474 #define ITCL_HULL_VAR 0x1000 /* non-zero => built-in "itcl_hull"
|
jpayne@69
|
475 * variable */
|
jpayne@69
|
476 #define ITCL_OPTION_READONLY 0x2000 /* non-zero => readonly */
|
jpayne@69
|
477 #define ITCL_VARIABLE 0x4000 /* non-zero => normal variable */
|
jpayne@69
|
478 #define ITCL_TYPE_VARIABLE 0x8000 /* non-zero => typevariable */
|
jpayne@69
|
479 #define ITCL_OPTION_INITTED 0x10000 /* non-zero => option has been initialized */
|
jpayne@69
|
480 #define ITCL_OPTION_COMP_VAR 0x20000 /* variable to collect option components of extendedclass */
|
jpayne@69
|
481
|
jpayne@69
|
482 /*
|
jpayne@69
|
483 * Instance components.
|
jpayne@69
|
484 */
|
jpayne@69
|
485 struct ItclVariable;
|
jpayne@69
|
486 typedef struct ItclComponent {
|
jpayne@69
|
487 Tcl_Obj *namePtr; /* member name */
|
jpayne@69
|
488 struct ItclVariable *ivPtr; /* variable for this component */
|
jpayne@69
|
489 int flags;
|
jpayne@69
|
490 int haveKeptOptions;
|
jpayne@69
|
491 Tcl_HashTable keptOptions; /* table of options to keep */
|
jpayne@69
|
492 } ItclComponent;
|
jpayne@69
|
493
|
jpayne@69
|
494 #define ITCL_COMPONENT_INHERIT 0x01
|
jpayne@69
|
495 #define ITCL_COMPONENT_PUBLIC 0x02
|
jpayne@69
|
496
|
jpayne@69
|
497 typedef struct ItclDelegatedFunction {
|
jpayne@69
|
498 Tcl_Obj *namePtr;
|
jpayne@69
|
499 ItclComponent *icPtr;
|
jpayne@69
|
500 Tcl_Obj *asPtr;
|
jpayne@69
|
501 Tcl_Obj *usingPtr;
|
jpayne@69
|
502 Tcl_HashTable exceptions;
|
jpayne@69
|
503 int flags;
|
jpayne@69
|
504 } ItclDelegatedFunction;
|
jpayne@69
|
505
|
jpayne@69
|
506 /*
|
jpayne@69
|
507 * Representation of member functions in an [incr Tcl] class.
|
jpayne@69
|
508 */
|
jpayne@69
|
509 typedef struct ItclMemberFunc {
|
jpayne@69
|
510 Tcl_Obj* namePtr; /* member name */
|
jpayne@69
|
511 Tcl_Obj* fullNamePtr; /* member name with "class::" qualifier */
|
jpayne@69
|
512 ItclClass* iclsPtr; /* class containing this member */
|
jpayne@69
|
513 int protection; /* protection level */
|
jpayne@69
|
514 int flags; /* flags describing member (see above) */
|
jpayne@69
|
515 ItclObjectInfo *infoPtr;
|
jpayne@69
|
516 ItclMemberCode *codePtr; /* code associated with member */
|
jpayne@69
|
517 Tcl_Command accessCmd; /* Tcl command installed for this function */
|
jpayne@69
|
518 Tcl_Size argcount; /* number of args in arglist */
|
jpayne@69
|
519 Tcl_Size maxargcount; /* max number of args in arglist */
|
jpayne@69
|
520 Tcl_Obj *usagePtr; /* usage string for error messages */
|
jpayne@69
|
521 Tcl_Obj *argumentPtr; /* the function arguments */
|
jpayne@69
|
522 Tcl_Obj *builtinArgumentPtr; /* the function arguments for builtin functions */
|
jpayne@69
|
523 Tcl_Obj *origArgsPtr; /* the argument string of the original definition */
|
jpayne@69
|
524 Tcl_Obj *bodyPtr; /* the function body */
|
jpayne@69
|
525 ItclArgList *argListPtr; /* the parsed arguments */
|
jpayne@69
|
526 ItclClass *declaringClassPtr; /* the class which declared the method/proc */
|
jpayne@69
|
527 void *tmPtr; /* TclOO methodPtr */
|
jpayne@69
|
528 ItclDelegatedFunction *idmPtr;
|
jpayne@69
|
529 /* if the function is delegated != NULL */
|
jpayne@69
|
530 } ItclMemberFunc;
|
jpayne@69
|
531
|
jpayne@69
|
532 /*
|
jpayne@69
|
533 * Instance variables.
|
jpayne@69
|
534 */
|
jpayne@69
|
535 typedef struct ItclVariable {
|
jpayne@69
|
536 Tcl_Obj *namePtr; /* member name */
|
jpayne@69
|
537 Tcl_Obj *fullNamePtr; /* member name with "class::" qualifier */
|
jpayne@69
|
538 ItclClass *iclsPtr; /* class containing this member */
|
jpayne@69
|
539 ItclObjectInfo *infoPtr;
|
jpayne@69
|
540 ItclMemberCode *codePtr; /* code associated with member */
|
jpayne@69
|
541 Tcl_Obj *init; /* initial value */
|
jpayne@69
|
542 Tcl_Obj *arrayInitPtr; /* initial value if variable should be array */
|
jpayne@69
|
543 int protection; /* protection level */
|
jpayne@69
|
544 int flags; /* flags describing member (see below) */
|
jpayne@69
|
545 int initted; /* is set when first time initted, to check
|
jpayne@69
|
546 * for example itcl_hull var, which can be only
|
jpayne@69
|
547 * initialized once */
|
jpayne@69
|
548 } ItclVariable;
|
jpayne@69
|
549
|
jpayne@69
|
550
|
jpayne@69
|
551 struct ItclOption;
|
jpayne@69
|
552
|
jpayne@69
|
553 typedef struct ItclDelegatedOption {
|
jpayne@69
|
554 Tcl_Obj *namePtr;
|
jpayne@69
|
555 Tcl_Obj *resourceNamePtr;
|
jpayne@69
|
556 Tcl_Obj *classNamePtr;
|
jpayne@69
|
557 struct ItclOption *ioptPtr; /* the option name or null for "*" */
|
jpayne@69
|
558 ItclComponent *icPtr; /* the component where the delegation goes
|
jpayne@69
|
559 * to */
|
jpayne@69
|
560 Tcl_Obj *asPtr;
|
jpayne@69
|
561 Tcl_HashTable exceptions; /* exceptions from delegation */
|
jpayne@69
|
562 } ItclDelegatedOption;
|
jpayne@69
|
563
|
jpayne@69
|
564 /*
|
jpayne@69
|
565 * Instance options.
|
jpayne@69
|
566 */
|
jpayne@69
|
567 typedef struct ItclOption {
|
jpayne@69
|
568 /* within a class hierarchy there must be only
|
jpayne@69
|
569 * one option with the same name !! */
|
jpayne@69
|
570 Tcl_Obj *namePtr; /* member name */
|
jpayne@69
|
571 Tcl_Obj *fullNamePtr; /* member name with "class::" qualifier */
|
jpayne@69
|
572 Tcl_Obj *resourceNamePtr;
|
jpayne@69
|
573 Tcl_Obj *classNamePtr;
|
jpayne@69
|
574 ItclClass *iclsPtr; /* class containing this member */
|
jpayne@69
|
575 int protection; /* protection level */
|
jpayne@69
|
576 int flags; /* flags describing member (see below) */
|
jpayne@69
|
577 ItclMemberCode *codePtr; /* code associated with member */
|
jpayne@69
|
578 Tcl_Obj *defaultValuePtr; /* initial value */
|
jpayne@69
|
579 Tcl_Obj *cgetMethodPtr;
|
jpayne@69
|
580 Tcl_Obj *cgetMethodVarPtr;
|
jpayne@69
|
581 Tcl_Obj *configureMethodPtr;
|
jpayne@69
|
582 Tcl_Obj *configureMethodVarPtr;
|
jpayne@69
|
583 Tcl_Obj *validateMethodPtr;
|
jpayne@69
|
584 Tcl_Obj *validateMethodVarPtr;
|
jpayne@69
|
585 ItclDelegatedOption *idoPtr;
|
jpayne@69
|
586 /* if the option is delegated != NULL */
|
jpayne@69
|
587 } ItclOption;
|
jpayne@69
|
588
|
jpayne@69
|
589 /*
|
jpayne@69
|
590 * Instance methodvariables.
|
jpayne@69
|
591 */
|
jpayne@69
|
592 typedef struct ItclMethodVariable {
|
jpayne@69
|
593 Tcl_Obj *namePtr; /* member name */
|
jpayne@69
|
594 Tcl_Obj *fullNamePtr; /* member name with "class::" qualifier */
|
jpayne@69
|
595 ItclClass *iclsPtr; /* class containing this member */
|
jpayne@69
|
596 int protection; /* protection level */
|
jpayne@69
|
597 int flags; /* flags describing member (see below) */
|
jpayne@69
|
598 Tcl_Obj *defaultValuePtr;
|
jpayne@69
|
599 Tcl_Obj *callbackPtr;
|
jpayne@69
|
600 } ItclMethodVariable;
|
jpayne@69
|
601
|
jpayne@69
|
602 #define VAR_TYPE_VARIABLE 1
|
jpayne@69
|
603 #define VAR_TYPE_COMMON 2
|
jpayne@69
|
604
|
jpayne@69
|
605 #define CMD_TYPE_METHOD 1
|
jpayne@69
|
606 #define CMD_TYPE_PROC 2
|
jpayne@69
|
607
|
jpayne@69
|
608 typedef struct ItclClassCmdInfo {
|
jpayne@69
|
609 int type;
|
jpayne@69
|
610 int protection;
|
jpayne@69
|
611 #if TCL_MAJOR_VERSION == 8
|
jpayne@69
|
612 int cmdNum; /* not actually used */
|
jpayne@69
|
613 #endif
|
jpayne@69
|
614 Tcl_Namespace *nsPtr;
|
jpayne@69
|
615 Tcl_Namespace *declaringNsPtr;
|
jpayne@69
|
616 } ItclClassCmdInfo;
|
jpayne@69
|
617
|
jpayne@69
|
618 /*
|
jpayne@69
|
619 * Instance variable lookup entry.
|
jpayne@69
|
620 */
|
jpayne@69
|
621 typedef struct ItclVarLookup {
|
jpayne@69
|
622 ItclVariable* ivPtr; /* variable definition */
|
jpayne@69
|
623 int usage; /* number of uses for this record */
|
jpayne@69
|
624 int accessible; /* non-zero => accessible from class with
|
jpayne@69
|
625 * this lookup record in its resolveVars */
|
jpayne@69
|
626 char *leastQualName; /* simplist name for this variable, with
|
jpayne@69
|
627 * the fewest qualifiers. This string is
|
jpayne@69
|
628 * taken from the resolveVars table, so
|
jpayne@69
|
629 * it shouldn't be freed. */
|
jpayne@69
|
630 Tcl_Size varNum;
|
jpayne@69
|
631 Tcl_Var varPtr;
|
jpayne@69
|
632 } ItclVarLookup;
|
jpayne@69
|
633
|
jpayne@69
|
634 /*
|
jpayne@69
|
635 * Instance command lookup entry.
|
jpayne@69
|
636 */
|
jpayne@69
|
637 typedef struct ItclCmdLookup {
|
jpayne@69
|
638 ItclMemberFunc* imPtr; /* function definition */
|
jpayne@69
|
639 #if TCL_MAJOR_VERSION == 8
|
jpayne@69
|
640 int cmdNum; /* not actually used */
|
jpayne@69
|
641 #endif
|
jpayne@69
|
642 ItclClassCmdInfo *classCmdInfoPtr;
|
jpayne@69
|
643 Tcl_Command cmdPtr;
|
jpayne@69
|
644 } ItclCmdLookup;
|
jpayne@69
|
645
|
jpayne@69
|
646 typedef struct ItclCallContext {
|
jpayne@69
|
647 int objectFlags;
|
jpayne@69
|
648 Tcl_Namespace *nsPtr;
|
jpayne@69
|
649 ItclObject *ioPtr;
|
jpayne@69
|
650 ItclMemberFunc *imPtr;
|
jpayne@69
|
651 Tcl_Size refCount;
|
jpayne@69
|
652 } ItclCallContext;
|
jpayne@69
|
653
|
jpayne@69
|
654 /*
|
jpayne@69
|
655 * The macro below is used to modify a "char" value (e.g. by casting
|
jpayne@69
|
656 * it to an unsigned character) so that it can be used safely with
|
jpayne@69
|
657 * macros such as isspace.
|
jpayne@69
|
658 */
|
jpayne@69
|
659
|
jpayne@69
|
660 #define UCHAR(c) ((unsigned char) (c))
|
jpayne@69
|
661 /*
|
jpayne@69
|
662 * Macros used to cast between pointers and integers (e.g. when storing an int
|
jpayne@69
|
663 * in ClientData), on 64-bit architectures they avoid gcc warning about "cast
|
jpayne@69
|
664 * to/from pointer from/to integer of different size".
|
jpayne@69
|
665 */
|
jpayne@69
|
666
|
jpayne@69
|
667 #if !defined(INT2PTR)
|
jpayne@69
|
668 # define INT2PTR(p) ((void *)(ptrdiff_t)(p))
|
jpayne@69
|
669 #endif
|
jpayne@69
|
670 #if !defined(PTR2INT)
|
jpayne@69
|
671 # define PTR2INT(p) ((ptrdiff_t)(p))
|
jpayne@69
|
672 #endif
|
jpayne@69
|
673
|
jpayne@69
|
674 #ifdef ITCL_DEBUG
|
jpayne@69
|
675 MODULE_SCOPE int _itcl_debug_level;
|
jpayne@69
|
676 MODULE_SCOPE void ItclShowArgs(int level, const char *str, size_t objc,
|
jpayne@69
|
677 Tcl_Obj *const *objv);
|
jpayne@69
|
678 #else
|
jpayne@69
|
679 #define ItclShowArgs(a,b,c,d) do {(void)(c);(void)(d);} while(0)
|
jpayne@69
|
680 #endif
|
jpayne@69
|
681
|
jpayne@69
|
682 MODULE_SCOPE Tcl_ObjCmdProc ItclCallCCommand;
|
jpayne@69
|
683 MODULE_SCOPE Tcl_ObjCmdProc ItclObjectUnknownCommand;
|
jpayne@69
|
684 MODULE_SCOPE int ItclCheckCallProc(void *clientData, Tcl_Interp *interp,
|
jpayne@69
|
685 Tcl_ObjectContext contextPtr, Tcl_CallFrame *framePtr, int *isFinished);
|
jpayne@69
|
686
|
jpayne@69
|
687 MODULE_SCOPE void ItclPreserveClass(ItclClass *iclsPtr);
|
jpayne@69
|
688 MODULE_SCOPE void ItclReleaseClass(void *iclsPtr);
|
jpayne@69
|
689
|
jpayne@69
|
690 MODULE_SCOPE ItclFoundation *ItclGetFoundation(Tcl_Interp *interp);
|
jpayne@69
|
691 MODULE_SCOPE Tcl_ObjCmdProc ItclClassCommandDispatcher;
|
jpayne@69
|
692 MODULE_SCOPE Tcl_Command Itcl_CmdAliasProc(Tcl_Interp *interp,
|
jpayne@69
|
693 Tcl_Namespace *nsPtr, const char *cmdName, void *clientData);
|
jpayne@69
|
694 MODULE_SCOPE Tcl_Var Itcl_VarAliasProc(Tcl_Interp *interp,
|
jpayne@69
|
695 Tcl_Namespace *nsPtr, const char *VarName, void *clientData);
|
jpayne@69
|
696 MODULE_SCOPE int ItclIsClass(Tcl_Interp *interp, Tcl_Command cmd);
|
jpayne@69
|
697 MODULE_SCOPE int ItclCheckCallMethod(void *clientData, Tcl_Interp *interp,
|
jpayne@69
|
698 Tcl_ObjectContext contextPtr, Tcl_CallFrame *framePtr, int *isFinished);
|
jpayne@69
|
699 MODULE_SCOPE int ItclAfterCallMethod(void *clientData, Tcl_Interp *interp,
|
jpayne@69
|
700 Tcl_ObjectContext contextPtr, Tcl_Namespace *nsPtr, int result);
|
jpayne@69
|
701 MODULE_SCOPE void ItclReportObjectUsage(Tcl_Interp *interp,
|
jpayne@69
|
702 ItclObject *contextIoPtr, Tcl_Namespace *callerNsPtr,
|
jpayne@69
|
703 Tcl_Namespace *contextNsPtr);
|
jpayne@69
|
704 MODULE_SCOPE int ItclMapMethodNameProc(Tcl_Interp *interp, Tcl_Object oPtr,
|
jpayne@69
|
705 Tcl_Class *startClsPtr, Tcl_Obj *methodObj);
|
jpayne@69
|
706 MODULE_SCOPE int ItclCreateArgList(Tcl_Interp *interp, const char *str,
|
jpayne@69
|
707 Tcl_Size *argcPtr, Tcl_Size *maxArgcPtr, Tcl_Obj **usagePtr,
|
jpayne@69
|
708 ItclArgList **arglistPtrPtr, ItclMemberFunc *imPtr,
|
jpayne@69
|
709 const char *commandName);
|
jpayne@69
|
710 MODULE_SCOPE int ItclObjectCmd(void *clientData, Tcl_Interp *interp,
|
jpayne@69
|
711 Tcl_Object oPtr, Tcl_Class clsPtr, size_t objc, Tcl_Obj *const *objv);
|
jpayne@69
|
712 MODULE_SCOPE int ItclCreateObject (Tcl_Interp *interp, const char* name,
|
jpayne@69
|
713 ItclClass *iclsPtr, size_t objc, Tcl_Obj *const objv[]);
|
jpayne@69
|
714 MODULE_SCOPE void ItclDeleteObjectVariablesNamespace(Tcl_Interp *interp,
|
jpayne@69
|
715 ItclObject *ioPtr);
|
jpayne@69
|
716 MODULE_SCOPE void ItclDeleteClassVariablesNamespace(Tcl_Interp *interp,
|
jpayne@69
|
717 ItclClass *iclsPtr);
|
jpayne@69
|
718 MODULE_SCOPE int ItclInfoInit(Tcl_Interp *interp, ItclObjectInfo *infoPtr);
|
jpayne@69
|
719
|
jpayne@69
|
720 MODULE_SCOPE Tcl_HashEntry *ItclResolveVarEntry(
|
jpayne@69
|
721 ItclClass* iclsPtr, const char *varName);
|
jpayne@69
|
722
|
jpayne@69
|
723 struct Tcl_ResolvedVarInfo;
|
jpayne@69
|
724 MODULE_SCOPE int Itcl_ClassCmdResolver(Tcl_Interp *interp, const char* name,
|
jpayne@69
|
725 Tcl_Namespace *nsPtr, int flags, Tcl_Command *rPtr);
|
jpayne@69
|
726 MODULE_SCOPE int Itcl_ClassVarResolver(Tcl_Interp *interp, const char* name,
|
jpayne@69
|
727 Tcl_Namespace *nsPtr, int flags, Tcl_Var *rPtr);
|
jpayne@69
|
728 MODULE_SCOPE int Itcl_ClassCompiledVarResolver(Tcl_Interp *interp,
|
jpayne@69
|
729 const char* name, Tcl_Size length, Tcl_Namespace *nsPtr,
|
jpayne@69
|
730 struct Tcl_ResolvedVarInfo **rPtr);
|
jpayne@69
|
731 MODULE_SCOPE int Itcl_ClassCmdResolver2(Tcl_Interp *interp, const char* name,
|
jpayne@69
|
732 Tcl_Namespace *nsPtr, int flags, Tcl_Command *rPtr);
|
jpayne@69
|
733 MODULE_SCOPE int Itcl_ClassVarResolver2(Tcl_Interp *interp, const char* name,
|
jpayne@69
|
734 Tcl_Namespace *nsPtr, int flags, Tcl_Var *rPtr);
|
jpayne@69
|
735 MODULE_SCOPE int ItclSetParserResolver(Tcl_Namespace *nsPtr);
|
jpayne@69
|
736 MODULE_SCOPE void ItclProcErrorProc(Tcl_Interp *interp, Tcl_Obj *procNameObj);
|
jpayne@69
|
737 MODULE_SCOPE int Itcl_CreateOption (Tcl_Interp *interp, ItclClass *iclsPtr,
|
jpayne@69
|
738 ItclOption *ioptPtr);
|
jpayne@69
|
739 MODULE_SCOPE int ItclCreateMethodVariable(Tcl_Interp *interp,
|
jpayne@69
|
740 ItclVariable *ivPtr, Tcl_Obj* defaultPtr, Tcl_Obj* callbackPtr,
|
jpayne@69
|
741 ItclMethodVariable** imvPtrPtr);
|
jpayne@69
|
742 MODULE_SCOPE int DelegationInstall(Tcl_Interp *interp, ItclObject *ioPtr,
|
jpayne@69
|
743 ItclClass *iclsPtr);
|
jpayne@69
|
744 MODULE_SCOPE ItclClass *ItclNamespace2Class(Tcl_Namespace *nsPtr);
|
jpayne@69
|
745 MODULE_SCOPE const char* ItclGetCommonInstanceVar(Tcl_Interp *interp,
|
jpayne@69
|
746 const char *name, const char *name2, ItclObject *contextIoPtr,
|
jpayne@69
|
747 ItclClass *contextIclsPtr);
|
jpayne@69
|
748 MODULE_SCOPE int ItclCreateMethod(Tcl_Interp* interp, ItclClass *iclsPtr,
|
jpayne@69
|
749 Tcl_Obj *namePtr, const char* arglist, const char* body,
|
jpayne@69
|
750 ItclMemberFunc **imPtrPtr);
|
jpayne@69
|
751 MODULE_SCOPE int Itcl_WidgetParseInit(Tcl_Interp *interp,
|
jpayne@69
|
752 ItclObjectInfo *infoPtr);
|
jpayne@69
|
753 MODULE_SCOPE void ItclDeleteObjectMetadata(void *clientData);
|
jpayne@69
|
754 MODULE_SCOPE void ItclDeleteClassMetadata(void *clientData);
|
jpayne@69
|
755 MODULE_SCOPE void ItclDeleteArgList(ItclArgList *arglistPtr);
|
jpayne@69
|
756 MODULE_SCOPE int Itcl_ClassOptionCmd(void *clientData, Tcl_Interp *interp,
|
jpayne@69
|
757 int objc, Tcl_Obj *const objv[]);
|
jpayne@69
|
758 MODULE_SCOPE int DelegatedOptionsInstall(Tcl_Interp *interp,
|
jpayne@69
|
759 ItclClass *iclsPtr);
|
jpayne@69
|
760 MODULE_SCOPE int Itcl_HandleDelegateOptionCmd(Tcl_Interp *interp,
|
jpayne@69
|
761 ItclObject *ioPtr, ItclClass *iclsPtr, ItclDelegatedOption **idoPtrPtr,
|
jpayne@69
|
762 size_t objc, Tcl_Obj *const objv[]);
|
jpayne@69
|
763 MODULE_SCOPE int Itcl_HandleDelegateMethodCmd(Tcl_Interp *interp,
|
jpayne@69
|
764 ItclObject *ioPtr, ItclClass *iclsPtr,
|
jpayne@69
|
765 ItclDelegatedFunction **idmPtrPtr, size_t objc, Tcl_Obj *const objv[]);
|
jpayne@69
|
766 MODULE_SCOPE int DelegateFunction(Tcl_Interp *interp, ItclObject *ioPtr,
|
jpayne@69
|
767 ItclClass *iclsPtr, Tcl_Obj *componentNamePtr,
|
jpayne@69
|
768 ItclDelegatedFunction *idmPtr);
|
jpayne@69
|
769 MODULE_SCOPE int ItclInitObjectMethodVariables(Tcl_Interp *interp,
|
jpayne@69
|
770 ItclObject *ioPtr, ItclClass *iclsPtr, const char *name);
|
jpayne@69
|
771 MODULE_SCOPE int InitTclOOFunctionPointers(Tcl_Interp *interp);
|
jpayne@69
|
772 MODULE_SCOPE ItclOption* ItclNewOption(Tcl_Interp *interp, ItclObject *ioPtr,
|
jpayne@69
|
773 ItclClass *iclsPtr, Tcl_Obj *namePtr, const char *resourceName,
|
jpayne@69
|
774 const char *className, char *init, ItclMemberCode *mCodePtr);
|
jpayne@69
|
775 MODULE_SCOPE int ItclParseOption(ItclObjectInfo *infoPtr, Tcl_Interp *interp,
|
jpayne@69
|
776 size_t objc, Tcl_Obj *const objv[], ItclClass *iclsPtr,
|
jpayne@69
|
777 ItclObject *ioPtr, ItclOption **ioptPtrPtr);
|
jpayne@69
|
778 MODULE_SCOPE void ItclDestroyClassNamesp(void *cdata);
|
jpayne@69
|
779 MODULE_SCOPE int ExpandDelegateAs(Tcl_Interp *interp, ItclObject *ioPtr,
|
jpayne@69
|
780 ItclClass *iclsPtr, ItclDelegatedFunction *idmPtr,
|
jpayne@69
|
781 const char *funcName, Tcl_Obj *listPtr);
|
jpayne@69
|
782 MODULE_SCOPE int ItclCheckForInitializedComponents(Tcl_Interp *interp,
|
jpayne@69
|
783 ItclClass *iclsPtr, ItclObject *ioPtr);
|
jpayne@69
|
784 MODULE_SCOPE int ItclCreateDelegatedFunction(Tcl_Interp *interp,
|
jpayne@69
|
785 ItclClass *iclsPtr, Tcl_Obj *methodNamePtr, ItclComponent *icPtr,
|
jpayne@69
|
786 Tcl_Obj *targetPtr, Tcl_Obj *usingPtr, Tcl_Obj *exceptionsPtr,
|
jpayne@69
|
787 ItclDelegatedFunction **idmPtrPtr);
|
jpayne@69
|
788 MODULE_SCOPE void ItclDeleteDelegatedOption(char *cdata);
|
jpayne@69
|
789 MODULE_SCOPE void Itcl_FinishList();
|
jpayne@69
|
790 MODULE_SCOPE void ItclDeleteDelegatedFunction(ItclDelegatedFunction *idmPtr);
|
jpayne@69
|
791 MODULE_SCOPE void ItclFinishEnsemble(ItclObjectInfo *infoPtr);
|
jpayne@69
|
792 MODULE_SCOPE int Itcl_EnsembleDeleteCmd(void *clientData,
|
jpayne@69
|
793 Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
|
jpayne@69
|
794 MODULE_SCOPE int ItclAddClassesDictInfo(Tcl_Interp *interp, ItclClass *iclsPtr);
|
jpayne@69
|
795 MODULE_SCOPE int ItclDeleteClassesDictInfo(Tcl_Interp *interp,
|
jpayne@69
|
796 ItclClass *iclsPtr);
|
jpayne@69
|
797 MODULE_SCOPE int ItclAddObjectsDictInfo(Tcl_Interp *interp, ItclObject *ioPtr);
|
jpayne@69
|
798 MODULE_SCOPE int ItclDeleteObjectsDictInfo(Tcl_Interp *interp,
|
jpayne@69
|
799 ItclObject *ioPtr);
|
jpayne@69
|
800 MODULE_SCOPE int ItclAddOptionDictInfo(Tcl_Interp *interp, ItclClass *iclsPtr,
|
jpayne@69
|
801 ItclOption *ioptPtr);
|
jpayne@69
|
802 MODULE_SCOPE int ItclAddDelegatedOptionDictInfo(Tcl_Interp *interp,
|
jpayne@69
|
803 ItclClass *iclsPtr, ItclDelegatedOption *idoPtr);
|
jpayne@69
|
804 MODULE_SCOPE int ItclAddClassComponentDictInfo(Tcl_Interp *interp,
|
jpayne@69
|
805 ItclClass *iclsPtr, ItclComponent *icPtr);
|
jpayne@69
|
806 MODULE_SCOPE int ItclAddClassVariableDictInfo(Tcl_Interp *interp,
|
jpayne@69
|
807 ItclClass *iclsPtr, ItclVariable *ivPtr);
|
jpayne@69
|
808 MODULE_SCOPE int ItclAddClassFunctionDictInfo(Tcl_Interp *interp,
|
jpayne@69
|
809 ItclClass *iclsPtr, ItclMemberFunc *imPtr);
|
jpayne@69
|
810 MODULE_SCOPE int ItclAddClassDelegatedFunctionDictInfo(Tcl_Interp *interp,
|
jpayne@69
|
811 ItclClass *iclsPtr, ItclDelegatedFunction *idmPtr);
|
jpayne@69
|
812 MODULE_SCOPE int ItclClassCreateObject(void *clientData, Tcl_Interp *interp,
|
jpayne@69
|
813 size_t objc, Tcl_Obj *const objv[]);
|
jpayne@69
|
814
|
jpayne@69
|
815 MODULE_SCOPE void ItclRestoreInfoVars(void *clientData);
|
jpayne@69
|
816
|
jpayne@69
|
817 MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiMyProcCmd;
|
jpayne@69
|
818 MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiInstallComponentCmd;
|
jpayne@69
|
819 MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiCallInstanceCmd;
|
jpayne@69
|
820 MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiGetInstanceVarCmd;
|
jpayne@69
|
821 MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiMyTypeMethodCmd;
|
jpayne@69
|
822 MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiMyMethodCmd;
|
jpayne@69
|
823 MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiMyTypeVarCmd;
|
jpayne@69
|
824 MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiMyVarCmd;
|
jpayne@69
|
825 MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiItclHullCmd;
|
jpayne@69
|
826 MODULE_SCOPE Tcl_ObjCmdProc Itcl_ThisCmd;
|
jpayne@69
|
827 MODULE_SCOPE Tcl_ObjCmdProc Itcl_ExtendedClassCmd;
|
jpayne@69
|
828 MODULE_SCOPE Tcl_ObjCmdProc Itcl_TypeClassCmd;
|
jpayne@69
|
829 MODULE_SCOPE Tcl_ObjCmdProc Itcl_AddObjectOptionCmd;
|
jpayne@69
|
830 MODULE_SCOPE Tcl_ObjCmdProc Itcl_AddDelegatedOptionCmd;
|
jpayne@69
|
831 MODULE_SCOPE Tcl_ObjCmdProc Itcl_AddDelegatedFunctionCmd;
|
jpayne@69
|
832 MODULE_SCOPE Tcl_ObjCmdProc Itcl_SetComponentCmd;
|
jpayne@69
|
833 MODULE_SCOPE Tcl_ObjCmdProc Itcl_ClassHullTypeCmd;
|
jpayne@69
|
834 MODULE_SCOPE Tcl_ObjCmdProc Itcl_ClassWidgetClassCmd;
|
jpayne@69
|
835
|
jpayne@69
|
836 typedef int (ItclRootMethodProc)(ItclObject *ioPtr, Tcl_Interp *interp,
|
jpayne@69
|
837 int objc, Tcl_Obj *const objv[]);
|
jpayne@69
|
838
|
jpayne@69
|
839 MODULE_SCOPE const Tcl_MethodType itclRootMethodType;
|
jpayne@69
|
840 MODULE_SCOPE ItclRootMethodProc ItclUnknownGuts;
|
jpayne@69
|
841 MODULE_SCOPE ItclRootMethodProc ItclConstructGuts;
|
jpayne@69
|
842 MODULE_SCOPE ItclRootMethodProc ItclInfoGuts;
|
jpayne@69
|
843
|
jpayne@69
|
844 #include "itcl2TclOO.h"
|
jpayne@69
|
845
|
jpayne@69
|
846 /*
|
jpayne@69
|
847 * Include all the private API, generated from itcl.decls.
|
jpayne@69
|
848 */
|
jpayne@69
|
849
|
jpayne@69
|
850 #include "itclIntDecls.h"
|