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