1 #ifndef __PYX_HAVE_API__CyClpSimplex 2 #define __PYX_HAVE_API__CyClpSimplex 3 #include "Python.h" 4 5 static void (*__pyx_f_12CyClpSimplex_CyPostPrimalRow)(IClpSimplex *) = 0; 6 #define CyPostPrimalRow __pyx_f_12CyClpSimplex_CyPostPrimalRow 7 static int (*__pyx_f_12CyClpSimplex_CyPivotIsAcceptable)(IClpSimplex *) = 0; 8 #define CyPivotIsAcceptable __pyx_f_12CyClpSimplex_CyPivotIsAcceptable 9 10 #ifndef __PYX_HAVE_RT_ImportModule 11 #define __PYX_HAVE_RT_ImportModule 12 static PyObject *__Pyx_ImportModule(const char *name) { 13 PyObject *py_name = 0; 14 PyObject *py_module = 0; 15 16 #if PY_MAJOR_VERSION < 3 17 py_name = PyString_FromString(name); 18 #else 19 py_name = PyUnicode_FromString(name); 20 #endif 21 if (!py_name) 22 goto bad; 23 py_module = PyImport_Import(py_name); 24 Py_DECREF(py_name); 25 return py_module; 26 bad: 27 Py_XDECREF(py_name); 28 return 0; 29 } 30 #endif 31 32 #ifndef __PYX_HAVE_RT_ImportFunction 33 #define __PYX_HAVE_RT_ImportFunction 34 static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { 35 PyObject *d = 0; 36 PyObject *cobj = 0; 37 union { 38 void (*fp)(void); 39 void *p; 40 } tmp; 41 42 d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); 43 if (!d) 44 goto bad; 45 cobj = PyDict_GetItemString(d, funcname); 46 if (!cobj) { 47 PyErr_Format(PyExc_ImportError, 48 "%s does not export expected C function %s", 49 PyModule_GetName(module), funcname); 50 goto bad; 51 } 52 #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) 53 if (!PyCapsule_IsValid(cobj, sig)) { 54 PyErr_Format(PyExc_TypeError, 55 "C function %s.%s has wrong signature (expected %s, got %s)", 56 PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj)); 57 goto bad; 58 } 59 tmp.p = PyCapsule_GetPointer(cobj, sig); 60 #else 61 {const char *desc, *s1, *s2; 62 desc = (const char *)PyCObject_GetDesc(cobj); 63 if (!desc) 64 goto bad; 65 s1 = desc; s2 = sig; 66 while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } 67 if (*s1 != *s2) { 68 PyErr_Format(PyExc_TypeError, 69 "C function %s.%s has wrong signature (expected %s, got %s)", 70 PyModule_GetName(module), funcname, sig, desc); 71 goto bad; 72 } 73 tmp.p = PyCObject_AsVoidPtr(cobj);} 74 #endif 75 *f = tmp.fp; 76 if (!(*f)) 77 goto bad; 78 Py_DECREF(d); 79 return 0; 80 bad: 81 Py_XDECREF(d); 82 return -1; 83 } 84 #endif 85 86 static int import_CyClpSimplex(void) { 87 PyObject *module = 0; 88 module = __Pyx_ImportModule("CyClpSimplex"); 89 if (!module) goto bad; 90 if (__Pyx_ImportFunction(module, "CyPostPrimalRow", (void (**)(void))&__pyx_f_12CyClpSimplex_CyPostPrimalRow, "void (IClpSimplex *)") < 0) goto bad; 91 if (__Pyx_ImportFunction(module, "CyPivotIsAcceptable", (void (**)(void))&__pyx_f_12CyClpSimplex_CyPivotIsAcceptable, "int (IClpSimplex *)") < 0) goto bad; 92 Py_DECREF(module); module = 0; 93 return 0; 94 bad: 95 Py_XDECREF(module); 96 return -1; 97 } 98 99 #endif /* !__PYX_HAVE_API__CyClpSimplex */ 100