/***********************************************************************
* This file contains generic CAPI SWIG runtime support for pointer
************************************************************************/
/* 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" */
# 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)
# define SWIG_TYPE_TABLE_NAME
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.
# define SWIGRUNTIME SWIGINTERN
#ifndef SWIGRUNTIMEINLINE
# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
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 */
/* 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 */
/* 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 */
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 ' '.
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
SWIG_TypeEquiv(const char *nb, const char *tb) {
const char* te = tb + strlen(tb);
for (nb = ne; *ne; ++ne) {
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if equal, -1 if nb < tb, 1 if nb > tb
SWIG_TypeCompare(const char *nb, const char *tb) {
const char* te = tb + strlen(tb);
for (nb = ne; *ne; ++ne) {
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
/* think of this as a c++ template<> or a scheme macro */
#define SWIG_TypeCheck_Template(comparison, ty) \
swig_cast_info *iter = ty->cast; \
if (iter == ty->cast) return iter; \
/* Move iter to the top of the linked list */ \
iter->prev->next = iter->next; \
iter->next->prev = iter->prev; \
if (ty->cast) ty->cast->prev = iter; \
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
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)) {
Return the name associated with this type
SWIGRUNTIMEINLINE const char *
SWIG_TypeName(const swig_type_info *ty) {
Return the pretty name associated with this type,
that is an unmangled type name in a form presentable to the user.
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
const char *last_name = type->str;
for (s = type->str; *s; s++)
if (*s == '|') last_name = s+1;
Set the clientdata field for a type
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
swig_cast_info *cast = ti->cast;
/* if (ti->clientdata == clientdata) return; */
ti->clientdata = clientdata;
swig_type_info *tc = cast->type;
SWIG_TypeClientData(tc, clientdata);
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
SWIGRUNTIME swig_type_info *
SWIG_MangledTypeQueryModule(swig_module_info *start,
swig_module_info *iter = start;
register size_t r = iter->size - 1;
/* since l+r >= 0, we can (>> 1) instead (/ 2) */
register size_t i = (l + r) >> 1;
const char *iname = iter->types[i]->name;
register int compare = strcmp(name, iname);
} else if (compare < 0) {
} else if (compare > 0) {
break; /* should never happen */
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
SWIGRUNTIME swig_type_info *
SWIG_TypeQueryModule(swig_module_info *start,
/* STEP 1: Search the name field using binary search */
swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
/* 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;
for (; i < iter->size; ++i) {
if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
/* neither found a match */
Pack binary data into a string
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;
register unsigned char uu = *u;
*(c++) = hex[(uu & 0xf0) >> 4];
Unpack binary data from a string
SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
register unsigned char *u = (unsigned char *) ptr;
register const unsigned char *eu = u + sz;
register char d = *(c++);
register unsigned char uu = 0;
if ((d >= '0') && (d <= '9'))
else if ((d >= 'a') && (d <= 'f'))
uu = ((d - ('a'-10)) << 4);
if ((d >= '0') && (d <= '9'))
else if ((d >= 'a') && (d <= 'f'))
Pack 'void *' into a string buffer.
SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
if ((2*sizeof(void *) + 2) > bsz) return 0;
r = SWIG_PackData(r,&ptr,sizeof(void *));
if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
if (strcmp(c,"NULL") == 0) {
return SWIG_UnpackData(++c,ptr,sizeof(void *));
SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
size_t lname = (name ? strlen(name) : 0);
if ((2*sz + 2 + lname) > bsz) return 0;
r = SWIG_PackData(r,ptr,sz);
SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
if (strcmp(c,"NULL") == 0) {
return SWIG_UnpackData(++c,ptr,sz);