cy_cxxtest_api.h (2475B)
1 /* Generated by Cython 0.29 */ 2 3 #ifndef __PYX_HAVE_API__cy_cxxtest 4 #define __PYX_HAVE_API__cy_cxxtest 5 #include "Python.h" 6 #include "cy_cxxtest.h" 7 8 static void (*__pyx_api_f_10cy_cxxtest_cy_hello)(void) = 0; 9 #define cy_hello __pyx_api_f_10cy_cxxtest_cy_hello 10 #if !defined(__Pyx_PyIdentifier_FromString) 11 #if PY_MAJOR_VERSION < 3 12 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) 13 #else 14 #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) 15 #endif 16 #endif 17 18 #ifndef __PYX_HAVE_RT_ImportFunction 19 #define __PYX_HAVE_RT_ImportFunction 20 static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { 21 PyObject *d = 0; 22 PyObject *cobj = 0; 23 union { 24 void (*fp)(void); 25 void *p; 26 } tmp; 27 d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); 28 if (!d) 29 goto bad; 30 cobj = PyDict_GetItemString(d, funcname); 31 if (!cobj) { 32 PyErr_Format(PyExc_ImportError, 33 "%.200s does not export expected C function %.200s", 34 PyModule_GetName(module), funcname); 35 goto bad; 36 } 37 #if PY_VERSION_HEX >= 0x02070000 38 if (!PyCapsule_IsValid(cobj, sig)) { 39 PyErr_Format(PyExc_TypeError, 40 "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", 41 PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj)); 42 goto bad; 43 } 44 tmp.p = PyCapsule_GetPointer(cobj, sig); 45 #else 46 {const char *desc, *s1, *s2; 47 desc = (const char *)PyCObject_GetDesc(cobj); 48 if (!desc) 49 goto bad; 50 s1 = desc; s2 = sig; 51 while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } 52 if (*s1 != *s2) { 53 PyErr_Format(PyExc_TypeError, 54 "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", 55 PyModule_GetName(module), funcname, sig, desc); 56 goto bad; 57 } 58 tmp.p = PyCObject_AsVoidPtr(cobj);} 59 #endif 60 *f = tmp.fp; 61 if (!(*f)) 62 goto bad; 63 Py_DECREF(d); 64 return 0; 65 bad: 66 Py_XDECREF(d); 67 return -1; 68 } 69 #endif 70 71 72 static int import_cy_cxxtest(void) { 73 PyObject *module = 0; 74 module = PyImport_ImportModule("cy_cxxtest"); 75 if (!module) goto bad; 76 if (__Pyx_ImportFunction(module, "cy_hello", (void (**)(void))&__pyx_api_f_10cy_cxxtest_cy_hello, "void (void)") < 0) goto bad; 77 Py_DECREF(module); module = 0; 78 return 0; 79 bad: 80 Py_XDECREF(module); 81 return -1; 82 } 83 84 #endif /* !__PYX_HAVE_API__cy_cxxtest */