17 #ifndef SWIGTEMPLATEDISAMBIGUATOR
18 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
19 # define SWIGTEMPLATEDISAMBIGUATOR template
20 # elif defined(__HP_aCC)
23 # define SWIGTEMPLATEDISAMBIGUATOR template
25 # define SWIGTEMPLATEDISAMBIGUATOR
31 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
32 # define SWIGINLINE inline
40 # if defined(__GNUC__)
41 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
42 # define SWIGUNUSED __attribute__ ((__unused__))
47 # define SWIGUNUSED __attribute__ ((__unused__))
53 #ifndef SWIG_MSC_UNSUPPRESS_4505
54 # if defined(_MSC_VER)
55 # pragma warning(disable : 4505)
59 #ifndef SWIGUNUSEDPARM
61 # define SWIGUNUSEDPARM(p)
63 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
69 # define SWIGINTERN static SWIGUNUSED
73 #ifndef SWIGINTERNINLINE
74 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
78 #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
79 # ifndef GCC_HASCLASSVISIBILITY
80 # define GCC_HASCLASSVISIBILITY
85 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
86 # if defined(STATIC_LINKED)
89 # define SWIGEXPORT __declspec(dllexport)
92 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
93 # define SWIGEXPORT __attribute__ ((visibility("default")))
102 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
103 # define SWIGSTDCALL __stdcall
110 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
111 # define _CRT_SECURE_NO_DEPRECATE
115 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
116 # define _SCL_SECURE_NO_DEPRECATE
120 #define SWIG_UnknownError -1
121 #define SWIG_IOError -2
122 #define SWIG_RuntimeError -3
123 #define SWIG_IndexError -4
124 #define SWIG_TypeError -5
125 #define SWIG_DivisionByZero -6
126 #define SWIG_OverflowError -7
127 #define SWIG_SyntaxError -8
128 #define SWIG_ValueError -9
129 #define SWIG_SystemError -10
130 #define SWIG_AttributeError -11
131 #define SWIG_MemoryError -12
132 #define SWIG_NullReferenceError -13
136 #define SWIG_UnknownError -1
137 #define SWIG_IOError -2
138 #define SWIG_RuntimeError -3
139 #define SWIG_IndexError -4
140 #define SWIG_TypeError -5
141 #define SWIG_DivisionByZero -6
142 #define SWIG_OverflowError -7
143 #define SWIG_SyntaxError -8
144 #define SWIG_ValueError -9
145 #define SWIG_SystemError -10
146 #define SWIG_AttributeError -11
147 #define SWIG_MemoryError -12
148 #define SWIG_NullReferenceError -13
160 #define SWIG_RUNTIME_VERSION "4"
163 #ifdef SWIG_TYPE_TABLE
164 # define SWIG_QUOTE_STRING(x) #x
165 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
166 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
168 # define SWIG_TYPE_TABLE_NAME
181 # define SWIGRUNTIME SWIGINTERN
184 #ifndef SWIGRUNTIMEINLINE
185 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
189 #ifndef SWIG_BUFFER_SIZE
190 # define SWIG_BUFFER_SIZE 1024
194 #define SWIG_POINTER_DISOWN 0x1
195 #define SWIG_CAST_NEW_MEMORY 0x2
198 #define SWIG_POINTER_OWN 0x1
281 #define SWIG_ERROR (-1)
282 #define SWIG_IsOK(r) (r >= 0)
283 #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
286 #define SWIG_CASTRANKLIMIT (1 << 8)
288 #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
290 #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
292 #define SWIG_BADOBJ (SWIG_ERROR)
293 #define SWIG_OLDOBJ (SWIG_OK)
294 #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
295 #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
297 #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
298 #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
299 #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
300 #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
301 #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
302 #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
305 #if defined(SWIG_CASTRANK_MODE)
306 # ifndef SWIG_TypeRank
307 # define SWIG_TypeRank unsigned long
309 # ifndef SWIG_MAXCASTRANK
310 # define SWIG_MAXCASTRANK (2)
312 # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
313 # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
318 return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
321 # define SWIG_AddCast
322 # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
332 typedef void *(*swig_converter_func)(
void *,
int *);
374 const char *f2,
const char *l2) {
375 for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
376 while ((*f1 ==
' ') && (f1 != l1)) ++f1;
377 while ((*f2 ==
' ') && (f2 != l2)) ++f2;
378 if (*f1 != *f2)
return (*f1 > *f2) ? 1 : -1;
380 return (
int)((l1 - f1) - (l2 - f2));
390 const char* te = tb + strlen(tb);
392 while (!equiv && *ne) {
393 for (nb = ne; *ne; ++ne) {
394 if (*ne ==
'|')
break;
409 const char* te = tb + strlen(tb);
411 while (!equiv && *ne) {
412 for (nb = ne; *ne; ++ne) {
413 if (*ne ==
'|')
break;
430 if (strcmp(iter->
type->
name, c) == 0) {
431 if (iter == ty->
cast)
457 if (iter->
type == from) {
458 if (iter == ty->
cast)
490 if (!ty || !ty->
dcast)
return ty;
491 while (ty && (ty->
dcast)) {
492 ty = (*ty->
dcast)(ptr);
516 if (!type)
return NULL;
517 if (type->
str != NULL) {
518 const char *last_name = type->
str;
520 for (s = type->
str; *s; s++)
521 if (*s ==
'|') last_name = s+1;
568 register size_t l = 0;
569 register size_t r = iter->
size - 1;
572 register size_t i = (l + r) >> 1;
573 const char *iname = iter->
types[i]->
name;
575 register int compare = strcmp(name, iname);
577 return iter->
types[i];
578 }
else if (compare < 0) {
584 }
else if (compare > 0) {
593 }
while (iter != end);
619 register size_t i = 0;
620 for (; i < iter->
size; ++i) {
622 return iter->
types[i];
625 }
while (iter != end);
637 static const char hex[17] =
"0123456789abcdef";
638 register const unsigned char *u = (
unsigned char *) ptr;
639 register const unsigned char *eu = u + sz;
640 for (; u != eu; ++u) {
641 register unsigned char uu = *u;
642 *(c++) = hex[(uu & 0xf0) >> 4];
643 *(c++) = hex[uu & 0xf];
653 register unsigned char *u = (
unsigned char *) ptr;
654 register const unsigned char *eu = u + sz;
655 for (; u != eu; ++u) {
656 register char d = *(c++);
657 register unsigned char uu;
658 if ((d >=
'0') && (d <=
'9'))
659 uu = ((d -
'0') << 4);
660 else if ((d >=
'a') && (d <=
'f'))
661 uu = ((d - (
'a'-10)) << 4);
665 if ((d >=
'0') && (d <=
'9'))
667 else if ((d >=
'a') && (d <=
'f'))
668 uu |= (d - (
'a'-10));
682 if ((2*
sizeof(
void *) + 2) > bsz)
return 0;
685 if (strlen(name) + 1 > (bsz - (r - buff)))
return 0;
693 if (strcmp(c,
"NULL") == 0) {
706 size_t lname = (name ? strlen(name) : 0);
707 if ((2*sz + 2 + lname) > bsz)
return 0;
711 strncpy(r,name,lname+1);
721 if (strcmp(c,
"NULL") == 0) {
735 #if PY_VERSION_HEX >= 0x03000000
737 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
738 #define PyInt_Check(x) PyLong_Check(x)
739 #define PyInt_AsLong(x) PyLong_AsLong(x)
740 #define PyInt_FromLong(x) PyLong_FromLong(x)
741 #define PyString_Check(name) PyBytes_Check(name)
742 #define PyString_FromString(x) PyUnicode_FromString(x)
743 #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args)
744 #define PyString_AsString(str) PyBytes_AsString(str)
745 #define PyString_Size(str) PyBytes_Size(str)
746 #define PyString_InternFromString(key) PyUnicode_InternFromString(key)
747 #define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
748 #define PyString_AS_STRING(x) PyUnicode_AS_STRING(x)
749 #define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)
754 # define Py_TYPE(op) ((op)->ob_type)
759 #if PY_VERSION_HEX >= 0x03000000
760 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat
762 # define SWIG_Python_str_FromFormat PyString_FromFormat
772 #if PY_VERSION_HEX >= 0x03000000
776 str = PyUnicode_AsUTF8String(str);
777 PyBytes_AsStringAndSize(str, &cstr, &len);
778 newstr = (
char *) malloc(len+1);
779 memcpy(newstr, cstr, len+1);
783 return PyString_AsString(str);
787 #if PY_VERSION_HEX >= 0x03000000
788 # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
790 # define SWIG_Python_str_DelForPy3(x)
797 #if PY_VERSION_HEX >= 0x03000000
798 return PyUnicode_FromString(c);
800 return PyString_FromString(c);
805 #if PY_VERSION_HEX < 0x02020000
806 # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
807 # define PyOS_snprintf _snprintf
809 # define PyOS_snprintf snprintf
814 #if PY_VERSION_HEX < 0x02020000
816 #ifndef SWIG_PYBUFFER_SIZE
817 # define SWIG_PYBUFFER_SIZE 1024
821 PyString_FromFormat(
const char *fmt, ...) {
826 res = vsnprintf(buf,
sizeof(buf), fmt, ap);
828 return (res < 0 || res >= (
int)
sizeof(buf)) ? 0 : PyString_FromString(buf);
833 #if PY_VERSION_HEX < 0x01060000
834 # define PyObject_Del(op) PyMem_DEL((op))
837 # define PyObject_DEL PyObject_Del
841 #if PY_VERSION_HEX < 0x02020000
842 # ifndef PyExc_StopIteration
843 # define PyExc_StopIteration PyExc_RuntimeError
845 # ifndef PyObject_GenericGetAttr
846 # define PyObject_GenericGetAttr 0
851 #if PY_VERSION_HEX < 0x02010000
852 # ifndef Py_NotImplemented
853 # define Py_NotImplemented PyExc_RuntimeError
858 #if PY_VERSION_HEX < 0x02010000
859 # ifndef PyString_AsStringAndSize
860 # define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;}
865 #if PY_VERSION_HEX < 0x02000000
866 # ifndef PySequence_Size
867 # define PySequence_Size PySequence_Length
872 #if PY_VERSION_HEX < 0x02030000
874 PyObject *PyBool_FromLong(
long ok)
876 PyObject *result = ok ? Py_True : Py_False;
885 #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
887 # define PY_SSIZE_T_MAX INT_MAX
888 # define PY_SSIZE_T_MIN INT_MIN
898 static long PyNumber_AsSsize_t (PyObject *x,
void *
SWIGUNUSEDPARM(exc))
901 PyObject *i = PyNumber_Int(x);
903 result = PyInt_AsLong(i);
910 #if PY_VERSION_HEX < 0x02040000
911 #define Py_VISIT(op) \
914 int vret = visit((op), arg); \
921 #if PY_VERSION_HEX < 0x02030000
932 #if PY_VERSION_HEX < 0x02030000
936 #if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \
937 (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0) || \
938 (PY_MAJOR_VERSION > 3))
939 # define SWIGPY_USE_CAPSULE
940 # define SWIGPY_CAPSULE_NAME ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
943 #if PY_VERSION_HEX < 0x03020000
944 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
945 #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
956 type = PyExc_MemoryError;
959 type = PyExc_IOError;
962 type = PyExc_RuntimeError;
965 type = PyExc_IndexError;
968 type = PyExc_TypeError;
971 type = PyExc_ZeroDivisionError;
974 type = PyExc_OverflowError;
977 type = PyExc_SyntaxError;
980 type = PyExc_ValueError;
983 type = PyExc_SystemError;
986 type = PyExc_AttributeError;
989 type = PyExc_RuntimeError;
1000 PyObject *traceback = 0;
1002 if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
1005 PyObject *old_str = PyObject_Str(value);
1014 PyErr_SetString(PyExc_RuntimeError, mesg);
1017 #if defined(SWIG_PYTHON_NO_THREADS)
1018 # if defined(SWIG_PYTHON_THREADS)
1019 # undef SWIG_PYTHON_THREADS
1022 #if defined(SWIG_PYTHON_THREADS)
1023 # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
1024 # if (PY_VERSION_HEX >= 0x02030000)
1025 # define SWIG_PYTHON_USE_GIL
1028 # if defined(SWIG_PYTHON_USE_GIL)
1029 # ifndef SWIG_PYTHON_INITIALIZE_THREADS
1030 # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
1033 class SWIG_Python_Thread_Block {
1035 PyGILState_STATE state;
1037 void end() {
if (status) { PyGILState_Release(state); status =
false;} }
1038 SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
1039 ~SWIG_Python_Thread_Block() { end(); }
1041 class SWIG_Python_Thread_Allow {
1043 PyThreadState *save;
1045 void end() {
if (status) { PyEval_RestoreThread(save); status =
false; }}
1046 SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
1047 ~SWIG_Python_Thread_Allow() { end(); }
1049 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block
1050 # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end()
1051 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow
1052 # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end()
1054 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
1055 # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block)
1056 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread()
1057 # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow)
1060 # if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
1061 # define SWIG_PYTHON_INITIALIZE_THREADS
1063 # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
1064 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1066 # if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
1067 # define SWIG_PYTHON_THREAD_END_BLOCK
1069 # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
1070 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1072 # if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
1073 # define SWIG_PYTHON_THREAD_END_ALLOW
1077 # define SWIG_PYTHON_INITIALIZE_THREADS
1078 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1079 # define SWIG_PYTHON_THREAD_END_BLOCK
1080 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1081 # define SWIG_PYTHON_THREAD_END_ALLOW
1096 #define SWIG_PY_POINTER 4
1097 #define SWIG_PY_BINARY 5
1114 #if PY_VERSION_HEX >= 0x03000000
1117 return PyInstanceMethod_New(func);
1142 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1143 #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
1144 #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1146 #ifdef SWIGPYTHON_BUILTIN
1147 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags)
1149 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1152 #define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1154 #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
1155 #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
1156 #define swig_owntype int
1159 #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1160 #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1163 #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1164 #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1167 #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
1168 #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0)
1171 #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1172 #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1177 #define SWIG_GetModule(clientdata) SWIG_Python_GetModule()
1178 #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
1179 #define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
1181 #define SWIG_SetErrorObj SWIG_Python_SetErrorObj
1182 #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
1183 #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
1184 #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
1185 #define SWIG_fail goto fail
1195 PyErr_SetObject(errtype, obj);
1203 PyErr_SetString(errtype, (
char *) msg);
1207 #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
1211 #if defined(SWIGPYTHON_BUILTIN)
1214 SwigPyBuiltin_AddPublicSymbol(PyObject *seq,
const char *key) {
1215 PyObject *s = PyString_InternFromString(key);
1216 PyList_Append(seq, s);
1222 PyDict_SetItemString(d, (
char *)name, obj);
1224 if (public_interface)
1225 SwigPyBuiltin_AddPublicSymbol(public_interface, name);
1232 PyDict_SetItemString(d, (
char *)name, obj);
1242 #if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
1245 }
else if (result == Py_None) {
1249 if (!PyList_Check(result)) {
1250 PyObject *o2 = result;
1251 result = PyList_New(1);
1252 PyList_SetItem(result, 0, o2);
1254 PyList_Append(result,obj);
1263 }
else if (result == Py_None) {
1267 if (!PyTuple_Check(result)) {
1269 result = PyTuple_New(1);
1270 PyTuple_SET_ITEM(result, 0, o2);
1272 o3 = PyTuple_New(1);
1273 PyTuple_SET_ITEM(o3, 0, obj);
1275 result = PySequence_Concat(o2, o3);
1292 PyErr_Format(PyExc_TypeError,
"%s expected %s%d arguments, got none",
1293 name, (min == max ?
"" :
"at least "), (
int)min);
1297 if (!PyTuple_Check(args)) {
1298 if (min <= 1 && max >= 1) {
1301 for (i = 1; i < max; ++i) {
1306 PyErr_SetString(PyExc_SystemError,
"UnpackTuple() argument list is not a tuple");
1309 register Py_ssize_t l = PyTuple_GET_SIZE(args);
1311 PyErr_Format(PyExc_TypeError,
"%s expected %s%d arguments, got %d",
1312 name, (min == max ?
"" :
"at least "), (
int)min, (
int)l);
1314 }
else if (l > max) {
1315 PyErr_Format(PyExc_TypeError,
"%s expected %s%d arguments, got %d",
1316 name, (min == max ?
"" :
"at most "), (
int)max, (
int)l);
1320 for (i = 0; i < l; ++i) {
1321 objs[i] = PyTuple_GET_ITEM(args, i);
1323 for (; l < max; ++l) {
1332 #if PY_VERSION_HEX >= 0x02020000
1333 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
1335 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj);
1343 #define SWIG_STATIC_POINTER(var) var
1345 #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
1353 #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1)
1354 #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
1356 #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
1358 #define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2)
1359 #define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN)
1366 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
1367 # ifndef SWIG_PYTHON_NO_BUILD_NONE
1368 # ifndef SWIG_PYTHON_BUILD_NONE
1369 # define SWIG_PYTHON_BUILD_NONE
1374 #ifdef SWIG_PYTHON_BUILD_NONE
1377 # define Py_None SWIG_Py_None()
1382 PyObject *none = Py_BuildValue((
char*)
"");
1399 PyObject *none = Py_None;
1426 PyObject *klass = data ? data->
klass : 0;
1427 return (klass ? klass : PyExc_RuntimeError);
1440 Py_INCREF(data->
klass);
1442 if (PyClass_Check(obj)) {
1447 #if (PY_VERSION_HEX < 0x02020000)
1450 data->
newraw = PyObject_GetAttrString(data->
klass, (
char *)
"__new__");
1454 data->
newargs = PyTuple_New(1);
1455 PyTuple_SetItem(data->
newargs, 0, obj);
1462 data->
destroy = PyObject_GetAttrString(data->
klass, (
char *)
"__swig_destroy__");
1463 if (PyErr_Occurred()) {
1470 flags = PyCFunction_GET_FLAGS(data->
destroy);
1472 data->
delargs = !(flags & (METH_O));
1487 Py_XDECREF(data->
newraw);
1500 #ifdef SWIGPYTHON_BUILTIN
1508 return PyLong_FromVoidPtr(v->
ptr);
1514 PyObject *res = NULL;
1515 PyObject *args = PyTuple_New(1);
1520 #if PY_VERSION_HEX >= 0x03000000
1521 res = PyUnicode_Format(ofmt,args);
1523 res = PyString_Format(ofmt,args);
1560 # if PY_VERSION_HEX >= 0x03000000
1561 PyObject *joined = PyUnicode_Concat(repr, nrep);
1566 PyString_ConcatAndDel(&repr,nrep);
1605 return (i < j) ? -1 : ((i > j) ? 1 : 0);
1613 if( op != Py_EQ && op != Py_NE ) {
1624 #ifdef SWIGPYTHON_BUILTIN
1629 assert(SwigPyObject_stype);
1645 #ifdef SWIGPYTHON_BUILTIN
1647 if (PyType_IsSubtype(op->ob_type, target_tp))
1649 return (strcmp(op->ob_type->tp_name,
"SwigPyObject") == 0);
1652 || (strcmp(
Py_TYPE(op)->tp_name,
"SwigPyObject") == 0);
1663 PyObject *next = sobj->
next;
1667 PyObject *destroy = data ? data->
destroy : 0;
1677 PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
1678 PyObject *mself = PyCFunction_GET_SELF(destroy);
1679 res = ((*meth)(mself, v));
1683 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
1686 printf(
"swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name :
"unknown"));
1700 if (!PyArg_ParseTuple(next,(
char *)
"O:append", &tmp))
return NULL;
1720 Py_INCREF(sobj->
next);
1755 #if (PY_VERSION_HEX < 0x02020000)
1756 if (!PyArg_ParseTuple(args,(
char *)
"|O:own",&val))
1758 if (!PyArg_UnpackTuple(args, (
char *)
"own", 0, 1, &val))
1766 PyObject *obj = PyBool_FromLong(sobj->
own);
1769 if (PyObject_IsTrue(val)) {
1775 if (PyObject_IsTrue(val)) {
1788 swigobject_methods[] = {
1789 {(
char *)
"disown", (PyCFunction)
SwigPyObject_disown, METH_NOARGS, (
char *)
"releases ownership of the pointer"},
1790 {(
char *)
"acquire", (PyCFunction)
SwigPyObject_acquire, METH_NOARGS, (
char *)
"aquires ownership of the pointer"},
1791 {(
char *)
"own", (PyCFunction)
SwigPyObject_own, METH_VARARGS, (
char *)
"returns/sets ownership of the pointer"},
1792 {(
char *)
"append", (PyCFunction)
SwigPyObject_append, METH_O, (
char *)
"appends another 'this' object"},
1793 {(
char *)
"next", (PyCFunction)
SwigPyObject_next, METH_NOARGS, (
char *)
"returns the next 'this' object"},
1794 {(
char *)
"__repr__",(PyCFunction)
SwigPyObject_repr, METH_NOARGS, (
char *)
"returns object representation"},
1799 swigobject_methods[] = {
1800 {(
char *)
"disown", (PyCFunction)
SwigPyObject_disown, METH_VARARGS, (
char *)
"releases ownership of the pointer"},
1801 {(
char *)
"acquire", (PyCFunction)
SwigPyObject_acquire, METH_VARARGS, (
char *)
"aquires ownership of the pointer"},
1802 {(
char *)
"own", (PyCFunction)
SwigPyObject_own, METH_VARARGS, (
char *)
"returns/sets ownership of the pointer"},
1803 {(
char *)
"append", (PyCFunction)
SwigPyObject_append, METH_VARARGS, (
char *)
"appends another 'this' object"},
1804 {(
char *)
"next", (PyCFunction)
SwigPyObject_next, METH_VARARGS, (
char *)
"returns the next 'this' object"},
1805 {(
char *)
"__repr__",(PyCFunction)
SwigPyObject_repr, METH_VARARGS, (
char *)
"returns object representation"},
1810 #if PY_VERSION_HEX < 0x02020000
1814 return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
1820 static char swigobject_doc[] =
"Swig object carries a C/C++ instance pointer";
1822 static PyNumberMethods SwigPyObject_as_number = {
1827 #
if PY_VERSION_HEX < 0x03000000
1843 #
if PY_VERSION_HEX < 0x03000000
1847 #if PY_VERSION_HEX < 0x03000000
1853 #if PY_VERSION_HEX < 0x03000000
1857 #if PY_VERSION_HEX >= 0x03000000
1858 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1859 #elif PY_VERSION_HEX >= 0x02050000
1860 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1861 #elif PY_VERSION_HEX >= 0x02020000
1862 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1863 #elif PY_VERSION_HEX >= 0x02000000
1864 0,0,0,0,0,0,0,0,0,0,0
1868 static PyTypeObject swigpyobject_type;
1869 static int type_init = 0;
1871 const PyTypeObject tmp = {
1873 #if PY_VERSION_HEX >= 0x03000000
1874 PyVarObject_HEAD_INIT(NULL, 0)
1876 PyObject_HEAD_INIT(NULL)
1879 (
char *)
"SwigPyObject",
1884 #if PY_VERSION_HEX < 0x02020000
1890 #
if PY_VERSION_HEX >= 0x03000000
1896 &SwigPyObject_as_number,
1911 #
if PY_VERSION_HEX >= 0x02020000
1933 #
if PY_VERSION_HEX >= 0x02030000
1936 #
if PY_VERSION_HEX >= 0x02060000
1943 swigpyobject_type = tmp;
1945 #if PY_VERSION_HEX < 0x02020000
1946 swigpyobject_type.ob_type = &PyType_Type;
1948 if (PyType_Ready(&swigpyobject_type) < 0)
1952 return &swigpyobject_type;
1965 return (PyObject *)sobj;
1983 fputs(
"<Swig Packed ", fp);
2020 int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
2021 return s ? s : strncmp((
char *)v->
pack, (
char *)w->
pack, 2*v->
size);
2035 || (strcmp((op)->ob_type->tp_name,
"SwigPyPacked") == 0);
2050 static char swigpacked_doc[] =
"Swig object carries a C/C++ instance pointer";
2051 static PyTypeObject swigpypacked_type;
2052 static int type_init = 0;
2054 const PyTypeObject tmp = {
2056 #if PY_VERSION_HEX>=0x03000000
2057 PyVarObject_HEAD_INIT(NULL, 0)
2059 PyObject_HEAD_INIT(NULL)
2062 (
char *)
"SwigPyPacked",
2069 #if PY_VERSION_HEX>=0x03000000
2090 #
if PY_VERSION_HEX >= 0x02020000
2112 #
if PY_VERSION_HEX >= 0x02030000
2115 #
if PY_VERSION_HEX >= 0x02060000
2122 swigpypacked_type = tmp;
2124 #if PY_VERSION_HEX < 0x02020000
2125 swigpypacked_type.ob_type = &PyType_Type;
2127 if (PyType_Ready(&swigpypacked_type) < 0)
2131 return &swigpypacked_type;
2139 void *pack = malloc(size);
2141 memcpy(pack, ptr, size);
2150 return (PyObject *) sobj;
2158 if (sobj->
size != size)
return 0;
2159 memcpy(ptr, sobj->
pack, size);
2176 static PyObject *swig_this = NULL;
2181 if (swig_this == NULL)
2189 #if PY_VERSION_HEX>=0x03000000
2190 #define SWIG_PYTHON_SLOW_GETSET_THIS
2201 #ifdef SWIGPYTHON_BUILTIN
2203 # ifdef PyWeakref_CheckProxy
2204 if (PyWeakref_CheckProxy(pyobj)) {
2205 pyobj = PyWeakref_GET_OBJECT(pyobj);
2215 #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
2216 if (PyInstance_Check(pyobj)) {
2217 obj = _PyInstance_Lookup(pyobj,
SWIG_This());
2219 PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
2220 if (dictptr != NULL) {
2221 PyObject *dict = *dictptr;
2222 obj = dict ? PyDict_GetItem(dict,
SWIG_This()) : 0;
2224 #ifdef PyWeakref_CheckProxy
2225 if (PyWeakref_CheckProxy(pyobj)) {
2226 PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
2230 obj = PyObject_GetAttr(pyobj,
SWIG_This());
2234 if (PyErr_Occurred()) PyErr_Clear();
2240 obj = PyObject_GetAttr(pyobj,
SWIG_This());
2244 if (PyErr_Occurred()) PyErr_Clear();
2264 int oldown = sobj->
own;
2281 if (obj == Py_None) {
2293 void *vptr = sobj->
ptr;
2298 if (ptr) *ptr = vptr;
2318 if (ptr) *ptr = vptr;
2324 *own = *own | sobj->
own;
2333 PyObject *klass = data->
klass;
2339 if (PyErr_Occurred()) {
2373 if (!PyCFunction_Check(obj)) {
2379 const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
2380 const char *desc = doc ? strstr(doc,
"swig_ptr: ") : 0;
2429 #if (PY_VERSION_HEX >= 0x02020000)
2431 PyObject *newraw = data->
newraw;
2433 inst = PyObject_Call(newraw, data->
newargs, NULL);
2435 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2436 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2437 if (dictptr != NULL) {
2438 PyObject *dict = *dictptr;
2440 dict = PyDict_New();
2442 PyDict_SetItem(dict,
SWIG_This(), swig_this);
2447 PyObject_SetAttr(inst, key, swig_this);
2451 #if PY_VERSION_HEX >= 0x03000000
2452 inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->
newargs, Py_None, Py_None);
2453 PyObject_SetAttr(inst,
SWIG_This(), swig_this);
2454 Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
2456 PyObject *dict = PyDict_New();
2457 PyDict_SetItem(dict,
SWIG_This(), swig_this);
2458 inst = PyInstance_NewRaw(data->
newargs, dict);
2464 #if (PY_VERSION_HEX >= 0x02010000)
2466 PyObject *dict = PyDict_New();
2467 PyDict_SetItem(dict,
SWIG_This(), swig_this);
2468 inst = PyInstance_NewRaw(data->
newargs, dict);
2470 return (PyObject *) inst;
2472 PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
2476 inst->in_class = (PyClassObject *)data->
newargs;
2477 Py_INCREF(inst->in_class);
2478 inst->in_dict = PyDict_New();
2479 if (inst->in_dict == NULL) {
2483 #ifdef Py_TPFLAGS_HAVE_WEAKREFS
2484 inst->in_weakreflist = NULL;
2486 #ifdef Py_TPFLAGS_GC
2487 PyObject_GC_Init(inst);
2489 PyDict_SetItem(inst->in_dict,
SWIG_This(), swig_this);
2490 return (PyObject *) inst;
2499 #if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2500 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2501 if (dictptr != NULL) {
2504 dict = PyDict_New();
2507 PyDict_SetItem(dict,
SWIG_This(), swig_this);
2511 dict = PyObject_GetAttrString(inst, (
char*)
"__dict__");
2512 PyDict_SetItem(dict,
SWIG_This(), swig_this);
2546 if (clientdata && clientdata->
pytype) {
2551 PyObject *next_self = clientdata->
pytype->tp_alloc(clientdata->
pytype, 0);
2552 while (newobj->
next)
2554 newobj->
next = next_self;
2565 #ifdef SWIGPYTHON_BUILTIN
2568 return (PyObject*) newobj;
2597 #ifdef SWIG_LINK_RUNTIME
2598 void *SWIG_ReturnGlobalTypeList(
void *);
2603 static void *type_pointer = (
void *)0;
2605 if (!type_pointer) {
2606 #ifdef SWIG_LINK_RUNTIME
2607 type_pointer = SWIG_ReturnGlobalTypeList((
void *)0);
2609 # ifdef SWIGPY_USE_CAPSULE
2610 type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
2615 if (PyErr_Occurred()) {
2617 type_pointer = (
void *)0;
2624 #if PY_MAJOR_VERSION < 2
2631 if (!PyModule_Check(m)) {
2632 PyErr_SetString(PyExc_TypeError,
2633 "PyModule_AddObject() needs module as first arg");
2637 PyErr_SetString(PyExc_TypeError,
2638 "PyModule_AddObject() needs non-NULL value");
2642 dict = PyModule_GetDict(m);
2645 PyErr_Format(PyExc_SystemError,
"module '%s' has no __dict__",
2646 PyModule_GetName(m));
2649 if (PyDict_SetItemString(dict, name, o))
2657 #ifdef SWIGPY_USE_CAPSULE
2663 #ifdef SWIGPY_USE_CAPSULE
2670 for (i =0; i < swig_module->
size; ++i) {
2683 #if PY_VERSION_HEX >= 0x03000000
2687 static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };
2688 PyObject *module = Py_InitModule((
char*)
"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table);
2690 #ifdef SWIGPY_USE_CAPSULE
2692 if (pointer && module) {
2695 Py_XDECREF(pointer);
2699 if (pointer && module) {
2702 Py_XDECREF(pointer);
2719 PyObject *obj = PyDict_GetItem(cache, key);
2722 #ifdef SWIGPY_USE_CAPSULE
2731 #ifdef SWIGPY_USE_CAPSULE
2732 obj = PyCapsule_New((
void*) descriptor, NULL, NULL);
2734 obj = PyCObject_FromVoidPtr(descriptor, NULL);
2736 PyDict_SetItem(cache, key, obj);
2747 #define SWIG_POINTER_EXCEPTION 0
2748 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
2749 #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
2754 if (PyErr_Occurred()) {
2756 PyObject *value = 0;
2757 PyObject *traceback = 0;
2758 PyErr_Fetch(&type, &value, &traceback);
2761 PyObject *old_str = PyObject_Str(value);
2781 if (PyErr_Occurred()) {
2784 PyOS_snprintf(mesg,
sizeof(mesg),
"argument number %d:", argnum);
2796 return ty ? ty->
str : (
char*)
"";
2803 #if defined(SWIG_COBJECT_TYPES)
2807 PyErr_Format(PyExc_TypeError,
"a '%s' is expected, 'SwigPyObject(%s)' is received",
2814 const char *otype = (obj ? obj->ob_type->tp_name : 0);
2816 PyObject *str = PyObject_Str(obj);
2819 PyErr_Format(PyExc_TypeError,
"a '%s' is expected, '%s(%s)' is received",
2823 PyErr_Format(PyExc_TypeError,
"a '%s' is expected, '%s' is received",
2830 PyErr_Format(PyExc_TypeError,
"a '%s' is expected", type);
2832 PyErr_Format(PyExc_TypeError,
"unexpected type is received");
2843 #if SWIG_POINTER_EXCEPTION
2855 PyTypeObject *tp = obj->ob_type;
2857 PyObject *encoded_name;
2861 #ifdef Py_USING_UNICODE
2862 if (PyString_Check(name)) {
2863 name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL);
2866 }
else if (!PyUnicode_Check(name))
2868 if (!PyString_Check(name))
2871 PyErr_Format(PyExc_TypeError,
"attribute name must be string, not '%.200s'", name->ob_type->tp_name);
2878 if (PyType_Ready(tp) < 0)
2883 descr = _PyType_Lookup(tp, name);
2886 f = descr->ob_type->tp_descr_set;
2888 if (PyString_Check(name)) {
2889 encoded_name = name;
2892 encoded_name = PyUnicode_AsUTF8String(name);
2894 PyErr_Format(PyExc_AttributeError,
"'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name));
2895 Py_DECREF(encoded_name);
2897 res = f(descr, obj, value);
2918 #ifdef SWIG_MODULE_CLIENTDATA_TYPE