22 #if ((defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || \
23 (defined __cplusplus && __cplusplus >= 201103L) || \
24 defined SWIG_HAVE_SNPRINTF) && \
25 !defined SWIG_NO_SNPRINTF
26 # define SWIG_snprintf(O,S,F,A) snprintf(O,S,F,A)
27 # define SWIG_snprintf2(O,S,F,A,B) snprintf(O,S,F,A,B)
33 # define SWIG_snprintf(O,S,F,A) sprintf(O,F,A)
34 # define SWIG_snprintf2(O,S,F,A,B) sprintf(O,F,A,B)
42 #ifndef SWIGTEMPLATEDISAMBIGUATOR
43 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
44 # define SWIGTEMPLATEDISAMBIGUATOR template
45 # elif defined(__HP_aCC)
48 # define SWIGTEMPLATEDISAMBIGUATOR template
50 # define SWIGTEMPLATEDISAMBIGUATOR
56 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
57 # define SWIGINLINE inline
65 # if defined(__GNUC__)
66 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
67 # define SWIGUNUSED __attribute__ ((__unused__))
72 # define SWIGUNUSED __attribute__ ((__unused__))
78 #ifndef SWIG_MSC_UNSUPPRESS_4505
79 # if defined(_MSC_VER)
80 # pragma warning(disable : 4505)
84 #ifndef SWIGUNUSEDPARM
86 # define SWIGUNUSEDPARM(p)
88 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
94 # define SWIGINTERN static SWIGUNUSED
98 #ifndef SWIGINTERNINLINE
99 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
103 #if defined(__GNUC__)
104 # if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
105 # ifndef GCC_HASCLASSVISIBILITY
106 # define GCC_HASCLASSVISIBILITY
112 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
113 # if defined(STATIC_LINKED)
116 # define SWIGEXPORT __declspec(dllexport)
119 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
120 # define SWIGEXPORT __attribute__ ((visibility("default")))
129 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
130 # define SWIGSTDCALL __stdcall
137 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
138 # define _CRT_SECURE_NO_DEPRECATE
142 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
143 # define _SCL_SECURE_NO_DEPRECATE
147 #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
148 # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
156 #ifdef __INTEL_COMPILER
157 # pragma warning disable 592
160 #if defined(__cplusplus) && __cplusplus >=201103L
161 # define SWIG_NULLPTR nullptr
163 # define SWIG_NULLPTR NULL
166 #define SWIG_UnknownError -1
167 #define SWIG_IOError -2
168 #define SWIG_RuntimeError -3
169 #define SWIG_IndexError -4
170 #define SWIG_TypeError -5
171 #define SWIG_DivisionByZero -6
172 #define SWIG_OverflowError -7
173 #define SWIG_SyntaxError -8
174 #define SWIG_ValueError -9
175 #define SWIG_SystemError -10
176 #define SWIG_AttributeError -11
177 #define SWIG_MemoryError -12
178 #define SWIG_NullReferenceError -13
189 #define SWIG_RUNTIME_VERSION "4"
192 #ifdef SWIG_TYPE_TABLE
193 # define SWIG_QUOTE_STRING(x) #x
194 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
195 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
197 # define SWIG_TYPE_TABLE_NAME
210 # define SWIGRUNTIME SWIGINTERN
213 #ifndef SWIGRUNTIMEINLINE
214 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
218 #ifndef SWIG_BUFFER_SIZE
219 # define SWIG_BUFFER_SIZE 1024
223 #define SWIG_POINTER_DISOWN 0x1
224 #define SWIG_CAST_NEW_MEMORY 0x2
225 #define SWIG_POINTER_NO_NULL 0x4
226 #define SWIG_POINTER_CLEAR 0x8
227 #define SWIG_POINTER_RELEASE (SWIG_POINTER_CLEAR | SWIG_POINTER_DISOWN)
230 #define SWIG_POINTER_OWN 0x1
314 #define SWIG_ERROR (-1)
318 #define SWIG_ERROR_RELEASE_NOT_OWNED (-200)
320 #define SWIG_IsOK(r) (r >= 0)
321 #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
324 #define SWIG_CASTRANKLIMIT (1 << 8)
326 #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
328 #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
330 #define SWIG_BADOBJ (SWIG_ERROR)
331 #define SWIG_OLDOBJ (SWIG_OK)
332 #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
333 #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
335 #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
336 #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
337 #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
338 #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
339 #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
340 #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
343 #if defined(SWIG_CASTRANK_MODE)
344 # ifndef SWIG_TypeRank
345 # define SWIG_TypeRank unsigned long
347 # ifndef SWIG_MAXCASTRANK
348 # define SWIG_MAXCASTRANK (2)
350 # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
351 # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
356 return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
359 # define SWIG_AddCast(r) (r)
360 # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
370 typedef void *(*swig_converter_func)(
void *,
int *);
412 const char *f2,
const char *l2) {
413 for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
414 while ((*f1 ==
' ') && (f1 != l1)) ++f1;
415 while ((*f2 ==
' ') && (f2 != l2)) ++f2;
416 if (*f1 != *f2)
return (*f1 > *f2) ? 1 : -1;
418 return (
int)((l1 - f1) - (l2 - f2));
428 const char* te = tb + strlen(tb);
430 while (equiv != 0 && *ne) {
431 for (nb = ne; *ne; ++ne) {
432 if (*ne ==
'|')
break;
457 if (strcmp(iter->
type->
name, c) == 0) {
458 if (iter == ty->
cast)
484 if (iter->
type == from) {
485 if (iter == ty->
cast)
517 if (!ty || !ty->
dcast)
return ty;
518 while (ty && (ty->
dcast)) {
519 ty = (*ty->
dcast)(ptr);
543 if (!type)
return NULL;
544 if (type->
str != NULL) {
545 const char *last_name = type->
str;
547 for (s = type->
str; *s; s++)
548 if (*s ==
'|') last_name = s+1;
596 size_t r = iter->
size - 1;
599 size_t i = (l + r) >> 1;
600 const char *iname = iter->
types[i]->
name;
602 int compare = strcmp(name, iname);
604 return iter->
types[i];
605 }
else if (compare < 0) {
611 }
else if (compare > 0) {
620 }
while (iter != end);
647 for (; i < iter->
size; ++i) {
649 return iter->
types[i];
652 }
while (iter != end);
664 static const char hex[17] =
"0123456789abcdef";
665 const unsigned char *u = (
unsigned char *) ptr;
666 const unsigned char *eu = u + sz;
667 for (; u != eu; ++u) {
668 unsigned char uu = *u;
669 *(c++) = hex[(uu & 0xf0) >> 4];
670 *(c++) = hex[uu & 0xf];
680 unsigned char *u = (
unsigned char *) ptr;
681 const unsigned char *eu = u + sz;
682 for (; u != eu; ++u) {
685 if ((d >=
'0') && (d <=
'9'))
686 uu = (
unsigned char)((d -
'0') << 4);
687 else if ((d >=
'a') && (d <=
'f'))
688 uu = (
unsigned char)((d - (
'a'-10)) << 4);
692 if ((d >=
'0') && (d <=
'9'))
693 uu |= (
unsigned char)(d -
'0');
694 else if ((d >=
'a') && (d <=
'f'))
695 uu |= (
unsigned char)(d - (
'a'-10));
709 if ((2*
sizeof(
void *) + 2) > bsz)
return 0;
712 if (strlen(name) + 1 > (bsz - (r - buff)))
return 0;
720 if (strcmp(c,
"NULL") == 0) {
733 size_t lname = (name ? strlen(name) : 0);
734 if ((2*sz + 2 + lname) > bsz)
return 0;
738 strncpy(r,name,lname+1);
748 if (strcmp(c,
"NULL") == 0) {
762 #if PY_VERSION_HEX >= 0x03000000
764 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
765 #define PyInt_Check(x) PyLong_Check(x)
766 #define PyInt_AsLong(x) PyLong_AsLong(x)
767 #define PyInt_FromLong(x) PyLong_FromLong(x)
768 #define PyInt_FromSize_t(x) PyLong_FromSize_t(x)
769 #define PyString_Check(name) PyBytes_Check(name)
770 #define PyString_FromString(x) PyUnicode_FromString(x)
771 #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args)
772 #define PyString_AsString(str) PyBytes_AsString(str)
773 #define PyString_Size(str) PyBytes_Size(str)
774 #define PyString_InternFromString(key) PyUnicode_InternFromString(key)
775 #define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
776 #define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)
782 #if PY_VERSION_HEX >= 0x03000000
783 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat
785 # define SWIG_Python_str_FromFormat PyString_FromFormat
793 #if PY_VERSION_HEX >= 0x03030000
794 # if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000
796 return PyUnicode_AsUTF8AndSize(str, psize);
799 *pbytes = PyUnicode_AsUTF8String(str);
800 chars = *pbytes ? PyBytes_AsString(*pbytes) : NULL;
802 *psize = PyBytes_Size(*pbytes);
808 PyString_AsStringAndSize(str, &chars, psize);
816 #if PY_VERSION_HEX >= 0x03000000
817 return PyUnicode_FromString(c);
819 return PyString_FromString(c);
824 # define SWIGPY_USE_CAPSULE
825 #ifdef SWIGPYTHON_BUILTIN
826 # define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule_builtin" SWIG_TYPE_TABLE_NAME
828 # define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule" SWIG_TYPE_TABLE_NAME
830 # define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION "." SWIGPY_CAPSULE_ATTR_NAME)
832 #if PY_VERSION_HEX < 0x03020000
833 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
834 #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
835 #define Py_hash_t long
838 #ifdef Py_LIMITED_API
839 # define PyTuple_GET_ITEM PyTuple_GetItem
842 # define PyTuple_SET_ITEM PyTuple_SetItem
843 # define PyTuple_GET_SIZE PyTuple_Size
844 # define PyCFunction_GET_FLAGS PyCFunction_GetFlags
845 # define PyCFunction_GET_FUNCTION PyCFunction_GetFunction
846 # define PyCFunction_GET_SELF PyCFunction_GetSelf
847 # define PyList_GET_ITEM PyList_GetItem
848 # define PyList_SET_ITEM PyList_SetItem
849 # define PySliceObject PyObject
853 #ifdef Py_LIMITED_API
854 # define SWIG_Py_INCREF Py_IncRef
855 # define SWIG_Py_XINCREF Py_IncRef
856 # define SWIG_Py_DECREF Py_DecRef
857 # define SWIG_Py_XDECREF Py_DecRef
859 # define SWIG_Py_INCREF Py_INCREF
860 # define SWIG_Py_XINCREF Py_XINCREF
861 # define SWIG_Py_DECREF Py_DECREF
862 # define SWIG_Py_XDECREF Py_XDECREF
873 type = PyExc_MemoryError;
876 type = PyExc_IOError;
879 type = PyExc_RuntimeError;
882 type = PyExc_IndexError;
885 type = PyExc_TypeError;
888 type = PyExc_ZeroDivisionError;
891 type = PyExc_OverflowError;
894 type = PyExc_SyntaxError;
897 type = PyExc_ValueError;
900 type = PyExc_SystemError;
903 type = PyExc_AttributeError;
906 type = PyExc_TypeError;
909 type = PyExc_RuntimeError;
920 PyObject *traceback = 0;
922 if (PyErr_Occurred())
923 PyErr_Fetch(&type, &value, &traceback);
925 PyObject *old_str = PyObject_Str(value);
926 PyObject *bytes = NULL;
931 PyErr_Format(type,
"%s %s", tmp, mesg);
933 PyErr_Format(type,
"%s", mesg);
938 PyErr_SetString(PyExc_RuntimeError, mesg);
948 error = PyErr_Occurred();
949 return error && PyErr_GivenExceptionMatches(error, PyExc_TypeError);
958 PyObject *type = NULL, *value = NULL, *traceback = NULL;
959 PyErr_Fetch(&type, &value, &traceback);
960 #if PY_VERSION_HEX >= 0x03000000
961 newvalue = PyUnicode_FromFormat(
"%S\nAdditional information:\n%s", value, message);
963 newvalue = PyString_FromFormat(
"%s\nAdditional information:\n%s", PyString_AsString(value), message);
967 PyErr_Restore(type, newvalue, traceback);
969 PyErr_Restore(type, value, traceback);
973 PyErr_SetString(PyExc_TypeError, message);
976 #if defined(SWIG_PYTHON_NO_THREADS)
977 # if defined(SWIG_PYTHON_THREADS)
978 # undef SWIG_PYTHON_THREADS
981 #if defined(SWIG_PYTHON_THREADS)
982 # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
983 # define SWIG_PYTHON_USE_GIL
985 # if defined(SWIG_PYTHON_USE_GIL)
986 # if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
987 # if PY_VERSION_HEX < 0x03070000
988 # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
990 # define SWIG_PYTHON_INITIALIZE_THREADS
994 class SWIG_Python_Thread_Block {
996 PyGILState_STATE state;
998 void end() {
if (status) { PyGILState_Release(state); status =
false;} }
999 SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
1000 ~SWIG_Python_Thread_Block() { end(); }
1002 class SWIG_Python_Thread_Allow {
1004 PyThreadState *save;
1006 void end() {
if (status) { status =
false; PyEval_RestoreThread(save); }}
1007 SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
1008 ~SWIG_Python_Thread_Allow() { end(); }
1010 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block
1011 # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end()
1012 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow
1013 # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end()
1015 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
1016 # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block)
1017 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread()
1018 # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow)
1021 # if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
1022 # define SWIG_PYTHON_INITIALIZE_THREADS
1024 # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
1025 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1027 # if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
1028 # define SWIG_PYTHON_THREAD_END_BLOCK
1030 # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
1031 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1033 # if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
1034 # define SWIG_PYTHON_THREAD_END_ALLOW
1038 # define SWIG_PYTHON_INITIALIZE_THREADS
1039 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1040 # define SWIG_PYTHON_THREAD_END_BLOCK
1041 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1042 # define SWIG_PYTHON_THREAD_END_ALLOW
1057 #define SWIG_PY_POINTER 4
1058 #define SWIG_PY_BINARY 5
1083 #if PY_VERSION_HEX < 0x02070000
1084 # error "This version of SWIG only supports Python >= 2.7"
1087 #if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03030000
1088 # error "This version of SWIG only supports Python 3 >= 3.3"
1094 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1095 #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
1096 #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1098 #ifdef SWIGPYTHON_BUILTIN
1099 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags)
1101 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1104 #define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1106 #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
1107 #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
1108 #define swig_owntype int
1111 #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1112 #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1115 #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1116 #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1119 #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
1120 #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0)
1123 #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1124 #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1129 #define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata)
1130 #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
1131 #define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
1133 #define SWIG_SetErrorObj SWIG_Python_SetErrorObj
1134 #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
1135 #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
1136 #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
1137 #define SWIG_fail goto fail
1147 PyErr_SetObject(errtype, obj);
1155 PyErr_SetString(errtype, msg);
1159 #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
1163 #if defined(SWIGPYTHON_BUILTIN)
1166 SwigPyBuiltin_AddPublicSymbol(PyObject *seq,
const char *key) {
1167 PyObject *s = PyString_InternFromString(key);
1168 PyList_Append(seq, s);
1174 PyDict_SetItemString(d, name, obj);
1176 if (public_interface)
1177 SwigPyBuiltin_AddPublicSymbol(public_interface, name);
1184 PyDict_SetItemString(d, name, obj);
1196 }
else if (result == Py_None && is_void) {
1200 if (!PyList_Check(result)) {
1201 PyObject *o2 = result;
1202 result = PyList_New(1);
1204 PyList_SET_ITEM(result, 0, o2);
1210 PyList_Append(result,obj);
1225 PyErr_Format(PyExc_TypeError,
"%s expected %s%d arguments, got none",
1226 name, (min == max ?
"" :
"at least "), (
int)min);
1230 if (!PyTuple_Check(args)) {
1231 if (min <= 1 && max >= 1) {
1234 for (i = 1; i < max; ++i) {
1239 PyErr_SetString(PyExc_SystemError,
"UnpackTuple() argument list is not a tuple");
1242 Py_ssize_t l = PyTuple_GET_SIZE(args);
1244 PyErr_Format(PyExc_TypeError,
"%s expected %s%d arguments, got %d",
1245 name, (min == max ?
"" :
"at least "), (
int)min, (
int)l);
1247 }
else if (l > max) {
1248 PyErr_Format(PyExc_TypeError,
"%s expected %s%d arguments, got %d",
1249 name, (min == max ?
"" :
"at most "), (
int)max, (
int)l);
1253 for (i = 0; i < l; ++i) {
1254 objs[i] = PyTuple_GET_ITEM(args, i);
1256 for (; l < max; ++l) {
1268 assert(PyDict_Check(kwargs));
1269 if (PyDict_Size(kwargs) > 0) {
1270 PyErr_Format(PyExc_TypeError,
"%s() does not take keyword arguments", name);
1278 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
1285 #define SWIG_STATIC_POINTER(var) var
1287 #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
1295 #define SWIG_newvarlink() SWIG_Python_newvarlink()
1296 #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)
1297 #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
1305 PyObject *(*get_attr)(void);
1317 #if PY_VERSION_HEX >= 0x03000000
1318 return PyUnicode_InternFromString(
"<Swig global variables>");
1320 return PyString_FromString(
"<Swig global variables>");
1327 #if PY_VERSION_HEX >= 0x03000000
1328 PyObject *str = PyUnicode_InternFromString(
"(");
1332 for (var = v->
vars; var; var=var->
next) {
1333 tail = PyUnicode_FromString(var->
name);
1334 joined = PyUnicode_Concat(str, tail);
1339 tail = PyUnicode_InternFromString(
", ");
1340 joined = PyUnicode_Concat(str, tail);
1346 tail = PyUnicode_InternFromString(
")");
1347 joined = PyUnicode_Concat(str, tail);
1352 PyObject *str = PyString_FromString(
"(");
1354 for (var = v->
vars; var; var=var->
next) {
1355 PyString_ConcatAndDel(&str,PyString_FromString(var->
name));
1356 if (var->
next) PyString_ConcatAndDel(&str,PyString_FromString(
", "));
1358 PyString_ConcatAndDel(&str,PyString_FromString(
")"));
1378 PyObject *res = NULL;
1381 if (strcmp(var->
name,n) == 0) {
1387 if (res == NULL && !PyErr_Occurred()) {
1388 PyErr_Format(PyExc_AttributeError,
"Unknown C global variable '%s'", n);
1399 if (strcmp(var->
name,n) == 0) {
1405 if (res == 1 && !PyErr_Occurred()) {
1406 PyErr_Format(PyExc_AttributeError,
"Unknown C global variable '%s'", n);
1413 static char varlink__doc__[] =
"Swig var link object";
1414 #ifndef SWIG_HEAPTYPES
1415 static PyTypeObject varlink_type;
1416 static int type_init = 0;
1418 const PyTypeObject tmp = {
1419 #if PY_VERSION_HEX >= 0x03000000
1420 PyVarObject_HEAD_INIT(NULL, 0)
1422 PyObject_HEAD_INIT(NULL)
1429 #if PY_VERSION_HEX < 0x030800b4
1453 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1456 #if PY_VERSION_HEX >= 0x03040000
1459 #if PY_VERSION_HEX >= 0x03080000
1462 #if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
1465 #if PY_VERSION_HEX >= 0x030c0000
1468 #if PY_VERSION_HEX >= 0x030d00a4
1481 if (PyType_Ready(&varlink_type) < 0)
1484 return &varlink_type;
1486 PyType_Slot slots[] = {
1492 { Py_tp_doc, (
void *)varlink__doc__ },
1495 PyType_Spec spec = {
1502 return (PyTypeObject *)PyType_FromSpec(&spec);
1513 return ((PyObject*) result);
1521 size_t size = strlen(name)+1;
1522 gv->
name = (
char *)malloc(size);
1524 memcpy(gv->
name, name, size);
1553 #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1)
1554 #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
1556 #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
1558 #define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2)
1559 #define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN)
1570 PyObject *none = Py_None;
1593 PyErr_SetString(PyExc_TypeError,
"Implicit conversion is prohibited for explicit constructors.");
1600 PyObject *klass = data ? data->
klass : 0;
1601 return (klass ? klass : PyExc_RuntimeError);
1616 if (PyClass_Check(obj)) {
1621 data->
newraw = PyObject_GetAttrString(data->
klass,
"__new__");
1623 data->
newargs = PyTuple_New(1);
1626 PyTuple_SET_ITEM(data->
newargs, 0, obj);
1639 data->
destroy = PyObject_GetAttrString(data->
klass,
"__swig_destroy__");
1640 if (PyErr_Occurred()) {
1645 data->
delargs = !(PyCFunction_GET_FLAGS(data->
destroy) & METH_O);
1673 #ifdef SWIGPYTHON_BUILTIN
1679 #ifdef SWIGPYTHON_BUILTIN
1682 SwigPyObject_get___dict__(PyObject *v, PyObject *
SWIGUNUSEDPARM(args))
1687 sobj->dict = PyDict_New();
1698 return PyLong_FromVoidPtr(v->
ptr);
1704 PyObject *res = NULL;
1705 PyObject *args = PyTuple_New(1);
1710 PyTuple_SET_ITEM(args, 0, val);
1713 #if PY_VERSION_HEX >= 0x03000000
1714 res = PyUnicode_Format(ofmt,args);
1716 res = PyString_Format(ofmt,args);
1743 if (repr && v->next) {
1746 # if PY_VERSION_HEX >= 0x03000000
1747 PyObject *joined = PyUnicode_Concat(repr, nrep);
1752 PyString_ConcatAndDel(&repr,nrep);
1775 return (i < j) ? -1 : ((i > j) ? 1 : 0);
1782 PyObject* res = NULL;
1783 if (!PyErr_Occurred()) {
1784 if (op != Py_EQ && op != Py_NE) {
1786 return Py_NotImplemented;
1796 #ifdef SWIGPYTHON_BUILTIN
1801 assert(SwigPyObject_stype);
1818 PyTypeObject *op_type = Py_TYPE(op);
1819 #ifdef SWIGPYTHON_BUILTIN
1820 if (PyType_IsSubtype(op_type, target_tp))
1822 return (strcmp(op_type->tp_name,
"SwigPyObject") == 0);
1824 # ifdef Py_LIMITED_API
1828 if (op_type == target_tp)
1830 # ifdef Py_LIMITED_API
1831 tp_name = PyObject_GetAttrString((PyObject *)op_type,
"__name__");
1834 cmp = PyUnicode_CompareWithASCIIString(tp_name,
"SwigPyObject");
1838 return (strcmp(op_type->tp_name,
"SwigPyObject") == 0);
1852 PyObject *next = sobj->
next;
1856 PyObject *destroy = data ? data->
destroy : 0;
1868 PyObject *type = NULL, *value = NULL, *traceback = NULL;
1869 PyErr_Fetch(&type, &value, &traceback);
1881 PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
1882 PyObject *mself = PyCFunction_GET_SELF(destroy);
1883 res = ((*meth)(mself, v));
1886 PyErr_WriteUnraisable(destroy);
1888 PyErr_Restore(type, value, traceback);
1892 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
1895 printf(
"swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name :
"unknown"));
1901 #ifdef SWIGPYTHON_BUILTIN
1912 PyErr_SetString(PyExc_TypeError,
"Attempt to append a non SwigPyObject");
1953 if (!PyArg_UnpackTuple(args,
"own", 0, 1, &val)) {
1957 PyObject *obj = PyBool_FromLong(sobj->
own);
1959 if (PyObject_IsTrue(val)) {
1973 {
"own",
SwigPyObject_own, METH_VARARGS,
"returns/sets ownership of the pointer"},
1982 static char swigobject_doc[] =
"Swig object carries a C/C++ instance pointer";
1983 #ifndef SWIG_HEAPTYPES
1984 static PyNumberMethods SwigPyObject_as_number = {
1989 #
if PY_VERSION_HEX < 0x03000000
2005 #
if PY_VERSION_HEX < 0x03000000
2009 #if PY_VERSION_HEX < 0x03000000
2015 #if PY_VERSION_HEX < 0x03000000
2019 #if PY_VERSION_HEX >= 0x03050000
2020 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2021 #elif PY_VERSION_HEX >= 0x03000000
2022 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2024 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2028 static PyTypeObject swigpyobject_type;
2029 static int type_init = 0;
2031 const PyTypeObject tmp = {
2032 #if PY_VERSION_HEX >= 0x03000000
2033 PyVarObject_HEAD_INIT(NULL, 0)
2035 PyObject_HEAD_INIT(NULL)
2042 #if PY_VERSION_HEX < 0x030800b4
2049 #if PY_VERSION_HEX >= 0x03000000
2055 &SwigPyObject_as_number,
2061 PyObject_GenericGetAttr,
2092 #
if PY_VERSION_HEX >= 0x03040000
2095 #
if PY_VERSION_HEX >= 0x03080000
2098 #
if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
2101 #
if PY_VERSION_HEX >= 0x030c0000
2104 #
if PY_VERSION_HEX >= 0x030d00a4
2115 swigpyobject_type = tmp;
2117 if (PyType_Ready(&swigpyobject_type) != 0)
2120 return &swigpyobject_type;
2122 PyType_Slot slots[] = {
2125 { Py_tp_getattro, (
void *)PyObject_GenericGetAttr },
2126 { Py_tp_doc, (
void *)swigobject_doc },
2132 PyType_Spec spec = {
2136 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,
2139 return (PyTypeObject *)PyType_FromSpec(&spec);
2152 #ifdef SWIGPYTHON_BUILTIN
2162 return (PyObject *)sobj;
2203 int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
2204 return s ? s : strncmp((
const char *)v->
pack, (
const char *)w->
pack, 2*v->
size);
2217 #ifdef Py_LIMITED_API
2221 PyTypeObject* op_type = Py_TYPE(op);
2224 #ifdef Py_LIMITED_API
2225 tp_name = PyObject_GetAttrString((PyObject *)op_type,
"__name__");
2228 cmp = PyUnicode_CompareWithASCIIString(tp_name,
"SwigPyPacked");
2232 return (strcmp(op_type->tp_name,
"SwigPyPacked") == 0);
2248 static char swigpacked_doc[] =
"Swig object carries a C/C++ instance pointer";
2249 #ifndef SWIG_HEAPTYPES
2250 static PyTypeObject swigpypacked_type;
2251 static int type_init = 0;
2253 const PyTypeObject tmp = {
2254 #if PY_VERSION_HEX>=0x03000000
2255 PyVarObject_HEAD_INIT(NULL, 0)
2257 PyObject_HEAD_INIT(NULL)
2264 #if PY_VERSION_HEX < 0x030800b4
2271 #if PY_VERSION_HEX>=0x03000000
2283 PyObject_GenericGetAttr,
2314 #
if PY_VERSION_HEX >= 0x03040000
2317 #
if PY_VERSION_HEX >= 0x03080000
2320 #
if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
2323 #
if PY_VERSION_HEX >= 0x030c0000
2326 #
if PY_VERSION_HEX >= 0x030d00a4
2337 swigpypacked_type = tmp;
2339 if (PyType_Ready(&swigpypacked_type) != 0)
2342 return &swigpypacked_type;
2344 PyType_Slot slots[] = {
2348 { Py_tp_getattro, (
void *)PyObject_GenericGetAttr },
2349 { Py_tp_doc, (
void *)swigpacked_doc },
2352 PyType_Spec spec = {
2359 return (PyTypeObject *)PyType_FromSpec(&spec);
2368 void *pack = malloc(size);
2370 memcpy(pack, ptr, size);
2375 PyObject_Free((PyObject *)sobj);
2379 return (PyObject *) sobj;
2387 if (sobj->
size != size)
return 0;
2388 memcpy(ptr, sobj->
pack, size);
2412 #if PY_VERSION_HEX>=0x03000000
2413 #define SWIG_PYTHON_SLOW_GETSET_THIS
2424 #ifdef SWIGPYTHON_BUILTIN
2426 # ifdef PyWeakref_CheckProxy
2427 if (PyWeakref_CheckProxy(pyobj)) {
2428 #if PY_VERSION_HEX >= 0x030d0000
2429 PyWeakref_GetRef(pyobj, &pyobj);
2432 pyobj = PyWeakref_GET_OBJECT(pyobj);
2443 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2444 if (PyInstance_Check(pyobj)) {
2445 obj = _PyInstance_Lookup(pyobj,
SWIG_This());
2447 PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
2448 if (dictptr != NULL) {
2449 PyObject *dict = *dictptr;
2450 obj = dict ? PyDict_GetItem(dict,
SWIG_This()) : 0;
2452 #ifdef PyWeakref_CheckProxy
2453 if (PyWeakref_CheckProxy(pyobj)) {
2454 PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
2458 obj = PyObject_GetAttr(pyobj,
SWIG_This());
2462 if (PyErr_Occurred()) PyErr_Clear();
2468 obj = PyObject_GetAttr(pyobj,
SWIG_This());
2472 if (PyErr_Occurred()) PyErr_Clear();
2492 int oldown = sobj->
own;
2510 if (obj == Py_None && !implicit_conv) {
2522 void *vptr = sobj->
ptr;
2527 if (ptr) *ptr = vptr;
2547 if (ptr) *ptr = vptr;
2556 *own = *own | sobj->
own;
2566 if (implicit_conv) {
2569 PyObject *klass = data->
klass;
2575 if (PyErr_Occurred()) {
2600 if (!
SWIG_IsOK(res) && obj == Py_None) {
2603 if (PyErr_Occurred())
2616 if (!PyCFunction_Check(obj)) {
2623 #ifndef Py_LIMITED_API
2624 const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
2626 PyObject* pystr_doc = PyObject_GetAttrString(obj,
"__doc__");
2627 PyObject *bytes = NULL;
2630 const char *desc = doc ? strstr(doc,
"swig_ptr: ") : 0;
2633 #ifdef Py_LIMITED_API
2680 PyObject *newraw = data->
newraw;
2682 inst = PyObject_Call(newraw, data->
newargs, NULL);
2684 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2685 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2686 if (dictptr != NULL) {
2687 PyObject *dict = *dictptr;
2689 dict = PyDict_New();
2693 PyDict_SetItem(dict,
SWIG_This(), swig_this);
2700 if (PyObject_SetAttr(inst,
SWIG_This(), swig_this) == -1) {
2707 #if PY_VERSION_HEX >= 0x03000000
2708 PyObject *empty_args = PyTuple_New(0);
2710 PyObject *empty_kwargs = PyDict_New();
2712 #ifndef Py_LIMITED_API
2713 newfunc newfn = ((PyTypeObject *)data->
newargs)->tp_new;
2715 newfunc newfn = (newfunc)PyType_GetSlot((PyTypeObject *)data->
newargs, Py_tp_new);
2717 inst = newfn((PyTypeObject *)data->
newargs, empty_args, empty_kwargs);
2720 if (PyObject_SetAttr(inst,
SWIG_This(), swig_this) == -1) {
2724 PyType_Modified(Py_TYPE(inst));
2731 PyObject *dict = PyDict_New();
2733 PyDict_SetItem(dict,
SWIG_This(), swig_this);
2734 inst = PyInstance_NewRaw(data->
newargs, dict);
2745 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2746 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2747 if (dictptr != NULL) {
2748 PyObject *dict = *dictptr;
2750 dict = PyDict_New();
2754 return PyDict_SetItem(dict,
SWIG_This(), swig_this);
2760 return PyObject_SetAttr(inst,
SWIG_This(), swig_this);
2794 if (clientdata && clientdata->
pytype) {
2799 #ifndef Py_LIMITED_API
2800 allocfunc alloc = clientdata->
pytype->tp_alloc;
2802 allocfunc alloc = (allocfunc)PyType_GetSlot(clientdata->
pytype, Py_tp_alloc);
2804 PyObject *next_self = alloc(clientdata->
pytype, 0);
2805 while (newobj->
next)
2807 newobj->
next = next_self;
2809 #ifdef SWIGPYTHON_BUILTIN
2815 #ifdef SWIGPYTHON_BUILTIN
2826 return (PyObject*) newobj;
2853 #ifdef SWIG_LINK_RUNTIME
2854 void *SWIG_ReturnGlobalTypeList(
void *);
2870 #ifdef SWIG_LINK_RUNTIME
2871 static void *type_pointer = (
void *)0;
2873 if (!type_pointer) {
2874 type_pointer = SWIG_ReturnGlobalTypeList((
void *)0);
2878 if (PyErr_Occurred()) {
2880 type_pointer = (
void *)0;
2897 for (i =0; i < swig_module->
size; ++i) {
2916 #if PY_VERSION_HEX >= 0x03000000
2920 static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };
2921 PyObject *module = Py_InitModule(
"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table);
2924 if (pointer && module) {
2941 PyObject *obj = PyDict_GetItem(cache, key);
2949 obj = PyCapsule_New((
void*) descriptor, NULL, NULL);
2951 PyDict_SetItem(cache, key, obj);
2963 #define SWIG_POINTER_EXCEPTION 0
2964 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
2965 #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
2970 if (PyErr_Occurred()) {
2972 PyObject *value = 0;
2973 PyObject *traceback = 0;
2974 PyErr_Fetch(&type, &value, &traceback);
2976 PyObject *old_str = PyObject_Str(value);
2977 PyObject *bytes = NULL;
2979 const char *errmesg = tmp ? tmp :
"Invalid error message";
2983 PyErr_Format(type,
"%s %s", mesg, errmesg);
2985 PyErr_Format(type,
"%s %s", errmesg, mesg);
2999 if (PyErr_Occurred()) {
3002 PyOS_snprintf(mesg,
sizeof(mesg),
"argument number %d:", argnum);
3014 return ty ? ty->
str :
"";
3022 #if defined(SWIG_COBJECT_TYPES)
3026 PyErr_Format(PyExc_TypeError,
"a '%s' is expected, 'SwigPyObject(%s)' is received",
3033 #ifndef Py_LIMITED_API
3035 const char *otype = (obj ? obj->ob_type->tp_name : 0);
3037 PyObject *str = PyObject_Str(obj);
3038 PyObject *bytes = NULL;
3041 PyErr_Format(PyExc_TypeError,
"a '%s' is expected, '%s(%s)' is received",
3044 PyErr_Format(PyExc_TypeError,
"a '%s' is expected, '%s' is received",
3053 PyErr_Format(PyExc_TypeError,
"a '%s' is expected", type);
3055 PyErr_Format(PyExc_TypeError,
"unexpected type is received");
3070 #ifdef SWIGPYTHON_BUILTIN
3072 SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
3073 PyTypeObject *tp = obj->ob_type;
3075 PyObject *encoded_name;
3079 # ifdef Py_USING_UNICODE
3080 if (PyString_Check(name)) {
3081 name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL);
3084 }
else if (!PyUnicode_Check(name))
3086 if (!PyString_Check(name))
3089 PyErr_Format(PyExc_TypeError,
"attribute name must be string, not '%.200s'", name->ob_type->tp_name);
3096 if (PyType_Ready(tp) != 0)
3100 descr = _PyType_Lookup(tp, name);
3103 f = descr->ob_type->tp_descr_set;
3105 if (PyString_Check(name)) {
3106 encoded_name = name;
3109 encoded_name = PyUnicode_AsUTF8String(name);
3113 PyErr_Format(PyExc_AttributeError,
"'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name));
3116 res = f(descr, obj, value);
3138 #ifdef SWIG_MODULE_CLIENTDATA_TYPE
3141 SWIG_TypeQuery(SWIG_MODULE_CLIENTDATA_TYPE clientdata,
const char *name) {