📄 agrepy_wrap.c
字号:
obj = 0; break; } if (obj) { PyDict_SetItemString(d,constants[i].name,obj); Py_DECREF(obj); } }}#endif/* Contract support */#define SWIG_contract_assert(expr, msg) if (!(expr)) { PyErr_SetString(PyExc_RuntimeError, (char *) msg ); goto fail; } else#ifdef __cplusplus}#endif/* -------- TYPES TABLE (BEGIN) -------- */#define SWIGTYPE_p_char swig_types[0] #define SWIGTYPE_p_param_struct swig_types[1] static swig_type_info *swig_types[3];/* -------- TYPES TABLE (END) -------- *//*----------------------------------------------- @(target):= _agrepy.so ------------------------------------------------*/#define SWIG_init init_agrepy#define SWIG_name "_agrepy"/* Auxiliar swig macros that appear in the header */#define SWIG_OLDOBJ 1#define SWIG_NEWOBJ SWIG_OLDOBJ + 1#define SWIG_PYSTR SWIG_NEWOBJ + 1#ifdef __cplusplus#define SWIGSTATICINLINE(a) static inline a#define SWIGSTATIC(a) static a#define swig_new_array(size,Type) (new Type[(size)])#define swig_delete(cptr) delete cptr#define swig_delete_array(cptr) delete[] cptr#define swig_const_cast(a,Type) const_cast<Type >(a)#define swig_static_cast(a,Type) static_cast<Type >(a)#define swig_reinterpret_cast(a,Type) reinterpret_cast<Type >(a)#define swig_new_copy(ptr,Type) (new Type(*ptr))#define swig_numeric_cast(a,Type) static_cast<Type >(a)#else /* C case */#define SWIGSTATICINLINE(a) static a#define SWIGSTATIC(a) static a#define swig_new_array(size,Type) ((Type*) malloc((size)*sizeof(Type)))#define swig_delete(cptr) free((char*)cptr)#define swig_delete_array(cptr) free((char*)cptr)#define swig_const_cast(a,Type) (Type)(a)#define swig_static_cast(a,Type) (Type)(a)#define swig_reinterpret_cast(a,Type) (Type)(a)#define swig_numeric_cast(a,Type) (Type)(a)#define swig_new_copy(ptr,Type) ((Type*)memcpy(malloc(sizeof(Type)),ptr,sizeof(Type)))#endif /* __cplusplus *//*@/sw/share/swig/1.3.22/python/pymacros.swg,63,SWIG_define@*/#define SWIG_From_signed_SS_char PyInt_FromLong/*@@*//*@/sw/share/swig/1.3.22/python/pymacros.swg,63,SWIG_define@*/#define SWIG_From_unsigned_SS_char PyInt_FromLong/*@@*//*@/sw/share/swig/1.3.22/python/pymacros.swg,63,SWIG_define@*/#define SWIG_From_short PyInt_FromLong/*@@*//*@/sw/share/swig/1.3.22/python/pymacros.swg,63,SWIG_define@*/#define SWIG_From_unsigned_SS_short PyInt_FromLong/*@@*//*@/sw/share/swig/1.3.22/python/pymacros.swg,63,SWIG_define@*/#define SWIG_From_int PyInt_FromLong/*@@*//*@/sw/share/swig/1.3.22/python/pymacros.swg,63,SWIG_define@*/#define SWIG_From_long PyInt_FromLong/*@@*//*@/sw/share/swig/1.3.22/python/pymacros.swg,63,SWIG_define@*/#define SWIG_From_float PyFloat_FromDouble/*@@*//*@/sw/share/swig/1.3.22/python/pymacros.swg,63,SWIG_define@*/#define SWIG_From_double PyFloat_FromDouble/*@@*/#include "agrepy.h"/* returns SWIG_OLDOBJ if the input is a raw char*, SWIG_PYSTR if is a PyString */SWIGSTATIC(int)SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize){ static swig_type_info* pchar_info = 0; char* vptr = 0; if (!pchar_info) pchar_info = SWIG_TypeQuery("char *"); if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_info, 0) != -1) { if (cptr) *cptr = vptr; if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0; return SWIG_OLDOBJ; } else { if (PyString_Check(obj)) { if (cptr) { *cptr = PyString_AS_STRING(obj); if (psize) { *psize = PyString_GET_SIZE(obj) + 1; } } return SWIG_PYSTR; } } if (cptr) { PyErr_SetString(PyExc_TypeError, "a string is expected"); } return 0;}SWIGSTATICINLINE(int)SWIG_AsCharPtr(PyObject *obj, char **val){ char* cptr = 0; if (SWIG_AsCharPtrAndSize(obj, &cptr, (size_t*)(0))) { if (val) *val = cptr; return 1; } if (val) { PyErr_SetString(PyExc_TypeError, "a char* is expected"); } return 0;}#include <limits.h>SWIGSTATICINLINE(int) SWIG_CheckLongInRange(long value, long min_value, long max_value, const char *errmsg){ if (value < min_value) { if (errmsg) { PyErr_Format(PyExc_OverflowError, "value %ld is less than '%s' minimum %ld", value, errmsg, min_value); } return 0; } else if (value > max_value) { if (errmsg) { PyErr_Format(PyExc_OverflowError, "value %ld is greater than '%s' maximum %ld", value, errmsg, max_value); } return 0; } return 1;}SWIGSTATICINLINE(int) SWIG_AsVal_long(PyObject * obj, long* val){ if (PyInt_Check(obj)) { if (val) *val = PyInt_AS_LONG(obj); return 1; } if (PyLong_Check(obj)) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return 1; } else { if (!val) PyErr_Clear(); return 0; } } if (val) { PyErr_SetString(PyExc_TypeError, "a long is expected"); } return 0; }#if INT_MAX != LONG_MAXSWIGSTATICINLINE(int) SWIG_AsVal_int(PyObject *obj, int *val){ const char* errmsg = val ? "int" : 0; long v; if (SWIG_AsVal_long(obj, &v)) { if (SWIG_CheckLongInRange(v, INT_MIN,INT_MAX, errmsg)) { if (val) *val = swig_numeric_cast(v, int); return 1; } else { return 0; } } else { PyErr_Clear(); } if (val) { PyErr_SetString(PyExc_TypeError, "an int is expected"); } return 0; }#elseSWIGSTATICINLINE(int) SWIG_AsVal_int(PyObject *obj, int *val){ return SWIG_AsVal_long(obj,(long*)val);}#endifSWIGSTATICINLINE(int)SWIG_As_int(PyObject* obj){ int v; if (!SWIG_AsVal_int(obj, &v)) { /* this is needed to make valgrind/purify happier. the other solution is throw an exception, but since this code should work with plain C .... */ memset((void*)&v, 0, sizeof(int)); } return v;} SWIGSTATICINLINE(int)SWIG_Check_int(PyObject* obj){ return SWIG_AsVal_int(obj, (int*)0);}#ifdef __cplusplusextern "C" {#endifstatic PyObject *_wrap_compile(PyObject *self, PyObject *args) { PyObject *resultobj; char *arg1 ; int arg2 ; int arg3 ; param_struct *result; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if(!PyArg_ParseTuple(args,(char *)"OOO:compile",&obj0,&obj1,&obj2)) goto fail; if (!SWIG_AsCharPtr(obj0, (char**)&arg1)) SWIG_fail; arg2 = (int)SWIG_As_int(obj1); if (PyErr_Occurred()) SWIG_fail; arg3 = (int)SWIG_As_int(obj2); if (PyErr_Occurred()) SWIG_fail; result = (param_struct *)compile(arg1,arg2,arg3); resultobj = SWIG_NewPointerObj((void*)(result), SWIGTYPE_p_param_struct, 0); return resultobj; fail: return NULL;}static PyObject *_wrap_agrepy(PyObject *self, PyObject *args) { PyObject *resultobj; char *arg1 ; int arg2 ; char *arg3 ; int arg4 ; int arg5 ; param_struct *arg6 = (param_struct *) 0 ; int_pair_list *result; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; if(!PyArg_ParseTuple(args,(char *)"OOOOOO:agrepy",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) goto fail; if (!SWIG_AsCharPtr(obj0, (char**)&arg1)) SWIG_fail; arg2 = (int)SWIG_As_int(obj1); if (PyErr_Occurred()) SWIG_fail; if (!SWIG_AsCharPtr(obj2, (char**)&arg3)) SWIG_fail; arg4 = (int)SWIG_As_int(obj3); if (PyErr_Occurred()) SWIG_fail; arg5 = (int)SWIG_As_int(obj4); if (PyErr_Occurred()) SWIG_fail; if ((SWIG_ConvertPtr(obj5,(void **)(&arg6),SWIGTYPE_p_param_struct, SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail; result = (int_pair_list *)agrepy(arg1,arg2,arg3,arg4,arg5,arg6); { int_pair_list *plist = result; PyObject *retlist, *temp_tuple, *pyint; int i; if(plist == NULL) { Py_INCREF(Py_None); return Py_None; } retlist = PyList_New(plist -> npairs + 1); for(i=0; i<= plist -> npairs; i++) { temp_tuple = PyTuple_New(2); PyTuple_SetItem(temp_tuple, 0, PyInt_FromLong(plist -> pairs[i].start)); PyTuple_SetItem(temp_tuple, 1, PyInt_FromLong(plist -> pairs[i].end)); PyList_SetItem(retlist, i, temp_tuple); } free(plist -> pairs); free(plist); return(retlist); } return resultobj; fail: return NULL;}static PyMethodDef SwigMethods[] = { { (char *)"compile", _wrap_compile, METH_VARARGS, NULL }, { (char *)"agrepy", _wrap_agrepy, METH_VARARGS, NULL }, { NULL, NULL, 0, NULL }};/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */static swig_type_info _swigt__p_char[] = {{"_p_char", 0, "char *", 0, 0, 0, 0},{"_p_char", 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0}};static swig_type_info _swigt__p_param_struct[] = {{"_p_param_struct", 0, "param_struct *", 0, 0, 0, 0},{"_p_param_struct", 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0}};static swig_type_info *swig_types_initial[] = {_swigt__p_char, _swigt__p_param_struct, 0};/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */static swig_const_info swig_const_table[] = {{0, 0, 0, 0.0, 0, 0}};#ifdef __cplusplus}#endif#ifdef __cplusplusextern "C"#endifSWIGEXPORT(void) SWIG_init(void) { static PyObject *SWIG_globals = 0; static int typeinit = 0; PyObject *m, *d; int i; if (!SWIG_globals) SWIG_globals = SWIG_newvarlink(); m = Py_InitModule((char *) SWIG_name, SwigMethods); d = PyModule_GetDict(m); if (!typeinit) { for (i = 0; swig_types_initial[i]; i++) { swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]); } typeinit = 1; } SWIG_InstallConstants(d,swig_const_table); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -