Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / share / swig / 1.3.26 / swigrun.swg
CommitLineData
920dae64
AT
1/***********************************************************************
2 * swigrun.swg
3 *
4 * This file contains generic CAPI SWIG runtime support for pointer
5 * type checking.
6 *
7 ************************************************************************/
8
9/* This should only be incremented when either the layout of swig_type_info changes,
10 or for whatever reason, the runtime changes incompatibly */
11#define SWIG_RUNTIME_VERSION "2"
12
13/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
14#ifdef SWIG_TYPE_TABLE
15# define SWIG_QUOTE_STRING(x) #x
16# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
17# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
18#else
19# define SWIG_TYPE_TABLE_NAME
20#endif
21
22/*
23 You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
24 creating a static or dynamic library from the swig runtime code.
25 In 99.9% of the cases, swig just needs to declare them as 'static'.
26
27 But only do this if is strictly necessary, ie, if you have problems
28 with your compiler or so.
29*/
30
31#ifndef SWIGRUNTIME
32# define SWIGRUNTIME SWIGINTERN
33#endif
34
35#ifndef SWIGRUNTIMEINLINE
36# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
37#endif
38
39#include <string.h>
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45typedef void *(*swig_converter_func)(void *);
46typedef struct swig_type_info *(*swig_dycast_func)(void **);
47
48/* Structure to store inforomation on one type */
49typedef struct swig_type_info {
50 const char *name; /* mangled name of this type */
51 const char *str; /* human readable name of this type */
52 swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
53 struct swig_cast_info *cast; /* linked list of types that can cast into this type */
54 void *clientdata; /* language specific type data */
55} swig_type_info;
56
57/* Structure to store a type and conversion function used for casting */
58typedef struct swig_cast_info {
59 swig_type_info *type; /* pointer to type that is equivalent to this type */
60 swig_converter_func converter; /* function to cast the void pointers */
61 struct swig_cast_info *next; /* pointer to next cast in linked list */
62 struct swig_cast_info *prev; /* pointer to the previous cast */
63} swig_cast_info;
64
65/* Structure used to store module information
66 * Each module generates one structure like this, and the runtime collects
67 * all of these structures and stores them in a circularly linked list.*/
68typedef struct swig_module_info {
69 swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
70 size_t size; /* Number of types in this module */
71 struct swig_module_info *next; /* Pointer to next element in circularly linked list */
72 swig_type_info **type_initial; /* Array of initially generated type structures */
73 swig_cast_info **cast_initial; /* Array of initially generated casting structures */
74 void *clientdata; /* Language specific module data */
75} swig_module_info;
76
77
78/*
79 Compare two type names skipping the space characters, therefore
80 "char*" == "char *" and "Class<int>" == "Class<int >", etc.
81
82 Return 0 when the two name types are equivalent, as in
83 strncmp, but skipping ' '.
84*/
85SWIGRUNTIME int
86SWIG_TypeNameComp(const char *f1, const char *l1,
87 const char *f2, const char *l2) {
88 for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
89 while ((*f1 == ' ') && (f1 != l1)) ++f1;
90 while ((*f2 == ' ') && (f2 != l2)) ++f2;
91 if (*f1 != *f2) return (int)(*f1 - *f2);
92 }
93 return (l1 - f1) - (l2 - f2);
94}
95
96/*
97 Check type equivalence in a name list like <name1>|<name2>|...
98 Return 0 if not equal, 1 if equal
99*/
100SWIGRUNTIME int
101SWIG_TypeEquiv(const char *nb, const char *tb) {
102 int equiv = 0;
103 const char* te = tb + strlen(tb);
104 const char* ne = nb;
105 while (!equiv && *ne) {
106 for (nb = ne; *ne; ++ne) {
107 if (*ne == '|') break;
108 }
109 equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
110 if (*ne) ++ne;
111 }
112 return equiv;
113}
114
115/*
116 Check type equivalence in a name list like <name1>|<name2>|...
117 Return 0 if equal, -1 if nb < tb, 1 if nb > tb
118*/
119SWIGRUNTIME int
120SWIG_TypeCompare(const char *nb, const char *tb) {
121 int equiv = 0;
122 const char* te = tb + strlen(tb);
123 const char* ne = nb;
124 while (!equiv && *ne) {
125 for (nb = ne; *ne; ++ne) {
126 if (*ne == '|') break;
127 }
128 equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
129 if (*ne) ++ne;
130 }
131 return equiv;
132}
133
134
135/* think of this as a c++ template<> or a scheme macro */
136#define SWIG_TypeCheck_Template(comparison, ty) \
137 if (ty) { \
138 swig_cast_info *iter = ty->cast; \
139 while (iter) { \
140 if (comparison) { \
141 if (iter == ty->cast) return iter; \
142 /* Move iter to the top of the linked list */ \
143 iter->prev->next = iter->next; \
144 if (iter->next) \
145 iter->next->prev = iter->prev; \
146 iter->next = ty->cast; \
147 iter->prev = 0; \
148 if (ty->cast) ty->cast->prev = iter; \
149 ty->cast = iter; \
150 return iter; \
151 } \
152 iter = iter->next; \
153 } \
154 } \
155 return 0
156
157/*
158 Check the typename
159*/
160SWIGRUNTIME swig_cast_info *
161SWIG_TypeCheck(const char *c, swig_type_info *ty) {
162 SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
163}
164
165/* Same as previous function, except strcmp is replaced with a pointer comparison */
166SWIGRUNTIME swig_cast_info *
167SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
168 SWIG_TypeCheck_Template(iter->type == from, into);
169}
170
171/*
172 Cast a pointer up an inheritance hierarchy
173*/
174SWIGRUNTIMEINLINE void *
175SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
176 return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
177}
178
179/*
180 Dynamic pointer casting. Down an inheritance hierarchy
181*/
182SWIGRUNTIME swig_type_info *
183SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
184 swig_type_info *lastty = ty;
185 if (!ty || !ty->dcast) return ty;
186 while (ty && (ty->dcast)) {
187 ty = (*ty->dcast)(ptr);
188 if (ty) lastty = ty;
189 }
190 return lastty;
191}
192
193/*
194 Return the name associated with this type
195*/
196SWIGRUNTIMEINLINE const char *
197SWIG_TypeName(const swig_type_info *ty) {
198 return ty->name;
199}
200
201/*
202 Return the pretty name associated with this type,
203 that is an unmangled type name in a form presentable to the user.
204*/
205SWIGRUNTIME const char *
206SWIG_TypePrettyName(const swig_type_info *type) {
207 /* The "str" field contains the equivalent pretty names of the
208 type, separated by vertical-bar characters. We choose
209 to print the last name, as it is often (?) the most
210 specific. */
211 if (type->str != NULL) {
212 const char *last_name = type->str;
213 const char *s;
214 for (s = type->str; *s; s++)
215 if (*s == '|') last_name = s+1;
216 return last_name;
217 }
218 else
219 return type->name;
220}
221
222/*
223 Set the clientdata field for a type
224*/
225SWIGRUNTIME void
226SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
227 swig_cast_info *cast = ti->cast;
228 /* if (ti->clientdata == clientdata) return; */
229 ti->clientdata = clientdata;
230
231 while (cast) {
232 if (!cast->converter) {
233 swig_type_info *tc = cast->type;
234 if (!tc->clientdata) {
235 SWIG_TypeClientData(tc, clientdata);
236 }
237 }
238 cast = cast->next;
239 }
240}
241
242/*
243 Search for a swig_type_info structure only by mangled name
244 Search is a O(log #types)
245
246 We start searching at module start, and finish searching when start == end.
247 Note: if start == end at the beginning of the function, we go all the way around
248 the circular list.
249*/
250SWIGRUNTIME swig_type_info *
251SWIG_MangledTypeQueryModule(swig_module_info *start,
252 swig_module_info *end,
253 const char *name) {
254 swig_module_info *iter = start;
255 do {
256 if (iter->size) {
257 register size_t l = 0;
258 register size_t r = iter->size - 1;
259 do {
260 /* since l+r >= 0, we can (>> 1) instead (/ 2) */
261 register size_t i = (l + r) >> 1;
262 const char *iname = iter->types[i]->name;
263 if (iname) {
264 register int compare = strcmp(name, iname);
265 if (compare == 0) {
266 return iter->types[i];
267 } else if (compare < 0) {
268 if (i) {
269 r = i - 1;
270 } else {
271 break;
272 }
273 } else if (compare > 0) {
274 l = i + 1;
275 }
276 } else {
277 break; /* should never happen */
278 }
279 } while (l <= r);
280 }
281 iter = iter->next;
282 } while (iter != end);
283 return 0;
284}
285
286/*
287 Search for a swig_type_info structure for either a mangled name or a human readable name.
288 It first searches the mangled names of the types, which is a O(log #types)
289 If a type is not found it then searches the human readable names, which is O(#types).
290
291 We start searching at module start, and finish searching when start == end.
292 Note: if start == end at the beginning of the function, we go all the way around
293 the circular list.
294*/
295SWIGRUNTIME swig_type_info *
296SWIG_TypeQueryModule(swig_module_info *start,
297 swig_module_info *end,
298 const char *name) {
299 /* STEP 1: Search the name field using binary search */
300 swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
301 if (ret) {
302 return ret;
303 } else {
304 /* STEP 2: If the type hasn't been found, do a complete search
305 of the str field (the human readable name) */
306 swig_module_info *iter = start;
307 do {
308 register size_t i = 0;
309 for (; i < iter->size; ++i) {
310 if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
311 return iter->types[i];
312 }
313 iter = iter->next;
314 } while (iter != end);
315 }
316
317 /* neither found a match */
318 return 0;
319}
320
321
322/*
323 Pack binary data into a string
324*/
325SWIGRUNTIME char *
326SWIG_PackData(char *c, void *ptr, size_t sz) {
327 static const char hex[17] = "0123456789abcdef";
328 register const unsigned char *u = (unsigned char *) ptr;
329 register const unsigned char *eu = u + sz;
330 for (; u != eu; ++u) {
331 register unsigned char uu = *u;
332 *(c++) = hex[(uu & 0xf0) >> 4];
333 *(c++) = hex[uu & 0xf];
334 }
335 return c;
336}
337
338/*
339 Unpack binary data from a string
340*/
341SWIGRUNTIME const char *
342SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
343 register unsigned char *u = (unsigned char *) ptr;
344 register const unsigned char *eu = u + sz;
345 for (; u != eu; ++u) {
346 register char d = *(c++);
347 register unsigned char uu = 0;
348 if ((d >= '0') && (d <= '9'))
349 uu = ((d - '0') << 4);
350 else if ((d >= 'a') && (d <= 'f'))
351 uu = ((d - ('a'-10)) << 4);
352 else
353 return (char *) 0;
354 d = *(c++);
355 if ((d >= '0') && (d <= '9'))
356 uu |= (d - '0');
357 else if ((d >= 'a') && (d <= 'f'))
358 uu |= (d - ('a'-10));
359 else
360 return (char *) 0;
361 *u = uu;
362 }
363 return c;
364}
365
366/*
367 Pack 'void *' into a string buffer.
368*/
369SWIGRUNTIME char *
370SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
371 char *r = buff;
372 if ((2*sizeof(void *) + 2) > bsz) return 0;
373 *(r++) = '_';
374 r = SWIG_PackData(r,&ptr,sizeof(void *));
375 if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
376 strcpy(r,name);
377 return buff;
378}
379
380SWIGRUNTIME const char *
381SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
382 if (*c != '_') {
383 if (strcmp(c,"NULL") == 0) {
384 *ptr = (void *) 0;
385 return name;
386 } else {
387 return 0;
388 }
389 }
390 return SWIG_UnpackData(++c,ptr,sizeof(void *));
391}
392
393SWIGRUNTIME char *
394SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
395 char *r = buff;
396 size_t lname = (name ? strlen(name) : 0);
397 if ((2*sz + 2 + lname) > bsz) return 0;
398 *(r++) = '_';
399 r = SWIG_PackData(r,ptr,sz);
400 if (lname) {
401 strncpy(r,name,lname+1);
402 } else {
403 *r = 0;
404 }
405 return buff;
406}
407
408SWIGRUNTIME const char *
409SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
410 if (*c != '_') {
411 if (strcmp(c,"NULL") == 0) {
412 memset(ptr,0,sz);
413 return name;
414 } else {
415 return 0;
416 }
417 }
418 return SWIG_UnpackData(++c,ptr,sz);
419}
420
421#ifdef __cplusplus
422}
423#endif