1/* ----------------------------------------------------------------------------- 2 * See the LICENSE file for information on copyright, usage and redistribution 3 * of SWIG, and the README file for authors - http://www.swig.org/release.html. 4 * 5 * pyrun.swg 6 * 7 * This file contains the runtime support for Python modules 8 * and includes code for managing global variables and pointer 9 * type checking. 10 * 11 * ----------------------------------------------------------------------------- */ 12 13/* Common SWIG API */ 14 15/* for raw pointers */ 16#define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) 17#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) 18#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) 19#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags) 20#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) 21#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) 22#define swig_owntype int 23 24/* for raw packed data */ 25#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) 26#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) 27 28/* for class or struct pointers */ 29#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) 30#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) 31 32/* for C or C++ function pointers */ 33#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) 34#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(ptr, type, 0) 35 36/* for C++ member pointers, ie, member methods */ 37#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) 38#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) 39 40 41/* Runtime API */ 42 43#define SWIG_GetModule(clientdata) SWIG_Python_GetModule() 44#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) 45#define SWIG_NewClientData(obj) SwigPyClientData_New(obj) 46 47#define SWIG_SetErrorObj SWIG_Python_SetErrorObj 48#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg 49#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) 50#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) 51#define SWIG_fail goto fail 52 53 54/* Runtime API implementation */ 55 56/* Error manipulation */ 57 58SWIGINTERN void 59SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { 60 SWIG_PYTHON_THREAD_BEGIN_BLOCK; 61 PyErr_SetObject(errtype, obj); 62 Py_DECREF(obj); 63 SWIG_PYTHON_THREAD_END_BLOCK; 64} 65 66SWIGINTERN void 67SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { 68 SWIG_PYTHON_THREAD_BEGIN_BLOCK; 69 PyErr_SetString(errtype, (char *) msg); 70 SWIG_PYTHON_THREAD_END_BLOCK; 71} 72 73#define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) 74 75/* Set a constant value */ 76 77SWIGINTERN void 78SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { 79 PyDict_SetItemString(d, (char*) name, obj); 80 Py_DECREF(obj); 81} 82 83/* Append a value to the result obj */ 84 85SWIGINTERN PyObject* 86SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { 87#if !defined(SWIG_PYTHON_OUTPUT_TUPLE) 88 if (!result) { 89 result = obj; 90 } else if (result == Py_None) { 91 Py_DECREF(result); 92 result = obj; 93 } else { 94 if (!PyList_Check(result)) { 95 PyObject *o2 = result; 96 result = PyList_New(1); 97 PyList_SetItem(result, 0, o2); 98 } 99 PyList_Append(result,obj); 100 Py_DECREF(obj); 101 } 102 return result; 103#else 104 PyObject* o2; 105 PyObject* o3; 106 if (!result) { 107 result = obj; 108 } else if (result == Py_None) { 109 Py_DECREF(result); 110 result = obj; 111 } else { 112 if (!PyTuple_Check(result)) { 113 o2 = result; 114 result = PyTuple_New(1); 115 PyTuple_SET_ITEM(result, 0, o2); 116 } 117 o3 = PyTuple_New(1); 118 PyTuple_SET_ITEM(o3, 0, obj); 119 o2 = result; 120 result = PySequence_Concat(o2, o3); 121 Py_DECREF(o2); 122 Py_DECREF(o3); 123 } 124 return result; 125#endif 126} 127 128/* Unpack the argument tuple */ 129 130SWIGINTERN int 131SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) 132{ 133 if (!args) { 134 if (!min && !max) { 135 return 1; 136 } else { 137 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", 138 name, (min == max ? "" : "at least "), (int)min); 139 return 0; 140 } 141 } 142 if (!PyTuple_Check(args)) { 143 PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); 144 return 0; 145 } else { 146 register Py_ssize_t l = PyTuple_GET_SIZE(args); 147 if (l < min) { 148 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 149 name, (min == max ? "" : "at least "), (int)min, (int)l); 150 return 0; 151 } else if (l > max) { 152 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 153 name, (min == max ? "" : "at most "), (int)max, (int)l); 154 return 0; 155 } else { 156 register int i; 157 for (i = 0; i < l; ++i) { 158 objs[i] = PyTuple_GET_ITEM(args, i); 159 } 160 for (; l < max; ++l) { 161 objs[l] = 0; 162 } 163 return i + 1; 164 } 165 } 166} 167 168/* A functor is a function object with one single object argument */ 169#if PY_VERSION_HEX >= 0x02020000 170#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); 171#else 172#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj); 173#endif 174 175/* 176 Helper for static pointer initialization for both C and C++ code, for example 177 static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); 178*/ 179#ifdef __cplusplus 180#define SWIG_STATIC_POINTER(var) var 181#else 182#define SWIG_STATIC_POINTER(var) var = 0; if (!var) var 183#endif 184 185/* ----------------------------------------------------------------------------- 186 * Pointer declarations 187 * ----------------------------------------------------------------------------- */ 188 189/* Flags for new pointer objects */ 190#define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) 191#define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) 192 193#define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) 194 195#ifdef __cplusplus 196extern "C" { 197#if 0 198} /* cc-mode */ 199#endif 200#endif 201 202/* How to access Py_None */ 203#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) 204# ifndef SWIG_PYTHON_NO_BUILD_NONE 205# ifndef SWIG_PYTHON_BUILD_NONE 206# define SWIG_PYTHON_BUILD_NONE 207# endif 208# endif 209#endif 210 211#ifdef SWIG_PYTHON_BUILD_NONE 212# ifdef Py_None 213# undef Py_None 214# define Py_None SWIG_Py_None() 215# endif 216SWIGRUNTIMEINLINE PyObject * 217_SWIG_Py_None(void) 218{ 219 PyObject *none = Py_BuildValue((char*)""); 220 Py_DECREF(none); 221 return none; 222} 223SWIGRUNTIME PyObject * 224SWIG_Py_None(void) 225{ 226 static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); 227 return none; 228} 229#endif 230 231/* The python void return value */ 232 233SWIGRUNTIMEINLINE PyObject * 234SWIG_Py_Void(void) 235{ 236 PyObject *none = Py_None; 237 Py_INCREF(none); 238 return none; 239} 240 241/* SwigPyClientData */ 242 243typedef struct { 244 PyObject *klass; 245 PyObject *newraw; 246 PyObject *newargs; 247 PyObject *destroy; 248 int delargs; 249 int implicitconv; 250} SwigPyClientData; 251 252SWIGRUNTIMEINLINE int 253SWIG_Python_CheckImplicit(swig_type_info *ty) 254{ 255 SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; 256 return data ? data->implicitconv : 0; 257} 258 259SWIGRUNTIMEINLINE PyObject * 260SWIG_Python_ExceptionType(swig_type_info *desc) { 261 SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; 262 PyObject *klass = data ? data->klass : 0; 263 return (klass ? klass : PyExc_RuntimeError); 264} 265 266 267SWIGRUNTIME SwigPyClientData * 268SwigPyClientData_New(PyObject* obj) 269{ 270 if (!obj) { 271 return 0; 272 } else { 273 SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); 274 /* the klass element */ 275 data->klass = obj; 276 Py_INCREF(data->klass); 277 /* the newraw method and newargs arguments used to create a new raw instance */ 278 if (PyClass_Check(obj)) { 279 data->newraw = 0; 280 data->newargs = obj; 281 Py_INCREF(obj); 282 } else { 283#if (PY_VERSION_HEX < 0x02020000) 284 data->newraw = 0; 285#else 286 data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__"); 287#endif 288 if (data->newraw) { 289 Py_INCREF(data->newraw); 290 data->newargs = PyTuple_New(1); 291 PyTuple_SetItem(data->newargs, 0, obj); 292 } else { 293 data->newargs = obj; 294 } 295 Py_INCREF(data->newargs); 296 } 297 /* the destroy method, aka as the C++ delete method */ 298 data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__"); 299 if (PyErr_Occurred()) { 300 PyErr_Clear(); 301 data->destroy = 0; 302 } 303 if (data->destroy) { 304 int flags; 305 Py_INCREF(data->destroy); 306 flags = PyCFunction_GET_FLAGS(data->destroy); 307#ifdef METH_O 308 data->delargs = !(flags & (METH_O)); 309#else 310 data->delargs = 0; 311#endif 312 } else { 313 data->delargs = 0; 314 } 315 data->implicitconv = 0; 316 return data; 317 } 318} 319 320SWIGRUNTIME void 321SwigPyClientData_Del(SwigPyClientData* data) 322{ 323 Py_XDECREF(data->newraw); 324 Py_XDECREF(data->newargs); 325 Py_XDECREF(data->destroy); 326} 327 328/* =============== SwigPyObject =====================*/ 329 330typedef struct { 331 PyObject_HEAD 332 void *ptr; 333 swig_type_info *ty; 334 int own; 335 PyObject *next; 336} SwigPyObject; 337 338SWIGRUNTIME PyObject * 339SwigPyObject_long(SwigPyObject *v) 340{ 341 return PyLong_FromVoidPtr(v->ptr); 342} 343 344SWIGRUNTIME PyObject * 345SwigPyObject_format(const char* fmt, SwigPyObject *v) 346{ 347 PyObject *res = NULL; 348 PyObject *args = PyTuple_New(1); 349 if (args) { 350 if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { 351 PyObject *ofmt = SWIG_Python_str_FromChar(fmt); 352 if (ofmt) { 353#if PY_VERSION_HEX >= 0x03000000 354 res = PyUnicode_Format(ofmt,args); 355#else 356 res = PyString_Format(ofmt,args); 357#endif 358 Py_DECREF(ofmt); 359 } 360 Py_DECREF(args); 361 } 362 } 363 return res; 364} 365 366SWIGRUNTIME PyObject * 367SwigPyObject_oct(SwigPyObject *v) 368{ 369 return SwigPyObject_format("%o",v); 370} 371 372SWIGRUNTIME PyObject * 373SwigPyObject_hex(SwigPyObject *v) 374{ 375 return SwigPyObject_format("%x",v); 376} 377 378SWIGRUNTIME PyObject * 379#ifdef METH_NOARGS 380SwigPyObject_repr(SwigPyObject *v) 381#else 382SwigPyObject_repr(SwigPyObject *v, PyObject *args) 383#endif 384{ 385 const char *name = SWIG_TypePrettyName(v->ty); 386 PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", name, v); 387 if (v->next) { 388#ifdef METH_NOARGS 389 PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); 390#else 391 PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args); 392#endif 393#if PY_VERSION_HEX >= 0x03000000 394 PyObject *joined = PyUnicode_Concat(repr, nrep); 395 Py_DecRef(repr); 396 Py_DecRef(nrep); 397 repr = joined; 398#else 399 PyString_ConcatAndDel(&repr,nrep); 400#endif 401 } 402 return repr; 403} 404 405SWIGRUNTIME int 406SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) 407{ 408 char *str; 409#ifdef METH_NOARGS 410 PyObject *repr = SwigPyObject_repr(v); 411#else 412 PyObject *repr = SwigPyObject_repr(v, NULL); 413#endif 414 if (repr) { 415 str = SWIG_Python_str_AsChar(repr); 416 fputs(str, fp); 417 SWIG_Python_str_DelForPy3(str); 418 Py_DECREF(repr); 419 return 0; 420 } else { 421 return 1; 422 } 423} 424 425SWIGRUNTIME PyObject * 426SwigPyObject_str(SwigPyObject *v) 427{ 428 char result[SWIG_BUFFER_SIZE]; 429 return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ? 430 SWIG_Python_str_FromChar(result) : 0; 431} 432 433SWIGRUNTIME int 434SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) 435{ 436 void *i = v->ptr; 437 void *j = w->ptr; 438 return (i < j) ? -1 : ((i > j) ? 1 : 0); 439} 440 441/* Added for Python 3.x, would it also be useful for Python 2.x? */ 442SWIGRUNTIME PyObject* 443SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) 444{ 445 PyObject* res; 446 if( op != Py_EQ && op != Py_NE ) { 447 Py_INCREF(Py_NotImplemented); 448 return Py_NotImplemented; 449 } 450 if( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ) 451 res = Py_True; 452 else 453 res = Py_False; 454 Py_INCREF(res); 455 return res; 456} 457 458 459SWIGRUNTIME PyTypeObject* _PySwigObject_type(void); 460 461SWIGRUNTIME PyTypeObject* 462SwigPyObject_type(void) { 463 static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type(); 464 return type; 465} 466 467SWIGRUNTIMEINLINE int 468SwigPyObject_Check(PyObject *op) { 469 return (Py_TYPE(op) == SwigPyObject_type()) 470 || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); 471} 472 473SWIGRUNTIME PyObject * 474SwigPyObject_New(void *ptr, swig_type_info *ty, int own); 475 476SWIGRUNTIME void 477SwigPyObject_dealloc(PyObject *v) 478{ 479 SwigPyObject *sobj = (SwigPyObject *) v; 480 PyObject *next = sobj->next; 481 if (sobj->own == SWIG_POINTER_OWN) { 482 swig_type_info *ty = sobj->ty; 483 SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; 484 PyObject *destroy = data ? data->destroy : 0; 485 if (destroy) { 486 /* destroy is always a VARARGS method */ 487 PyObject *res; 488 if (data->delargs) { 489 /* we need to create a temporary object to carry the destroy operation */ 490 PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); 491 res = SWIG_Python_CallFunctor(destroy, tmp); 492 Py_DECREF(tmp); 493 } else { 494 PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); 495 PyObject *mself = PyCFunction_GET_SELF(destroy); 496 res = ((*meth)(mself, v)); 497 } 498 Py_XDECREF(res); 499 } 500#if !defined(SWIG_PYTHON_SILENT_MEMLEAK) 501 else { 502 const char *name = SWIG_TypePrettyName(ty); 503 printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); 504 } 505#endif 506 } 507 Py_XDECREF(next); 508 PyObject_DEL(v); 509} 510 511SWIGRUNTIME PyObject* 512SwigPyObject_append(PyObject* v, PyObject* next) 513{ 514 SwigPyObject *sobj = (SwigPyObject *) v; 515#ifndef METH_O 516 PyObject *tmp = 0; 517 if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; 518 next = tmp; 519#endif 520 if (!SwigPyObject_Check(next)) { 521 return NULL; 522 } 523 sobj->next = next; 524 Py_INCREF(next); 525 return SWIG_Py_Void(); 526} 527 528SWIGRUNTIME PyObject* 529#ifdef METH_NOARGS 530SwigPyObject_next(PyObject* v) 531#else 532SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) 533#endif 534{ 535 SwigPyObject *sobj = (SwigPyObject *) v; 536 if (sobj->next) { 537 Py_INCREF(sobj->next); 538 return sobj->next; 539 } else { 540 return SWIG_Py_Void(); 541 } 542} 543 544SWIGINTERN PyObject* 545#ifdef METH_NOARGS 546SwigPyObject_disown(PyObject *v) 547#else 548SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) 549#endif 550{ 551 SwigPyObject *sobj = (SwigPyObject *)v; 552 sobj->own = 0; 553 return SWIG_Py_Void(); 554} 555 556SWIGINTERN PyObject* 557#ifdef METH_NOARGS 558SwigPyObject_acquire(PyObject *v) 559#else 560SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) 561#endif 562{ 563 SwigPyObject *sobj = (SwigPyObject *)v; 564 sobj->own = SWIG_POINTER_OWN; 565 return SWIG_Py_Void(); 566} 567 568SWIGINTERN PyObject* 569SwigPyObject_own(PyObject *v, PyObject *args) 570{ 571 PyObject *val = 0; 572#if (PY_VERSION_HEX < 0x02020000) 573 if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) 574#else 575 if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) 576#endif 577 { 578 return NULL; 579 } 580 else 581 { 582 SwigPyObject *sobj = (SwigPyObject *)v; 583 PyObject *obj = PyBool_FromLong(sobj->own); 584 if (val) { 585#ifdef METH_NOARGS 586 if (PyObject_IsTrue(val)) { 587 SwigPyObject_acquire(v); 588 } else { 589 SwigPyObject_disown(v); 590 } 591#else 592 if (PyObject_IsTrue(val)) { 593 SwigPyObject_acquire(v,args); 594 } else { 595 SwigPyObject_disown(v,args); 596 } 597#endif 598 } 599 return obj; 600 } 601} 602 603#ifdef METH_O 604static PyMethodDef 605swigobject_methods[] = { 606 {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, 607 {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, 608 {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, 609 {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, 610 {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, 611 {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, 612 {0, 0, 0, 0} 613}; 614#else 615static PyMethodDef 616swigobject_methods[] = { 617 {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, 618 {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"}, 619 {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, 620 {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, 621 {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, 622 {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, 623 {0, 0, 0, 0} 624}; 625#endif 626 627#if PY_VERSION_HEX < 0x02020000 628SWIGINTERN PyObject * 629SwigPyObject_getattr(SwigPyObject *sobj,char *name) 630{ 631 return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); 632} 633#endif 634 635SWIGRUNTIME PyTypeObject* 636_PySwigObject_type(void) { 637 static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; 638 639 static PyNumberMethods SwigPyObject_as_number = { 640 (binaryfunc)0, /*nb_add*/ 641 (binaryfunc)0, /*nb_subtract*/ 642 (binaryfunc)0, /*nb_multiply*/ 643 /* nb_divide removed in Python 3 */ 644#if PY_VERSION_HEX < 0x03000000 645 (binaryfunc)0, /*nb_divide*/ 646#endif 647 (binaryfunc)0, /*nb_remainder*/ 648 (binaryfunc)0, /*nb_divmod*/ 649 (ternaryfunc)0,/*nb_power*/ 650 (unaryfunc)0, /*nb_negative*/ 651 (unaryfunc)0, /*nb_positive*/ 652 (unaryfunc)0, /*nb_absolute*/ 653 (inquiry)0, /*nb_nonzero*/ 654 0, /*nb_invert*/ 655 0, /*nb_lshift*/ 656 0, /*nb_rshift*/ 657 0, /*nb_and*/ 658 0, /*nb_xor*/ 659 0, /*nb_or*/ 660#if PY_VERSION_HEX < 0x03000000 661 0, /*nb_coerce*/ 662#endif 663 (unaryfunc)SwigPyObject_long, /*nb_int*/ 664#if PY_VERSION_HEX < 0x03000000 665 (unaryfunc)SwigPyObject_long, /*nb_long*/ 666#else 667 0, /*nb_reserved*/ 668#endif 669 (unaryfunc)0, /*nb_float*/ 670#if PY_VERSION_HEX < 0x03000000 671 (unaryfunc)SwigPyObject_oct, /*nb_oct*/ 672 (unaryfunc)SwigPyObject_hex, /*nb_hex*/ 673#endif 674#if PY_VERSION_HEX >= 0x03000000 /* 3.0 */ 675 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ 676#elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ 677 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ 678#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ 679 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ 680#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */ 681 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ 682#endif 683 }; 684 685 static PyTypeObject swigpyobject_type; 686 static int type_init = 0; 687 if (!type_init) { 688 const PyTypeObject tmp 689 = { 690 /* PyObject header changed in Python 3 */ 691#if PY_VERSION_HEX >= 0x03000000 692 PyVarObject_HEAD_INIT(&PyType_Type, 0) 693#else 694 PyObject_HEAD_INIT(NULL) 695 0, /* ob_size */ 696#endif 697 (char *)"SwigPyObject", /* tp_name */ 698 sizeof(SwigPyObject), /* tp_basicsize */ 699 0, /* tp_itemsize */ 700 (destructor)SwigPyObject_dealloc, /* tp_dealloc */ 701 (printfunc)SwigPyObject_print, /* tp_print */ 702#if PY_VERSION_HEX < 0x02020000 703 (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ 704#else 705 (getattrfunc)0, /* tp_getattr */ 706#endif 707 (setattrfunc)0, /* tp_setattr */ 708#if PY_VERSION_HEX >= 0x03000000 709 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ 710#else 711 (cmpfunc)SwigPyObject_compare, /* tp_compare */ 712#endif 713 (reprfunc)SwigPyObject_repr, /* tp_repr */ 714 &SwigPyObject_as_number, /* tp_as_number */ 715 0, /* tp_as_sequence */ 716 0, /* tp_as_mapping */ 717 (hashfunc)0, /* tp_hash */ 718 (ternaryfunc)0, /* tp_call */ 719 (reprfunc)SwigPyObject_str, /* tp_str */ 720 PyObject_GenericGetAttr, /* tp_getattro */ 721 0, /* tp_setattro */ 722 0, /* tp_as_buffer */ 723 Py_TPFLAGS_DEFAULT, /* tp_flags */ 724 swigobject_doc, /* tp_doc */ 725 0, /* tp_traverse */ 726 0, /* tp_clear */ 727 (richcmpfunc)SwigPyObject_richcompare, /* tp_richcompare */ 728 0, /* tp_weaklistoffset */ 729#if PY_VERSION_HEX >= 0x02020000 730 0, /* tp_iter */ 731 0, /* tp_iternext */ 732 swigobject_methods, /* tp_methods */ 733 0, /* tp_members */ 734 0, /* tp_getset */ 735 0, /* tp_base */ 736 0, /* tp_dict */ 737 0, /* tp_descr_get */ 738 0, /* tp_descr_set */ 739 0, /* tp_dictoffset */ 740 0, /* tp_init */ 741 0, /* tp_alloc */ 742 0, /* tp_new */ 743 0, /* tp_free */ 744 0, /* tp_is_gc */ 745 0, /* tp_bases */ 746 0, /* tp_mro */ 747 0, /* tp_cache */ 748 0, /* tp_subclasses */ 749 0, /* tp_weaklist */ 750#endif 751#if PY_VERSION_HEX >= 0x02030000 752 0, /* tp_del */ 753#endif 754#ifdef COUNT_ALLOCS 755 0,0,0,0 /* tp_alloc -> tp_next */ 756#endif 757 }; 758 swigpyobject_type = tmp; 759 /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ 760#if PY_VERSION_HEX < 0x03000000 761 swigpyobject_type.ob_type = &PyType_Type; 762#endif 763 type_init = 1; 764 } 765 return &swigpyobject_type; 766} 767 768SWIGRUNTIME PyObject * 769SwigPyObject_New(void *ptr, swig_type_info *ty, int own) 770{ 771 SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); 772 if (sobj) { 773 sobj->ptr = ptr; 774 sobj->ty = ty; 775 sobj->own = own; 776 sobj->next = 0; 777 } 778 return (PyObject *)sobj; 779} 780 781/* ----------------------------------------------------------------------------- 782 * Implements a simple Swig Packed type, and use it instead of string 783 * ----------------------------------------------------------------------------- */ 784 785typedef struct { 786 PyObject_HEAD 787 void *pack; 788 swig_type_info *ty; 789 size_t size; 790} SwigPyPacked; 791 792SWIGRUNTIME int 793SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) 794{ 795 char result[SWIG_BUFFER_SIZE]; 796 fputs("<Swig Packed ", fp); 797 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { 798 fputs("at ", fp); 799 fputs(result, fp); 800 } 801 fputs(v->ty->name,fp); 802 fputs(">", fp); 803 return 0; 804} 805 806SWIGRUNTIME PyObject * 807SwigPyPacked_repr(SwigPyPacked *v) 808{ 809 char result[SWIG_BUFFER_SIZE]; 810 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { 811 return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name); 812 } else { 813 return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name); 814 } 815} 816 817SWIGRUNTIME PyObject * 818SwigPyPacked_str(SwigPyPacked *v) 819{ 820 char result[SWIG_BUFFER_SIZE]; 821 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ 822 return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); 823 } else { 824 return SWIG_Python_str_FromChar(v->ty->name); 825 } 826} 827 828SWIGRUNTIME int 829SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) 830{ 831 size_t i = v->size; 832 size_t j = w->size; 833 int s = (i < j) ? -1 : ((i > j) ? 1 : 0); 834 return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); 835} 836 837SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void); 838 839SWIGRUNTIME PyTypeObject* 840SwigPyPacked_type(void) { 841 static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type(); 842 return type; 843} 844 845SWIGRUNTIMEINLINE int 846SwigPyPacked_Check(PyObject *op) { 847 return ((op)->ob_type == _PySwigPacked_type()) 848 || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); 849} 850 851SWIGRUNTIME void 852SwigPyPacked_dealloc(PyObject *v) 853{ 854 if (SwigPyPacked_Check(v)) { 855 SwigPyPacked *sobj = (SwigPyPacked *) v; 856 free(sobj->pack); 857 } 858 PyObject_DEL(v); 859} 860 861SWIGRUNTIME PyTypeObject* 862_PySwigPacked_type(void) { 863 static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; 864 static PyTypeObject swigpypacked_type; 865 static int type_init = 0; 866 if (!type_init) { 867 const PyTypeObject tmp 868 = { 869 /* PyObject header changed in Python 3 */ 870#if PY_VERSION_HEX>=0x03000000 871 PyVarObject_HEAD_INIT(&PyType_Type, 0) 872#else 873 PyObject_HEAD_INIT(NULL) 874 0, /* ob_size */ 875#endif 876 (char *)"SwigPyPacked", /* tp_name */ 877 sizeof(SwigPyPacked), /* tp_basicsize */ 878 0, /* tp_itemsize */ 879 (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ 880 (printfunc)SwigPyPacked_print, /* tp_print */ 881 (getattrfunc)0, /* tp_getattr */ 882 (setattrfunc)0, /* tp_setattr */ 883#if PY_VERSION_HEX>=0x03000000 884 0, /* tp_reserved in 3.0.1 */ 885#else 886 (cmpfunc)SwigPyPacked_compare, /* tp_compare */ 887#endif 888 (reprfunc)SwigPyPacked_repr, /* tp_repr */ 889 0, /* tp_as_number */ 890 0, /* tp_as_sequence */ 891 0, /* tp_as_mapping */ 892 (hashfunc)0, /* tp_hash */ 893 (ternaryfunc)0, /* tp_call */ 894 (reprfunc)SwigPyPacked_str, /* tp_str */ 895 PyObject_GenericGetAttr, /* tp_getattro */ 896 0, /* tp_setattro */ 897 0, /* tp_as_buffer */ 898 Py_TPFLAGS_DEFAULT, /* tp_flags */ 899 swigpacked_doc, /* tp_doc */ 900 0, /* tp_traverse */ 901 0, /* tp_clear */ 902 0, /* tp_richcompare */ 903 0, /* tp_weaklistoffset */ 904#if PY_VERSION_HEX >= 0x02020000 905 0, /* tp_iter */ 906 0, /* tp_iternext */ 907 0, /* tp_methods */ 908 0, /* tp_members */ 909 0, /* tp_getset */ 910 0, /* tp_base */ 911 0, /* tp_dict */ 912 0, /* tp_descr_get */ 913 0, /* tp_descr_set */ 914 0, /* tp_dictoffset */ 915 0, /* tp_init */ 916 0, /* tp_alloc */ 917 0, /* tp_new */ 918 0, /* tp_free */ 919 0, /* tp_is_gc */ 920 0, /* tp_bases */ 921 0, /* tp_mro */ 922 0, /* tp_cache */ 923 0, /* tp_subclasses */ 924 0, /* tp_weaklist */ 925#endif 926#if PY_VERSION_HEX >= 0x02030000 927 0, /* tp_del */ 928#endif 929#ifdef COUNT_ALLOCS 930 0,0,0,0 /* tp_alloc -> tp_next */ 931#endif 932 }; 933 swigpypacked_type = tmp; 934 /* for Python 3 the ob_type already assigned in PyVarObject_HEAD_INIT() */ 935#if PY_VERSION_HEX < 0x03000000 936 swigpypacked_type.ob_type = &PyType_Type; 937#endif 938 type_init = 1; 939 } 940 return &swigpypacked_type; 941} 942 943SWIGRUNTIME PyObject * 944SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) 945{ 946 SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); 947 if (sobj) { 948 void *pack = malloc(size); 949 if (pack) { 950 memcpy(pack, ptr, size); 951 sobj->pack = pack; 952 sobj->ty = ty; 953 sobj->size = size; 954 } else { 955 PyObject_DEL((PyObject *) sobj); 956 sobj = 0; 957 } 958 } 959 return (PyObject *) sobj; 960} 961 962SWIGRUNTIME swig_type_info * 963SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) 964{ 965 if (SwigPyPacked_Check(obj)) { 966 SwigPyPacked *sobj = (SwigPyPacked *)obj; 967 if (sobj->size != size) return 0; 968 memcpy(ptr, sobj->pack, size); 969 return sobj->ty; 970 } else { 971 return 0; 972 } 973} 974 975/* ----------------------------------------------------------------------------- 976 * pointers/data manipulation 977 * ----------------------------------------------------------------------------- */ 978 979SWIGRUNTIMEINLINE PyObject * 980_SWIG_This(void) 981{ 982 return SWIG_Python_str_FromChar("this"); 983} 984 985SWIGRUNTIME PyObject * 986SWIG_This(void) 987{ 988 static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); 989 return swig_this; 990} 991 992/* #define SWIG_PYTHON_SLOW_GETSET_THIS */ 993 994/* TODO: I don't know how to implement the fast getset in Python 3 right now */ 995#if PY_VERSION_HEX>=0x03000000 996#define SWIG_PYTHON_SLOW_GETSET_THIS 997#endif 998 999SWIGRUNTIME SwigPyObject * 1000SWIG_Python_GetSwigThis(PyObject *pyobj) 1001{ 1002 if (SwigPyObject_Check(pyobj)) { 1003 return (SwigPyObject *) pyobj; 1004 } else { 1005 PyObject *obj = 0; 1006#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) 1007 if (PyInstance_Check(pyobj)) { 1008 obj = _PyInstance_Lookup(pyobj, SWIG_This()); 1009 } else { 1010 PyObject **dictptr = _PyObject_GetDictPtr(pyobj); 1011 if (dictptr != NULL) { 1012 PyObject *dict = *dictptr; 1013 obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; 1014 } else { 1015#ifdef PyWeakref_CheckProxy 1016 if (PyWeakref_CheckProxy(pyobj)) { 1017 PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); 1018 return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; 1019 } 1020#endif 1021 obj = PyObject_GetAttr(pyobj,SWIG_This()); 1022 if (obj) { 1023 Py_DECREF(obj); 1024 } else { 1025 if (PyErr_Occurred()) PyErr_Clear(); 1026 return 0; 1027 } 1028 } 1029 } 1030#else 1031 obj = PyObject_GetAttr(pyobj,SWIG_This()); 1032 if (obj) { 1033 Py_DECREF(obj); 1034 } else { 1035 if (PyErr_Occurred()) PyErr_Clear(); 1036 return 0; 1037 } 1038#endif 1039 if (obj && !SwigPyObject_Check(obj)) { 1040 /* a PyObject is called 'this', try to get the 'real this' 1041 SwigPyObject from it */ 1042 return SWIG_Python_GetSwigThis(obj); 1043 } 1044 return (SwigPyObject *)obj; 1045 } 1046} 1047 1048/* Acquire a pointer value */ 1049 1050SWIGRUNTIME int 1051SWIG_Python_AcquirePtr(PyObject *obj, int own) { 1052 if (own == SWIG_POINTER_OWN) { 1053 SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); 1054 if (sobj) { 1055 int oldown = sobj->own; 1056 sobj->own = own; 1057 return oldown; 1058 } 1059 } 1060 return 0; 1061} 1062 1063/* Convert a pointer value */ 1064 1065SWIGRUNTIME int 1066SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { 1067 if (!obj) return SWIG_ERROR; 1068 if (obj == Py_None) { 1069 if (ptr) *ptr = 0; 1070 return SWIG_OK; 1071 } else { 1072 SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); 1073 if (own) 1074 *own = 0; 1075 while (sobj) { 1076 void *vptr = sobj->ptr; 1077 if (ty) { 1078 swig_type_info *to = sobj->ty; 1079 if (to == ty) { 1080 /* no type cast needed */ 1081 if (ptr) *ptr = vptr; 1082 break; 1083 } else { 1084 swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); 1085 if (!tc) { 1086 sobj = (SwigPyObject *)sobj->next; 1087 } else { 1088 if (ptr) { 1089 int newmemory = 0; 1090 *ptr = SWIG_TypeCast(tc,vptr,&newmemory); 1091 if (newmemory == SWIG_CAST_NEW_MEMORY) { 1092 assert(own); 1093 if (own) 1094 *own = *own | SWIG_CAST_NEW_MEMORY; 1095 } 1096 } 1097 break; 1098 } 1099 } 1100 } else { 1101 if (ptr) *ptr = vptr; 1102 break; 1103 } 1104 } 1105 if (sobj) { 1106 if (own) 1107 *own = *own | sobj->own; 1108 if (flags & SWIG_POINTER_DISOWN) { 1109 sobj->own = 0; 1110 } 1111 return SWIG_OK; 1112 } else { 1113 int res = SWIG_ERROR; 1114 if (flags & SWIG_POINTER_IMPLICIT_CONV) { 1115 SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; 1116 if (data && !data->implicitconv) { 1117 PyObject *klass = data->klass; 1118 if (klass) { 1119 PyObject *impconv; 1120 data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ 1121 impconv = SWIG_Python_CallFunctor(klass, obj); 1122 data->implicitconv = 0; 1123 if (PyErr_Occurred()) { 1124 PyErr_Clear(); 1125 impconv = 0; 1126 } 1127 if (impconv) { 1128 SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); 1129 if (iobj) { 1130 void *vptr; 1131 res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); 1132 if (SWIG_IsOK(res)) { 1133 if (ptr) { 1134 *ptr = vptr; 1135 /* transfer the ownership to 'ptr' */ 1136 iobj->own = 0; 1137 res = SWIG_AddCast(res); 1138 res = SWIG_AddNewMask(res); 1139 } else { 1140 res = SWIG_AddCast(res); 1141 } 1142 } 1143 } 1144 Py_DECREF(impconv); 1145 } 1146 } 1147 } 1148 } 1149 return res; 1150 } 1151 } 1152} 1153 1154/* Convert a function ptr value */ 1155 1156SWIGRUNTIME int 1157SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { 1158 if (!PyCFunction_Check(obj)) { 1159 return SWIG_ConvertPtr(obj, ptr, ty, 0); 1160 } else { 1161 void *vptr = 0; 1162 1163 /* here we get the method pointer for callbacks */ 1164 const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); 1165 const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; 1166 if (desc) 1167 desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; 1168 if (!desc) 1169 return SWIG_ERROR; 1170 if (ty) { 1171 swig_cast_info *tc = SWIG_TypeCheck(desc,ty); 1172 if (tc) { 1173 int newmemory = 0; 1174 *ptr = SWIG_TypeCast(tc,vptr,&newmemory); 1175 assert(!newmemory); /* newmemory handling not yet implemented */ 1176 } else { 1177 return SWIG_ERROR; 1178 } 1179 } else { 1180 *ptr = vptr; 1181 } 1182 return SWIG_OK; 1183 } 1184} 1185 1186/* Convert a packed value value */ 1187 1188SWIGRUNTIME int 1189SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { 1190 swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); 1191 if (!to) return SWIG_ERROR; 1192 if (ty) { 1193 if (to != ty) { 1194 /* check type cast? */ 1195 swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); 1196 if (!tc) return SWIG_ERROR; 1197 } 1198 } 1199 return SWIG_OK; 1200} 1201 1202/* ----------------------------------------------------------------------------- 1203 * Create a new pointer object 1204 * ----------------------------------------------------------------------------- */ 1205 1206/* 1207 Create a new instance object, without calling __init__, and set the 1208 'this' attribute. 1209*/ 1210 1211SWIGRUNTIME PyObject* 1212SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) 1213{ 1214#if (PY_VERSION_HEX >= 0x02020000) 1215 PyObject *inst = 0; 1216 PyObject *newraw = data->newraw; 1217 if (newraw) { 1218 inst = PyObject_Call(newraw, data->newargs, NULL); 1219 if (inst) { 1220#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) 1221 PyObject **dictptr = _PyObject_GetDictPtr(inst); 1222 if (dictptr != NULL) { 1223 PyObject *dict = *dictptr; 1224 if (dict == NULL) { 1225 dict = PyDict_New(); 1226 *dictptr = dict; 1227 PyDict_SetItem(dict, SWIG_This(), swig_this); 1228 } 1229 } 1230#else 1231 PyObject *key = SWIG_This(); 1232 PyObject_SetAttr(inst, key, swig_this); 1233#endif 1234 } 1235 } else { 1236#if PY_VERSION_HEX >= 0x03000000 1237 inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); 1238 PyObject_SetAttr(inst, SWIG_This(), swig_this); 1239 Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; 1240#else 1241 PyObject *dict = PyDict_New(); 1242 PyDict_SetItem(dict, SWIG_This(), swig_this); 1243 inst = PyInstance_NewRaw(data->newargs, dict); 1244 Py_DECREF(dict); 1245#endif 1246 } 1247 return inst; 1248#else 1249#if (PY_VERSION_HEX >= 0x02010000) 1250 PyObject *inst; 1251 PyObject *dict = PyDict_New(); 1252 PyDict_SetItem(dict, SWIG_This(), swig_this); 1253 inst = PyInstance_NewRaw(data->newargs, dict); 1254 Py_DECREF(dict); 1255 return (PyObject *) inst; 1256#else 1257 PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); 1258 if (inst == NULL) { 1259 return NULL; 1260 } 1261 inst->in_class = (PyClassObject *)data->newargs; 1262 Py_INCREF(inst->in_class); 1263 inst->in_dict = PyDict_New(); 1264 if (inst->in_dict == NULL) { 1265 Py_DECREF(inst); 1266 return NULL; 1267 } 1268#ifdef Py_TPFLAGS_HAVE_WEAKREFS 1269 inst->in_weakreflist = NULL; 1270#endif 1271#ifdef Py_TPFLAGS_GC 1272 PyObject_GC_Init(inst); 1273#endif 1274 PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this); 1275 return (PyObject *) inst; 1276#endif 1277#endif 1278} 1279 1280SWIGRUNTIME void 1281SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) 1282{ 1283 PyObject *dict; 1284#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) 1285 PyObject **dictptr = _PyObject_GetDictPtr(inst); 1286 if (dictptr != NULL) { 1287 dict = *dictptr; 1288 if (dict == NULL) { 1289 dict = PyDict_New(); 1290 *dictptr = dict; 1291 } 1292 PyDict_SetItem(dict, SWIG_This(), swig_this); 1293 return; 1294 } 1295#endif 1296 dict = PyObject_GetAttrString(inst, (char*)"__dict__"); 1297 PyDict_SetItem(dict, SWIG_This(), swig_this); 1298 Py_DECREF(dict); 1299} 1300 1301 1302SWIGINTERN PyObject * 1303SWIG_Python_InitShadowInstance(PyObject *args) { 1304 PyObject *obj[2]; 1305 if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) { 1306 return NULL; 1307 } else { 1308 SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); 1309 if (sthis) { 1310 SwigPyObject_append((PyObject*) sthis, obj[1]); 1311 } else { 1312 SWIG_Python_SetSwigThis(obj[0], obj[1]); 1313 } 1314 return SWIG_Py_Void(); 1315 } 1316} 1317 1318/* Create a new pointer object */ 1319 1320SWIGRUNTIME PyObject * 1321SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) { 1322 if (!ptr) { 1323 return SWIG_Py_Void(); 1324 } else { 1325 int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; 1326 PyObject *robj = SwigPyObject_New(ptr, type, own); 1327 SwigPyClientData *clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; 1328 if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { 1329 PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); 1330 if (inst) { 1331 Py_DECREF(robj); 1332 robj = inst; 1333 } 1334 } 1335 return robj; 1336 } 1337} 1338 1339/* Create a new packed object */ 1340 1341SWIGRUNTIMEINLINE PyObject * 1342SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { 1343 return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); 1344} 1345 1346/* -----------------------------------------------------------------------------* 1347 * Get type list 1348 * -----------------------------------------------------------------------------*/ 1349 1350#if PY_VERSION_HEX >= 0x03030000 1351#define _SWIG_PYTHON_CAPSULE_NAME (char *) "swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME 1352#endif 1353 1354#ifdef SWIG_LINK_RUNTIME 1355void *SWIG_ReturnGlobalTypeList(void *); 1356#endif 1357 1358SWIGRUNTIME swig_module_info * 1359SWIG_Python_GetModule(void) { 1360 static void *type_pointer = (void *)0; 1361 /* first check if module already created */ 1362 if (!type_pointer) { 1363#ifdef SWIG_LINK_RUNTIME 1364 type_pointer = SWIG_ReturnGlobalTypeList((void *)0); 1365#else 1366# if PY_VERSION_HEX >= 0x03030000 1367 type_pointer = PyCapsule_Import(_SWIG_PYTHON_CAPSULE_NAME, 0); 1368# else 1369 type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, 1370 (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); 1371#endif 1372 if (PyErr_Occurred()) { 1373 PyErr_Clear(); 1374 type_pointer = (void *)0; 1375 } 1376#endif 1377 } 1378 return (swig_module_info *) type_pointer; 1379} 1380 1381#if PY_MAJOR_VERSION < 2 1382/* PyModule_AddObject function was introduced in Python 2.0. The following function 1383 is copied out of Python/modsupport.c in python version 2.3.4 */ 1384SWIGINTERN int 1385PyModule_AddObject(PyObject *m, char *name, PyObject *o) 1386{ 1387 PyObject *dict; 1388 if (!PyModule_Check(m)) { 1389 PyErr_SetString(PyExc_TypeError, 1390 "PyModule_AddObject() needs module as first arg"); 1391 return SWIG_ERROR; 1392 } 1393 if (!o) { 1394 PyErr_SetString(PyExc_TypeError, 1395 "PyModule_AddObject() needs non-NULL value"); 1396 return SWIG_ERROR; 1397 } 1398 1399 dict = PyModule_GetDict(m); 1400 if (dict == NULL) { 1401 /* Internal error -- modules must have a dict! */ 1402 PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", 1403 PyModule_GetName(m)); 1404 return SWIG_ERROR; 1405 } 1406 if (PyDict_SetItemString(dict, name, o)) 1407 return SWIG_ERROR; 1408 Py_DECREF(o); 1409 return SWIG_OK; 1410} 1411#endif 1412 1413SWIGRUNTIME void 1414#if PY_VERSION_HEX >= 0x03030000 1415SWIG_Python_DestroyModule(PyObject *obj) 1416#else 1417SWIG_Python_DestroyModule(void *vptr) 1418#endif 1419{ 1420#if PY_VERSION_HEX >= 0x03030000 1421 swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, _SWIG_PYTHON_CAPSULE_NAME); 1422#else 1423 swig_module_info *swig_module = (swig_module_info *) vptr; 1424#endif 1425 swig_type_info **types = swig_module->types; 1426 size_t i; 1427 for (i =0; i < swig_module->size; ++i) { 1428 swig_type_info *ty = types[i]; 1429 if (ty->owndata) { 1430 SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; 1431 if (data) SwigPyClientData_Del(data); 1432 } 1433 } 1434 Py_DECREF(SWIG_This()); 1435} 1436 1437SWIGRUNTIME void 1438SWIG_Python_SetModule(swig_module_info *swig_module) { 1439 static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */ 1440 1441#if PY_VERSION_HEX >= 0x03000000 1442 /* Add a dummy module object into sys.modules */ 1443 PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION); 1444#else 1445 PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, 1446 swig_empty_runtime_method_table); 1447#endif 1448#if PY_VERSION_HEX >= 0x03030000 1449 PyObject *pointer = PyCapsule_New((void *) swig_module, _SWIG_PYTHON_CAPSULE_NAME, SWIG_Python_DestroyModule); 1450#else 1451 PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); 1452#endif 1453 if (pointer && module) { 1454#if PY_VERSION_HEX >= 0x03030000 1455 PyModule_AddObject(module, (char *)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); 1456#else 1457 PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); 1458#endif 1459 } else { 1460 Py_XDECREF(pointer); 1461 } 1462} 1463 1464/* The python cached type query */ 1465SWIGRUNTIME PyObject * 1466SWIG_Python_TypeCache(void) { 1467 static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); 1468 return cache; 1469} 1470 1471SWIGRUNTIME swig_type_info * 1472SWIG_Python_TypeQuery(const char *type) 1473{ 1474 PyObject *cache = SWIG_Python_TypeCache(); 1475 PyObject *key = SWIG_Python_str_FromChar(type); 1476 PyObject *obj = PyDict_GetItem(cache, key); 1477 swig_type_info *descriptor; 1478 if (obj) { 1479#if PY_VERSION_HEX >= 0x03030000 1480 descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); 1481#else 1482 descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); 1483#endif 1484 } else { 1485 swig_module_info *swig_module = SWIG_Python_GetModule(); 1486 descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); 1487 if (descriptor) { 1488#if PY_VERSION_HEX >= 0x03030000 1489 obj = PyCapsule_New((void *) descriptor, NULL, NULL); 1490#else 1491 obj = PyCObject_FromVoidPtr(descriptor, NULL); 1492#endif 1493 PyDict_SetItem(cache, key, obj); 1494 Py_DECREF(obj); 1495 } 1496 } 1497 Py_DECREF(key); 1498 return descriptor; 1499} 1500 1501/* 1502 For backward compatibility only 1503*/ 1504#define SWIG_POINTER_EXCEPTION 0 1505#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) 1506#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) 1507 1508SWIGRUNTIME int 1509SWIG_Python_AddErrMesg(const char* mesg, int infront) 1510{ 1511 if (PyErr_Occurred()) { 1512 PyObject *type = 0; 1513 PyObject *value = 0; 1514 PyObject *traceback = 0; 1515 PyErr_Fetch(&type, &value, &traceback); 1516 if (value) { 1517 char *tmp; 1518 PyObject *old_str = PyObject_Str(value); 1519 Py_XINCREF(type); 1520 PyErr_Clear(); 1521 if (infront) { 1522 PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str)); 1523 } else { 1524 PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); 1525 } 1526 SWIG_Python_str_DelForPy3(tmp); 1527 Py_DECREF(old_str); 1528 } 1529 return 1; 1530 } else { 1531 return 0; 1532 } 1533} 1534 1535SWIGRUNTIME int 1536SWIG_Python_ArgFail(int argnum) 1537{ 1538 if (PyErr_Occurred()) { 1539 /* add information about failing argument */ 1540 char mesg[256]; 1541 PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); 1542 return SWIG_Python_AddErrMesg(mesg, 1); 1543 } else { 1544 return 0; 1545 } 1546} 1547 1548SWIGRUNTIMEINLINE const char * 1549SwigPyObject_GetDesc(PyObject *self) 1550{ 1551 SwigPyObject *v = (SwigPyObject *)self; 1552 swig_type_info *ty = v ? v->ty : 0; 1553 return ty ? ty->str : (char*)""; 1554} 1555 1556SWIGRUNTIME void 1557SWIG_Python_TypeError(const char *type, PyObject *obj) 1558{ 1559 if (type) { 1560#if defined(SWIG_COBJECT_TYPES) 1561 if (obj && SwigPyObject_Check(obj)) { 1562 const char *otype = (const char *) SwigPyObject_GetDesc(obj); 1563 if (otype) { 1564 PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", 1565 type, otype); 1566 return; 1567 } 1568 } else 1569#endif 1570 { 1571 const char *otype = (obj ? obj->ob_type->tp_name : 0); 1572 if (otype) { 1573 PyObject *str = PyObject_Str(obj); 1574 const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; 1575 if (cstr) { 1576 PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", 1577 type, otype, cstr); 1578 SWIG_Python_str_DelForPy3(cstr); 1579 } else { 1580 PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", 1581 type, otype); 1582 } 1583 Py_XDECREF(str); 1584 return; 1585 } 1586 } 1587 PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); 1588 } else { 1589 PyErr_Format(PyExc_TypeError, "unexpected type is received"); 1590 } 1591} 1592 1593 1594/* Convert a pointer value, signal an exception on a type mismatch */ 1595SWIGRUNTIME void * 1596SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) { 1597 void *result; 1598 if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { 1599 PyErr_Clear(); 1600#if SWIG_POINTER_EXCEPTION 1601 if (flags) { 1602 SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); 1603 SWIG_Python_ArgFail(argnum); 1604 } 1605#endif 1606 } 1607 return result; 1608} 1609 1610 1611#ifdef __cplusplus 1612#if 0 1613{ /* cc-mode */ 1614#endif 1615} 1616#endif 1617