From: Wouter Wijngaards Date: Thu, 26 Mar 2009 12:47:04 +0000 (+0000) Subject: pyunbound works. X-Git-Tag: release-1.3.0~63 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e0cd16b38c0d847f7b13ab94953873e9e0c91f33;p=thirdparty%2Funbound.git pyunbound works. git-svn-id: file:///svn/unbound/trunk@1560 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/contrib/python/Makefile b/contrib/python/Makefile index 1c8a50021..fc59ee60b 100644 --- a/contrib/python/Makefile +++ b/contrib/python/Makefile @@ -58,7 +58,7 @@ clean: testenv: ../../.libs/libunbound.so.0 ../../ldns-src/lib/libldns.so _unbound.so rm -rdf examples/unbound - cd examples && mkdir unbound && ln -s ../../unbound.py unbound/__init__.py && ln -s ../../_unbound.so unbound/_unbound.so && ln -s ../../../../.libs/libunbound.so.0 unbound/libunbound.so.0 && ln -s ../../../../ldns-src/lib/libldns.so.1 unbound/libldns.so.1 && ls -la + cd examples && mkdir unbound && ln -s ../../unbound.py unbound/__init__.py && ln -s ../../_unbound.so unbound/_unbound.so && ln -s ../../../../.libs/libunbound.so.1 unbound/libunbound.so.1 && ln -s ../../../../ldns-src/lib/libldns.so.1 unbound/libldns.so.1 && ls -la @echo "Run a script by typing ./script_name.py" cd examples && LD_LIBRARY_PATH=unbound bash rm -rdf examples/unbound @@ -70,5 +70,5 @@ doc: ../../.libs/libunbound.so.0 _unbound.so swig: libunbound.i swig -python -o libunbound_wrap.c -I../.. libunbound.i gcc -c libunbound_wrap.c -O9 -fPIC -I../.. -I/usr/include/python2.5 -I. -o libunbound_wrap.o - ld -shared libunbound_wrap.o -L../../.libs -lunbound -o _unbound.so + gcc -shared libunbound_wrap.o -L../../.libs -lunbound -o _unbound.so diff --git a/contrib/python/libunbound_wrap.c b/contrib/python/libunbound_wrap.c index 507349b6a..d40517add 100644 --- a/contrib/python/libunbound_wrap.c +++ b/contrib/python/libunbound_wrap.c @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.38 + * Version 1.3.33 * * 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 @@ -10,7 +10,6 @@ #define SWIGPYTHON #define SWIG_PYTHON_DIRECTOR_NO_VTABLE - /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. @@ -53,12 +52,6 @@ # endif #endif -#ifndef SWIG_MSC_UNSUPPRESS_4505 -# if defined(_MSC_VER) -# pragma warning(disable : 4505) /* unreferenced local function has been removed */ -# endif -#endif - #ifndef SWIGUNUSEDPARM # ifdef __cplusplus # define SWIGUNUSEDPARM(p) @@ -127,13 +120,13 @@ /* ----------------------------------------------------------------------------- * swigrun.swg * - * This file contains generic C API SWIG runtime support for pointer + * 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 "4" +#define SWIG_RUNTIME_VERSION "3" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -146,11 +139,11 @@ /* 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'. + 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 strictly necessary, ie, if you have problems - with your compiler or suchlike. + But only do this if is strictly necessary, ie, if you have problems + with your compiler or so. */ #ifndef SWIGRUNTIME @@ -168,7 +161,6 @@ /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 -#define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 @@ -177,14 +169,14 @@ /* Flags/methods for returning states. - The SWIG conversion methods, as ConvertPtr, return and integer + The swig conversion methods, as ConvertPtr, return and integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). Use the following macros/flags to set or process the returning states. - In old versions of SWIG, code such as the following was usually written: + In old swig versions, you usually write code as: if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { // success code @@ -192,7 +184,7 @@ //fail code } - Now you can be more explicit: + Now you can be more explicit as: int res = SWIG_ConvertPtr(obj,vptr,ty.flags); if (SWIG_IsOK(res)) { @@ -201,7 +193,7 @@ // fail code } - which is the same really, but now you can also do + that seems to be the same, but now you can also do Type *ptr; int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); @@ -219,7 +211,7 @@ I.e., now SWIG_ConvertPtr can return new objects and you can identify the case and take care of the deallocation. Of course that - also requires SWIG_ConvertPtr to return new result values, such as + requires also to SWIG_ConvertPtr to return new result values, as int SWIG_ConvertPtr(obj, ptr,...) { if () { @@ -237,7 +229,7 @@ Of course, returning the plain '0(success)/-1(fail)' still works, but you can be more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the - SWIG errors code. + swig errors code. Finally, if the SWIG_CASTRANK_MODE is enabled, the result code allows to return the 'cast rank', for example, if you have this @@ -251,8 +243,9 @@ fooi(1) // cast rank '0' just use the SWIG_AddCast()/SWIG_CheckState() -*/ + + */ #define SWIG_OK (0) #define SWIG_ERROR (-1) #define SWIG_IsOK(r) (r >= 0) @@ -277,6 +270,7 @@ #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) + /* Cast-Rank Mode */ #if defined(SWIG_CASTRANK_MODE) # ifndef SWIG_TypeRank @@ -299,16 +293,18 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) { #endif + + #include #ifdef __cplusplus extern "C" { #endif -typedef void *(*swig_converter_func)(void *, int *); +typedef void *(*swig_converter_func)(void *); typedef struct swig_type_info *(*swig_dycast_func)(void **); -/* Structure to store information on one type */ +/* 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 */ @@ -395,66 +391,48 @@ SWIG_TypeCompare(const char *nb, const char *tb) { } +/* 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) { - if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (strcmp(iter->type->name, c) == 0) { - 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; + SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty); } -/* - Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison -*/ +/* 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 *ty) { - if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (iter->type == from) { - 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; +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, int *newmemory) { - return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); +SWIG_TypeCast(swig_cast_info *ty, void *ptr) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr); } /* @@ -725,49 +703,6 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { -/* Compatibility marcos for Python 3 */ -#if PY_VERSION_HEX >= 0x03000000 - -#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) -#define PyInt_Check(x) PyLong_Check(x) -#define PyInt_AsLong(x) PyLong_AsLong(x) -#define PyInt_FromLong(x) PyLong_FromLong(x) -#define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) - -#endif - -#ifndef Py_TYPE -# define Py_TYPE(op) ((op)->ob_type) -#endif - -/* SWIG APIs for compatibility of both Python 2 & 3 */ - -#if PY_VERSION_HEX >= 0x03000000 -# define SWIG_Python_str_FromFormat PyUnicode_FromFormat -#else -# define SWIG_Python_str_FromFormat PyString_FromFormat -#endif - -SWIGINTERN char* -SWIG_Python_str_AsChar(PyObject *str) -{ -#if PY_VERSION_HEX >= 0x03000000 - str = PyUnicode_AsUTF8String(str); - return PyBytes_AsString(str); -#else - return PyString_AsString(str); -#endif -} - -SWIGINTERN PyObject* -SWIG_Python_str_FromChar(const char *c) -{ -#if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromString(c); -#else - return PyString_FromString(c); -#endif -} /* Add PyOS_snprintf for old Pythons */ #if PY_VERSION_HEX < 0x02020000 @@ -814,7 +749,6 @@ PyString_FromFormat(const char *fmt, ...) { # define PyObject_GenericGetAttr 0 # endif #endif - /* Py_NotImplemented is defined in 2.1 and up. */ #if PY_VERSION_HEX < 0x02010000 # ifndef Py_NotImplemented @@ -822,6 +756,7 @@ PyString_FromFormat(const char *fmt, ...) { # endif #endif + /* A crude PyString_AsStringAndSize implementation for old Pythons */ #if PY_VERSION_HEX < 0x02010000 # ifndef PyString_AsStringAndSize @@ -836,6 +771,7 @@ PyString_FromFormat(const char *fmt, ...) { # endif #endif + /* PyBool_FromLong for old Pythons */ #if PY_VERSION_HEX < 0x02030000 static @@ -916,15 +852,16 @@ SWIG_Python_AddErrorMsg(const char* mesg) PyObject *old_str = PyObject_Str(value); PyErr_Clear(); Py_XINCREF(type); - - PyErr_Format(type, "%s %s", SWIG_Python_str_AsChar(old_str), mesg); + PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg); Py_DECREF(old_str); Py_DECREF(value); } else { - PyErr_SetString(PyExc_RuntimeError, mesg); + PyErr_Format(PyExc_RuntimeError, mesg); } } + + #if defined(SWIG_PYTHON_NO_THREADS) # if defined(SWIG_PYTHON_THREADS) # undef SWIG_PYTHON_THREADS @@ -1021,20 +958,6 @@ typedef struct swig_const_info { swig_type_info **ptype; } swig_const_info; - -/* ----------------------------------------------------------------------------- - * Wrapper of PyInstanceMethod_New() used in Python 3 - * It is exported to the generated module, used for -fastproxy - * ----------------------------------------------------------------------------- */ -SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *self, PyObject *func) -{ -#if PY_VERSION_HEX >= 0x03000000 - return PyInstanceMethod_New(func); -#else - return NULL; -#endif -} - #ifdef __cplusplus #if 0 { /* cc-mode */ @@ -1087,7 +1010,7 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *self, PyObject *func) #define SWIG_GetModule(clientdata) SWIG_Python_GetModule() #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) -#define SWIG_NewClientData(obj) SwigPyClientData_New(obj) +#define SWIG_NewClientData(obj) PySwigClientData_New(obj) #define SWIG_SetErrorObj SWIG_Python_SetErrorObj #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg @@ -1283,7 +1206,7 @@ SWIG_Py_Void(void) return none; } -/* SwigPyClientData */ +/* PySwigClientData */ typedef struct { PyObject *klass; @@ -1292,30 +1215,30 @@ typedef struct { PyObject *destroy; int delargs; int implicitconv; -} SwigPyClientData; +} PySwigClientData; SWIGRUNTIMEINLINE int SWIG_Python_CheckImplicit(swig_type_info *ty) { - SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; + PySwigClientData *data = (PySwigClientData *)ty->clientdata; return data ? data->implicitconv : 0; } SWIGRUNTIMEINLINE PyObject * SWIG_Python_ExceptionType(swig_type_info *desc) { - SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; + PySwigClientData *data = desc ? (PySwigClientData *) desc->clientdata : 0; PyObject *klass = data ? data->klass : 0; return (klass ? klass : PyExc_RuntimeError); } -SWIGRUNTIME SwigPyClientData * -SwigPyClientData_New(PyObject* obj) +SWIGRUNTIME PySwigClientData * +PySwigClientData_New(PyObject* obj) { if (!obj) { return 0; } else { - SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); + PySwigClientData *data = (PySwigClientData *)malloc(sizeof(PySwigClientData)); /* the klass element */ data->klass = obj; Py_INCREF(data->klass); @@ -1363,14 +1286,14 @@ SwigPyClientData_New(PyObject* obj) } SWIGRUNTIME void -SwigPyClientData_Del(SwigPyClientData* data) +PySwigClientData_Del(PySwigClientData* data) { Py_XDECREF(data->newraw); Py_XDECREF(data->newargs); Py_XDECREF(data->destroy); } -/* =============== SwigPyObject =====================*/ +/* =============== PySwigObject =====================*/ typedef struct { PyObject_HEAD @@ -1378,28 +1301,24 @@ typedef struct { swig_type_info *ty; int own; PyObject *next; -} SwigPyObject; +} PySwigObject; SWIGRUNTIME PyObject * -SwigPyObject_long(SwigPyObject *v) +PySwigObject_long(PySwigObject *v) { return PyLong_FromVoidPtr(v->ptr); } SWIGRUNTIME PyObject * -SwigPyObject_format(const char* fmt, SwigPyObject *v) +PySwigObject_format(const char* fmt, PySwigObject *v) { PyObject *res = NULL; PyObject *args = PyTuple_New(1); if (args) { - if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { - PyObject *ofmt = SWIG_Python_str_FromChar(fmt); + if (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0) { + PyObject *ofmt = PyString_FromString(fmt); if (ofmt) { -#if PY_VERSION_HEX >= 0x03000000 - res = PyUnicode_Format(ofmt,args); -#else res = PyString_Format(ofmt,args); -#endif Py_DECREF(ofmt); } Py_DECREF(args); @@ -1409,56 +1328,49 @@ SwigPyObject_format(const char* fmt, SwigPyObject *v) } SWIGRUNTIME PyObject * -SwigPyObject_oct(SwigPyObject *v) +PySwigObject_oct(PySwigObject *v) { - return SwigPyObject_format("%o",v); + return PySwigObject_format("%o",v); } SWIGRUNTIME PyObject * -SwigPyObject_hex(SwigPyObject *v) +PySwigObject_hex(PySwigObject *v) { - return SwigPyObject_format("%x",v); + return PySwigObject_format("%x",v); } SWIGRUNTIME PyObject * #ifdef METH_NOARGS -SwigPyObject_repr(SwigPyObject *v) +PySwigObject_repr(PySwigObject *v) #else -SwigPyObject_repr(SwigPyObject *v, PyObject *args) +PySwigObject_repr(PySwigObject *v, PyObject *args) #endif { const char *name = SWIG_TypePrettyName(v->ty); - PyObject *hex = SwigPyObject_hex(v); - PyObject *repr = SWIG_Python_str_FromFormat("", name, hex); + PyObject *hex = PySwigObject_hex(v); + PyObject *repr = PyString_FromFormat("", name, PyString_AsString(hex)); Py_DECREF(hex); if (v->next) { #ifdef METH_NOARGS - PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); + PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next); #else - PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args); + PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next, args); #endif -#if PY_VERSION_HEX >= 0x03000000 - PyObject *joined = PyUnicode_Concat(repr, nrep); - Py_DecRef(repr); - Py_DecRef(nrep); - repr = joined; -#else PyString_ConcatAndDel(&repr,nrep); -#endif } return repr; } SWIGRUNTIME int -SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) +PySwigObject_print(PySwigObject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { #ifdef METH_NOARGS - PyObject *repr = SwigPyObject_repr(v); + PyObject *repr = PySwigObject_repr(v); #else - PyObject *repr = SwigPyObject_repr(v, NULL); + PyObject *repr = PySwigObject_repr(v, NULL); #endif if (repr) { - fputs(SWIG_Python_str_AsChar(repr), fp); + fputs(PyString_AsString(repr), fp); Py_DECREF(repr); return 0; } else { @@ -1467,71 +1379,53 @@ SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) } SWIGRUNTIME PyObject * -SwigPyObject_str(SwigPyObject *v) +PySwigObject_str(PySwigObject *v) { char result[SWIG_BUFFER_SIZE]; return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ? - SWIG_Python_str_FromChar(result) : 0; + PyString_FromString(result) : 0; } SWIGRUNTIME int -SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) +PySwigObject_compare(PySwigObject *v, PySwigObject *w) { void *i = v->ptr; void *j = w->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } -/* Added for Python 3.x, whould it also useful for Python 2.x? */ -SWIGRUNTIME PyObject* -SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) -{ - PyObject* res; - if( op != Py_EQ && op != Py_NE ) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - if( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ) - res = Py_True; - else - res = Py_False; - Py_INCREF(res); - return res; -} - - SWIGRUNTIME PyTypeObject* _PySwigObject_type(void); SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +PySwigObject_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type(); return type; } SWIGRUNTIMEINLINE int -SwigPyObject_Check(PyObject *op) { - return (Py_TYPE(op) == SwigPyObject_type()) - || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); +PySwigObject_Check(PyObject *op) { + return ((op)->ob_type == PySwigObject_type()) + || (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0); } SWIGRUNTIME PyObject * -SwigPyObject_New(void *ptr, swig_type_info *ty, int own); +PySwigObject_New(void *ptr, swig_type_info *ty, int own); SWIGRUNTIME void -SwigPyObject_dealloc(PyObject *v) +PySwigObject_dealloc(PyObject *v) { - SwigPyObject *sobj = (SwigPyObject *) v; + PySwigObject *sobj = (PySwigObject *) v; PyObject *next = sobj->next; - if (sobj->own == SWIG_POINTER_OWN) { + if (sobj->own) { swig_type_info *ty = sobj->ty; - SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; + PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0; PyObject *destroy = data ? data->destroy : 0; if (destroy) { /* destroy is always a VARARGS method */ PyObject *res; if (data->delargs) { /* we need to create a temporal object to carry the destroy operation */ - PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); + PyObject *tmp = PySwigObject_New(sobj->ptr, ty, 0); res = SWIG_Python_CallFunctor(destroy, tmp); Py_DECREF(tmp); } else { @@ -1540,28 +1434,27 @@ SwigPyObject_dealloc(PyObject *v) res = ((*meth)(mself, v)); } Py_XDECREF(res); - } -#if !defined(SWIG_PYTHON_SILENT_MEMLEAK) - else { + } else { const char *name = SWIG_TypePrettyName(ty); - printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); - } +#if !defined(SWIG_PYTHON_SILENT_MEMLEAK) + printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name); #endif + } } Py_XDECREF(next); PyObject_DEL(v); } SWIGRUNTIME PyObject* -SwigPyObject_append(PyObject* v, PyObject* next) +PySwigObject_append(PyObject* v, PyObject* next) { - SwigPyObject *sobj = (SwigPyObject *) v; + PySwigObject *sobj = (PySwigObject *) v; #ifndef METH_O PyObject *tmp = 0; if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; next = tmp; #endif - if (!SwigPyObject_Check(next)) { + if (!PySwigObject_Check(next)) { return NULL; } sobj->next = next; @@ -1571,12 +1464,12 @@ SwigPyObject_append(PyObject* v, PyObject* next) SWIGRUNTIME PyObject* #ifdef METH_NOARGS -SwigPyObject_next(PyObject* v) +PySwigObject_next(PyObject* v) #else -SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +PySwigObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { - SwigPyObject *sobj = (SwigPyObject *) v; + PySwigObject *sobj = (PySwigObject *) v; if (sobj->next) { Py_INCREF(sobj->next); return sobj->next; @@ -1587,30 +1480,30 @@ SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) SWIGINTERN PyObject* #ifdef METH_NOARGS -SwigPyObject_disown(PyObject *v) +PySwigObject_disown(PyObject *v) #else -SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +PySwigObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { - SwigPyObject *sobj = (SwigPyObject *)v; + PySwigObject *sobj = (PySwigObject *)v; sobj->own = 0; return SWIG_Py_Void(); } SWIGINTERN PyObject* #ifdef METH_NOARGS -SwigPyObject_acquire(PyObject *v) +PySwigObject_acquire(PyObject *v) #else -SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +PySwigObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { - SwigPyObject *sobj = (SwigPyObject *)v; + PySwigObject *sobj = (PySwigObject *)v; sobj->own = SWIG_POINTER_OWN; return SWIG_Py_Void(); } SWIGINTERN PyObject* -SwigPyObject_own(PyObject *v, PyObject *args) +PySwigObject_own(PyObject *v, PyObject *args) { PyObject *val = 0; #if (PY_VERSION_HEX < 0x02020000) @@ -1623,20 +1516,20 @@ SwigPyObject_own(PyObject *v, PyObject *args) } else { - SwigPyObject *sobj = (SwigPyObject *)v; + PySwigObject *sobj = (PySwigObject *)v; PyObject *obj = PyBool_FromLong(sobj->own); if (val) { #ifdef METH_NOARGS if (PyObject_IsTrue(val)) { - SwigPyObject_acquire(v); + PySwigObject_acquire(v); } else { - SwigPyObject_disown(v); + PySwigObject_disown(v); } #else if (PyObject_IsTrue(val)) { - SwigPyObject_acquire(v,args); + PySwigObject_acquire(v,args); } else { - SwigPyObject_disown(v,args); + PySwigObject_disown(v,args); } #endif } @@ -1647,30 +1540,30 @@ SwigPyObject_own(PyObject *v, PyObject *args) #ifdef METH_O static PyMethodDef swigobject_methods[] = { - {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, - {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, - {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, - {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, - {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, - {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, + {(char *)"disown", (PyCFunction)PySwigObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, + {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, + {(char *)"own", (PyCFunction)PySwigObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, + {(char *)"append", (PyCFunction)PySwigObject_append, METH_O, (char *)"appends another 'this' object"}, + {(char *)"next", (PyCFunction)PySwigObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, + {(char *)"__repr__",(PyCFunction)PySwigObject_repr, METH_NOARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #else static PyMethodDef swigobject_methods[] = { - {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, - {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"}, - {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, - {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, - {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, - {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, + {(char *)"disown", (PyCFunction)PySwigObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, + {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"}, + {(char *)"own", (PyCFunction)PySwigObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, + {(char *)"append", (PyCFunction)PySwigObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, + {(char *)"next", (PyCFunction)PySwigObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, + {(char *)"__repr__",(PyCFunction)PySwigObject_repr, METH_VARARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #endif #if PY_VERSION_HEX < 0x02020000 SWIGINTERN PyObject * -SwigPyObject_getattr(SwigPyObject *sobj,char *name) +PySwigObject_getattr(PySwigObject *sobj,char *name) { return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); } @@ -1680,14 +1573,11 @@ SWIGRUNTIME PyTypeObject* _PySwigObject_type(void) { static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; - static PyNumberMethods SwigPyObject_as_number = { + static PyNumberMethods PySwigObject_as_number = { (binaryfunc)0, /*nb_add*/ (binaryfunc)0, /*nb_subtract*/ (binaryfunc)0, /*nb_multiply*/ - /* nb_divide removed in Python 3 */ -#if PY_VERSION_HEX < 0x03000000 (binaryfunc)0, /*nb_divide*/ -#endif (binaryfunc)0, /*nb_remainder*/ (binaryfunc)0, /*nb_divmod*/ (ternaryfunc)0,/*nb_power*/ @@ -1701,19 +1591,13 @@ _PySwigObject_type(void) { 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ -#if PY_VERSION_HEX < 0x03000000 - 0, /*nb_coerce*/ -#endif - (unaryfunc)SwigPyObject_long, /*nb_int*/ - (unaryfunc)SwigPyObject_long, /*nb_long*/ + (coercion)0, /*nb_coerce*/ + (unaryfunc)PySwigObject_long, /*nb_int*/ + (unaryfunc)PySwigObject_long, /*nb_long*/ (unaryfunc)0, /*nb_float*/ -#if PY_VERSION_HEX < 0x03000000 - (unaryfunc)SwigPyObject_oct, /*nb_oct*/ - (unaryfunc)SwigPyObject_hex, /*nb_hex*/ -#endif -#if PY_VERSION_HEX >= 0x03000000 /* 3.0 */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ -#elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ + (unaryfunc)PySwigObject_oct, /*nb_oct*/ + (unaryfunc)PySwigObject_hex, /*nb_hex*/ +#if PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ #elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ @@ -1722,37 +1606,32 @@ _PySwigObject_type(void) { #endif }; - static PyTypeObject swigpyobject_type; + static PyTypeObject pyswigobject_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { - /* PyOjbect header changed in Python 3 */ -#if PY_VERSION_HEX >= 0x03000000 - PyVarObject_HEAD_INIT(&PyType_Type, 0) -#else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ -#endif - (char *)"SwigPyObject", /* tp_name */ - sizeof(SwigPyObject), /* tp_basicsize */ + (char *)"PySwigObject", /* tp_name */ + sizeof(PySwigObject), /* tp_basicsize */ 0, /* tp_itemsize */ - (destructor)SwigPyObject_dealloc, /* tp_dealloc */ - (printfunc)SwigPyObject_print, /* tp_print */ + (destructor)PySwigObject_dealloc, /* tp_dealloc */ + (printfunc)PySwigObject_print, /* tp_print */ #if PY_VERSION_HEX < 0x02020000 - (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ + (getattrfunc)PySwigObject_getattr, /* tp_getattr */ #else (getattrfunc)0, /* tp_getattr */ #endif (setattrfunc)0, /* tp_setattr */ - (cmpfunc)SwigPyObject_compare, /* tp_compare */ - (reprfunc)SwigPyObject_repr, /* tp_repr */ - &SwigPyObject_as_number, /* tp_as_number */ + (cmpfunc)PySwigObject_compare, /* tp_compare */ + (reprfunc)PySwigObject_repr, /* tp_repr */ + &PySwigObject_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ - (reprfunc)SwigPyObject_str, /* tp_str */ + (reprfunc)PySwigObject_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ @@ -1760,7 +1639,7 @@ _PySwigObject_type(void) { swigobject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ - (richcmpfunc)SwigPyObject_richcompare, /* tp_richcompare */ + 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ @@ -1777,11 +1656,11 @@ _PySwigObject_type(void) { 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ - 0, /* tp_is_gc */ + 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ - 0, /* tp_subclasses */ + 0, /* tp_subclasses */ 0, /* tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 @@ -1791,20 +1670,17 @@ _PySwigObject_type(void) { 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; - swigpyobject_type = tmp; - /* for Python 3 we already assigned the ob_type in PyVarObject_HEAD_INIT() */ -#if PY_VERSION_HEX < 0x03000000 - swigpyobject_type.ob_type = &PyType_Type; -#endif + pyswigobject_type = tmp; + pyswigobject_type.ob_type = &PyType_Type; type_init = 1; } - return &swigpyobject_type; + return &pyswigobject_type; } SWIGRUNTIME PyObject * -SwigPyObject_New(void *ptr, swig_type_info *ty, int own) +PySwigObject_New(void *ptr, swig_type_info *ty, int own) { - SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); + PySwigObject *sobj = PyObject_NEW(PySwigObject, PySwigObject_type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; @@ -1823,10 +1699,10 @@ typedef struct { void *pack; swig_type_info *ty; size_t size; -} SwigPyPacked; +} PySwigPacked; SWIGRUNTIME int -SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) +PySwigPacked_print(PySwigPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char result[SWIG_BUFFER_SIZE]; fputs("pack, v->size, 0, sizeof(result))) { - return SWIG_Python_str_FromFormat("", result, v->ty->name); + return PyString_FromFormat("", result, v->ty->name); } else { - return SWIG_Python_str_FromFormat("", v->ty->name); + return PyString_FromFormat("", v->ty->name); } } SWIGRUNTIME PyObject * -SwigPyPacked_str(SwigPyPacked *v) +PySwigPacked_str(PySwigPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ - return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); + return PyString_FromFormat("%s%s", result, v->ty->name); } else { - return SWIG_Python_str_FromChar(v->ty->name); + return PyString_FromString(v->ty->name); } } SWIGRUNTIME int -SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) +PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w) { size_t i = v->size; size_t j = w->size; @@ -1873,22 +1749,22 @@ SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void); SWIGRUNTIME PyTypeObject* -SwigPyPacked_type(void) { +PySwigPacked_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type(); return type; } SWIGRUNTIMEINLINE int -SwigPyPacked_Check(PyObject *op) { +PySwigPacked_Check(PyObject *op) { return ((op)->ob_type == _PySwigPacked_type()) - || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); + || (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0); } SWIGRUNTIME void -SwigPyPacked_dealloc(PyObject *v) +PySwigPacked_dealloc(PyObject *v) { - if (SwigPyPacked_Check(v)) { - SwigPyPacked *sobj = (SwigPyPacked *) v; + if (PySwigPacked_Check(v)) { + PySwigPacked *sobj = (PySwigPacked *) v; free(sobj->pack); } PyObject_DEL(v); @@ -1897,33 +1773,28 @@ SwigPyPacked_dealloc(PyObject *v) SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void) { static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; - static PyTypeObject swigpypacked_type; + static PyTypeObject pyswigpacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { - /* PyObject header changed in Python 3 */ -#if PY_VERSION_HEX>=0x03000000 - PyVarObject_HEAD_INIT(&PyType_Type, 0) -#else PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ -#endif - (char *)"SwigPyPacked", /* tp_name */ - sizeof(SwigPyPacked), /* tp_basicsize */ + 0, /* ob_size */ + (char *)"PySwigPacked", /* tp_name */ + sizeof(PySwigPacked), /* tp_basicsize */ 0, /* tp_itemsize */ - (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ - (printfunc)SwigPyPacked_print, /* tp_print */ + (destructor)PySwigPacked_dealloc, /* tp_dealloc */ + (printfunc)PySwigPacked_print, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ - (cmpfunc)SwigPyPacked_compare, /* tp_compare */ - (reprfunc)SwigPyPacked_repr, /* tp_repr */ + (cmpfunc)PySwigPacked_compare, /* tp_compare */ + (reprfunc)PySwigPacked_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ - (reprfunc)SwigPyPacked_str, /* tp_str */ + (reprfunc)PySwigPacked_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ @@ -1962,20 +1833,17 @@ _PySwigPacked_type(void) { 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; - swigpypacked_type = tmp; - /* for Python 3 the ob_type already assigned in PyVarObject_HEAD_INIT() */ -#if PY_VERSION_HEX < 0x03000000 - swigpypacked_type.ob_type = &PyType_Type; -#endif + pyswigpacked_type = tmp; + pyswigpacked_type.ob_type = &PyType_Type; type_init = 1; } - return &swigpypacked_type; + return &pyswigpacked_type; } SWIGRUNTIME PyObject * -SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) +PySwigPacked_New(void *ptr, size_t size, swig_type_info *ty) { - SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); + PySwigPacked *sobj = PyObject_NEW(PySwigPacked, PySwigPacked_type()); if (sobj) { void *pack = malloc(size); if (pack) { @@ -1992,10 +1860,10 @@ SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) } SWIGRUNTIME swig_type_info * -SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) +PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size) { - if (SwigPyPacked_Check(obj)) { - SwigPyPacked *sobj = (SwigPyPacked *)obj; + if (PySwigPacked_Check(obj)) { + PySwigPacked *sobj = (PySwigPacked *)obj; if (sobj->size != size) return 0; memcpy(ptr, sobj->pack, size); return sobj->ty; @@ -2011,7 +1879,7 @@ SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) SWIGRUNTIMEINLINE PyObject * _SWIG_This(void) { - return SWIG_Python_str_FromChar("this"); + return PyString_FromString("this"); } SWIGRUNTIME PyObject * @@ -2023,16 +1891,11 @@ SWIG_This(void) /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ -/* TODO: I don't know how to implement the fast getset in Python 3 right now */ -#if PY_VERSION_HEX>=0x03000000 -#define SWIG_PYTHON_SLOW_GETSET_THIS -#endif - -SWIGRUNTIME SwigPyObject * +SWIGRUNTIME PySwigObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { - if (SwigPyObject_Check(pyobj)) { - return (SwigPyObject *) pyobj; + if (PySwigObject_Check(pyobj)) { + return (PySwigObject *) pyobj; } else { PyObject *obj = 0; #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) @@ -2068,12 +1931,12 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) return 0; } #endif - if (obj && !SwigPyObject_Check(obj)) { + if (obj && !PySwigObject_Check(obj)) { /* a PyObject is called 'this', try to get the 'real this' - SwigPyObject from it */ + PySwigObject from it */ return SWIG_Python_GetSwigThis(obj); } - return (SwigPyObject *)obj; + return (PySwigObject *)obj; } } @@ -2081,8 +1944,8 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject *obj, int own) { - if (own == SWIG_POINTER_OWN) { - SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); + if (own) { + PySwigObject *sobj = SWIG_Python_GetSwigThis(obj); if (sobj) { int oldown = sobj->own; sobj->own = own; @@ -2101,9 +1964,7 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int if (ptr) *ptr = 0; return SWIG_OK; } else { - SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); - if (own) - *own = 0; + PySwigObject *sobj = SWIG_Python_GetSwigThis(obj); while (sobj) { void *vptr = sobj->ptr; if (ty) { @@ -2115,17 +1976,9 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int } else { swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); if (!tc) { - sobj = (SwigPyObject *)sobj->next; + sobj = (PySwigObject *)sobj->next; } else { - if (ptr) { - int newmemory = 0; - *ptr = SWIG_TypeCast(tc,vptr,&newmemory); - if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(own); - if (own) - *own = *own | SWIG_CAST_NEW_MEMORY; - } - } + if (ptr) *ptr = SWIG_TypeCast(tc,vptr); break; } } @@ -2135,8 +1988,7 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int } } if (sobj) { - if (own) - *own = *own | sobj->own; + if (own) *own = sobj->own; if (flags & SWIG_POINTER_DISOWN) { sobj->own = 0; } @@ -2144,7 +1996,7 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int } else { int res = SWIG_ERROR; if (flags & SWIG_POINTER_IMPLICIT_CONV) { - SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; + PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0; if (data && !data->implicitconv) { PyObject *klass = data->klass; if (klass) { @@ -2157,7 +2009,7 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int impconv = 0; } if (impconv) { - SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); + PySwigObject *iobj = SWIG_Python_GetSwigThis(impconv); if (iobj) { void *vptr; res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); @@ -2201,13 +2053,8 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { } if (ty) { swig_cast_info *tc = SWIG_TypeCheck(desc,ty); - if (tc) { - int newmemory = 0; - *ptr = SWIG_TypeCast(tc,vptr,&newmemory); - assert(!newmemory); /* newmemory handling not yet implemented */ - } else { - return SWIG_ERROR; - } + if (!tc) return SWIG_ERROR; + *ptr = SWIG_TypeCast(tc,vptr); } else { *ptr = vptr; } @@ -2219,7 +2066,7 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { SWIGRUNTIME int SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { - swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); + swig_type_info *to = PySwigPacked_UnpackData(obj, ptr, sz); if (!to) return SWIG_ERROR; if (ty) { if (to != ty) { @@ -2241,7 +2088,7 @@ SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *t */ SWIGRUNTIME PyObject* -SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) +SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this) { #if (PY_VERSION_HEX >= 0x02020000) PyObject *inst = 0; @@ -2265,17 +2112,10 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) #endif } } else { -#if PY_VERSION_HEX >= 0x03000000 - inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); - Py_INCREF(data->newargs); - PyObject_SetAttr(inst, SWIG_This(), swig_this); - Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; -#else PyObject *dict = PyDict_New(); PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); -#endif } return inst; #else @@ -2338,9 +2178,9 @@ SWIG_Python_InitShadowInstance(PyObject *args) { if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) { return NULL; } else { - SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); + PySwigObject *sthis = SWIG_Python_GetSwigThis(obj[0]); if (sthis) { - SwigPyObject_append((PyObject*) sthis, obj[1]); + PySwigObject_append((PyObject*) sthis, obj[1]); } else { SWIG_Python_SetSwigThis(obj[0], obj[1]); } @@ -2356,8 +2196,8 @@ SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) { return SWIG_Py_Void(); } else { int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; - PyObject *robj = SwigPyObject_New(ptr, type, own); - SwigPyClientData *clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; + PyObject *robj = PySwigObject_New(ptr, type, own); + PySwigClientData *clientdata = type ? (PySwigClientData *)(type->clientdata) : 0; if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); if (inst) { @@ -2373,7 +2213,7 @@ SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) { SWIGRUNTIMEINLINE PyObject * SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { - return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); + return ptr ? PySwigPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); } /* -----------------------------------------------------------------------------* @@ -2444,8 +2284,8 @@ SWIG_Python_DestroyModule(void *vptr) for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { - SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; - if (data) SwigPyClientData_Del(data); + PySwigClientData *data = (PySwigClientData *) ty->clientdata; + if (data) PySwigClientData_Del(data); } } Py_DECREF(SWIG_This()); @@ -2455,13 +2295,8 @@ SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */ -#if PY_VERSION_HEX >= 0x03000000 - /* Add a dummy module object into sys.modules */ - PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION); -#else PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); -#endif PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); if (pointer && module) { PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); @@ -2481,7 +2316,7 @@ SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { PyObject *cache = SWIG_Python_TypeCache(); - PyObject *key = SWIG_Python_str_FromChar(type); + PyObject *key = PyString_FromString(type); PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { @@ -2519,9 +2354,9 @@ SWIG_Python_AddErrMesg(const char* mesg, int infront) Py_XINCREF(type); PyErr_Clear(); if (infront) { - PyErr_Format(type, "%s %s", mesg, SWIG_Python_str_AsChar(old_str)); + PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str)); } else { - PyErr_Format(type, "%s %s", SWIG_Python_str_AsChar(old_str), mesg); + PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg); } Py_DECREF(old_str); } @@ -2545,9 +2380,9 @@ SWIG_Python_ArgFail(int argnum) } SWIGRUNTIMEINLINE const char * -SwigPyObject_GetDesc(PyObject *self) +PySwigObject_GetDesc(PyObject *self) { - SwigPyObject *v = (SwigPyObject *)self; + PySwigObject *v = (PySwigObject *)self; swig_type_info *ty = v ? v->ty : 0; return ty ? ty->str : (char*)""; } @@ -2557,10 +2392,10 @@ SWIG_Python_TypeError(const char *type, PyObject *obj) { if (type) { #if defined(SWIG_COBJECT_TYPES) - if (obj && SwigPyObject_Check(obj)) { - const char *otype = (const char *) SwigPyObject_GetDesc(obj); + if (obj && PySwigObject_Check(obj)) { + const char *otype = (const char *) PySwigObject_GetDesc(obj); if (otype) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", + PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received", type, otype); return; } @@ -2570,7 +2405,7 @@ SWIG_Python_TypeError(const char *type, PyObject *obj) const char *otype = (obj ? obj->ob_type->tp_name : 0); if (otype) { PyObject *str = PyObject_Str(obj); - const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; + const char *cstr = str ? PyString_AsString(str) : 0; if (cstr) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", type, otype, cstr); @@ -2646,16 +2481,11 @@ static swig_module_info swig_module = {swig_types, 9, 0, 0, 0, 0}; /*----------------------------------------------- @(target):= _unbound.so ------------------------------------------------*/ -#if PY_VERSION_HEX >= 0x03000000 -# define SWIG_init PyInit__unbound +#define SWIG_init init_unbound -#else -# define SWIG_init init_unbound - -#endif #define SWIG_name "_unbound" -#define SWIGVERSION 0x010338 +#define SWIGVERSION 0x010333 #define SWIG_VERSION SWIGVERSION @@ -2859,20 +2689,10 @@ SWIG_pchar_descriptor(void) SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) { -#if PY_VERSION_HEX>=0x03000000 - if (PyUnicode_Check(obj)) -#else - if (PyString_Check(obj)) -#endif - { + if (PyString_Check(obj)) { char *cstr; Py_ssize_t len; -#if PY_VERSION_HEX>=0x03000000 - obj = PyUnicode_AsUTF8String(obj); - PyBytes_AsStringAndSize(obj, &cstr, &len); -#else PyString_AsStringAndSize(obj, &cstr, &len); -#endif - if (cptr) { + if (cptr) { if (alloc) { /* In python the user should not be able to modify the inner @@ -2897,7 +2717,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) *alloc = SWIG_OLDOBJ; } } else { - *cptr = SWIG_Python_str_AsChar(obj); + *cptr = PyString_AsString(obj); } } if (psize) *psize = len + 1; @@ -2930,11 +2750,7 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size) return pchar_descriptor ? SWIG_NewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void(); } else { -#if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromStringAndSize(carray, (int)(size)); -#else return PyString_FromStringAndSize(carray, (int)(size)); -#endif } } else { return SWIG_Py_Void(); @@ -3123,13 +2939,11 @@ SWIG_AsValFilePtr(PyObject *obj, FILE **val) { if ((SWIG_ConvertPtr(obj, &vptr, desc, 0)) == SWIG_OK) { if (val) *val = (FILE *)vptr; return SWIG_OK; - } -#if PY_VERSION_HEX < 0x03000000 + } if (PyFile_Check(obj)) { if (val) *val = PyFile_AsFile(obj); return SWIG_OK; } -#endif return SWIG_TypeError; } @@ -3256,10 +3070,10 @@ fail: SWIGINTERN PyObject *_wrap_ub_result_qname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; struct ub_result *arg1 = (struct ub_result *) 0 ; + char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - char *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:ub_result_qname_get",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_result, 0 | 0 ); @@ -3298,6 +3112,7 @@ SWIGINTERN PyObject *_wrap_ub_result_qtype_set(PyObject *SWIGUNUSEDPARM(self), P } arg2 = (int)(val2); if (arg1) (arg1)->qtype = arg2; + resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -3308,10 +3123,10 @@ fail: SWIGINTERN PyObject *_wrap_ub_result_qtype_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; struct ub_result *arg1 = (struct ub_result *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"O:ub_result_qtype_get",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_result, 0 | 0 ); @@ -3350,6 +3165,7 @@ SWIGINTERN PyObject *_wrap_ub_result_qclass_set(PyObject *SWIGUNUSEDPARM(self), } arg2 = (int)(val2); if (arg1) (arg1)->qclass = arg2; + resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -3360,10 +3176,10 @@ fail: SWIGINTERN PyObject *_wrap_ub_result_qclass_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; struct ub_result *arg1 = (struct ub_result *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"O:ub_result_qclass_get",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_result, 0 | 0 ); @@ -3402,6 +3218,7 @@ SWIGINTERN PyObject *_wrap_ub_result__data_set(PyObject *SWIGUNUSEDPARM(self), P } arg2 = (char **)(argp2); if (arg1) (arg1)->data = arg2; + resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -3412,10 +3229,10 @@ fail: SWIGINTERN PyObject *_wrap_ub_result__data_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; struct ub_result *arg1 = (struct ub_result *) 0 ; + char **result = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - char **result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:ub_result__data_get",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_result, 0 | 0 ); @@ -3454,6 +3271,7 @@ SWIGINTERN PyObject *_wrap_ub_result_len_set(PyObject *SWIGUNUSEDPARM(self), PyO } arg2 = (int *)(argp2); if (arg1) (arg1)->len = arg2; + resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -3464,10 +3282,10 @@ fail: SWIGINTERN PyObject *_wrap_ub_result_len_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; struct ub_result *arg1 = (struct ub_result *) 0 ; + int *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - int *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:ub_result_len_get",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_result, 0 | 0 ); @@ -3525,10 +3343,10 @@ fail: SWIGINTERN PyObject *_wrap_ub_result_canonname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; struct ub_result *arg1 = (struct ub_result *) 0 ; + char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - char *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:ub_result_canonname_get",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_result, 0 | 0 ); @@ -3567,6 +3385,7 @@ SWIGINTERN PyObject *_wrap_ub_result_rcode_set(PyObject *SWIGUNUSEDPARM(self), P } arg2 = (int)(val2); if (arg1) (arg1)->rcode = arg2; + resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -3577,10 +3396,10 @@ fail: SWIGINTERN PyObject *_wrap_ub_result_rcode_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; struct ub_result *arg1 = (struct ub_result *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"O:ub_result_rcode_get",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_result, 0 | 0 ); @@ -3617,6 +3436,7 @@ SWIGINTERN PyObject *_wrap_ub_result_answer_packet_set(PyObject *SWIGUNUSEDPARM( SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ub_result_answer_packet_set" "', argument " "2"" of type '" "void *""'"); } if (arg1) (arg1)->answer_packet = arg2; + resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -3627,10 +3447,10 @@ fail: SWIGINTERN PyObject *_wrap_ub_result_answer_packet_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; struct ub_result *arg1 = (struct ub_result *) 0 ; + void *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - void *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:ub_result_answer_packet_get",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_result, 0 | 0 ); @@ -3669,6 +3489,7 @@ SWIGINTERN PyObject *_wrap_ub_result_answer_len_set(PyObject *SWIGUNUSEDPARM(sel } arg2 = (int)(val2); if (arg1) (arg1)->answer_len = arg2; + resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -3679,10 +3500,10 @@ fail: SWIGINTERN PyObject *_wrap_ub_result_answer_len_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; struct ub_result *arg1 = (struct ub_result *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"O:ub_result_answer_len_get",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_result, 0 | 0 ); @@ -3721,6 +3542,7 @@ SWIGINTERN PyObject *_wrap_ub_result_havedata_set(PyObject *SWIGUNUSEDPARM(self) } arg2 = (int)(val2); if (arg1) (arg1)->havedata = arg2; + resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -3731,10 +3553,10 @@ fail: SWIGINTERN PyObject *_wrap_ub_result_havedata_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; struct ub_result *arg1 = (struct ub_result *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"O:ub_result_havedata_get",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_result, 0 | 0 ); @@ -3773,6 +3595,7 @@ SWIGINTERN PyObject *_wrap_ub_result_nxdomain_set(PyObject *SWIGUNUSEDPARM(self) } arg2 = (int)(val2); if (arg1) (arg1)->nxdomain = arg2; + resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -3783,10 +3606,10 @@ fail: SWIGINTERN PyObject *_wrap_ub_result_nxdomain_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; struct ub_result *arg1 = (struct ub_result *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"O:ub_result_nxdomain_get",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_result, 0 | 0 ); @@ -3825,6 +3648,7 @@ SWIGINTERN PyObject *_wrap_ub_result_secure_set(PyObject *SWIGUNUSEDPARM(self), } arg2 = (int)(val2); if (arg1) (arg1)->secure = arg2; + resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -3835,10 +3659,10 @@ fail: SWIGINTERN PyObject *_wrap_ub_result_secure_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; struct ub_result *arg1 = (struct ub_result *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"O:ub_result_secure_get",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_result, 0 | 0 ); @@ -3877,6 +3701,7 @@ SWIGINTERN PyObject *_wrap_ub_result_bogus_set(PyObject *SWIGUNUSEDPARM(self), P } arg2 = (int)(val2); if (arg1) (arg1)->bogus = arg2; + resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -3887,10 +3712,10 @@ fail: SWIGINTERN PyObject *_wrap_ub_result_bogus_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; struct ub_result *arg1 = (struct ub_result *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"O:ub_result_bogus_get",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_result, 0 | 0 ); @@ -3910,13 +3735,13 @@ SWIGINTERN PyObject *_wrap_ub_result__ub_result_data(PyObject *SWIGUNUSEDPARM(se PyObject *resultobj = 0; struct ub_result *arg1 = (struct ub_result *) 0 ; struct ub_result *arg2 = (struct ub_result *) 0 ; + PyObject *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - PyObject *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:ub_result__ub_result_data",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_result, 0 | 0 ); @@ -3939,7 +3764,7 @@ fail: SWIGINTERN PyObject *ub_result_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; + if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_ub_result, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } @@ -3983,6 +3808,7 @@ SWIGINTERN PyObject *_wrap_ub_ctx_set_option(PyObject *SWIGUNUSEDPARM(self), PyO struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -3994,7 +3820,6 @@ SWIGINTERN PyObject *_wrap_ub_ctx_set_option(PyObject *SWIGUNUSEDPARM(self), PyO PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"OOO:ub_ctx_set_option",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4028,6 +3853,7 @@ SWIGINTERN PyObject *_wrap_ub_ctx_config(PyObject *SWIGUNUSEDPARM(self), PyObjec PyObject *resultobj = 0; struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; char *arg2 = (char *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4035,7 +3861,6 @@ SWIGINTERN PyObject *_wrap_ub_ctx_config(PyObject *SWIGUNUSEDPARM(self), PyObjec int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"OO:ub_ctx_config",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4062,6 +3887,7 @@ SWIGINTERN PyObject *_wrap_ub_ctx_set_fwd(PyObject *SWIGUNUSEDPARM(self), PyObje PyObject *resultobj = 0; struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; char *arg2 = (char *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4069,7 +3895,6 @@ SWIGINTERN PyObject *_wrap_ub_ctx_set_fwd(PyObject *SWIGUNUSEDPARM(self), PyObje int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"OO:ub_ctx_set_fwd",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4096,6 +3921,7 @@ SWIGINTERN PyObject *_wrap_ub_ctx_resolvconf(PyObject *SWIGUNUSEDPARM(self), PyO PyObject *resultobj = 0; struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; char *arg2 = (char *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4103,7 +3929,6 @@ SWIGINTERN PyObject *_wrap_ub_ctx_resolvconf(PyObject *SWIGUNUSEDPARM(self), PyO int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"OO:ub_ctx_resolvconf",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4130,6 +3955,7 @@ SWIGINTERN PyObject *_wrap_ub_ctx_hosts(PyObject *SWIGUNUSEDPARM(self), PyObject PyObject *resultobj = 0; struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; char *arg2 = (char *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4137,7 +3963,6 @@ SWIGINTERN PyObject *_wrap_ub_ctx_hosts(PyObject *SWIGUNUSEDPARM(self), PyObject int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"OO:ub_ctx_hosts",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4164,6 +3989,7 @@ SWIGINTERN PyObject *_wrap_ub_ctx_add_ta(PyObject *SWIGUNUSEDPARM(self), PyObjec PyObject *resultobj = 0; struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; char *arg2 = (char *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4171,7 +3997,6 @@ SWIGINTERN PyObject *_wrap_ub_ctx_add_ta(PyObject *SWIGUNUSEDPARM(self), PyObjec int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"OO:ub_ctx_add_ta",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4198,6 +4023,7 @@ SWIGINTERN PyObject *_wrap_ub_ctx_add_ta_file(PyObject *SWIGUNUSEDPARM(self), Py PyObject *resultobj = 0; struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; char *arg2 = (char *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4205,7 +4031,6 @@ SWIGINTERN PyObject *_wrap_ub_ctx_add_ta_file(PyObject *SWIGUNUSEDPARM(self), Py int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"OO:ub_ctx_add_ta_file",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4232,6 +4057,7 @@ SWIGINTERN PyObject *_wrap_ub_ctx_trustedkeys(PyObject *SWIGUNUSEDPARM(self), Py PyObject *resultobj = 0; struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; char *arg2 = (char *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4239,7 +4065,6 @@ SWIGINTERN PyObject *_wrap_ub_ctx_trustedkeys(PyObject *SWIGUNUSEDPARM(self), Py int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"OO:ub_ctx_trustedkeys",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4266,12 +4091,12 @@ SWIGINTERN PyObject *_wrap_ub_ctx_debugout__SWIG_0(PyObject *SWIGUNUSEDPARM(self PyObject *resultobj = 0; struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; void *arg2 = (void *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; int res2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"OO:ub_ctx_debugout",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4295,13 +4120,13 @@ SWIGINTERN PyObject *_wrap_ub_ctx_debuglevel(PyObject *SWIGUNUSEDPARM(self), PyO PyObject *resultobj = 0; struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; int arg2 ; + int result; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"OO:ub_ctx_debuglevel",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4326,13 +4151,13 @@ SWIGINTERN PyObject *_wrap_ub_ctx_async(PyObject *SWIGUNUSEDPARM(self), PyObject PyObject *resultobj = 0; struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; int arg2 ; + int result; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"OO:ub_ctx_async",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4356,10 +4181,10 @@ fail: SWIGINTERN PyObject *_wrap_ub_poll(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"O:ub_poll",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4378,10 +4203,10 @@ fail: SWIGINTERN PyObject *_wrap_ub_wait(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"O:ub_wait",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4400,10 +4225,10 @@ fail: SWIGINTERN PyObject *_wrap_ub_fd(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"O:ub_fd",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4422,10 +4247,10 @@ fail: SWIGINTERN PyObject *_wrap_ub_process(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"O:ub_process",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4448,6 +4273,7 @@ SWIGINTERN PyObject *_wrap_ub_resolve(PyObject *SWIGUNUSEDPARM(self), PyObject * int arg3 ; int arg4 ; struct ub_result **arg5 = (struct ub_result **) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4461,7 +4287,6 @@ SWIGINTERN PyObject *_wrap_ub_resolve(PyObject *SWIGUNUSEDPARM(self), PyObject * PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; - int result; struct ub_result* newubr; arg5 = &newubr; @@ -4520,6 +4345,7 @@ SWIGINTERN PyObject *_wrap_ub_resolve_async(PyObject *SWIGUNUSEDPARM(self), PyOb void *arg5 = (void *) 0 ; ub_callback_t arg6 = (ub_callback_t) 0 ; int *arg7 = (int *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4539,7 +4365,6 @@ SWIGINTERN PyObject *_wrap_ub_resolve_async(PyObject *SWIGUNUSEDPARM(self), PyOb PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:ub_resolve_async",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4591,13 +4416,13 @@ SWIGINTERN PyObject *_wrap_ub_cancel(PyObject *SWIGUNUSEDPARM(self), PyObject *a PyObject *resultobj = 0; struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; int arg2 ; + int result; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"OO:ub_cancel",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4642,10 +4467,10 @@ fail: SWIGINTERN PyObject *_wrap_ub_strerror(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; + char *result = 0 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; - char *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:ub_strerror",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); @@ -4664,10 +4489,10 @@ fail: SWIGINTERN PyObject *_wrap_ub_ctx_print_local_zones(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"O:ub_ctx_print_local_zones",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4688,6 +4513,7 @@ SWIGINTERN PyObject *_wrap_ub_ctx_zone_add(PyObject *SWIGUNUSEDPARM(self), PyObj struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4699,7 +4525,6 @@ SWIGINTERN PyObject *_wrap_ub_ctx_zone_add(PyObject *SWIGUNUSEDPARM(self), PyObj PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"OOO:ub_ctx_zone_add",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4733,6 +4558,7 @@ SWIGINTERN PyObject *_wrap_ub_ctx_zone_remove(PyObject *SWIGUNUSEDPARM(self), Py PyObject *resultobj = 0; struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; char *arg2 = (char *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4740,7 +4566,6 @@ SWIGINTERN PyObject *_wrap_ub_ctx_zone_remove(PyObject *SWIGUNUSEDPARM(self), Py int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"OO:ub_ctx_zone_remove",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4767,6 +4592,7 @@ SWIGINTERN PyObject *_wrap_ub_ctx_data_add(PyObject *SWIGUNUSEDPARM(self), PyObj PyObject *resultobj = 0; struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; char *arg2 = (char *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4774,7 +4600,6 @@ SWIGINTERN PyObject *_wrap_ub_ctx_data_add(PyObject *SWIGUNUSEDPARM(self), PyObj int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"OO:ub_ctx_data_add",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4801,6 +4626,7 @@ SWIGINTERN PyObject *_wrap_ub_ctx_data_remove(PyObject *SWIGUNUSEDPARM(self), Py PyObject *resultobj = 0; struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; char *arg2 = (char *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4808,7 +4634,6 @@ SWIGINTERN PyObject *_wrap_ub_ctx_data_remove(PyObject *SWIGUNUSEDPARM(self), Py int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"OO:ub_ctx_data_remove",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4833,7 +4658,7 @@ fail: SWIGINTERN PyObject *ub_ctx_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; + if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_ub_ctx, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } @@ -4842,13 +4667,13 @@ SWIGINTERN PyObject *_wrap_ub_ctx_debugout__SWIG_1(PyObject *SWIGUNUSEDPARM(self PyObject *resultobj = 0; struct ub_ctx *arg1 = (struct ub_ctx *) 0 ; FILE *arg2 = (FILE *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; FILE *val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - int result; if (!PyArg_ParseTuple(args,(char *)"OO:ub_ctx_debugout",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ub_ctx, 0 | 0 ); @@ -4910,10 +4735,7 @@ SWIGINTERN PyObject *_wrap_ub_ctx_debugout(PyObject *self, PyObject *args) { } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'ub_ctx_debugout'.\n" - " Possible C/C++ prototypes are:\n" - " ub_ctx_debugout(struct ub_ctx *,void *)\n" - " ub_ctx_debugout(struct ub_ctx *,FILE *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'ub_ctx_debugout'.\n Possible C/C++ prototypes are:\n"" ub_ctx_debugout(struct ub_ctx *,void *)\n"" ub_ctx_debugout(struct ub_ctx *,FILE *)\n"); return NULL; } @@ -4927,6 +4749,7 @@ SWIGINTERN PyObject *_wrap__ub_resolve_async(PyObject *SWIGUNUSEDPARM(self), PyO void *arg5 = (void *) 0 ; PyObject *arg6 = (PyObject *) 0 ; int *arg7 = (int *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4942,7 +4765,6 @@ SWIGINTERN PyObject *_wrap__ub_resolve_async(PyObject *SWIGUNUSEDPARM(self), PyO PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; - int result; int asyncid = -1; arg7 = &asyncid; @@ -4992,7 +4814,6 @@ fail: static PyMethodDef SwigMethods[] = { - { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL}, { (char *)"ub_ctx_free_dbg", _wrap_ub_ctx_free_dbg, METH_VARARGS, NULL}, { (char *)"ub_resolve_free_dbg", _wrap_ub_resolve_free_dbg, METH_VARARGS, NULL}, { (char *)"ub_result_qname_set", _wrap_ub_result_qname_set, METH_VARARGS, NULL}, @@ -5168,7 +4989,7 @@ SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; - int found, init; + int found; clientdata = clientdata; @@ -5178,9 +4999,6 @@ SWIG_InitializeModule(void *clientdata) { swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; swig_module.next = &swig_module; - init = 1; - } else { - init = 0; } /* Try and load any already created modules */ @@ -5209,12 +5027,6 @@ SWIG_InitializeModule(void *clientdata) { module_head->next = &swig_module; } - /* When multiple interpeters are used, a module could have already been initialized in - a different interpreter, but not yet have a pointer in this interpreter. - In this case, we do not want to continue adding types... everything should be - set up already */ - if (init == 0) return; - /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); @@ -5377,48 +5189,18 @@ extern "C" { SWIGINTERN PyObject * swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { -#if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_InternFromString(""); -#else return PyString_FromString(""); -#endif } SWIGINTERN PyObject * swig_varlink_str(swig_varlinkobject *v) { -#if PY_VERSION_HEX >= 0x03000000 - PyObject *str = PyUnicode_InternFromString("("); - PyObject *tail; - PyObject *joined; - swig_globalvar *var; - for (var = v->vars; var; var=var->next) { - tail = PyUnicode_FromString(var->name); - joined = PyUnicode_Concat(str, tail); - Py_DecRef(str); - Py_DecRef(tail); - str = joined; - if (var->next) { - tail = PyUnicode_InternFromString(", "); - joined = PyUnicode_Concat(str, tail); - Py_DecRef(str); - Py_DecRef(tail); - str = joined; - } - } - tail = PyUnicode_InternFromString(")"); - joined = PyUnicode_Concat(str, tail); - Py_DecRef(str); - Py_DecRef(tail); - str = joined; -#else PyObject *str = PyString_FromString("("); - swig_globalvar *var; + swig_globalvar *var; for (var = v->vars; var; var=var->next) { PyString_ConcatAndDel(&str,PyString_FromString(var->name)); if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); } PyString_ConcatAndDel(&str,PyString_FromString(")")); -#endif return str; } @@ -5426,7 +5208,7 @@ extern "C" { swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { PyObject *str = swig_varlink_str(v); fprintf(fp,"Swig global variables "); - fprintf(fp,"%s\n", SWIG_Python_str_AsChar(str)); + fprintf(fp,"%s\n", PyString_AsString(str)); Py_DECREF(str); return 0; } @@ -5484,13 +5266,8 @@ extern "C" { if (!type_init) { const PyTypeObject tmp = { - /* PyObject header changed in Python 3 */ -#if PY_VERSION_HEX >= 0x03000000 - PyVarObject_HEAD_INIT(&PyType_Type, 0) -#else PyObject_HEAD_INIT(NULL) 0, /* Number of items in variable part (ob_size) */ -#endif (char *)"swigvarlink", /* Type name (tp_name) */ sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */ 0, /* Itemsize (tp_itemsize) */ @@ -5526,10 +5303,7 @@ extern "C" { #endif }; varlink_type = tmp; - /* for Python 3 we already assigned the ob_type in PyVarObject_HEAD_INIT() */ -#if PY_VERSION_HEX < 0x03000000 varlink_type.ob_type = &PyType_Type; -#endif type_init = 1; } return &varlink_type; @@ -5654,35 +5428,13 @@ extern "C" { #ifdef __cplusplus extern "C" #endif - -SWIGEXPORT -#if PY_VERSION_HEX >= 0x03000000 -PyObject* -#else -void -#endif -SWIG_init(void) { +SWIGEXPORT void SWIG_init(void) { PyObject *m, *d; /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); -#if PY_VERSION_HEX >= 0x03000000 - static struct PyModuleDef SWIG_module = { - PyModuleDef_HEAD_INIT, - (char *) SWIG_name, - NULL, - -1, - SwigMethods, - NULL, - NULL, - NULL, - NULL - }; - m = PyModule_Create(&SWIG_module); -#else m = Py_InitModule((char *) SWIG_name, SwigMethods); -#endif d = PyModule_GetDict(m); SWIG_InitializeModule(0); @@ -5767,10 +5519,5 @@ SWIG_init(void) { SWIG_Python_SetConstant(d, "RCODE_NXRRSET",SWIG_From_int((int)(RCODE_NXRRSET))); SWIG_Python_SetConstant(d, "RCODE_NOTAUTH",SWIG_From_int((int)(RCODE_NOTAUTH))); SWIG_Python_SetConstant(d, "RCODE_NOTZONE",SWIG_From_int((int)(RCODE_NOTZONE))); -#if PY_VERSION_HEX >= 0x03000000 - return m; -#else - return; -#endif } diff --git a/doc/Changelog b/doc/Changelog index dc784a588..d70f92658 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -2,6 +2,7 @@ - ignore swig varargs warnings with gcc. - remove duplicate example.conf text from python example configs. - outofdir compile fix for python. + - pyunbound works. 25 March 2009: Wouter - initial import of the python contribution from Zdenek Vasicek and