+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.22
+ *
+ * This file is not intended to be easily readable and contains a number of
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+#define SWIGPYTHON
+
+#define SWIG_GLOBAL 1
+
+
+#include "Python.h"
+
+/*************************************************************** -*- c -*-
+ * python/precommon.swg
+ *
+ * Rename all exported symbols from common.swg, to avoid symbol
+ * clashes if multiple interpreters are included
+ *
+ ************************************************************************/
+
+#define SWIG_TypeRegister SWIG_Python_TypeRegister
+#define SWIG_TypeCheck SWIG_Python_TypeCheck
+#define SWIG_TypeCast SWIG_Python_TypeCast
+#define SWIG_TypeDynamicCast SWIG_Python_TypeDynamicCast
+#define SWIG_TypeName SWIG_Python_TypeName
+#define SWIG_TypeQuery SWIG_Python_TypeQuery
+#define SWIG_TypeClientData SWIG_Python_TypeClientData
+#define SWIG_PackData SWIG_Python_PackData
+#define SWIG_UnpackData SWIG_Python_UnpackData
+
+
/***********************************************************************
- * $Header$
- * swig_lib/python/python.cfg
+ * common.swg
+ *
+ * This file contains generic SWIG runtime support for pointer
+ * type checking as well as a few commonly used macros to control
+ * external linkage.
+ *
+ * Author : David Beazley (beazley@cs.uchicago.edu)
*
- * Contains variable linking and pointer type-checking code.
+ * Copyright (c) 1999-2000, The University of Chicago
+ *
+ * This file may be freely redistributed without license or fee provided
+ * this copyright message remains intact.
************************************************************************/
#include <string.h>
-#include <stdlib.h>
-#include "Python.h"
+#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+# if defined(_MSC_VER) || defined(__GNUC__)
+# if defined(STATIC_LINKED)
+# define SWIGEXPORT(a) a
+# define SWIGIMPORT(a) extern a
+# else
+# define SWIGEXPORT(a) __declspec(dllexport) a
+# define SWIGIMPORT(a) extern a
+# endif
+# else
+# if defined(__BORLANDC__)
+# define SWIGEXPORT(a) a _export
+# define SWIGIMPORT(a) a _export
+# else
+# define SWIGEXPORT(a) a
+# define SWIGIMPORT(a) a
+# endif
+# endif
+#else
+# define SWIGEXPORT(a) a
+# define SWIGIMPORT(a) a
+#endif
+
+#ifdef SWIG_GLOBAL
+# define SWIGRUNTIME(a) SWIGEXPORT(a)
+#else
+# define SWIGRUNTIME(a) static a
+#endif
#ifdef __cplusplus
extern "C" {
#endif
-/* Definitions for Windows/Unix exporting */
-#if defined(_WIN32) || defined(__WIN32__)
-# if defined(_MSC_VER)
-# define SWIGEXPORT(a) __declspec(dllexport) a
-# else
-# if defined(__BORLANDC__)
-# define SWIGEXPORT(a) a _export
-# else
-# define SWIGEXPORT(a) a
-# endif
-# endif
+typedef void *(*swig_converter_func)(void *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+typedef struct swig_type_info {
+ const char *name;
+ swig_converter_func converter;
+ const char *str;
+ void *clientdata;
+ swig_dycast_func dcast;
+ struct swig_type_info *next;
+ struct swig_type_info *prev;
+} swig_type_info;
+
+#ifdef SWIG_NOINCLUDE
+
+SWIGIMPORT(swig_type_info *) SWIG_TypeRegister(swig_type_info *);
+SWIGIMPORT(swig_type_info *) SWIG_TypeCheck(char *c, swig_type_info *);
+SWIGIMPORT(void *) SWIG_TypeCast(swig_type_info *, void *);
+SWIGIMPORT(swig_type_info *) SWIG_TypeDynamicCast(swig_type_info *, void **);
+SWIGIMPORT(const char *) SWIG_TypeName(const swig_type_info *);
+SWIGIMPORT(swig_type_info *) SWIG_TypeQuery(const char *);
+SWIGIMPORT(void) SWIG_TypeClientData(swig_type_info *, void *);
+SWIGIMPORT(char *) SWIG_PackData(char *, void *, int);
+SWIGIMPORT(char *) SWIG_UnpackData(char *, void *, int);
+
#else
-# define SWIGEXPORT(a) a
+
+static swig_type_info *swig_type_list = 0;
+
+/* Register a type mapping with the type-checking */
+SWIGRUNTIME(swig_type_info *)
+SWIG_TypeRegister(swig_type_info *ti) {
+ swig_type_info *tc, *head, *ret, *next;
+ /* Check to see if this type has already been registered */
+ tc = swig_type_list;
+ while (tc) {
+ if (strcmp(tc->name, ti->name) == 0) {
+ /* Already exists in the table. Just add additional types to the list */
+ if (tc->clientdata) ti->clientdata = tc->clientdata;
+ head = tc;
+ next = tc->next;
+ goto l1;
+ }
+ tc = tc->prev;
+ }
+ head = ti;
+ next = 0;
+
+ /* Place in list */
+ ti->prev = swig_type_list;
+ swig_type_list = ti;
+
+ /* Build linked lists */
+ l1:
+ ret = head;
+ tc = ti + 1;
+ /* Patch up the rest of the links */
+ while (tc->name) {
+ head->next = tc;
+ tc->prev = head;
+ head = tc;
+ tc++;
+ }
+ if (next) next->prev = head;
+ head->next = next;
+ return ret;
+}
+
+/* Check the typename */
+SWIGRUNTIME(swig_type_info *)
+SWIG_TypeCheck(char *c, swig_type_info *ty) {
+ swig_type_info *s;
+ if (!ty) return 0; /* Void pointer */
+ s = ty->next; /* First element always just a name */
+ do {
+ if (strcmp(s->name,c) == 0) {
+ if (s == ty->next) return s;
+ /* Move s to the top of the linked list */
+ s->prev->next = s->next;
+ if (s->next) {
+ s->next->prev = s->prev;
+ }
+ /* Insert s as second element in the list */
+ s->next = ty->next;
+ if (ty->next) ty->next->prev = s;
+ ty->next = s;
+ s->prev = ty;
+ return s;
+ }
+ s = s->next;
+ } while (s && (s != ty->next));
+ return 0;
+}
+
+/* Cast a pointer up an inheritance hierarchy */
+SWIGRUNTIME(void *)
+SWIG_TypeCast(swig_type_info *ty, void *ptr) {
+ if ((!ty) || (!ty->converter)) return ptr;
+ return (*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 */
+SWIGRUNTIME(const char *)
+SWIG_TypeName(const swig_type_info *ty) {
+ return ty->name;
+}
+
+/*
+ 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 ' '.
+*/
+static 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 *f1 - *f2;
+ }
+ return (l1 - f1) - (l2 - f2);
+}
+
+/*
+ Check type equivalence in a name list like <name1>|<name2>|...
+*/
+static 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;
+ if (*ne) ++ne;
+ }
+ return equiv;
+}
+
+
+/* Search for a swig_type_info structure */
+SWIGRUNTIME(swig_type_info *)
+SWIG_TypeQuery(const char *name) {
+ swig_type_info *ty = swig_type_list;
+ while (ty) {
+ if (ty->str && (SWIG_TypeEquiv(ty->str,name))) return ty;
+ if (ty->name && (strcmp(name,ty->name) == 0)) return ty;
+ ty = ty->prev;
+ }
+ return 0;
+}
+
+/* Set the clientdata field for a type */
+SWIGRUNTIME(void)
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+ swig_type_info *tc, *equiv;
+ if (ti->clientdata == clientdata) return;
+ ti->clientdata = clientdata;
+ equiv = ti->next;
+ while (equiv) {
+ if (!equiv->converter) {
+ tc = swig_type_list;
+ while (tc) {
+ if ((strcmp(tc->name, equiv->name) == 0))
+ SWIG_TypeClientData(tc,clientdata);
+ tc = tc->prev;
+ }
+ }
+ equiv = equiv->next;
+ }
+}
+
+/* Pack binary data into a string */
+SWIGRUNTIME(char *)
+SWIG_PackData(char *c, void *ptr, int sz) {
+ static char hex[17] = "0123456789abcdef";
+ int i;
+ unsigned char *u = (unsigned char *) ptr;
+ register unsigned char uu;
+ for (i = 0; i < sz; i++,u++) {
+ uu = *u;
+ *(c++) = hex[(uu & 0xf0) >> 4];
+ *(c++) = hex[uu & 0xf];
+ }
+ return c;
+}
+
+/* Unpack binary data from a string */
+SWIGRUNTIME(char *)
+SWIG_UnpackData(char *c, void *ptr, int sz) {
+ register unsigned char uu = 0;
+ register int d;
+ unsigned char *u = (unsigned char *) ptr;
+ int i;
+ for (i = 0; i < sz; i++, u++) {
+ d = *(c++);
+ if ((d >= '0') && (d <= '9'))
+ uu = ((d - '0') << 4);
+ else if ((d >= 'a') && (d <= 'f'))
+ uu = ((d - ('a'-10)) << 4);
+ d = *(c++);
+ if ((d >= '0') && (d <= '9'))
+ uu |= (d - '0');
+ else if ((d >= 'a') && (d <= 'f'))
+ uu |= (d - ('a'-10));
+ *u = uu;
+ }
+ return c;
+}
+
#endif
-#ifdef SWIG_GLOBAL
-#define SWIGSTATICRUNTIME(a) SWIGEXPORT(a)
-#else
-#define SWIGSTATICRUNTIME(a) static a
+#ifdef __cplusplus
+}
#endif
-typedef struct {
- char *name;
- PyObject *(*get_attr)(void);
- int (*set_attr)(PyObject *);
+/***********************************************************************
+ * python.swg
+ *
+ * This file contains the runtime support for Python modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ *
+ * Author : David Beazley (beazley@cs.uchicago.edu)
+ ************************************************************************/
+
+#include "Python.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SWIG_PY_INT 1
+#define SWIG_PY_FLOAT 2
+#define SWIG_PY_STRING 3
+#define SWIG_PY_POINTER 4
+#define SWIG_PY_BINARY 5
+
+/* Flags for pointer conversion */
+
+#define SWIG_POINTER_EXCEPTION 0x1
+#define SWIG_POINTER_DISOWN 0x2
+
+/* Exception handling in wrappers */
+#define SWIG_fail goto fail
+
+/* Constant information structure */
+typedef struct swig_const_info {
+ int type;
+ char *name;
+ long lvalue;
+ double dvalue;
+ void *pvalue;
+ swig_type_info **ptype;
+} swig_const_info;
+
+/* Common SWIG API */
+#define SWIG_ConvertPtr(obj, pp, type, flags) \
+ SWIG_Python_ConvertPtr(obj, pp, type, flags)
+#define SWIG_NewPointerObj(p, type, flags) \
+ SWIG_Python_NewPointerObj(p, type, flags)
+#define SWIG_MustGetPtr(p, type, argnum, flags) \
+ SWIG_Python_MustGetPtr(p, type, argnum, flags)
+
+/* Python-specific SWIG API */
+#define SWIG_newvarlink() \
+ SWIG_Python_newvarlink()
+#define SWIG_addvarlink(p, name, get_attr, set_attr) \
+ SWIG_Python_addvarlink(p, name, get_attr, set_attr)
+#define SWIG_ConvertPacked(obj, ptr, sz, ty, flags) \
+ SWIG_Python_ConvertPacked(obj, ptr, sz, ty, flags)
+#define SWIG_NewPackedObj(ptr, sz, type) \
+ SWIG_Python_NewPackedObj(ptr, sz, type)
+#define SWIG_InstallConstants(d, constants) \
+ SWIG_Python_InstallConstants(d, constants)
+
+typedef double (*py_objasdbl_conv)(PyObject *obj);
+
+#ifdef SWIG_NOINCLUDE
+
+SWIGIMPORT(int) SWIG_Python_ConvertPtr(PyObject *, void **, swig_type_info *, int);
+SWIGIMPORT(PyObject *) SWIG_Python_NewPointerObj(void *, swig_type_info *,int own);
+SWIGIMPORT(void *) SWIG_Python_MustGetPtr(PyObject *, swig_type_info *, int, int);
+SWIGIMPORT(PyObject *) SWIG_Python_newvarlink(void);
+SWIGIMPORT(void) SWIG_Python_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *));
+SWIGIMPORT(int) SWIG_Python_ConvertPacked(PyObject *, void *, int sz, swig_type_info *, int);
+SWIGIMPORT(PyObject *) SWIG_Python_NewPackedObj(void *, int sz, swig_type_info *);
+SWIGIMPORT(void) SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]);
+
+
+#else
+
+
+/* -----------------------------------------------------------------------------
+ * global variable support code.
+ * ----------------------------------------------------------------------------- */
+
+typedef struct swig_globalvar {
+ char *name; /* Name of global variable */
+ PyObject *(*get_attr)(void); /* Return the current value */
+ int (*set_attr)(PyObject *); /* Set the value */
+ struct swig_globalvar *next;
} swig_globalvar;
typedef struct swig_varlinkobject {
PyObject_HEAD
- swig_globalvar **vars;
- int nvars;
- int maxvars;
+ swig_globalvar *vars;
} swig_varlinkobject;
-/* ----------------------------------------------------------------------
- swig_varlink_repr()
-
- Function for python repr method
- ---------------------------------------------------------------------- */
-
static PyObject *
-swig_varlink_repr(swig_varlinkobject *v)
-{
+swig_varlink_repr(swig_varlinkobject *v) {
v = v;
return PyString_FromString("<Global variables>");
}
-/* ---------------------------------------------------------------------
- swig_varlink_print()
-
- Print out all of the global variable names
- --------------------------------------------------------------------- */
-
static int
-swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags)
-{
-
- int i = 0;
+swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags) {
+ swig_globalvar *var;
flags = flags;
fprintf(fp,"Global variables { ");
- while (v->vars[i]) {
- fprintf(fp,"%s", v->vars[i]->name);
- i++;
- if (v->vars[i]) fprintf(fp,", ");
+ for (var = v->vars; var; var=var->next) {
+ fprintf(fp,"%s", var->name);
+ if (var->next) fprintf(fp,", ");
}
fprintf(fp," }\n");
return 0;
}
-/* --------------------------------------------------------------------
- swig_varlink_getattr
-
- This function gets the value of a variable and returns it as a
- PyObject. In our case, we'll be looking at the datatype and
- converting into a number or string
- -------------------------------------------------------------------- */
-
static PyObject *
-swig_varlink_getattr(swig_varlinkobject *v, char *n)
-{
- int i = 0;
- char temp[128];
-
- while (v->vars[i]) {
- if (strcmp(v->vars[i]->name,n) == 0) {
- return (*v->vars[i]->get_attr)();
+swig_varlink_getattr(swig_varlinkobject *v, char *n) {
+ swig_globalvar *var = v->vars;
+ while (var) {
+ if (strcmp(var->name,n) == 0) {
+ return (*var->get_attr)();
}
- i++;
+ var = var->next;
}
- sprintf(temp,"C global variable %s not found.", n);
- PyErr_SetString(PyExc_NameError,temp);
+ PyErr_SetString(PyExc_NameError,"Unknown C global variable");
return NULL;
}
-/* -------------------------------------------------------------------
- swig_varlink_setattr()
-
- This function sets the value of a variable.
- ------------------------------------------------------------------- */
-
static int
-swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p)
-{
- char temp[128];
- int i = 0;
- while (v->vars[i]) {
- if (strcmp(v->vars[i]->name,n) == 0) {
- return (*v->vars[i]->set_attr)(p);
+swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
+ swig_globalvar *var = v->vars;
+ while (var) {
+ if (strcmp(var->name,n) == 0) {
+ return (*var->set_attr)(p);
}
- i++;
+ var = var->next;
}
- sprintf(temp,"C global variable %s not found.", n);
- PyErr_SetString(PyExc_NameError,temp);
+ PyErr_SetString(PyExc_NameError,"Unknown C global variable");
return 1;
}
statichere PyTypeObject varlinktype = {
-/* PyObject_HEAD_INIT(&PyType_Type) Note : This doesn't work on some machines */
- PyObject_HEAD_INIT(0)
- 0,
- "varlink", /* Type name */
- sizeof(swig_varlinkobject), /* Basic size */
- 0, /* Itemsize */
- 0, /* Deallocator */
- (printfunc) swig_varlink_print, /* Print */
- (getattrfunc) swig_varlink_getattr, /* get attr */
- (setattrfunc) swig_varlink_setattr, /* Set attr */
- 0, /* tp_compare */
- (reprfunc) swig_varlink_repr, /* tp_repr */
+ PyObject_HEAD_INIT(0)
+ 0, /* Number of items in variable part (ob_size) */
+ (char *)"swigvarlink", /* Type name (tp_name) */
+ sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */
+ 0, /* Itemsize (tp_itemsize) */
+ 0, /* Deallocator (tp_dealloc) */
+ (printfunc) swig_varlink_print, /* Print (tp_print) */
+ (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */
+ (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */
+ 0, /* tp_compare */
+ (reprfunc) swig_varlink_repr, /* tp_repr */
0, /* tp_as_number */
- 0, /* tp_as_mapping*/
- 0, /* tp_hash */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ 0, /* tp_flags */
+ 0, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
+ 0, /* tp_free */
+ 0, /* tp_is_gc */
+ 0, /* tp_bases */
+ 0, /* tp_mro */
+ 0, /* tp_cache */
+ 0, /* tp_subclasses */
+ 0, /* tp_weaklist */
};
/* Create a variable linking object for use later */
-
-SWIGSTATICRUNTIME(PyObject *)
-SWIG_newvarlink(void)
-{
+SWIGRUNTIME(PyObject *)
+SWIG_Python_newvarlink(void) {
swig_varlinkobject *result = 0;
result = PyMem_NEW(swig_varlinkobject,1);
varlinktype.ob_type = &PyType_Type; /* Patch varlinktype into a PyType */
result->ob_type = &varlinktype;
- /* _Py_NewReference(result); Does not seem to be necessary */
- result->nvars = 0;
- result->maxvars = 64;
- result->vars = (swig_globalvar **) malloc(64*sizeof(swig_globalvar *));
- result->vars[0] = 0;
+ result->vars = 0;
result->ob_refcnt = 0;
Py_XINCREF((PyObject *) result);
return ((PyObject*) result);
}
-SWIGSTATICRUNTIME(void)
-SWIG_addvarlink(PyObject *p, char *name,
- PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p))
-{
+SWIGRUNTIME(void)
+SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
swig_varlinkobject *v;
+ swig_globalvar *gv;
v= (swig_varlinkobject *) p;
+ gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
+ gv->name = (char *) malloc(strlen(name)+1);
+ strcpy(gv->name,name);
+ gv->get_attr = get_attr;
+ gv->set_attr = set_attr;
+ gv->next = v->vars;
+ v->vars = gv;
+}
- if (v->nvars >= v->maxvars -1) {
- v->maxvars = 2*v->maxvars;
- v->vars = (swig_globalvar **) realloc(v->vars,v->maxvars*sizeof(swig_globalvar *));
- if (v->vars == NULL) {
- fprintf(stderr,"SWIG : Fatal error in initializing Python module.\n");
- exit(1);
+/* Convert a pointer value */
+SWIGRUNTIME(int)
+SWIG_Python_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags) {
+ swig_type_info *tc;
+ char *c = 0;
+ static PyObject *SWIG_this = 0;
+ int newref = 0;
+ PyObject *pyobj = 0;
+
+ if (!obj) return 0;
+ if (obj == Py_None) {
+ *ptr = 0;
+ return 0;
+ }
+#ifdef SWIG_COBJECT_TYPES
+ if (!(PyCObject_Check(obj))) {
+ if (!SWIG_this)
+ SWIG_this = PyString_FromString("this");
+ pyobj = obj;
+ obj = PyObject_GetAttr(obj,SWIG_this);
+ newref = 1;
+ if (!obj) goto type_error;
+ if (!PyCObject_Check(obj)) {
+ Py_DECREF(obj);
+ goto type_error;
+ }
+ }
+ *ptr = PyCObject_AsVoidPtr(obj);
+ c = (char *) PyCObject_GetDesc(obj);
+ if (newref) Py_DECREF(obj);
+ goto cobject;
+#else
+ if (!(PyString_Check(obj))) {
+ if (!SWIG_this)
+ SWIG_this = PyString_FromString("this");
+ pyobj = obj;
+ obj = PyObject_GetAttr(obj,SWIG_this);
+ newref = 1;
+ if (!obj) goto type_error;
+ if (!PyString_Check(obj)) {
+ Py_DECREF(obj);
+ goto type_error;
+ }
+ }
+ c = PyString_AsString(obj);
+ /* Pointer values must start with leading underscore */
+ if (*c != '_') {
+ *ptr = (void *) 0;
+ if (strcmp(c,"NULL") == 0) {
+ if (newref) { Py_DECREF(obj); }
+ return 0;
+ } else {
+ if (newref) { Py_DECREF(obj); }
+ goto type_error;
}
}
- v->vars[v->nvars] = (swig_globalvar *) malloc(sizeof(swig_globalvar));
- v->vars[v->nvars]->name = (char *) malloc(strlen(name)+1);
- strcpy(v->vars[v->nvars]->name,name);
- v->vars[v->nvars]->get_attr = get_attr;
- v->vars[v->nvars]->set_attr = set_attr;
- v->nvars++;
- v->vars[v->nvars] = 0;
-}
-
-/* -----------------------------------------------------------------------------
- * Pointer type-checking
- * ----------------------------------------------------------------------------- */
-
-/* SWIG pointer structure */
-typedef struct SwigPtrType {
- char *name; /* Datatype name */
- int len; /* Length (used for optimization) */
- void *(*cast)(void *); /* Pointer casting function */
- struct SwigPtrType *next; /* Linked list pointer */
-} SwigPtrType;
-
-/* Pointer cache structure */
-typedef struct {
- int stat; /* Status (valid) bit */
- SwigPtrType *tp; /* Pointer to type structure */
- char name[256]; /* Given datatype name */
- char mapped[256]; /* Equivalent name */
-} SwigCacheType;
-
-static int SwigPtrMax = 64; /* Max entries that can be currently held */
-static int SwigPtrN = 0; /* Current number of entries */
-static int SwigPtrSort = 0; /* Status flag indicating sort */
-static int SwigStart[256]; /* Starting positions of types */
-static SwigPtrType *SwigPtrTable = 0; /* Table containing pointer equivalences */
-
-/* Cached values */
-#define SWIG_CACHESIZE 8
-#define SWIG_CACHEMASK 0x7
-static SwigCacheType SwigCache[SWIG_CACHESIZE];
-static int SwigCacheIndex = 0;
-static int SwigLastCache = 0;
-
-/* Sort comparison function */
-static int swigsort(const void *data1, const void *data2) {
- SwigPtrType *d1 = (SwigPtrType *) data1;
- SwigPtrType *d2 = (SwigPtrType *) data2;
- return strcmp(d1->name,d2->name);
-}
+ c++;
+ c = SWIG_UnpackData(c,ptr,sizeof(void *));
+ if (newref) { Py_DECREF(obj); }
+#endif
-/* Register a new datatype with the type-checker */
-SWIGSTATICRUNTIME(void)
-SWIG_RegisterMapping(char *origtype, char *newtype, void *(*cast)(void *)) {
- int i;
- SwigPtrType *t = 0,*t1;
+#ifdef SWIG_COBJECT_TYPES
+cobject:
+#endif
- /* Allocate the pointer table if necessary */
- if (!SwigPtrTable) {
- SwigPtrTable = (SwigPtrType *) malloc(SwigPtrMax*sizeof(SwigPtrType));
+ if (ty) {
+ tc = SWIG_TypeCheck(c,ty);
+ if (!tc) goto type_error;
+ *ptr = SWIG_TypeCast(tc,(void*) *ptr);
}
- /* Grow the table */
- if (SwigPtrN >= SwigPtrMax) {
- SwigPtrMax = 2*SwigPtrMax;
- SwigPtrTable = (SwigPtrType *) realloc((char *) SwigPtrTable,SwigPtrMax*sizeof(SwigPtrType));
- }
- for (i = 0; i < SwigPtrN; i++) {
- if (strcmp(SwigPtrTable[i].name,origtype) == 0) {
- t = &SwigPtrTable[i];
- break;
- }
- }
- if (!t) {
- t = &SwigPtrTable[SwigPtrN++];
- t->name = origtype;
- t->len = strlen(t->name);
- t->cast = 0;
- t->next = 0;
+ if ((pyobj) && (flags & SWIG_POINTER_DISOWN)) {
+ PyObject *zero = PyInt_FromLong(0);
+ PyObject_SetAttrString(pyobj,(char*)"thisown",zero);
+ Py_DECREF(zero);
}
+ return 0;
- /* Check for existing entries */
- while (t->next) {
- if ((strcmp(t->name,newtype) == 0)) {
- if (cast) t->cast = cast;
- return;
+type_error:
+ if (flags & SWIG_POINTER_EXCEPTION) {
+ if (ty && c) {
+ PyObject *err =
+ PyString_FromFormat("Type error. Got %s, expected %s",c,ty->name);
+ PyErr_SetObject(PyExc_TypeError, err);
+ Py_DECREF(err);
+ } else {
+ PyErr_SetString(PyExc_TypeError,"Expected a pointer");
}
- t = t->next;
}
- t1 = (SwigPtrType *) malloc(sizeof(SwigPtrType));
- t1->name = newtype;
- t1->len = strlen(t1->name);
- t1->cast = cast;
- t1->next = 0;
- t->next = t1;
- SwigPtrSort = 0;
+ return -1;
}
-/* Make a pointer value string */
-SWIGSTATICRUNTIME(void)
-SWIG_MakePtr(char *c, const void *ptr, char *type) {
- static char hex[17] = "0123456789abcdef";
- unsigned long p, s;
- char result[24], *r;
- r = result;
- p = (unsigned long) ptr;
- if (p > 0) {
- while (p > 0) {
- s = p & 0xf;
- *(r++) = hex[s];
- p = p >> 4;
- }
- *r = '_';
- while (r >= result)
- *(c++) = *(r--);
- strcpy (c, type);
- } else {
- strcpy (c, "NULL");
- }
+/* Convert a pointer value, signal an exception on a type mismatch */
+SWIGRUNTIME(void *)
+SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) {
+ void *result;
+ SWIG_Python_ConvertPtr(obj, &result, ty, flags | SWIG_POINTER_EXCEPTION);
+ return result;
}
-/* Function for getting a pointer value */
-SWIGSTATICRUNTIME(char *)
-SWIG_GetPtr(char *c, void **ptr, char *t)
-{
- unsigned long p;
- char temp_type[256], *name;
- int i, len, start, end;
- SwigPtrType *sp,*tp;
- SwigCacheType *cache;
- register int d;
+/* Convert a packed value value */
+SWIGRUNTIME(int)
+SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, int sz, swig_type_info *ty, int flags) {
+ swig_type_info *tc;
+ char *c = 0;
- p = 0;
+ if ((!obj) || (!PyString_Check(obj))) goto type_error;
+ c = PyString_AsString(obj);
/* Pointer values must start with leading underscore */
- if (*c != '_') {
- *ptr = (void *) 0;
- if (strcmp(c,"NULL") == 0) return (char *) 0;
- else return c;
- }
+ if (*c != '_') goto type_error;
c++;
- /* Extract hex value from pointer */
- while ((d = *c) != 0) {
- if ((d >= '0') && (d <= '9'))
- p = (p << 4) + (d - '0');
- else if ((d >= 'a') && (d <= 'f'))
- p = (p << 4) + (d - ('a'-10));
- else
- break;
- c++;
+ c = SWIG_UnpackData(c,ptr,sz);
+ if (ty) {
+ tc = SWIG_TypeCheck(c,ty);
+ if (!tc) goto type_error;
}
- *ptr = (void *) p;
- if ((!t) || (strcmp(t,c)==0)) return (char *) 0;
-
- if (!SwigPtrSort) {
- qsort((void *) SwigPtrTable, SwigPtrN, sizeof(SwigPtrType), swigsort);
- for (i = 0; i < 256; i++) SwigStart[i] = SwigPtrN;
- for (i = SwigPtrN-1; i >= 0; i--) SwigStart[(int) (SwigPtrTable[i].name[1])] = i;
- for (i = 255; i >= 1; i--) {
- if (SwigStart[i-1] > SwigStart[i])
- SwigStart[i-1] = SwigStart[i];
+ return 0;
+
+type_error:
+
+ if (flags) {
+ if (ty && c) {
+ PyObject *err =
+ PyString_FromFormat("Type error. Got %s, expected %s",c,ty->name);
+ PyErr_SetObject(PyExc_TypeError, err);
+ Py_DECREF(err);
+ } else {
+ PyErr_SetString(PyExc_TypeError,"Expected a pointer");
}
- SwigPtrSort = 1;
- for (i = 0; i < SWIG_CACHESIZE; i++) SwigCache[i].stat = 0;
}
- /* First check cache for matches. Uses last cache value as starting point */
- cache = &SwigCache[SwigLastCache];
- for (i = 0; i < SWIG_CACHESIZE; i++) {
- if (cache->stat && (strcmp(t,cache->name) == 0) && (strcmp(c,cache->mapped) == 0)) {
- cache->stat++;
- if (cache->tp->cast) *ptr = (*(cache->tp->cast))(*ptr);
- return (char *) 0;
- }
- SwigLastCache = (SwigLastCache+1) & SWIG_CACHEMASK;
- if (!SwigLastCache) cache = SwigCache;
- else cache++;
+ return -1;
+}
+
+/* Create a new pointer object */
+SWIGRUNTIME(PyObject *)
+SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int own) {
+ PyObject *robj;
+ if (!ptr) {
+ Py_INCREF(Py_None);
+ return Py_None;
}
- /* Type mismatch. Look through type-mapping table */
- start = SwigStart[(int) t[1]];
- end = SwigStart[(int) t[1]+1];
- sp = &SwigPtrTable[start];
-
- /* Try to find a match */
- while (start < end) { /* was "<=" --robin */
- if (strncmp(t,sp->name,sp->len) == 0) {
- name = sp->name;
- len = sp->len;
- tp = sp->next;
- /* Try to find entry for our given datatype */
- while(tp) {
- if (tp->len >= 255) {
- return c;
- }
- strcpy(temp_type,tp->name);
- strncat(temp_type,t+len,255-tp->len);
- if (strcmp(c,temp_type) == 0) {
- strcpy(SwigCache[SwigCacheIndex].mapped,c);
- strcpy(SwigCache[SwigCacheIndex].name,t);
- SwigCache[SwigCacheIndex].stat = 1;
- SwigCache[SwigCacheIndex].tp = tp;
- SwigCacheIndex = SwigCacheIndex & SWIG_CACHEMASK;
- /* Get pointer value */
- *ptr = (void *) p;
- if (tp->cast) *ptr = (*(tp->cast))(*ptr);
- return (char *) 0;
- }
- tp = tp->next;
+#ifdef SWIG_COBJECT_TYPES
+ robj = PyCObject_FromVoidPtrAndDesc((void *) ptr, (char *) type->name, NULL);
+#else
+ {
+ char result[1024];
+ char *r = result;
+ *(r++) = '_';
+ r = SWIG_PackData(r,&ptr,sizeof(void *));
+ strcpy(r,type->name);
+ robj = PyString_FromString(result);
+ }
+#endif
+ if (!robj || (robj == Py_None)) return robj;
+ if (type->clientdata) {
+ PyObject *inst;
+ PyObject *args = Py_BuildValue((char*)"(O)", robj);
+ Py_DECREF(robj);
+ inst = PyObject_CallObject((PyObject *) type->clientdata, args);
+ Py_DECREF(args);
+ if (inst) {
+ if (own) {
+ PyObject *n = PyInt_FromLong(1);
+ PyObject_SetAttrString(inst,(char*)"thisown",n);
+ Py_DECREF(n);
}
+ robj = inst;
}
- sp++;
- start++;
}
- return c;
+ return robj;
}
-/* New object-based GetPointer function. This uses the Python abstract
- * object interface to automatically dereference the 'this' attribute
- * of shadow objects. */
-
-SWIGSTATICRUNTIME(char *)
-SWIG_GetPtrObj(PyObject *obj, void **ptr, char *type) {
- PyObject *sobj = obj;
- char *str;
+SWIGRUNTIME(PyObject *)
+SWIG_Python_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
+ char result[1024];
+ char *r = result;
+ if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
+ *(r++) = '_';
+ r = SWIG_PackData(r,ptr,sz);
+ strcpy(r,type->name);
+ return PyString_FromString(result);
+}
- if (!PyString_Check(obj)) {
- if (!PyInstance_Check(obj) || !(sobj = PyObject_GetAttrString(obj,"this")))
- return "";
- // PyObject_GetAttrString increases sobj refcout !
- Py_DECREF(sobj);
+/* Install Constants */
+SWIGRUNTIME(void)
+SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
+ int i;
+ PyObject *obj;
+ for (i = 0; constants[i].type; i++) {
+ switch(constants[i].type) {
+ case SWIG_PY_INT:
+ obj = PyInt_FromLong(constants[i].lvalue);
+ break;
+ case SWIG_PY_FLOAT:
+ obj = PyFloat_FromDouble(constants[i].dvalue);
+ break;
+ case SWIG_PY_STRING:
+ if (constants[i].pvalue) {
+ obj = PyString_FromString((char *) constants[i].pvalue);
+ } else {
+ Py_INCREF(Py_None);
+ obj = Py_None;
+ }
+ break;
+ case SWIG_PY_POINTER:
+ obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
+ break;
+ case SWIG_PY_BINARY:
+ obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
+ break;
+ default:
+ obj = 0;
+ break;
+ }
+ if (obj) {
+ PyDict_SetItemString(d,constants[i].name,obj);
+ Py_DECREF(obj);
+ }
}
- str = PyString_AsString(sobj);
- if (str == NULL)
- return "";
- return SWIG_GetPtr(str,ptr,type);
}
+#endif
+
+/* Contract support */
+
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { PyErr_SetString(PyExc_RuntimeError, (char *) msg ); goto fail; } else
#ifdef __cplusplus
}
#endif
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_char swig_types[0]
+static swig_type_info *swig_types[2];
+
+/* -------- TYPES TABLE (END) -------- */
+/*-----------------------------------------------
+ @(target):= _swigrun.so
+ ------------------------------------------------*/
+#define SWIG_init init_swigrun
+#define SWIG_name "_swigrun"
+/* Auxiliar swig macros */
+
+#ifdef __cplusplus
+#define SWIGSTATICINLINE(a) static inline a
+#define SWIGSTATIC(a) static a
+#define swig_new_array(type, size) (new type[(size)])
+#define swig_delete_array(cptr) delete[] cptr
+#define swig_const_cast(type,a) const_cast<type>(a)
+#define swig_static_cast(type,a) static_cast<type>(a)
+#define swig_reinterpret_cast(type,a) reinterpret_cast<type>(a)
+
+#ifdef HAVE_NUMERIC_CAST
+#define swig_numeric_cast(type,a) numeric_cast<type>(a)
+#else
+#define swig_numeric_cast(type,a) static_cast<type>(a)
+#endif
+#else /* C case */
+#define SWIGSTATICINLINE(a) static a
+#define SWIGSTATIC(a) static a
+#define swig_new_array(type, size) ((type*) malloc((size)*sizeof(type)))
+#define swig_delete_array(cptr) free((char*)cptr)
+#define swig_const_cast(type,a) (type)(a)
+#define swig_static_cast(type,a) (type)(a)
+#define swig_reinterpret_cast(type,a) (type)(a)
+#define swig_numeric_cast(type,a) (type)(a)
+#endif /* __cplusplus */
+#define SWIG_FromSignedChar PyInt_FromLong
+#define SWIG_FromUnsignedChar PyInt_FromLong
+#define SWIG_FromShort PyInt_FromLong
+#define SWIG_FromUnsignedShort PyInt_FromLong
+#define SWIG_FromInt PyInt_FromLong
+#define SWIG_FromLong PyInt_FromLong
+#define SWIG_FromFloat PyFloat_FromDouble
+#define SWIG_FromDouble PyFloat_FromDouble
+#define SWIG_FromFloat PyFloat_FromDouble
+#define SWIG_FromDouble PyFloat_FromDouble
+#ifdef __cplusplus
+extern "C" {
+#endif
+static PyMethodDef SwigMethods[] = {
+ { NULL, NULL }
+};
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+static swig_type_info _swigt__p_char[] = {{"_p_char", 0, "char *", 0, 0, 0, 0},{"_p_char", 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0}};
+static swig_type_info *swig_types_initial[] = {
+_swigt__p_char,
+0
+};
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+static swig_const_info swig_const_table[] = {
+{0}};
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+extern "C"
+#endif
+SWIGEXPORT(void) SWIG_init(void) {
+ static PyObject *SWIG_globals = 0;
+ static int typeinit = 0;
+ PyObject *m, *d;
+ int i;
+ if (!SWIG_globals) SWIG_globals = SWIG_newvarlink();
+ m = Py_InitModule((char *) SWIG_name, SwigMethods);
+ d = PyModule_GetDict(m);
+
+ if (!typeinit) {
+ for (i = 0; swig_types_initial[i]; i++) {
+ swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
+ }
+ typeinit = 1;
+ }
+ SWIG_InstallConstants(d,swig_const_table);
+
+}
+