|
| 1 | +################### |
| 2 | +### WARNING!!! ### |
| 3 | +################### |
| 4 | +# This file has been autogenerated |
| 5 | + |
| 6 | +# Cython imports |
| 7 | +from cython.operator cimport dereference as deref |
| 8 | +from cython.operator cimport preincrement as inc |
| 9 | +from libc cimport stdio |
| 10 | +from cpython.version cimport PY_MAJOR_VERSION |
| 11 | +from cpython.ref cimport PyTypeObject, Py_INCREF, Py_XDECREF |
| 12 | +from cpython.type cimport PyType_Ready |
| 13 | +from cpython.object cimport PyObject |
| 14 | +from cpython.object cimport Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, Py_GE |
| 15 | + |
| 16 | +# Python imports |
| 17 | +cimport numpy as np |
| 18 | + |
| 19 | +# Local imports |
| 20 | +cimport mypack_extra_types |
| 21 | + |
| 22 | +# Cython imports for types |
| 23 | +from libcpp.string cimport string as std_string |
| 24 | + |
| 25 | +cdef extern from "Python.h": |
| 26 | + ctypedef Py_ssize_t Py_ssize_t |
| 27 | + |
| 28 | + cdef long Py_TPFLAGS_DEFAULT |
| 29 | + cdef long Py_TPFLAGS_BASETYPE |
| 30 | + cdef long Py_TPFLAGS_CHECKTYPES |
| 31 | + cdef long Py_TPFLAGS_HEAPTYPE |
| 32 | + |
| 33 | + ctypedef struct PyGetSetDef: |
| 34 | + char * name |
| 35 | + |
| 36 | + ctypedef struct PyTypeObject: |
| 37 | + char * tp_name |
| 38 | + int tp_basicsize |
| 39 | + int tp_itemsize |
| 40 | + object tp_alloc(PyTypeObject *, Py_ssize_t) |
| 41 | + void tp_dealloc(object) |
| 42 | + object tp_richcompare(object, object, int) |
| 43 | + object tp_new(PyTypeObject *, object, object) |
| 44 | + object tp_str(object) |
| 45 | + object tp_repr(object) |
| 46 | + long tp_hash(object) |
| 47 | + long tp_flags |
| 48 | + char * tp_doc |
| 49 | + PyMemberDef * tp_members |
| 50 | + PyGetSetDef * tp_getset |
| 51 | + PyTypeObject * tp_base |
| 52 | + void tp_free(void *) |
| 53 | + # This is a dirty hack by declaring to Cython both the Python 2 & 3 APIs |
| 54 | + int (*tp_compare)(object, object) # Python 2 |
| 55 | + void * (*tp_reserved)(object, object) # Python 3 |
| 56 | + |
| 57 | +# structmember.h isn't included in Python.h for some reason |
| 58 | +cdef extern from "structmember.h": |
| 59 | + ctypedef struct PyMemberDef: |
| 60 | + char * name |
| 61 | + int type |
| 62 | + Py_ssize_t offset |
| 63 | + int flags |
| 64 | + char * doc |
| 65 | + |
| 66 | +cdef extern from "numpy/arrayobject.h": |
| 67 | + |
| 68 | + ctypedef object (*PyArray_GetItemFunc)(void *, void *) |
| 69 | + ctypedef int (*PyArray_SetItemFunc)(object, void *, void *) |
| 70 | + ctypedef void (*PyArray_CopySwapNFunc)(void *, np.npy_intp, void *, np.npy_intp, np.npy_intp, int, void *) |
| 71 | + ctypedef void (*PyArray_CopySwapFunc)(void *, void *, int, void *) |
| 72 | + ctypedef int (*PyArray_CompareFunc)(const void* d1, const void *, void *) |
| 73 | + ctypedef int (*PyArray_ArgFunc)(void *, np.npy_intp, np.npy_intp *, void *) |
| 74 | + ctypedef void (*PyArray_DotFunc)(void *, np.npy_intp, void *, np.npy_intp, void *, np.npy_intp, void *) |
| 75 | + ctypedef int (*PyArray_ScanFunc)(stdio.FILE *, void *, void *, void *) |
| 76 | + ctypedef int (*PyArray_FromStrFunc)(char *, void *, char **, void *) |
| 77 | + ctypedef np.npy_bool (*PyArray_NonzeroFunc)(void *, void *) |
| 78 | + ctypedef void (*PyArray_FillFunc)(void *, np.npy_intp, void *) |
| 79 | + ctypedef void (*PyArray_FillWithScalarFunc)(void *, np.npy_intp, void *, void *) |
| 80 | + ctypedef int (*PyArray_SortFunc)(void *, np.npy_intp, void *) |
| 81 | + ctypedef int (*PyArray_ArgSortFunc)(void *, np.npy_intp *, np.npy_intp, void *) |
| 82 | + ctypedef np.NPY_SCALARKIND (*PyArray_ScalarKindFunc)(np.PyArrayObject *) |
| 83 | + |
| 84 | + ctypedef struct PyArray_ArrFuncs: |
| 85 | + np.PyArray_VectorUnaryFunc ** cast |
| 86 | + PyArray_GetItemFunc *getitem |
| 87 | + PyArray_SetItemFunc *setitem |
| 88 | + PyArray_CopySwapNFunc *copyswapn |
| 89 | + PyArray_CopySwapFunc *copyswap |
| 90 | + PyArray_CompareFunc *compare |
| 91 | + PyArray_ArgFunc *argmax |
| 92 | + PyArray_DotFunc *dotfunc |
| 93 | + PyArray_ScanFunc *scanfunc |
| 94 | + PyArray_FromStrFunc *fromstr |
| 95 | + PyArray_NonzeroFunc *nonzero |
| 96 | + PyArray_FillFunc *fill |
| 97 | + PyArray_FillWithScalarFunc *fillwithscalar |
| 98 | + PyArray_SortFunc *sort |
| 99 | + PyArray_ArgSortFunc *argsort |
| 100 | + PyObject *castdict |
| 101 | + PyArray_ScalarKindFunc *scalarkind |
| 102 | + int **cancastscalarkindto |
| 103 | + int *cancastto |
| 104 | + int listpickle |
| 105 | + |
| 106 | + cdef void PyArray_InitArrFuncs(PyArray_ArrFuncs *) |
| 107 | + |
| 108 | + ctypedef struct PyArray_ArrayDescr: |
| 109 | + PyArray_Descr * base |
| 110 | + PyObject *shape |
| 111 | + |
| 112 | + cdef void ** PyArray_API |
| 113 | + |
| 114 | + cdef PyTypeObject * PyArrayDescr_Type |
| 115 | + |
| 116 | + ctypedef struct PyArray_Descr: |
| 117 | + Py_ssize_t ob_refcnt |
| 118 | + PyTypeObject * ob_type |
| 119 | + PyTypeObject * typeobj |
| 120 | + char kind |
| 121 | + char type |
| 122 | + char byteorder |
| 123 | + int flags |
| 124 | + int type_num |
| 125 | + int elsize |
| 126 | + int alignment |
| 127 | + PyArray_ArrayDescr * subarray |
| 128 | + PyObject * fields |
| 129 | + PyObject * names |
| 130 | + PyArray_ArrFuncs * f |
| 131 | + |
| 132 | + cdef int PyArray_RegisterDataType(PyArray_Descr *) |
| 133 | + |
| 134 | + cdef object PyArray_Scalar(void *, PyArray_Descr *, object) |
| 135 | + |
| 136 | +cdef extern from "mypack_extra_types.h" namespace "mypack_extra_types": |
| 137 | + cdef cppclass MemoryKnight[T]: |
| 138 | + MemoryKnight() nogil except + |
| 139 | + T * defnew() nogil except + |
| 140 | + T * renew(void *) nogil except + |
| 141 | + void deall(T *) nogil except + |
| 142 | + |
| 143 | +# std_string dtype |
| 144 | +ctypedef struct PyXDStr_Type: |
| 145 | + Py_ssize_t ob_refcnt |
| 146 | + PyTypeObject *ob_typ |
| 147 | + std_string obval |
| 148 | + |
| 149 | +cdef object pyxd_str_getitem(void * data, void * arr) |
| 150 | +cdef int pyxd_str_setitem(object value, void * data, void * arr) |
| 151 | +cdef void pyxd_str_copyswapn(void * dest, np.npy_intp dstride, void * src, np.npy_intp sstride, np.npy_intp n, int swap, void * arr) |
| 152 | +cdef void pyxd_str_copyswap(void * dest, void * src, int swap, void * arr) |
| 153 | +cdef np.npy_bool pyxd_str_nonzero(void * data, void * arr) |
| 154 | + |
| 155 | + |
0 commit comments