9
9
/* This should only be incremented when either the layout of swig_type_info changes,
10
10
or for whatever reason, the runtime changes incompatibly */
11
#define SWIG_RUNTIME_VERSION "1"
11
#define SWIG_RUNTIME_VERSION "2"
13
13
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
14
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)
19
#define SWIG_TYPE_TABLE_NAME
25
#if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
26
# define SWIGINLINE inline
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)
19
# define SWIG_TYPE_TABLE_NAME
51
45
typedef void *(*swig_converter_func)(void *);
52
46
typedef struct swig_type_info *(*swig_dycast_func)(void **);
48
/* Structure to store inforomation on one type */
54
49
typedef struct swig_type_info {
56
swig_converter_func converter;
59
swig_dycast_func dcast;
60
struct swig_type_info *next;
61
struct swig_type_info *prev;
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 */
57
/* Structure to store a type and conversion function used for casting */
58
typedef 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 */
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.*/
68
typedef 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 */
65
79
Compare two type names skipping the space characters, therefore
66
80
"char*" == "char *" and "Class<int>" == "Class<int >", etc.
91
106
for (nb = ne; *ne; ++ne) {
92
107
if (*ne == '|') break;
94
equiv = SWIG_TypeNameComp(nb, ne, tb, te) == 0;
109
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
101
Register a type mapping with the type-checking
116
Check type equivalence in a name list like <name1>|<name2>|...
117
Return 0 if equal, -1 if nb < tb, 1 if nb > tb
103
SWIGRUNTIME swig_type_info *
104
SWIG_TypeRegisterTL(swig_type_info **tl, swig_type_info *ti) {
105
swig_type_info *tc, *head, *ret, *next;
106
/* Check to see if this type has already been registered */
109
/* check simple type equivalence */
110
int typeequiv = (strcmp(tc->name, ti->name) == 0);
111
/* check full type equivalence, resolving typedefs */
113
/* only if tc is not a typedef (no '|' on it) */
114
if (tc->str && ti->str && !strstr(tc->str,"|")) {
115
typeequiv = SWIG_TypeEquiv(ti->str,tc->str);
119
/* Already exists in the table. Just add additional types to the list */
120
if (ti->clientdata) tc->clientdata = ti->clientdata;
134
/* Build linked lists */
138
/* Patch up the rest of the links */
145
if (next) next->prev = head;
120
SWIG_TypeCompare(const char *nb, const char *tb) {
122
const char* te = tb + strlen(tb);
124
while (!equiv && *ne) {
125
for (nb = ne; *ne; ++ne) {
126
if (*ne == '|') break;
128
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
135
/* think of this as a c++ template<> or a scheme macro */
136
#define SWIG_TypeCheck_Template(comparison, ty) \
138
swig_cast_info *iter = ty->cast; \
141
if (iter == ty->cast) return iter; \
142
/* Move iter to the top of the linked list */ \
143
iter->prev->next = iter->next; \
145
iter->next->prev = iter->prev; \
146
iter->next = ty->cast; \
148
if (ty->cast) ty->cast->prev = iter; \
152
158
Check the typename
154
SWIGRUNTIME swig_type_info *
160
SWIGRUNTIME swig_cast_info *
155
161
SWIG_TypeCheck(const char *c, swig_type_info *ty) {
157
if (!ty) return 0; /* Void pointer */
158
s = ty->next; /* First element always just a name */
160
if (strcmp(s->name,c) == 0) {
161
if (s == ty->next) return s;
162
/* Move s to the top of the linked list */
163
s->prev->next = s->next;
165
s->next->prev = s->prev;
167
/* Insert s as second element in the list */
169
if (ty->next) ty->next->prev = s;
175
} while (s && (s != ty->next));
162
SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
165
/* Same as previous function, except strcmp is replaced with a pointer comparison */
166
SWIGRUNTIME swig_cast_info *
167
SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
168
SWIG_TypeCheck_Template(iter->type == from, into);
180
172
Cast a pointer up an inheritance hierarchy
182
174
SWIGRUNTIMEINLINE void *
183
SWIG_TypeCast(swig_type_info *ty, void *ptr) {
175
SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
184
176
return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
227
219
return type->name;
231
Search for a swig_type_info structure
233
SWIGRUNTIME swig_type_info *
234
SWIG_TypeQueryTL(swig_type_info *tl, const char *name) {
235
swig_type_info *ty = tl;
237
if (ty->str && (SWIG_TypeEquiv(ty->str,name))) return ty;
238
if (ty->name && (strcmp(name,ty->name) == 0)) return ty;
245
223
Set the clientdata field for a type
248
SWIG_TypeClientDataTL(swig_type_info *tl, swig_type_info *ti, void *clientdata) {
249
swig_type_info *tc, *equiv;
250
if (ti->clientdata) return;
226
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
227
swig_cast_info *cast = ti->cast;
251
228
/* if (ti->clientdata == clientdata) return; */
252
229
ti->clientdata = clientdata;
255
if (!equiv->converter) {
258
if ((strcmp(tc->name, equiv->name) == 0))
259
SWIG_TypeClientDataTL(tl,tc,clientdata);
232
if (!cast->converter) {
233
swig_type_info *tc = cast->type;
234
if (!tc->clientdata) {
235
SWIG_TypeClientData(tc, clientdata);
243
Search for a swig_type_info structure only by mangled name
244
Search is a O(log #types)
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
250
SWIGRUNTIME swig_type_info *
251
SWIG_MangledTypeQueryModule(swig_module_info *start,
252
swig_module_info *end,
254
swig_module_info *iter = start;
257
register size_t l = 0;
258
register size_t r = iter->size - 1;
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;
264
register int compare = strcmp(name, iname);
266
return iter->types[i];
267
} else if (compare < 0) {
273
} else if (compare > 0) {
277
break; /* should never happen */
282
} while (iter != end);
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).
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
295
SWIGRUNTIME swig_type_info *
296
SWIG_TypeQueryModule(swig_module_info *start,
297
swig_module_info *end,
299
/* STEP 1: Search the name field using binary search */
300
swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
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;
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];
314
} while (iter != end);
317
/* neither found a match */
268
323
Pack binary data into a string
270
325
SWIGRUNTIME char *
271
326
SWIG_PackData(char *c, void *ptr, size_t sz) {
272
static char hex[17] = "0123456789abcdef";
273
unsigned char *u = (unsigned char *) ptr;
274
const unsigned char *eu = u + sz;
275
register unsigned char uu;
327
static const char hex[17] = "0123456789abcdef";
328
register const unsigned char *u = (unsigned char *) ptr;
329
register const unsigned char *eu = u + sz;
276
330
for (; u != eu; ++u) {
331
register unsigned char uu = *u;
278
332
*(c++) = hex[(uu & 0xf0) >> 4];
279
333
*(c++) = hex[uu & 0xf];
313
This function will propagate the clientdata field of type to any new
314
swig_type_info structures that have been added into the list of
315
equivalent types. It is like calling SWIG_TypeClientData(type,
316
clientdata) a second time.
319
SWIG_PropagateClientDataTL(swig_type_info *tl, swig_type_info *type) {
320
swig_type_info *equiv = type->next;
322
if (!type->clientdata) return;
324
if (!equiv->converter) {
327
if ((strcmp(tc->name, equiv->name) == 0) && !tc->clientdata)
328
SWIG_TypeClientDataTL(tl,tc, type->clientdata);
337
367
Pack 'void *' into a string buffer.