/* --------------------------------------------------------------------
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
statichere PyTypeObject varlinktype = {
/* PyObject_HEAD_INIT(&PyType_Type) Note : This doesn't work on some machines */
- PyObject_HEAD_INIT(0)
+ PyObject_HEAD_INIT(0)
0,
"varlink", /* Type name */
sizeof(swig_varlinkobject), /* Basic size */
0, /* Itemsize */
- 0, /* Deallocator */
+ 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 */
+ (reprfunc) swig_varlink_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_mapping*/
0, /* tp_hash */
{
swig_varlinkobject *v;
v= (swig_varlinkobject *) p;
-
+
if (v->nvars >= v->maxvars -1) {
v->maxvars = 2*v->maxvars;
v->vars = (swig_globalvar **) realloc(v->vars,v->maxvars*sizeof(swig_globalvar *));
/* Cached values */
#define SWIG_CACHESIZE 8
#define SWIG_CACHEMASK 0x7
-static SwigCacheType SwigCache[SWIG_CACHESIZE];
+static SwigCacheType SwigCache[SWIG_CACHESIZE];
static int SwigCacheIndex = 0;
static int SwigLastCache = 0;
}
/* Register a new datatype with the type-checker */
-SWIGSTATICRUNTIME(void)
+SWIGSTATICRUNTIME(void)
SWIG_RegisterMapping(char *origtype, char *newtype, void *(*cast)(void *)) {
int i;
SwigPtrType *t = 0,*t1;
/* Allocate the pointer table if necessary */
- if (!SwigPtrTable) {
+ if (!SwigPtrTable) {
SwigPtrTable = (SwigPtrType *) malloc(SwigPtrMax*sizeof(SwigPtrType));
}
t1->name = newtype;
t1->len = strlen(t1->name);
t1->cast = cast;
- t1->next = 0;
- t->next = t1;
+ t1->next = 0;
+ t->next = t1;
SwigPtrSort = 0;
}
/* Make a pointer value string */
-SWIGSTATICRUNTIME(void)
+SWIGSTATICRUNTIME(void)
SWIG_MakePtr(char *c, const void *ptr, char *type) {
static char hex[17] = "0123456789abcdef";
unsigned long p, s;
- char result[24], *r;
+ char result[24], *r;
r = result;
p = (unsigned long) ptr;
if (p > 0) {
}
/* Function for getting a pointer value */
-SWIGSTATICRUNTIME(char *)
+SWIGSTATICRUNTIME(char *)
SWIG_GetPtr(char *c, void **ptr, char *t)
{
unsigned long p;
else if ((d >= 'a') && (d <= 'f'))
p = (p << 4) + (d - ('a'-10));
else
- break;
+ break;
c++;
}
*ptr = (void *) p;
if ((!t) || (strcmp(t,c)==0)) return (char *) 0;
if (!SwigPtrSort) {
- qsort((void *) SwigPtrTable, SwigPtrN, sizeof(SwigPtrType), swigsort);
+ 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--) {
start++;
}
return c;
-}
+}
/* New object-based GetPointer function. This uses the Python abstract
* object interface to automatically dereference the 'this' attribute
PyObject *sobj = obj;
char *str;
if (!PyString_Check(obj)) {
- sobj = PyObject_GetAttrString(obj,"this");
- if (!sobj) return "";
+ if (!PyInstance_Check(obj) || !(sobj = PyObject_GetAttrString(obj,"this")))
+ return "";
+// sobj = PyObject_GetAttrString(obj,"this");
+// if (!sobj) return "";
}
str = PyString_AsString(sobj);
return SWIG_GetPtr(str,ptr,type);