16 #define SWIG_DIRECTORS
17 #define SWIG_PYTHON_THREADS
18 #define SWIG_PYTHON_DIRECTOR_NO_VTABLE
23 template<
typename T>
class SwigValueWrapper {
24 struct SwigMovePointer {
26 SwigMovePointer(T *p) : ptr(p) { }
27 ~SwigMovePointer() {
delete ptr; }
28 SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0;
delete oldptr; ptr = rhs.ptr; rhs.ptr = 0;
return *
this; }
30 SwigValueWrapper& operator=(
const SwigValueWrapper<T>& rhs);
31 SwigValueWrapper(
const SwigValueWrapper<T>& rhs);
33 SwigValueWrapper() : pointer(0) { }
34 SwigValueWrapper& operator=(
const T& t) { SwigMovePointer tmp(
new T(t)); pointer = tmp;
return *
this; }
35 operator T&()
const {
return *pointer.ptr; }
36 T *operator&() {
return pointer.ptr; }
39 template <
typename T> T SwigValueInit() {
50 #ifndef SWIGTEMPLATEDISAMBIGUATOR
51 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
52 # define SWIGTEMPLATEDISAMBIGUATOR template
53 # elif defined(__HP_aCC)
56 # define SWIGTEMPLATEDISAMBIGUATOR template
58 # define SWIGTEMPLATEDISAMBIGUATOR
64 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
65 # define SWIGINLINE inline
73 # if defined(__GNUC__)
74 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
75 # define SWIGUNUSED __attribute__ ((__unused__))
80 # define SWIGUNUSED __attribute__ ((__unused__))
86 #ifndef SWIG_MSC_UNSUPPRESS_4505
87 # if defined(_MSC_VER)
88 # pragma warning(disable : 4505)
92 #ifndef SWIGUNUSEDPARM
94 # define SWIGUNUSEDPARM(p)
96 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
102 # define SWIGINTERN static SWIGUNUSED
106 #ifndef SWIGINTERNINLINE
107 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
111 #if defined(__GNUC__)
112 # if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
113 # ifndef GCC_HASCLASSVISIBILITY
114 # define GCC_HASCLASSVISIBILITY
120 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
121 # if defined(STATIC_LINKED)
124 # define SWIGEXPORT __declspec(dllexport)
127 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
128 # define SWIGEXPORT __attribute__ ((visibility("default")))
137 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
138 # define SWIGSTDCALL __stdcall
145 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
146 # define _CRT_SECURE_NO_DEPRECATE
150 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
151 # define _SCL_SECURE_NO_DEPRECATE
155 #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
156 # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
164 #ifdef __INTEL_COMPILER
165 # pragma warning disable 592
169 #if defined(__GNUC__) && defined(_WIN32) && !defined(SWIG_PYTHON_NO_HYPOT_WORKAROUND)
174 #if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
192 #define SWIG_RUNTIME_VERSION "4"
195 #ifdef SWIG_TYPE_TABLE
196 # define SWIG_QUOTE_STRING(x) #x
197 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
198 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
200 # define SWIG_TYPE_TABLE_NAME
213 # define SWIGRUNTIME SWIGINTERN
216 #ifndef SWIGRUNTIMEINLINE
217 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
221 #ifndef SWIG_BUFFER_SIZE
222 # define SWIG_BUFFER_SIZE 1024
226 #define SWIG_POINTER_DISOWN 0x1
227 #define SWIG_CAST_NEW_MEMORY 0x2
228 #define SWIG_POINTER_NO_NULL 0x4
231 #define SWIG_POINTER_OWN 0x1
314 #define SWIG_ERROR (-1)
315 #define SWIG_IsOK(r) (r >= 0)
316 #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
319 #define SWIG_CASTRANKLIMIT (1 << 8)
321 #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
323 #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
325 #define SWIG_BADOBJ (SWIG_ERROR)
326 #define SWIG_OLDOBJ (SWIG_OK)
327 #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
328 #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
330 #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
331 #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
332 #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
333 #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
334 #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
335 #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
338 #if defined(SWIG_CASTRANK_MODE)
339 # ifndef SWIG_TypeRank
340 # define SWIG_TypeRank unsigned long
342 # ifndef SWIG_MAXCASTRANK
343 # define SWIG_MAXCASTRANK (2)
345 # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
346 # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
351 return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
354 # define SWIG_AddCast(r) (r)
355 # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
365 typedef void *(*swig_converter_func)(
void *,
int *);
407 const char *f2,
const char *l2) {
408 for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
409 while ((*f1 ==
' ') && (f1 != l1)) ++f1;
410 while ((*f2 ==
' ') && (f2 != l2)) ++f2;
411 if (*f1 != *f2)
return (*f1 > *f2) ? 1 : -1;
413 return (
int)((l1 - f1) - (l2 - f2));
423 const char* te = tb + strlen(tb);
425 while (equiv != 0 && *ne) {
426 for (nb = ne; *ne; ++ne) {
427 if (*ne ==
'|')
break;
452 if (strcmp(iter->
type->
name, c) == 0) {
453 if (iter == ty->
cast)
479 if (iter->
type == from) {
480 if (iter == ty->
cast)
512 if (!ty || !ty->
dcast)
return ty;
513 while (ty && (ty->
dcast)) {
514 ty = (*ty->
dcast)(ptr);
538 if (!type)
return NULL;
539 if (type->
str != NULL) {
540 const char *last_name = type->
str;
542 for (s = type->
str; *s; s++)
543 if (*s ==
'|') last_name = s+1;
591 size_t r = iter->
size - 1;
594 size_t i = (l + r) >> 1;
595 const char *iname = iter->
types[i]->
name;
597 int compare = strcmp(
name, iname);
599 return iter->
types[i];
600 }
else if (compare < 0) {
606 }
else if (compare > 0) {
615 }
while (iter != end);
642 for (; i < iter->
size; ++i) {
644 return iter->
types[i];
647 }
while (iter != end);
659 static const char hex[17] =
"0123456789abcdef";
660 const unsigned char *u = (
unsigned char *) ptr;
661 const unsigned char *eu = u + sz;
662 for (; u != eu; ++u) {
663 unsigned char uu = *u;
664 *(c++) = hex[(uu & 0xf0) >> 4];
665 *(c++) = hex[uu & 0xf];
675 unsigned char *u = (
unsigned char *) ptr;
676 const unsigned char *eu = u + sz;
677 for (; u != eu; ++u) {
680 if ((d >=
'0') && (d <=
'9'))
681 uu = (
unsigned char)((d -
'0') << 4);
682 else if ((d >=
'a') && (d <=
'f'))
683 uu = (
unsigned char)((d - (
'a'-10)) << 4);
687 if ((d >=
'0') && (d <=
'9'))
688 uu |= (
unsigned char)(d -
'0');
689 else if ((d >=
'a') && (d <=
'f'))
690 uu |= (
unsigned char)(d - (
'a'-10));
704 if ((2*
sizeof(
void *) + 2) > bsz)
return 0;
707 if (strlen(
name) + 1 > (bsz - (r - buff)))
return 0;
715 if (strcmp(c,
"NULL") == 0) {
728 size_t lname = (
name ? strlen(
name) : 0);
729 if ((2*sz + 2 + lname) > bsz)
return 0;
733 strncpy(r,
name,lname+1);
743 if (strcmp(c,
"NULL") == 0) {
758 #define SWIG_UnknownError -1
759 #define SWIG_IOError -2
760 #define SWIG_RuntimeError -3
761 #define SWIG_IndexError -4
762 #define SWIG_TypeError -5
763 #define SWIG_DivisionByZero -6
764 #define SWIG_OverflowError -7
765 #define SWIG_SyntaxError -8
766 #define SWIG_ValueError -9
767 #define SWIG_SystemError -10
768 #define SWIG_AttributeError -11
769 #define SWIG_MemoryError -12
770 #define SWIG_NullReferenceError -13
775 #if PY_VERSION_HEX >= 0x03000000
777 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
778 #define PyInt_Check(x) PyLong_Check(x)
779 #define PyInt_AsLong(x) PyLong_AsLong(x)
780 #define PyInt_FromLong(x) PyLong_FromLong(x)
781 #define PyInt_FromSize_t(x) PyLong_FromSize_t(x)
782 #define PyString_Check(name) PyBytes_Check(name)
783 #define PyString_FromString(x) PyUnicode_FromString(x)
784 #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args)
785 #define PyString_AsString(str) PyBytes_AsString(str)
786 #define PyString_Size(str) PyBytes_Size(str)
787 #define PyString_InternFromString(key) PyUnicode_InternFromString(key)
788 #define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
789 #define PyString_AS_STRING(x) PyUnicode_AS_STRING(x)
790 #define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)
795 # define Py_TYPE(op) ((op)->ob_type)
800 #if PY_VERSION_HEX >= 0x03000000
801 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat
803 # define SWIG_Python_str_FromFormat PyString_FromFormat
813 #if PY_VERSION_HEX >= 0x03030000
814 return (
char *)PyUnicode_AsUTF8(str);
815 #elif PY_VERSION_HEX >= 0x03000000
817 str = PyUnicode_AsUTF8String(str);
821 if (PyBytes_AsStringAndSize(str, &cstr, &len) != -1) {
822 newstr = (
char *)
malloc(len+1);
824 memcpy(newstr, cstr, len+1);
830 return PyString_AsString(str);
834 #if PY_VERSION_HEX >= 0x03030000 || PY_VERSION_HEX < 0x03000000
835 # define SWIG_Python_str_DelForPy3(x)
837 # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
844 #if PY_VERSION_HEX >= 0x03000000
845 return PyUnicode_FromString(c);
847 return PyString_FromString(c);
852 # define PyObject_DEL PyObject_Del
857 # define SWIGPY_USE_CAPSULE
858 # define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
860 #if PY_VERSION_HEX < 0x03020000
861 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
862 #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
863 #define Py_hash_t long
875 type = PyExc_MemoryError;
878 type = PyExc_IOError;
881 type = PyExc_RuntimeError;
884 type = PyExc_IndexError;
887 type = PyExc_TypeError;
890 type = PyExc_ZeroDivisionError;
893 type = PyExc_OverflowError;
896 type = PyExc_SyntaxError;
899 type = PyExc_ValueError;
902 type = PyExc_SystemError;
905 type = PyExc_AttributeError;
908 type = PyExc_RuntimeError;
919 PyObject *traceback = 0;
921 if (PyErr_Occurred())
922 PyErr_Fetch(&type, &
value, &traceback);
924 PyObject *old_str = PyObject_Str(
value);
929 PyErr_Format(type,
"%s %s", tmp, mesg);
931 PyErr_Format(type,
"%s", mesg);
936 PyErr_SetString(PyExc_RuntimeError, mesg);
946 error = PyErr_Occurred();
947 return error && PyErr_GivenExceptionMatches(error, PyExc_TypeError);
956 PyObject *type = NULL, *
value = NULL, *traceback = NULL;
957 PyErr_Fetch(&type, &
value, &traceback);
958 #if PY_VERSION_HEX >= 0x03000000
959 newvalue = PyUnicode_FromFormat(
"%S\nAdditional information:\n%s",
value,
message);
961 newvalue = PyString_FromFormat(
"%s\nAdditional information:\n%s", PyString_AsString(
value),
message);
964 PyErr_Restore(type, newvalue, traceback);
967 PyErr_SetString(PyExc_TypeError,
message);
971 #if defined(SWIG_PYTHON_NO_THREADS)
972 # if defined(SWIG_PYTHON_THREADS)
973 # undef SWIG_PYTHON_THREADS
976 #if defined(SWIG_PYTHON_THREADS)
977 # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
978 # define SWIG_PYTHON_USE_GIL
980 # if defined(SWIG_PYTHON_USE_GIL)
981 # ifndef SWIG_PYTHON_INITIALIZE_THREADS
982 # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
985 class SWIG_Python_Thread_Block {
987 PyGILState_STATE state;
989 void end() {
if (status) { PyGILState_Release(state); status =
false;} }
990 SWIG_Python_Thread_Block() : status(
true), state(PyGILState_Ensure()) {}
991 ~SWIG_Python_Thread_Block() { end(); }
993 class SWIG_Python_Thread_Allow {
997 void end() {
if (status) { PyEval_RestoreThread(save); status =
false; }}
998 SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
999 ~SWIG_Python_Thread_Allow() { end(); }
1001 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block
1002 # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end()
1003 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow
1004 # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end()
1006 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
1007 # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block)
1008 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread()
1009 # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow)
1012 # if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
1013 # define SWIG_PYTHON_INITIALIZE_THREADS
1015 # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
1016 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1018 # if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
1019 # define SWIG_PYTHON_THREAD_END_BLOCK
1021 # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
1022 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1024 # if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
1025 # define SWIG_PYTHON_THREAD_END_ALLOW
1029 # define SWIG_PYTHON_INITIALIZE_THREADS
1030 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1031 # define SWIG_PYTHON_THREAD_END_BLOCK
1032 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1033 # define SWIG_PYTHON_THREAD_END_ALLOW
1049 #define SWIG_PY_POINTER 4
1050 #define SWIG_PY_BINARY 5
1076 #if PY_VERSION_HEX < 0x02070000
1077 # error "This version of SWIG only supports Python >= 2.7"
1080 #if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03020000
1081 # error "This version of SWIG only supports Python 3 >= 3.2"
1087 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1088 #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
1089 #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1091 #ifdef SWIGPYTHON_BUILTIN
1092 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags)
1094 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1097 #define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1099 #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
1100 #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
1101 #define swig_owntype int
1104 #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1105 #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1108 #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1109 #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1112 #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
1113 #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0)
1116 #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1117 #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1122 #define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata)
1123 #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
1124 #define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
1126 #define SWIG_SetErrorObj SWIG_Python_SetErrorObj
1127 #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
1128 #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
1129 #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
1130 #define SWIG_fail goto fail
1140 PyErr_SetObject(errtype, obj);
1148 PyErr_SetString(errtype, msg);
1152 #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
1156 #if defined(SWIGPYTHON_BUILTIN)
1159 SwigPyBuiltin_AddPublicSymbol(PyObject *seq,
const char *key) {
1160 PyObject *s = PyString_InternFromString(key);
1161 PyList_Append(seq, s);
1167 PyDict_SetItemString(d,
name, obj);
1169 if (public_interface)
1170 SwigPyBuiltin_AddPublicSymbol(public_interface,
name);
1177 PyDict_SetItemString(d,
name, obj);
1189 }
else if (result == Py_None) {
1193 if (!PyList_Check(result)) {
1194 PyObject *o2 = result;
1195 result = PyList_New(1);
1196 PyList_SetItem(result, 0, o2);
1198 PyList_Append(result,obj);
1213 PyErr_Format(PyExc_TypeError,
"%s expected %s%d arguments, got none",
1218 if (!PyTuple_Check(args)) {
1219 if (min <= 1 && max >= 1) {
1222 for (i = 1; i <
max; ++i) {
1227 PyErr_SetString(PyExc_SystemError,
"UnpackTuple() argument list is not a tuple");
1230 Py_ssize_t l = PyTuple_GET_SIZE(args);
1232 PyErr_Format(PyExc_TypeError,
"%s expected %s%d arguments, got %d",
1235 }
else if (l >
max) {
1236 PyErr_Format(PyExc_TypeError,
"%s expected %s%d arguments, got %d",
1241 for (i = 0; i < l; ++i) {
1242 objs[i] = PyTuple_GET_ITEM(args, i);
1244 for (; l <
max; ++l) {
1256 assert(PyDict_Check(kwargs));
1257 if (PyDict_Size(kwargs) > 0) {
1258 PyErr_Format(PyExc_TypeError,
"%s() does not take keyword arguments",
name);
1266 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
1273 #define SWIG_STATIC_POINTER(var) var
1275 #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
1283 #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1)
1284 #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
1286 #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
1288 #define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2)
1289 #define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN)
1300 PyObject *none = Py_None;
1314 PyTypeObject *pytype;
1323 PyErr_SetString(PyExc_TypeError,
"Implicit conversion is prohibited for explicit constructors.");
1330 PyObject *klass = data ? data->
klass : 0;
1331 return (klass ? klass : PyExc_RuntimeError);
1344 Py_INCREF(data->
klass);
1346 if (PyClass_Check(obj)) {
1351 data->
newraw = PyObject_GetAttrString(data->
klass,
"__new__");
1354 data->
newargs = PyTuple_New(1);
1355 PyTuple_SetItem(data->
newargs, 0, obj);
1362 data->
destroy = PyObject_GetAttrString(data->
klass,
"__swig_destroy__");
1363 if (PyErr_Occurred()) {
1370 flags = PyCFunction_GET_FLAGS(data->
destroy);
1371 data->
delargs = !(flags & (METH_O));
1383 Py_XDECREF(data->
newraw);
1396 #ifdef SWIGPYTHON_BUILTIN
1402 #ifdef SWIGPYTHON_BUILTIN
1405 SwigPyObject_get___dict__(PyObject *v, PyObject *
SWIGUNUSEDPARM(args))
1410 sobj->dict = PyDict_New();
1412 Py_INCREF(sobj->dict);
1421 return PyLong_FromVoidPtr(v->
ptr);
1427 PyObject *res = NULL;
1428 PyObject *args = PyTuple_New(1);
1433 #if PY_VERSION_HEX >= 0x03000000
1434 res = PyUnicode_Format(ofmt,args);
1436 res = PyString_Format(ofmt,args);
1465 # if PY_VERSION_HEX >= 0x03000000
1466 PyObject *joined = PyUnicode_Concat(repr, nrep);
1471 PyString_ConcatAndDel(&repr,nrep);
1490 return (i < j) ? -1 : ((i > j) ? 1 : 0);
1498 if( op != Py_EQ && op != Py_NE ) {
1499 Py_INCREF(Py_NotImplemented);
1500 return Py_NotImplemented;
1509 #ifdef SWIGPYTHON_BUILTIN
1514 assert(SwigPyObject_stype);
1530 #ifdef SWIGPYTHON_BUILTIN
1532 if (PyType_IsSubtype(op->ob_type, target_tp))
1534 return (strcmp(op->ob_type->tp_name,
"SwigPyObject") == 0);
1537 || (strcmp(
Py_TYPE(op)->tp_name,
"SwigPyObject") == 0);
1552 PyObject *destroy = data ? data->
destroy : 0;
1564 PyObject *type = NULL, *
value = NULL, *traceback = NULL;
1565 PyErr_Fetch(&type, &
value, &traceback);
1573 PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
1574 PyObject *mself = PyCFunction_GET_SELF(destroy);
1575 res = ((*meth)(mself, v));
1578 PyErr_WriteUnraisable(destroy);
1580 PyErr_Restore(type,
value, traceback);
1584 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
1587 printf(
"swig/python detected a memory leak of type '%s', no destructor found.\n", (
name ?
name :
"unknown"));
1600 PyErr_SetString(PyExc_TypeError,
"Attempt to append a non SwigPyObject");
1613 Py_INCREF(sobj->
next);
1640 if (!PyArg_UnpackTuple(args,
"own", 0, 1, &val)) {
1644 PyObject *obj = PyBool_FromLong(sobj->
own);
1646 if (PyObject_IsTrue(val)) {
1660 {
"own",
SwigPyObject_own, METH_VARARGS,
"returns/sets ownership of the pointer"},
1669 static char swigobject_doc[] =
"Swig object carries a C/C++ instance pointer";
1671 static PyNumberMethods SwigPyObject_as_number = {
1676 #
if PY_VERSION_HEX < 0x03000000
1692 #
if PY_VERSION_HEX < 0x03000000
1696 #if PY_VERSION_HEX < 0x03000000
1702 #if PY_VERSION_HEX < 0x03000000
1706 #if PY_VERSION_HEX >= 0x03050000
1707 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1708 #elif PY_VERSION_HEX >= 0x03000000
1709 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1711 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1715 static PyTypeObject swigpyobject_type;
1716 static int type_init = 0;
1718 const PyTypeObject tmp = {
1719 #if PY_VERSION_HEX >= 0x03000000
1720 PyVarObject_HEAD_INIT(NULL, 0)
1722 PyObject_HEAD_INIT(NULL)
1732 #if PY_VERSION_HEX >= 0x03000000
1738 &SwigPyObject_as_number,
1744 PyObject_GenericGetAttr,
1775 #
if PY_VERSION_HEX >= 0x03040000
1778 #
if PY_VERSION_HEX >= 0x03080000
1781 #
if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
1792 swigpyobject_type = tmp;
1794 if (PyType_Ready(&swigpyobject_type) < 0)
1797 return &swigpyobject_type;
1810 return (PyObject *)sobj;
1851 int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
1852 return s ? s : strncmp((
const char *)v->
pack, (
const char *)w->
pack, 2*v->
size);
1866 || (strcmp((op)->ob_type->tp_name,
"SwigPyPacked") == 0);
1881 static char swigpacked_doc[] =
"Swig object carries a C/C++ instance pointer";
1882 static PyTypeObject swigpypacked_type;
1883 static int type_init = 0;
1885 const PyTypeObject tmp = {
1886 #if PY_VERSION_HEX>=0x03000000
1887 PyVarObject_HEAD_INIT(NULL, 0)
1889 PyObject_HEAD_INIT(NULL)
1899 #if PY_VERSION_HEX>=0x03000000
1911 PyObject_GenericGetAttr,
1942 #
if PY_VERSION_HEX >= 0x03040000
1945 #
if PY_VERSION_HEX >= 0x03080000
1948 #
if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
1959 swigpypacked_type = tmp;
1961 if (PyType_Ready(&swigpypacked_type) < 0)
1964 return &swigpypacked_type;
1972 void *pack =
malloc(size);
1974 memcpy(pack, ptr, size);
1983 return (PyObject *) sobj;
1991 if (sobj->
size != size)
return 0;
1992 memcpy(ptr, sobj->
pack, size);
2016 #if PY_VERSION_HEX>=0x03000000
2017 #define SWIG_PYTHON_SLOW_GETSET_THIS
2028 #ifdef SWIGPYTHON_BUILTIN
2030 # ifdef PyWeakref_CheckProxy
2031 if (PyWeakref_CheckProxy(pyobj)) {
2032 pyobj = PyWeakref_GET_OBJECT(pyobj);
2042 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2043 if (PyInstance_Check(pyobj)) {
2044 obj = _PyInstance_Lookup(pyobj,
SWIG_This());
2046 PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
2047 if (dictptr != NULL) {
2048 PyObject *dict = *dictptr;
2049 obj = dict ? PyDict_GetItem(dict,
SWIG_This()) : 0;
2051 #ifdef PyWeakref_CheckProxy
2052 if (PyWeakref_CheckProxy(pyobj)) {
2053 PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
2057 obj = PyObject_GetAttr(pyobj,
SWIG_This());
2061 if (PyErr_Occurred()) PyErr_Clear();
2067 obj = PyObject_GetAttr(pyobj,
SWIG_This());
2071 if (PyErr_Occurred()) PyErr_Clear();
2091 int oldown = sobj->
own;
2109 if (obj == Py_None && !implicit_conv) {
2121 void *vptr = sobj->
ptr;
2126 if (ptr) *ptr = vptr;
2146 if (ptr) *ptr = vptr;
2152 *own = *own | sobj->
own;
2158 if (implicit_conv) {
2161 PyObject *klass = data->
klass;
2167 if (PyErr_Occurred()) {
2192 if (!
SWIG_IsOK(res) && obj == Py_None) {
2195 if (PyErr_Occurred())
2208 if (!PyCFunction_Check(obj)) {
2215 const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
2216 const char *desc = doc ? strstr(doc,
"swig_ptr: ") : 0;
2262 PyObject *newraw = data->
newraw;
2264 inst = PyObject_Call(newraw, data->
newargs, NULL);
2266 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2267 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2268 if (dictptr != NULL) {
2269 PyObject *dict = *dictptr;
2271 dict = PyDict_New();
2273 PyDict_SetItem(dict,
SWIG_This(), swig_this);
2277 if (PyObject_SetAttr(inst,
SWIG_This(), swig_this) == -1) {
2284 #if PY_VERSION_HEX >= 0x03000000
2285 PyObject *empty_args = PyTuple_New(0);
2287 PyObject *empty_kwargs = PyDict_New();
2289 inst = ((PyTypeObject *)data->
newargs)->tp_new((PyTypeObject *)data->
newargs, empty_args, empty_kwargs);
2290 Py_DECREF(empty_kwargs);
2292 if (PyObject_SetAttr(inst,
SWIG_This(), swig_this) == -1) {
2296 Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
2300 Py_DECREF(empty_args);
2303 PyObject *dict = PyDict_New();
2305 PyDict_SetItem(dict,
SWIG_This(), swig_this);
2306 inst = PyInstance_NewRaw(data->
newargs, dict);
2317 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2318 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2319 if (dictptr != NULL) {
2320 PyObject *dict = *dictptr;
2322 dict = PyDict_New();
2325 return PyDict_SetItem(dict,
SWIG_This(), swig_this);
2328 return PyObject_SetAttr(inst,
SWIG_This(), swig_this);
2362 if (clientdata && clientdata->
pytype) {
2367 PyObject *next_self = clientdata->
pytype->tp_alloc(clientdata->
pytype, 0);
2368 while (newobj->
next)
2370 newobj->
next = next_self;
2372 #ifdef SWIGPYTHON_BUILTIN
2378 #ifdef SWIGPYTHON_BUILTIN
2387 return (PyObject*) newobj;
2414 #ifdef SWIG_LINK_RUNTIME
2415 void *SWIG_ReturnGlobalTypeList(
void *);
2420 static void *type_pointer = (
void *)0;
2422 if (!type_pointer) {
2423 #ifdef SWIG_LINK_RUNTIME
2424 type_pointer = SWIG_ReturnGlobalTypeList((
void *)0);
2427 if (PyErr_Occurred()) {
2429 type_pointer = (
void *)0;
2455 #if PY_VERSION_HEX >= 0x03000000
2459 static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };
2460 PyObject *module = Py_InitModule(
"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table);
2463 if (pointer && module) {
2466 Py_XDECREF(pointer);
2482 PyObject *obj = PyDict_GetItem(cache, key);
2490 obj = PyCapsule_New((
void*) descriptor, NULL, NULL);
2491 PyDict_SetItem(cache, key, obj);
2502 #define SWIG_POINTER_EXCEPTION 0
2503 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
2504 #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
2509 if (PyErr_Occurred()) {
2511 PyObject *
value = 0;
2512 PyObject *traceback = 0;
2513 PyErr_Fetch(&type, &
value, &traceback);
2515 PyObject *old_str = PyObject_Str(
value);
2517 const char *errmesg = tmp ? tmp :
"Invalid error message";
2521 PyErr_Format(type,
"%s %s", mesg, errmesg);
2523 PyErr_Format(type,
"%s %s", errmesg, mesg);
2537 if (PyErr_Occurred()) {
2540 PyOS_snprintf(mesg,
sizeof(mesg),
"argument number %d:", argnum);
2552 return ty ? ty->
str :
"";
2559 #if defined(SWIG_COBJECT_TYPES)
2563 PyErr_Format(PyExc_TypeError,
"a '%s' is expected, 'SwigPyObject(%s)' is received",
2570 const char *otype = (obj ? obj->ob_type->tp_name : 0);
2572 PyObject *str = PyObject_Str(obj);
2575 PyErr_Format(PyExc_TypeError,
"a '%s' is expected, '%s(%s)' is received",
2579 PyErr_Format(PyExc_TypeError,
"a '%s' is expected, '%s' is received",
2586 PyErr_Format(PyExc_TypeError,
"a '%s' is expected", type);
2588 PyErr_Format(PyExc_TypeError,
"unexpected type is received");
2599 #if SWIG_POINTER_EXCEPTION
2609 #ifdef SWIGPYTHON_BUILTIN
2611 SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *
name, PyObject *
value) {
2612 PyTypeObject *tp = obj->ob_type;
2614 PyObject *encoded_name;
2618 # ifdef Py_USING_UNICODE
2619 if (PyString_Check(
name)) {
2620 name = PyUnicode_Decode(PyString_AsString(
name), PyString_Size(
name), NULL, NULL);
2623 }
else if (!PyUnicode_Check(
name))
2625 if (!PyString_Check(
name))
2628 PyErr_Format(PyExc_TypeError,
"attribute name must be string, not '%.200s'",
name->ob_type->tp_name);
2635 if (PyType_Ready(tp) < 0)
2639 descr = _PyType_Lookup(tp,
name);
2642 f = descr->ob_type->tp_descr_set;
2644 if (PyString_Check(
name)) {
2645 encoded_name =
name;
2648 encoded_name = PyUnicode_AsUTF8String(
name);
2652 PyErr_Format(PyExc_AttributeError,
"'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name));
2653 Py_DECREF(encoded_name);
2655 res = f(descr, obj,
value);
2671 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
2673 #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
2692 #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0)
2705 #ifdef SWIG_DIRECTOR_STATIC
2716 #ifndef SWIG_DIRECTOR_PYTHON_HEADER_
2717 #define SWIG_DIRECTOR_PYTHON_HEADER_
2721 #include <exception>
2732 #ifndef SWIG_PYTHON_DIRECTOR_NO_VTABLE
2733 #ifndef SWIG_PYTHON_DIRECTOR_VTABLE
2734 #define SWIG_PYTHON_DIRECTOR_VTABLE
2744 #ifndef SWIG_DIRECTOR_NO_UEH
2745 #ifndef SWIG_DIRECTOR_UEH
2746 #define SWIG_DIRECTOR_UEH
2756 #ifdef SWIG_DIRECTOR_NORTTI
2761 # ifndef SWIG_DIRECTOR_RTDIR
2762 # define SWIG_DIRECTOR_RTDIR
2766 SWIGINTERN std::map<void *, Director *>& get_rtdir_map() {
2767 static std::map<void *, Director *> rtdir_map;
2772 get_rtdir_map()[vptr] = rtdir;
2776 std::map<void *, Director *>::const_iterator pos = get_rtdir_map().find(vptr);
2777 Director *rtdir = (pos != get_rtdir_map().end()) ? pos->second : 0;
2783 # define SWIG_DIRECTOR_CAST(ARG) Swig::get_rtdir(static_cast<void *>(ARG))
2784 # define SWIG_DIRECTOR_RGTR(ARG1, ARG2) Swig::set_rtdir(static_cast<void *>(ARG1), ARG2)
2788 # define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG)
2789 # define SWIG_DIRECTOR_RGTR(ARG1, ARG2)
2831 struct GCItem_Object : GCItem {
2846 template <
typename Type>
2847 struct GCItem_T : GCItem {
2859 template <
typename Type>
2860 struct GCArray_T : GCItem {
2873 class DirectorException :
public std::exception {
2883 if (!PyErr_Occurred()) {
2884 PyErr_SetString(error,
what());
2901 static void raise(PyObject *error,
const char *msg) {
2905 static void raise(
const char *msg) {
2906 raise(PyExc_RuntimeError, msg);
2911 class DirectorTypeMismatchException :
public DirectorException {
2921 static void raise(PyObject *error,
const char *msg) {
2925 static void raise(
const char *msg) {
2931 class DirectorMethodException :
public DirectorException {
2937 static void raise(
const char *msg) {
2943 class DirectorPureVirtualException :
public DirectorException {
2946 :
DirectorException(PyExc_RuntimeError,
"SWIG director pure virtual method called", msg) {
2949 static void raise(
const char *msg) {
2955 #if defined(SWIG_PYTHON_THREADS)
2957 # if !defined(__THREAD__)
2958 # define __THREAD__ 1
2963 # include "pythread.h"
2965 PyThread_type_lock &mutex_;
2968 Guard(PyThread_type_lock & mutex) : mutex_(mutex) {
2969 PyThread_acquire_lock(mutex_, WAIT_LOCK);
2973 PyThread_release_lock(mutex_);
2976 # define SWIG_GUARD(mutex) Guard _guard(mutex)
2978 # define SWIG_GUARD(mutex)
2985 PyObject *swig_self;
2987 mutable bool swig_disown_flag;
2990 void swig_decref()
const {
2991 if (swig_disown_flag) {
2993 Py_DECREF(swig_self);
3000 Director(PyObject *
self) : swig_self(self), swig_disown_flag(false) {
3015 if (!swig_disown_flag) {
3016 swig_disown_flag=
true;
3023 if (swig_disown_flag) {
3024 Py_INCREF(swig_self);
3038 typedef std::map<void *, GCItem_var> swig_ownership_map;
3039 mutable swig_ownership_map swig_owner;
3041 static PyThread_type_lock swig_mutex_own;
3045 template <
typename Type>
3053 template <
typename Type>
3072 swig_ownership_map::iterator iter = swig_owner.find(vptr);
3073 if (iter != swig_owner.end()) {
3074 own = iter->second->get_own();
3075 swig_owner.erase(iter);
3081 template <
typename Type>
3088 return PyWeakref_NewProxy(pyobj, NULL);
3093 PyThread_type_lock Director::swig_mutex_own = PyThread_allocate_lock();
3101 #define SWIGTYPE_p_char swig_types[0]
3102 #define SWIGTYPE_p_int swig_types[1]
3103 #define SWIGTYPE_p_long swig_types[2]
3104 #define SWIGTYPE_p_operations_research__Domain swig_types[3]
3105 #define SWIGTYPE_p_operations_research__sat__IntegerVariableProto swig_types[4]
3106 #define SWIGTYPE_p_operations_research__sat__SatHelper swig_types[5]
3107 #define SWIGTYPE_p_operations_research__sat__SolutionCallback swig_types[6]
3108 #define SWIGTYPE_p_short swig_types[7]
3109 #define SWIGTYPE_p_signed_char swig_types[8]
3110 #define SWIGTYPE_p_unsigned_char swig_types[9]
3111 #define SWIGTYPE_p_unsigned_int swig_types[10]
3112 #define SWIGTYPE_p_unsigned_long swig_types[11]
3113 #define SWIGTYPE_p_unsigned_short swig_types[12]
3116 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
3117 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
3121 #ifdef SWIG_TypeQuery
3122 # undef SWIG_TypeQuery
3124 #define SWIG_TypeQuery SWIG_Python_TypeQuery
3129 #if PY_VERSION_HEX >= 0x03000000
3130 # define SWIG_init PyInit__pywrapsat
3133 # define SWIG_init init_pywrapsat
3136 #define SWIG_name "_pywrapsat"
3138 #define SWIGVERSION 0x040002
3139 #define SWIG_VERSION SWIGVERSION
3142 #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
3143 #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
3146 #include <stdexcept>
3150 class SwigPtr_PyObject {
3178 Py_XINCREF(item._obj);
3192 operator PyObject *()
const
3206 struct SwigVar_PyObject : SwigPtr_PyObject {
3222 #define SWIGWORDSIZE64
3226 #if (__WORDSIZE == 32) || (LONG_MAX == INT_MAX)
3227 # error "SWIG wrapped code invalid in 32 bit architecture, regenerate code using -DSWIGWORDSIZE32"
3241 #include "ortools/base/python-swig.h"
3244 #include <functional>
3256 PyObject*
get()
const {
return obj_; }
3262 PyObject*
const obj_;
3265 template <
typename ReturnT>
3268 ReturnT result = ReturnT();
3270 if (!PyErr_Occurred()) {
3271 PyErr_SetString(PyExc_RuntimeError,
3272 "SWIG std::function invocation failed.");
3276 if (!PyObjAs<ReturnT>(pyresult, &result)) {
3277 if (!PyErr_Occurred()) {
3278 PyErr_SetString(PyExc_RuntimeError,
3279 "SWIG std::function invocation failed.");
3282 Py_DECREF(pyresult);
3290 if (!PyErr_Occurred()) {
3291 PyErr_SetString(PyExc_RuntimeError,
3292 "SWIG std::function invocation failed.");
3295 Py_DECREF(pyresult);
3299 template <
typename ReturnT,
typename... Args>
3301 const char* format, Args... args) {
3304 return HandleResult<ReturnT>(
3305 PyObject_CallFunction(pyfunc,
const_cast<char*
>(format), args...));
3308 template <
typename ReturnT>
3310 return HandleResult<ReturnT>(PyObject_CallFunctionObjArgs(pyfunc,
nullptr));
3317 #include "ortools/sat/swig_helper.h"
3320 #define SWIG_From_long PyInt_FromLong
3323 #define SWIG_From_double PyFloat_FromDouble
3327 #if !defined(SWIG_NO_LLONG_MAX)
3328 # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
3329 # define LLONG_MAX __LONG_LONG_MAX__
3330 # define LLONG_MIN (-LLONG_MAX - 1LL)
3331 # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
3340 if (PyFloat_Check(obj)) {
3341 if (val) *val = PyFloat_AsDouble(obj);
3343 #if PY_VERSION_HEX < 0x03000000
3344 }
else if (PyInt_Check(obj)) {
3345 if (val) *val = (double) PyInt_AsLong(obj);
3348 }
else if (PyLong_Check(obj)) {
3349 double v = PyLong_AsDouble(obj);
3350 if (!PyErr_Occurred()) {
3357 #ifdef SWIG_PYTHON_CAST_MODE
3360 double d = PyFloat_AsDouble(obj);
3361 if (!PyErr_Occurred()) {
3368 long v = PyLong_AsLong(obj);
3369 if (!PyErr_Occurred()) {
3391 if ((
min <= x && x <=
max)) {
3392 double fx = floor(x);
3393 double cx = ceil(x);
3394 double rd = ((x - fx) < 0.5) ? fx : cx;
3395 if ((errno == EDOM) || (errno == ERANGE)) {
3398 double summ, reps, diff;
3401 }
else if (rd > x) {
3408 if (reps < 8*DBL_EPSILON) {
3421 #if PY_VERSION_HEX < 0x03000000
3422 if (PyInt_Check(obj)) {
3423 if (val) *val = PyInt_AsLong(obj);
3427 if (PyLong_Check(obj)) {
3428 long v = PyLong_AsLong(obj);
3429 if (!PyErr_Occurred()) {
3437 #ifdef SWIG_PYTHON_CAST_MODE
3440 long v = PyInt_AsLong(obj);
3441 if (!PyErr_Occurred()) {
3451 if (val) *val = (long)(d);
3467 if ((v < INT_MIN || v > INT_MAX)) {
3470 if (val) *val =
static_cast< int >(v);
3480 return PyBool_FromLong(
value ? 1 : 0);
3487 static int init = 0;
3501 if (size > INT_MAX) {
3503 return pchar_descriptor ?
3506 #if PY_VERSION_HEX >= 0x03000000
3507 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3508 return PyBytes_FromStringAndSize(carray,
static_cast< Py_ssize_t
>(size));
3510 return PyUnicode_DecodeUTF8(carray,
static_cast< Py_ssize_t
>(size),
"surrogateescape");
3513 return PyString_FromStringAndSize(carray,
static_cast< Py_ssize_t
>(size));
3552 #if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
3553 const size_t swig_method_index = 0;
3554 const char *
const swig_method_name =
"OnSolutionCallback";
3555 PyObject *method = swig_get_method(swig_method_index, swig_method_name);
3563 PyObject *error = PyErr_Occurred();
3577 PyObject *resultobj = 0;
3578 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3581 PyObject *swig_obj[1] ;
3587 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "delete_SolutionCallback" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback *""'");
3589 arg1 =
reinterpret_cast< operations_research::sat::SolutionCallback *
>(argp1);
3603 PyObject *resultobj = 0;
3604 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3607 PyObject *swig_obj[1] ;
3609 bool upcall =
false;
3615 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "SolutionCallback_OnSolutionCallback" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3617 arg1 =
reinterpret_cast< operations_research::sat::SolutionCallback *
>(argp1);
3619 upcall = (director && (director->
swig_get_self()==swig_obj[0]));
3624 ((operations_research::sat::SolutionCallback
const *)arg1)->OnSolutionCallback();
3637 PyObject *resultobj = 0;
3638 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3641 PyObject *swig_obj[1] ;
3648 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "SolutionCallback_NumBooleans" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3650 arg1 =
reinterpret_cast< operations_research::sat::SolutionCallback *
>(argp1);
3653 result = (
int64)((operations_research::sat::SolutionCallback
const *)arg1)->NumBooleans();
3664 PyObject *resultobj = 0;
3665 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3668 PyObject *swig_obj[1] ;
3675 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "SolutionCallback_NumBranches" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3677 arg1 =
reinterpret_cast< operations_research::sat::SolutionCallback *
>(argp1);
3680 result = (
int64)((operations_research::sat::SolutionCallback
const *)arg1)->NumBranches();
3691 PyObject *resultobj = 0;
3692 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3695 PyObject *swig_obj[1] ;
3702 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "SolutionCallback_NumConflicts" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3704 arg1 =
reinterpret_cast< operations_research::sat::SolutionCallback *
>(argp1);
3707 result = (
int64)((operations_research::sat::SolutionCallback
const *)arg1)->NumConflicts();
3718 PyObject *resultobj = 0;
3719 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3722 PyObject *swig_obj[1] ;
3729 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "SolutionCallback_NumBinaryPropagations" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3731 arg1 =
reinterpret_cast< operations_research::sat::SolutionCallback *
>(argp1);
3734 result = (
int64)((operations_research::sat::SolutionCallback
const *)arg1)->NumBinaryPropagations();
3745 PyObject *resultobj = 0;
3746 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3749 PyObject *swig_obj[1] ;
3756 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "SolutionCallback_NumIntegerPropagations" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3758 arg1 =
reinterpret_cast< operations_research::sat::SolutionCallback *
>(argp1);
3761 result = (
int64)((operations_research::sat::SolutionCallback
const *)arg1)->NumIntegerPropagations();
3772 PyObject *resultobj = 0;
3773 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3776 PyObject *swig_obj[1] ;
3783 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "SolutionCallback_WallTime" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3785 arg1 =
reinterpret_cast< operations_research::sat::SolutionCallback *
>(argp1);
3788 result = (double)((operations_research::sat::SolutionCallback
const *)arg1)->WallTime();
3799 PyObject *resultobj = 0;
3800 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3803 PyObject *swig_obj[1] ;
3810 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "SolutionCallback_UserTime" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3812 arg1 =
reinterpret_cast< operations_research::sat::SolutionCallback *
>(argp1);
3815 result = (double)((operations_research::sat::SolutionCallback
const *)arg1)->UserTime();
3826 PyObject *resultobj = 0;
3827 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3830 PyObject *swig_obj[1] ;
3837 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "SolutionCallback_ObjectiveValue" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3839 arg1 =
reinterpret_cast< operations_research::sat::SolutionCallback *
>(argp1);
3842 result = (double)((operations_research::sat::SolutionCallback
const *)arg1)->ObjectiveValue();
3853 PyObject *resultobj = 0;
3854 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3857 PyObject *swig_obj[1] ;
3864 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "SolutionCallback_BestObjectiveBound" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3866 arg1 =
reinterpret_cast< operations_research::sat::SolutionCallback *
>(argp1);
3869 result = (double)((operations_research::sat::SolutionCallback
const *)arg1)->BestObjectiveBound();
3880 PyObject *resultobj = 0;
3881 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3887 PyObject *swig_obj[2] ;
3893 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "SolutionCallback_SolutionIntegerValue" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback *""'");
3895 arg1 =
reinterpret_cast< operations_research::sat::SolutionCallback *
>(argp1);
3900 arg2 =
static_cast< int >(val2);
3903 result = (
int64)(arg1)->SolutionIntegerValue(arg2);
3914 PyObject *resultobj = 0;
3915 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3921 PyObject *swig_obj[2] ;
3927 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "SolutionCallback_SolutionBooleanValue" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback *""'");
3929 arg1 =
reinterpret_cast< operations_research::sat::SolutionCallback *
>(argp1);
3934 arg2 =
static_cast< int >(val2);
3937 result = (bool)(arg1)->SolutionBooleanValue(arg2);
3948 PyObject *resultobj = 0;
3949 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3952 PyObject *swig_obj[1] ;
3958 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "SolutionCallback_StopSearch" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback *""'");
3960 arg1 =
reinterpret_cast< operations_research::sat::SolutionCallback *
>(argp1);
3963 (arg1)->StopSearch();
3974 PyObject *resultobj = 0;
3975 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3978 PyObject *swig_obj[1] ;
3985 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "SolutionCallback_Response" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3987 arg1 =
reinterpret_cast< operations_research::sat::SolutionCallback *
>(argp1);
3990 result = ((operations_research::sat::SolutionCallback
const *)arg1)->Response();
3994 PyObject*
const module = PyImport_ImportModule(
"ortools.sat.cp_model_pb2");
3995 if (module !=
nullptr) {
3996 PyObject*
const dict = PyModule_GetDict(module);
3997 if (dict !=
nullptr) {
3998 PyObject*
const clss = PyDict_GetItemString(dict,
"CpSolverResponse");
3999 if (clss !=
nullptr) {
4000 std::string encoded_protobuf;
4001 (&result)->SerializeToString(&encoded_protobuf);
4003 PyObject*
const python_encoded_protobuf = PyBytes_FromStringAndSize(
4004 encoded_protobuf.c_str(), encoded_protobuf.size());
4009 PyObject*
const result = PyObject_CallMethod(
4010 clss,
const_cast<char*
>(
"FromString"),
4011 const_cast<char*
>(
"(O)"),
4012 python_encoded_protobuf);
4013 Py_DECREF(python_encoded_protobuf);
4027 PyObject *resultobj = 0;
4028 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
4031 PyObject *swig_obj[1] ;
4038 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "SolutionCallback_HasResponse" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
4040 arg1 =
reinterpret_cast< operations_research::sat::SolutionCallback *
>(argp1);
4043 result = (bool)((operations_research::sat::SolutionCallback
const *)arg1)->HasResponse();
4054 PyObject *resultobj = 0;
4055 PyObject *arg1 = (PyObject *) 0 ;
4056 PyObject *swig_obj[1] ;
4057 operations_research::sat::SolutionCallback *result = 0 ;
4064 if ( arg1 != Py_None ) {
4068 SWIG_SetErrorMsg(PyExc_RuntimeError,
"accessing abstract class or protected constructor");
4082 PyObject *resultobj = 0;
4083 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
4086 PyObject *swig_obj[1] ;
4092 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "disown_SolutionCallback" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback *""'");
4094 arg1 =
reinterpret_cast< operations_research::sat::SolutionCallback *
>(argp1);
4123 PyObject *resultobj = 0;
4125 PyObject *swig_obj[1] ;
4132 PyObject*
const pyresult = PyObject_CallMethod(
4133 swig_obj[0],
const_cast<char*
>(
"SerializeToString"),
nullptr);
4134 if (pyresult !=
nullptr) {
4135 char* buffer =
nullptr;
4136 Py_ssize_t length = 0;
4137 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4138 if (buffer !=
nullptr) {
4139 arg1->ParseFromArray(buffer, length);
4141 Py_DECREF(pyresult);
4150 PyObject*
const module = PyImport_ImportModule(
"ortools.sat.cp_model_pb2");
4151 if (module !=
nullptr) {
4152 PyObject*
const dict = PyModule_GetDict(module);
4153 if (dict !=
nullptr) {
4154 PyObject*
const clss = PyDict_GetItemString(dict,
"CpSolverResponse");
4155 if (clss !=
nullptr) {
4156 std::string encoded_protobuf;
4157 (&result)->SerializeToString(&encoded_protobuf);
4159 PyObject*
const python_encoded_protobuf = PyBytes_FromStringAndSize(
4160 encoded_protobuf.c_str(), encoded_protobuf.size());
4165 PyObject*
const result = PyObject_CallMethod(
4166 clss,
const_cast<char*
>(
"FromString"),
4167 const_cast<char*
>(
"(O)"),
4168 python_encoded_protobuf);
4169 Py_DECREF(python_encoded_protobuf);
4189 PyObject *resultobj = 0;
4192 PyObject *swig_obj[2] ;
4198 PyObject*
const pyresult = PyObject_CallMethod(
4199 swig_obj[0],
const_cast<char*
>(
"SerializeToString"),
nullptr);
4200 if (pyresult !=
nullptr) {
4201 char* buffer =
nullptr;
4202 Py_ssize_t length = 0;
4203 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4204 if (buffer !=
nullptr) {
4205 arg1->ParseFromArray(buffer, length);
4207 Py_DECREF(pyresult);
4212 PyObject*
const pyresult = PyObject_CallMethod(
4213 swig_obj[1],
const_cast<char*
>(
"SerializeToString"),
nullptr);
4214 if (pyresult !=
nullptr) {
4215 char* buffer =
nullptr;
4216 Py_ssize_t length = 0;
4217 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4218 if (buffer !=
nullptr) {
4219 arg2->ParseFromArray(buffer, length);
4221 Py_DECREF(pyresult);
4230 PyObject*
const module = PyImport_ImportModule(
"ortools.sat.cp_model_pb2");
4231 if (module !=
nullptr) {
4232 PyObject*
const dict = PyModule_GetDict(module);
4233 if (dict !=
nullptr) {
4234 PyObject*
const clss = PyDict_GetItemString(dict,
"CpSolverResponse");
4235 if (clss !=
nullptr) {
4236 std::string encoded_protobuf;
4237 (&result)->SerializeToString(&encoded_protobuf);
4239 PyObject*
const python_encoded_protobuf = PyBytes_FromStringAndSize(
4240 encoded_protobuf.c_str(), encoded_protobuf.size());
4245 PyObject*
const result = PyObject_CallMethod(
4246 clss,
const_cast<char*
>(
"FromString"),
4247 const_cast<char*
>(
"(O)"),
4248 python_encoded_protobuf);
4249 Py_DECREF(python_encoded_protobuf);
4275 PyObject *resultobj = 0;
4278 operations_research::sat::SolutionCallback *arg3 = 0 ;
4281 PyObject *swig_obj[3] ;
4287 PyObject*
const pyresult = PyObject_CallMethod(
4288 swig_obj[0],
const_cast<char*
>(
"SerializeToString"),
nullptr);
4289 if (pyresult !=
nullptr) {
4290 char* buffer =
nullptr;
4291 Py_ssize_t length = 0;
4292 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4293 if (buffer !=
nullptr) {
4294 arg1->ParseFromArray(buffer, length);
4296 Py_DECREF(pyresult);
4301 PyObject*
const pyresult = PyObject_CallMethod(
4302 swig_obj[1],
const_cast<char*
>(
"SerializeToString"),
nullptr);
4303 if (pyresult !=
nullptr) {
4304 char* buffer =
nullptr;
4305 Py_ssize_t length = 0;
4306 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4307 if (buffer !=
nullptr) {
4308 arg2->ParseFromArray(buffer, length);
4310 Py_DECREF(pyresult);
4315 SWIG_exception_fail(
SWIG_ArgError(res3),
"in method '" "SatHelper_SolveWithParametersAndSolutionCallback" "', argument " "3"" of type '" "operations_research::sat::SolutionCallback const &""'");
4318 SWIG_exception_fail(
SWIG_ValueError,
"invalid null reference " "in method '" "SatHelper_SolveWithParametersAndSolutionCallback" "', argument " "3"" of type '" "operations_research::sat::SolutionCallback const &""'");
4320 arg3 =
reinterpret_cast< operations_research::sat::SolutionCallback *
>(argp3);
4327 PyObject*
const module = PyImport_ImportModule(
"ortools.sat.cp_model_pb2");
4328 if (module !=
nullptr) {
4329 PyObject*
const dict = PyModule_GetDict(module);
4330 if (dict !=
nullptr) {
4331 PyObject*
const clss = PyDict_GetItemString(dict,
"CpSolverResponse");
4332 if (clss !=
nullptr) {
4333 std::string encoded_protobuf;
4334 (&result)->SerializeToString(&encoded_protobuf);
4336 PyObject*
const python_encoded_protobuf = PyBytes_FromStringAndSize(
4337 encoded_protobuf.c_str(), encoded_protobuf.size());
4342 PyObject*
const result = PyObject_CallMethod(
4343 clss,
const_cast<char*
>(
"FromString"),
4344 const_cast<char*
>(
"(O)"),
4345 python_encoded_protobuf);
4346 Py_DECREF(python_encoded_protobuf);
4372 PyObject *resultobj = 0;
4374 PyObject *swig_obj[1] ;
4381 PyObject*
const pyresult = PyObject_CallMethod(
4382 swig_obj[0],
const_cast<char*
>(
"SerializeToString"),
nullptr);
4383 if (pyresult !=
nullptr) {
4384 char* buffer =
nullptr;
4385 Py_ssize_t length = 0;
4386 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4387 if (buffer !=
nullptr) {
4388 arg1->ParseFromArray(buffer, length);
4390 Py_DECREF(pyresult);
4412 PyObject *resultobj = 0;
4414 PyObject *swig_obj[1] ;
4421 PyObject*
const pyresult = PyObject_CallMethod(
4422 swig_obj[0],
const_cast<char*
>(
"SerializeToString"),
nullptr);
4423 if (pyresult !=
nullptr) {
4424 char* buffer =
nullptr;
4425 Py_ssize_t length = 0;
4426 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4427 if (buffer !=
nullptr) {
4428 arg1->ParseFromArray(buffer, length);
4430 Py_DECREF(pyresult);
4452 PyObject *resultobj = 0;
4454 PyObject *swig_obj[1] ;
4461 PyObject*
const pyresult = PyObject_CallMethod(
4462 swig_obj[0],
const_cast<char*
>(
"SerializeToString"),
nullptr);
4463 if (pyresult !=
nullptr) {
4464 char* buffer =
nullptr;
4465 Py_ssize_t length = 0;
4466 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4467 if (buffer !=
nullptr) {
4468 arg1->ParseFromArray(buffer, length);
4470 Py_DECREF(pyresult);
4492 PyObject *resultobj = 0;
4496 PyObject *swig_obj[1] ;
4503 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "SatHelper_VariableDomain" "', argument " "1"" of type '" "operations_research::sat::IntegerVariableProto const &""'");
4506 SWIG_exception_fail(
SWIG_ValueError,
"invalid null reference " "in method '" "SatHelper_VariableDomain" "', argument " "1"" of type '" "operations_research::sat::IntegerVariableProto const &""'");
4522 PyObject *resultobj = 0;
4523 operations_research::sat::SatHelper *result = 0 ;
4528 result = (operations_research::sat::SatHelper *)
new operations_research::sat::SatHelper();
4539 PyObject *resultobj = 0;
4540 operations_research::sat::SatHelper *arg1 = (operations_research::sat::SatHelper *) 0 ;
4543 PyObject *swig_obj[1] ;
4551 arg1 =
reinterpret_cast< operations_research::sat::SatHelper *
>(argp1);
4608 { NULL, NULL, 0, NULL }
4612 { NULL, NULL, 0, NULL }
4620 static swig_type_info _swigt__p_long = {
"_p_long",
"intptr_t *|int_least64_t *|int_fast32_t *|int_fast64_t *|int64 *|int64_t *|long *|int_fast16_t *|intmax_t *", 0, 0, (
void*)0, 0};
4629 static swig_type_info _swigt__p_unsigned_long = {
"_p_unsigned_long",
"uintptr_t *|uint_least64_t *|uint_fast32_t *|uint_fast64_t *|uint64 *|uint64_t *|unsigned long *|uint_fast16_t *|uintmax_t *", 0, 0, (
void*)0, 0};
4682 {0, 0, 0, 0.0, 0, 0}};
4736 #define SWIGRUNTIME_DEBUG
4772 }
while (iter!= module_head);
4783 if (init == 0)
return;
4786 #ifdef SWIGRUNTIME_DEBUG
4787 printf(
"SWIG_InitializeModule: size %lu\n", (
unsigned long)
swig_module.
size);
4794 #ifdef SWIGRUNTIME_DEBUG
4804 #ifdef SWIGRUNTIME_DEBUG
4805 printf(
"SWIG_InitializeModule: found type %s\n", type->
name);
4809 #ifdef SWIGRUNTIME_DEBUG
4810 printf(
"SWIG_InitializeModule: found and overwrite type %s \n", type->
name);
4819 while (cast->
type) {
4822 #ifdef SWIGRUNTIME_DEBUG
4823 printf(
"SWIG_InitializeModule: look cast %s\n", cast->
type->
name);
4827 #ifdef SWIGRUNTIME_DEBUG
4828 if (ret) printf(
"SWIG_InitializeModule: found cast %s\n", ret->
name);
4833 #ifdef SWIGRUNTIME_DEBUG
4834 printf(
"SWIG_InitializeModule: skip old type %s\n", ret->
name);
4841 #ifdef SWIGRUNTIME_DEBUG
4842 if (ocast) printf(
"SWIG_InitializeModule: skip old cast %s\n", ret->
name);
4844 if (!ocast) ret = 0;
4849 #ifdef SWIGRUNTIME_DEBUG
4850 printf(
"SWIG_InitializeModule: adding cast %s\n", cast->
type->
name);
4865 #ifdef SWIGRUNTIME_DEBUG
4866 printf(
"**** SWIG_InitializeModule: Cast List ******\n");
4871 while (cast->
type) {
4872 printf(
"SWIG_InitializeModule: cast type %s\n", cast->
type->
name);
4876 printf(
"---- Total casts: %d\n",j);
4878 printf(
"**** SWIG_InitializeModule: Cast List ******\n");
4891 static int init_run = 0;
4893 if (init_run)
return;
4904 equiv = equiv->
next;
4925 #define SWIG_newvarlink() SWIG_Python_newvarlink()
4926 #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)
4927 #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
4935 PyObject *(*get_attr)(void);
4947 #if PY_VERSION_HEX >= 0x03000000
4948 return PyUnicode_InternFromString(
"<Swig global variables>");
4950 return PyString_FromString(
"<Swig global variables>");
4956 #if PY_VERSION_HEX >= 0x03000000
4957 PyObject *str = PyUnicode_InternFromString(
"(");
4962 tail = PyUnicode_FromString(
var->name);
4963 joined = PyUnicode_Concat(str,
tail);
4968 tail = PyUnicode_InternFromString(
", ");
4969 joined = PyUnicode_Concat(str,
tail);
4975 tail = PyUnicode_InternFromString(
")");
4976 joined = PyUnicode_Concat(str,
tail);
4981 PyObject *str = PyString_FromString(
"(");
4984 PyString_ConcatAndDel(&str,PyString_FromString(
var->name));
4985 if (
var->next) PyString_ConcatAndDel(&str,PyString_FromString(
", "));
4987 PyString_ConcatAndDel(&str,PyString_FromString(
")"));
5005 PyObject *res = NULL;
5008 if (strcmp(
var->name,n) == 0) {
5009 res = (*
var->get_attr)();
5014 if (res == NULL && !PyErr_Occurred()) {
5015 PyErr_Format(PyExc_AttributeError,
"Unknown C global variable '%s'", n);
5025 if (strcmp(
var->name,n) == 0) {
5026 res = (*
var->set_attr)(p);
5031 if (res == 1 && !PyErr_Occurred()) {
5032 PyErr_Format(PyExc_AttributeError,
"Unknown C global variable '%s'", n);
5039 static char varlink__doc__[] =
"Swig var link object";
5040 static PyTypeObject varlink_type;
5041 static int type_init = 0;
5043 const PyTypeObject tmp = {
5044 #if PY_VERSION_HEX >= 0x03000000
5045 PyVarObject_HEAD_INIT(NULL, 0)
5047 PyObject_HEAD_INIT(NULL)
5074 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
5077 #if PY_VERSION_HEX >= 0x03040000
5080 #if PY_VERSION_HEX >= 0x03080000
5083 #if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
5096 if (PyType_Ready(&varlink_type) < 0)
5099 return &varlink_type;
5109 return ((PyObject*) result);
5117 size_t size = strlen(
name)+1;
5131 static PyObject *globals = 0;
5147 for (i = 0; constants[i].
type; ++i) {
5148 switch(constants[i].type) {
5153 obj =
SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
5160 PyDict_SetItemString(d, constants[i].
name, obj);
5176 for (i = 0; methods[i].ml_name; ++i) {
5177 const char *c = methods[i].ml_doc;
5179 c = strstr(c,
"swig_ptr: ");
5183 const char *
name = c + 10;
5184 for (j = 0; const_table[j].
type; ++j) {
5185 if (strncmp(const_table[j].
name,
name,
5186 strlen(const_table[j].
name)) == 0) {
5187 ci = &(const_table[j]);
5194 size_t shift = (ci->
ptype) - types;
5196 size_t ldoc = (c - methods[i].ml_doc);
5197 size_t lptr = strlen(ty->
name)+2*
sizeof(
void*)+2;
5198 char *ndoc = (
char*)
malloc(ldoc + lptr + 10);
5201 memcpy(buff, methods[i].ml_doc, ldoc);
5203 memcpy(buff,
"swig_ptr: ", 10);
5206 methods[i].ml_doc = ndoc;
5244 if (PyCFunction_Check(func)) {
5245 PyCFunctionObject *funcobj = (PyCFunctionObject *)func;
5248 func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module);
5250 #if PY_VERSION_HEX >= 0x03000000
5251 return PyInstanceMethod_New(func);
5253 return PyMethod_New(func, NULL, NULL);
5263 if (PyCFunction_Check(func)) {
5264 PyCFunctionObject *funcobj = (PyCFunctionObject *)func;
5267 func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module);
5269 return PyStaticMethod_New(func);
5285 #if PY_VERSION_HEX >= 0x03000000
5291 PyObject *m, *d, *md, *globals;
5293 #if PY_VERSION_HEX >= 0x03000000
5294 static struct PyModuleDef SWIG_module = {
5295 PyModuleDef_HEAD_INIT,
5307 #if defined(SWIGPYTHON_BUILTIN)
5311 static PyGetSetDef this_getset_def = {
5312 (
char *)
"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL
5314 static SwigPyGetSet thisown_getset_closure = {
5318 static PyGetSetDef thisown_getset_def = {
5319 (
char *)
"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure
5321 PyTypeObject *builtin_pytype;
5322 int builtin_base_count;
5325 PyGetSetDescrObject *static_getset;
5326 PyTypeObject *metatype;
5327 PyTypeObject *swigpyobject;
5329 PyObject *public_interface, *public_symbol;
5330 PyObject *this_descr;
5331 PyObject *thisown_descr;
5335 (void)builtin_pytype;
5336 (void)builtin_base_count;
5337 (void)builtin_basetype;
5339 (void)static_getset;
5343 metatype = SwigPyObjectType();
5353 #ifndef SWIGPYTHON_BUILTIN
5360 #if PY_VERSION_HEX >= 0x03000000
5361 m = PyModule_Create(&SWIG_module);
5366 md = d = PyModule_GetDict(m);
5371 #ifdef SWIGPYTHON_BUILTIN
5375 assert(SwigPyObject_stype);
5378 SwigPyObject_stype->
clientdata = &SwigPyObject_clientdata;
5379 SwigPyObject_clientdata.
pytype = swigpyobject;
5380 }
else if (swigpyobject->tp_basicsize != cd->
pytype->tp_basicsize) {
5381 PyErr_SetString(PyExc_RuntimeError,
"Import error: attempted to load two incompatible swig-generated modules.");
5382 # if PY_VERSION_HEX >= 0x03000000
5395 (void)thisown_descr;
5397 public_interface = PyList_New(0);
5399 (void)public_symbol;
5401 PyDict_SetItemString(md,
"__all__", public_interface);
5402 Py_DECREF(public_interface);
5404 SwigPyBuiltin_AddPublicSymbol(public_interface,
SwigMethods[i].ml_name);
5414 #if PY_VERSION_HEX >= 0x03000000