Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/itcl.h @ 69:33d812a61356
planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author | jpayne |
---|---|
date | Tue, 18 Mar 2025 17:55:14 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
67:0e9998148a16 | 69:33d812a61356 |
---|---|
1 /* | |
2 * itcl.h -- | |
3 * | |
4 * This file contains definitions for the C-implemeted part of a Itcl | |
5 * this version of [incr Tcl] (Itcl) is a completely new implementation | |
6 * based on TclOO extension of Tcl 8.5 | |
7 * It tries to provide the same interfaces as the original implementation | |
8 * of Michael J. McLennan | |
9 * Some small pieces of code are taken from that implementation | |
10 * | |
11 * Copyright (c) 2007 by Arnulf P. Wiedemann | |
12 * | |
13 * See the file "license.terms" for information on usage and redistribution of | |
14 * this file, and for a DISCLAIMER OF ALL WARRANTIES. | |
15 */ | |
16 | |
17 /* | |
18 * ------------------------------------------------------------------------ | |
19 * PACKAGE: [incr Tcl] | |
20 * DESCRIPTION: Object-Oriented Extensions to Tcl | |
21 * | |
22 * [incr Tcl] provides object-oriented extensions to Tcl, much as | |
23 * C++ provides object-oriented extensions to C. It provides a means | |
24 * of encapsulating related procedures together with their shared data | |
25 * in a local namespace that is hidden from the outside world. It | |
26 * promotes code re-use through inheritance. More than anything else, | |
27 * it encourages better organization of Tcl applications through the | |
28 * object-oriented paradigm, leading to code that is easier to | |
29 * understand and maintain. | |
30 * | |
31 * ADDING [incr Tcl] TO A Tcl-BASED APPLICATION: | |
32 * | |
33 * To add [incr Tcl] facilities to a Tcl application, modify the | |
34 * Tcl_AppInit() routine as follows: | |
35 * | |
36 * 1) Include this header file near the top of the file containing | |
37 * Tcl_AppInit(): | |
38 * | |
39 * #include "itcl.h" | |
40 * | |
41 * 2) Within the body of Tcl_AppInit(), add the following lines: | |
42 * | |
43 * if (Itcl_Init(interp) == TCL_ERROR) { | |
44 * return TCL_ERROR; | |
45 * } | |
46 * | |
47 * 3) Link your application with libitcl.a | |
48 * | |
49 * NOTE: An example file "tclAppInit.c" containing the changes shown | |
50 * above is included in this distribution. | |
51 * | |
52 *--------------------------------------------------------------------- | |
53 */ | |
54 | |
55 #ifndef ITCL_H_INCLUDED | |
56 #define ITCL_H_INCLUDED | |
57 | |
58 #include <tcl.h> | |
59 | |
60 #if (TCL_MAJOR_VERSION == 8) && defined(TCL_MINOR_VERSION) && (TCL_MINOR_VERSION < 6) | |
61 # error Itcl 4 build requires tcl.h from Tcl 8.6 or later | |
62 #endif | |
63 | |
64 /* | |
65 * For C++ compilers, use extern "C" | |
66 */ | |
67 | |
68 #ifdef __cplusplus | |
69 extern "C" { | |
70 #endif | |
71 | |
72 #ifndef TCL_ALPHA_RELEASE | |
73 # define TCL_ALPHA_RELEASE 0 | |
74 #endif | |
75 #ifndef TCL_BETA_RELEASE | |
76 # define TCL_BETA_RELEASE 1 | |
77 #endif | |
78 #ifndef TCL_FINAL_RELEASE | |
79 # define TCL_FINAL_RELEASE 2 | |
80 #endif | |
81 | |
82 #define ITCL_MAJOR_VERSION 4 | |
83 #define ITCL_MINOR_VERSION 2 | |
84 #define ITCL_RELEASE_LEVEL TCL_FINAL_RELEASE | |
85 #define ITCL_RELEASE_SERIAL 3 | |
86 | |
87 #define ITCL_VERSION "4.2" | |
88 #define ITCL_PATCH_LEVEL "4.2.3" | |
89 | |
90 | |
91 /* | |
92 * A special definition used to allow this header file to be included from | |
93 * windows resource files so that they can obtain version information. | |
94 * RC_INVOKED is defined by default by the windows RC tool. | |
95 * | |
96 * Resource compilers don't like all the C stuff, like typedefs and function | |
97 * declarations, that occur below, so block them out. | |
98 */ | |
99 | |
100 #ifndef RC_INVOKED | |
101 | |
102 #define ITCL_NAMESPACE "::itcl" | |
103 | |
104 #ifndef ITCLAPI | |
105 # if defined(BUILD_itcl) | |
106 # define ITCLAPI MODULE_SCOPE | |
107 # else | |
108 # define ITCLAPI extern | |
109 # undef USE_ITCL_STUBS | |
110 # define USE_ITCL_STUBS 1 | |
111 # endif | |
112 #endif | |
113 | |
114 #if defined(BUILD_itcl) && !defined(STATIC_BUILD) | |
115 # define ITCL_EXTERN extern DLLEXPORT | |
116 #else | |
117 # define ITCL_EXTERN extern | |
118 #endif | |
119 | |
120 ITCL_EXTERN int Itcl_Init(Tcl_Interp *interp); | |
121 ITCL_EXTERN int Itcl_SafeInit(Tcl_Interp *interp); | |
122 | |
123 /* | |
124 * Protection levels: | |
125 * | |
126 * ITCL_PUBLIC - accessible from any namespace | |
127 * ITCL_PROTECTED - accessible from namespace that imports in "protected" mode | |
128 * ITCL_PRIVATE - accessible only within the namespace that contains it | |
129 */ | |
130 #define ITCL_PUBLIC 1 | |
131 #define ITCL_PROTECTED 2 | |
132 #define ITCL_PRIVATE 3 | |
133 #define ITCL_DEFAULT_PROTECT 4 | |
134 | |
135 #if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 7) && !defined(Tcl_Size) | |
136 # define Tcl_Size int | |
137 #endif | |
138 | |
139 /* | |
140 * Generic stack. | |
141 */ | |
142 typedef struct Itcl_Stack { | |
143 void **values; /* values on stack */ | |
144 Tcl_Size len; /* number of values on stack */ | |
145 Tcl_Size max; /* maximum size of stack */ | |
146 void *space[5]; /* initial space for stack data */ | |
147 } Itcl_Stack; | |
148 | |
149 #define Itcl_GetStackSize(stackPtr) ((stackPtr)->len) | |
150 | |
151 /* | |
152 * Generic linked list. | |
153 */ | |
154 struct Itcl_List; | |
155 typedef struct Itcl_ListElem { | |
156 struct Itcl_List* owner; /* list containing this element */ | |
157 void *value; /* value associated with this element */ | |
158 struct Itcl_ListElem *prev; /* previous element in linked list */ | |
159 struct Itcl_ListElem *next; /* next element in linked list */ | |
160 } Itcl_ListElem; | |
161 | |
162 typedef struct Itcl_List { | |
163 int validate; /* validation stamp */ | |
164 Tcl_Size num; /* number of elements */ | |
165 struct Itcl_ListElem *head; /* previous element in linked list */ | |
166 struct Itcl_ListElem *tail; /* next element in linked list */ | |
167 } Itcl_List; | |
168 | |
169 #define Itcl_FirstListElem(listPtr) ((listPtr)->head) | |
170 #define Itcl_LastListElem(listPtr) ((listPtr)->tail) | |
171 #define Itcl_NextListElem(elemPtr) ((elemPtr)->next) | |
172 #define Itcl_PrevListElem(elemPtr) ((elemPtr)->prev) | |
173 #define Itcl_GetListLength(listPtr) ((listPtr)->num) | |
174 #define Itcl_GetListValue(elemPtr) ((elemPtr)->value) | |
175 | |
176 /* | |
177 * Token representing the state of an interpreter. | |
178 */ | |
179 typedef struct Itcl_InterpState_ *Itcl_InterpState; | |
180 | |
181 | |
182 /* | |
183 * Include all the public API, generated from itcl.decls. | |
184 */ | |
185 | |
186 #include "itclDecls.h" | |
187 | |
188 #endif /* RC_INVOKED */ | |
189 | |
190 /* | |
191 * end block for C++ | |
192 */ | |
193 | |
194 #ifdef __cplusplus | |
195 } | |
196 #endif | |
197 | |
198 #endif /* ITCL_H_INCLUDED */ |