| /*********************************************************************** |
| * swigrun.swg |
| * |
| * This file contains generic CAPI SWIG runtime support for pointer |
| * type checking. |
| * |
| ************************************************************************/ |
| |
| /* This should only be incremented when either the layout of swig_type_info changes, |
| or for whatever reason, the runtime changes incompatibly */ |
| #define SWIG_RUNTIME_VERSION "2" |
| |
| /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ |
| #ifdef SWIG_TYPE_TABLE |
| # define SWIG_QUOTE_STRING(x) #x |
| # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) |
| # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) |
| #else |
| # define SWIG_TYPE_TABLE_NAME |
| #endif |
| |
| /* |
| You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for |
| creating a static or dynamic library from the swig runtime code. |
| In 99.9% of the cases, swig just needs to declare them as 'static'. |
| |
| But only do this if is strictly necessary, ie, if you have problems |
| with your compiler or so. |
| */ |
| |
| #ifndef SWIGRUNTIME |
| # define SWIGRUNTIME SWIGINTERN |
| #endif |
| |
| #ifndef SWIGRUNTIMEINLINE |
| # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE |
| #endif |
| |
| #include <string.h> |
| |
| #ifdef __cplusplus |
| extern "C" { |
| #endif |
| |
| typedef void *(*swig_converter_func)(void *); |
| typedef struct swig_type_info *(*swig_dycast_func)(void **); |
| |
| /* Structure to store inforomation on one type */ |
| typedef struct swig_type_info { |
| const char *name; /* mangled name of this type */ |
| const char *str; /* human readable name of this type */ |
| swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ |
| struct swig_cast_info *cast; /* linked list of types that can cast into this type */ |
| void *clientdata; /* language specific type data */ |
| } swig_type_info; |
| |
| /* Structure to store a type and conversion function used for casting */ |
| typedef struct swig_cast_info { |
| swig_type_info *type; /* pointer to type that is equivalent to this type */ |
| swig_converter_func converter; /* function to cast the void pointers */ |
| struct swig_cast_info *next; /* pointer to next cast in linked list */ |
| struct swig_cast_info *prev; /* pointer to the previous cast */ |
| } swig_cast_info; |
| |
| /* Structure used to store module information |
| * Each module generates one structure like this, and the runtime collects |
| * all of these structures and stores them in a circularly linked list.*/ |
| typedef struct swig_module_info { |
| swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ |
| size_t size; /* Number of types in this module */ |
| struct swig_module_info *next; /* Pointer to next element in circularly linked list */ |
| swig_type_info **type_initial; /* Array of initially generated type structures */ |
| swig_cast_info **cast_initial; /* Array of initially generated casting structures */ |
| void *clientdata; /* Language specific module data */ |
| } swig_module_info; |
| |
| |
| /* |
| Compare two type names skipping the space characters, therefore |
| "char*" == "char *" and "Class<int>" == "Class<int >", etc. |
| |
| Return 0 when the two name types are equivalent, as in |
| strncmp, but skipping ' '. |
| */ |
| SWIGRUNTIME int |
| SWIG_TypeNameComp(const char *f1, const char *l1, |
| const char *f2, const char *l2) { |
| for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { |
| while ((*f1 == ' ') && (f1 != l1)) ++f1; |
| while ((*f2 == ' ') && (f2 != l2)) ++f2; |
| if (*f1 != *f2) return (int)(*f1 - *f2); |
| } |
| return (l1 - f1) - (l2 - f2); |
| } |
| |
| /* |
| Check type equivalence in a name list like <name1>|<name2>|... |
| Return 0 if not equal, 1 if equal |
| */ |
| SWIGRUNTIME int |
| SWIG_TypeEquiv(const char *nb, const char *tb) { |
| int equiv = 0; |
| const char* te = tb + strlen(tb); |
| const char* ne = nb; |
| while (!equiv && *ne) { |
| for (nb = ne; *ne; ++ne) { |
| if (*ne == '|') break; |
| } |
| equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; |
| if (*ne) ++ne; |
| } |
| return equiv; |
| } |
| |
| /* |
| Check type equivalence in a name list like <name1>|<name2>|... |
| Return 0 if equal, -1 if nb < tb, 1 if nb > tb |
| */ |
| SWIGRUNTIME int |
| SWIG_TypeCompare(const char *nb, const char *tb) { |
| int equiv = 0; |
| const char* te = tb + strlen(tb); |
| const char* ne = nb; |
| while (!equiv && *ne) { |
| for (nb = ne; *ne; ++ne) { |
| if (*ne == '|') break; |
| } |
| equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; |
| if (*ne) ++ne; |
| } |
| return equiv; |
| } |
| |
| |
| /* think of this as a c++ template<> or a scheme macro */ |
| #define SWIG_TypeCheck_Template(comparison, ty) \ |
| if (ty) { \ |
| swig_cast_info *iter = ty->cast; \ |
| while (iter) { \ |
| if (comparison) { \ |
| if (iter == ty->cast) return iter; \ |
| /* Move iter to the top of the linked list */ \ |
| iter->prev->next = iter->next; \ |
| if (iter->next) \ |
| iter->next->prev = iter->prev; \ |
| iter->next = ty->cast; \ |
| iter->prev = 0; \ |
| if (ty->cast) ty->cast->prev = iter; \ |
| ty->cast = iter; \ |
| return iter; \ |
| } \ |
| iter = iter->next; \ |
| } \ |
| } \ |
| return 0 |
| |
| /* |
| Check the typename |
| */ |
| SWIGRUNTIME swig_cast_info * |
| SWIG_TypeCheck(const char *c, swig_type_info *ty) { |
| SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty); |
| } |
| |
| /* Same as previous function, except strcmp is replaced with a pointer comparison */ |
| SWIGRUNTIME swig_cast_info * |
| SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { |
| SWIG_TypeCheck_Template(iter->type == from, into); |
| } |
| |
| /* |
| Cast a pointer up an inheritance hierarchy |
| */ |
| SWIGRUNTIMEINLINE void * |
| SWIG_TypeCast(swig_cast_info *ty, void *ptr) { |
| return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr); |
| } |
| |
| /* |
| Dynamic pointer casting. Down an inheritance hierarchy |
| */ |
| SWIGRUNTIME swig_type_info * |
| SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { |
| swig_type_info *lastty = ty; |
| if (!ty || !ty->dcast) return ty; |
| while (ty && (ty->dcast)) { |
| ty = (*ty->dcast)(ptr); |
| if (ty) lastty = ty; |
| } |
| return lastty; |
| } |
| |
| /* |
| Return the name associated with this type |
| */ |
| SWIGRUNTIMEINLINE const char * |
| SWIG_TypeName(const swig_type_info *ty) { |
| return ty->name; |
| } |
| |
| /* |
| Return the pretty name associated with this type, |
| that is an unmangled type name in a form presentable to the user. |
| */ |
| SWIGRUNTIME const char * |
| SWIG_TypePrettyName(const swig_type_info *type) { |
| /* The "str" field contains the equivalent pretty names of the |
| type, separated by vertical-bar characters. We choose |
| to print the last name, as it is often (?) the most |
| specific. */ |
| if (type->str != NULL) { |
| const char *last_name = type->str; |
| const char *s; |
| for (s = type->str; *s; s++) |
| if (*s == '|') last_name = s+1; |
| return last_name; |
| } |
| else |
| return type->name; |
| } |
| |
| /* |
| Set the clientdata field for a type |
| */ |
| SWIGRUNTIME void |
| SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { |
| swig_cast_info *cast = ti->cast; |
| /* if (ti->clientdata == clientdata) return; */ |
| ti->clientdata = clientdata; |
| |
| while (cast) { |
| if (!cast->converter) { |
| swig_type_info *tc = cast->type; |
| if (!tc->clientdata) { |
| SWIG_TypeClientData(tc, clientdata); |
| } |
| } |
| cast = cast->next; |
| } |
| } |
| |
| /* |
| Search for a swig_type_info structure only by mangled name |
| Search is a O(log #types) |
| |
| We start searching at module start, and finish searching when start == end. |
| Note: if start == end at the beginning of the function, we go all the way around |
| the circular list. |
| */ |
| SWIGRUNTIME swig_type_info * |
| SWIG_MangledTypeQueryModule(swig_module_info *start, |
| swig_module_info *end, |
| const char *name) { |
| swig_module_info *iter = start; |
| do { |
| if (iter->size) { |
| register size_t l = 0; |
| register size_t r = iter->size - 1; |
| do { |
| /* since l+r >= 0, we can (>> 1) instead (/ 2) */ |
| register size_t i = (l + r) >> 1; |
| const char *iname = iter->types[i]->name; |
| if (iname) { |
| register int compare = strcmp(name, iname); |
| if (compare == 0) { |
| return iter->types[i]; |
| } else if (compare < 0) { |
| if (i) { |
| r = i - 1; |
| } else { |
| break; |
| } |
| } else if (compare > 0) { |
| l = i + 1; |
| } |
| } else { |
| break; /* should never happen */ |
| } |
| } while (l <= r); |
| } |
| iter = iter->next; |
| } while (iter != end); |
| return 0; |
| } |
| |
| /* |
| Search for a swig_type_info structure for either a mangled name or a human readable name. |
| It first searches the mangled names of the types, which is a O(log #types) |
| If a type is not found it then searches the human readable names, which is O(#types). |
| |
| We start searching at module start, and finish searching when start == end. |
| Note: if start == end at the beginning of the function, we go all the way around |
| the circular list. |
| */ |
| SWIGRUNTIME swig_type_info * |
| SWIG_TypeQueryModule(swig_module_info *start, |
| swig_module_info *end, |
| const char *name) { |
| /* STEP 1: Search the name field using binary search */ |
| swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); |
| if (ret) { |
| return ret; |
| } else { |
| /* STEP 2: If the type hasn't been found, do a complete search |
| of the str field (the human readable name) */ |
| swig_module_info *iter = start; |
| do { |
| register size_t i = 0; |
| for (; i < iter->size; ++i) { |
| if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) |
| return iter->types[i]; |
| } |
| iter = iter->next; |
| } while (iter != end); |
| } |
| |
| /* neither found a match */ |
| return 0; |
| } |
| |
| |
| /* |
| Pack binary data into a string |
| */ |
| SWIGRUNTIME char * |
| SWIG_PackData(char *c, void *ptr, size_t sz) { |
| static const char hex[17] = "0123456789abcdef"; |
| register const unsigned char *u = (unsigned char *) ptr; |
| register const unsigned char *eu = u + sz; |
| for (; u != eu; ++u) { |
| register unsigned char uu = *u; |
| *(c++) = hex[(uu & 0xf0) >> 4]; |
| *(c++) = hex[uu & 0xf]; |
| } |
| return c; |
| } |
| |
| /* |
| Unpack binary data from a string |
| */ |
| SWIGRUNTIME const char * |
| SWIG_UnpackData(const char *c, void *ptr, size_t sz) { |
| register unsigned char *u = (unsigned char *) ptr; |
| register const unsigned char *eu = u + sz; |
| for (; u != eu; ++u) { |
| register char d = *(c++); |
| register unsigned char uu = 0; |
| if ((d >= '0') && (d <= '9')) |
| uu = ((d - '0') << 4); |
| else if ((d >= 'a') && (d <= 'f')) |
| uu = ((d - ('a'-10)) << 4); |
| else |
| return (char *) 0; |
| d = *(c++); |
| if ((d >= '0') && (d <= '9')) |
| uu |= (d - '0'); |
| else if ((d >= 'a') && (d <= 'f')) |
| uu |= (d - ('a'-10)); |
| else |
| return (char *) 0; |
| *u = uu; |
| } |
| return c; |
| } |
| |
| /* |
| Pack 'void *' into a string buffer. |
| */ |
| SWIGRUNTIME char * |
| SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { |
| char *r = buff; |
| if ((2*sizeof(void *) + 2) > bsz) return 0; |
| *(r++) = '_'; |
| r = SWIG_PackData(r,&ptr,sizeof(void *)); |
| if (strlen(name) + 1 > (bsz - (r - buff))) return 0; |
| strcpy(r,name); |
| return buff; |
| } |
| |
| SWIGRUNTIME const char * |
| SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { |
| if (*c != '_') { |
| if (strcmp(c,"NULL") == 0) { |
| *ptr = (void *) 0; |
| return name; |
| } else { |
| return 0; |
| } |
| } |
| return SWIG_UnpackData(++c,ptr,sizeof(void *)); |
| } |
| |
| SWIGRUNTIME char * |
| SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { |
| char *r = buff; |
| size_t lname = (name ? strlen(name) : 0); |
| if ((2*sz + 2 + lname) > bsz) return 0; |
| *(r++) = '_'; |
| r = SWIG_PackData(r,ptr,sz); |
| if (lname) { |
| strncpy(r,name,lname+1); |
| } else { |
| *r = 0; |
| } |
| return buff; |
| } |
| |
| SWIGRUNTIME const char * |
| SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { |
| if (*c != '_') { |
| if (strcmp(c,"NULL") == 0) { |
| memset(ptr,0,sz); |
| return name; |
| } else { |
| return 0; |
| } |
| } |
| return SWIG_UnpackData(++c,ptr,sz); |
| } |
| |
| #ifdef __cplusplus |
| } |
| #endif |