24static inline void set_strides(Py_buffer& view,
size_t itemsize,
bool isfix) {
26 Py_ssize_t stride = itemsize;
27 for (Py_ssize_t idim = view.ndim - 1; 0 <= idim; --idim) {
28 view.strides[idim] = stride;
29 stride *= view.shape[idim];
32 view.strides[view.ndim - 1] = itemsize;
33 for (Py_ssize_t idim = 0; idim < view.ndim - 1; ++idim)
34 view.strides[idim] = view.itemsize;
40static inline Py_ssize_t
fake_max(
size_t elemsize) {
41 return INT_MAX / (Py_ssize_t)elemsize;
53 memset(&pyobj->
fBufInfo, 0,
sizeof(Py_buffer));
55 pyobj->
fBuf =
nullptr;
81 Py_TYPE(pyobj)->tp_free((
PyObject*)pyobj);
85#define CPYRT_LL_FLAG_GETSET(name, flag, doc) \
86 static PyObject* ll_get##name(cpyrt::LowLevelView* pyobj) { \
87 return PyBool_FromLong((long)((intptr_t)pyobj->fBufInfo.internal & flag)); \
90 static int ll_set##name(cpyrt::LowLevelView* pyobj, PyObject* value, \
92 long settrue = PyLong_AsLong(value); \
93 if (settrue == -1 && PyErr_Occurred()) { \
94 PyErr_SetString(PyExc_ValueError, \
95 #doc " should be either True or False"); \
100 (intptr_t&)pyobj->fBufInfo.internal |= flag; \
102 (intptr_t&)pyobj->fBufInfo.internal &= ~flag; \
114 return PyUnicode_FromString((
char*)self->fBufInfo.format);
124#define HAVE_PTR(suboffsets, dim) (suboffsets && suboffsets[dim] >= 0)
126#define ADJUST_PTR(ptr, suboffsets, dim) \
127 (HAVE_PTR(suboffsets, dim) ? *((char**)ptr) + suboffsets[dim] : ptr)
131#define HAVE_SUBOFFSETS_IN_LAST_DIM(view) \
132 (view->suboffsets && view->suboffsets[dest->ndim - 1] >= 0)
136 const Py_buffer*
src) {
137 assert(
dest->ndim > 0 &&
src->ndim > 0);
141 src->strides[
src->ndim - 1] ==
src->itemsize);
152 for (
int i = 0; i <
dest->ndim; i++) {
153 if (
dest->shape[i] !=
src->shape[i])
155 if (
dest->shape[i] == 0)
166 if (strcmp(
dest->format,
src->format) != 0 ||
168 PyErr_SetString(PyExc_ValueError,
"low level pointer assignment: lvalue "
169 "and rvalue have different structures");
177static void copy_base(
const Py_ssize_t* shape, Py_ssize_t itemsize,
char* dptr,
178 const Py_ssize_t* dstrides,
const Py_ssize_t* dsuboffsets,
179 char* sptr,
const Py_ssize_t* sstrides,
180 const Py_ssize_t* ssuboffsets,
char* mem) {
185 Py_ssize_t
size = shape[0] * itemsize;
186 if (dptr +
size < sptr || sptr +
size < dptr)
187 memcpy(dptr, sptr,
size);
189 memmove(dptr, sptr,
size);
193 for (i = 0,
p = mem; i < shape[0];
194 p += itemsize, sptr += sstrides[0], i++) {
195 char* xsptr =
ADJUST_PTR(sptr, ssuboffsets, 0);
196 memcpy(
p, xsptr, itemsize);
198 for (i = 0,
p = mem; i < shape[0];
199 p += itemsize, dptr += dstrides[0], i++) {
200 char* xdptr =
ADJUST_PTR(dptr, dsuboffsets, 0);
201 memcpy(xdptr,
p, itemsize);
211 assert(
dest->ndim == 1);
217 mem = (
char*)PyMem_Malloc(
dest->shape[0] *
dest->itemsize);
225 dest->suboffsets, (
char*)
src->buf,
src->strides,
src->suboffsets,
240 assert(view.strides);
249 "negative index not supported on dimension %d with unknown size",
258 "multi index not supported on dimension %d with unknown stride",
264 PyErr_Format(PyExc_IndexError,
"index out of bounds on dimension %d",
269 ptr += view.strides[dim] *
index;
288 Py_ssize_t nindices = PyTuple_GET_SIZE(tup);
289 if (nindices > view.ndim) {
290 PyErr_Format(PyExc_TypeError,
291 "cannot index %d-dimension view with %zd-element tuple",
292 view.ndim, nindices);
296 char* ptr = (
char*)llview->
get_buf();
297 for (Py_ssize_t dim = 0; dim < nindices; dim++) {
299 index = PyNumber_AsSsize_t(PyTuple_GET_ITEM(tup, dim), PyExc_IndexError);
300 if (
index == -1 && PyErr_Occurred())
308 dim != view.ndim - 1)
323 Py_ssize_t start, stop, step, slicelength;
327 if (PySlice_GetIndicesEx(key, base->shape[dim], &start, &stop, &step,
331 if (!base->suboffsets || dim == 0) {
333 base->buf = (
char*)base->buf + base->strides[dim] * start;
335 Py_ssize_t
n = dim - 1;
336 while (
n >= 0 && base->suboffsets[
n] < 0)
340 base->suboffsets[
n] = base->suboffsets[
n] + base->strides[dim] * start;
342 base->shape[dim] = slicelength;
343 base->strides[dim] = base->strides[dim] * step;
350 if (!PyTuple_Check(key))
353 Py_ssize_t
size = PyTuple_GET_SIZE(key);
357 for (Py_ssize_t i = 0; i <
size; i++) {
359 if (!PySlice_Check(
x))
367 if (!PyTuple_Check(key))
370 Py_ssize_t
size = PyTuple_GET_SIZE(key);
371 for (Py_ssize_t i = 0; i <
size; i++) {
373 if (!PyIndex_Check(
x))
387 PyErr_SetString(PyExc_ReferenceError,
"attempt to access a null-pointer");
391 if (view.ndim == 0) {
392 PyErr_SetString(PyExc_TypeError,
"invalid indexing of 0-dim memory");
399 if (self->
fBufInfo.ndim == 1 || !isfix)
411 Py_ssize_t nindices = PyTuple_GET_SIZE(tup);
413 if (nindices < view.ndim) {
415 PyErr_SetString(PyExc_NotImplementedError,
"sub-views are not implemented");
435 if (view.ndim == 0) {
436 if (PyTuple_Check(key) && PyTuple_GET_SIZE(key) == 0) {
438 }
else if (key == Py_Ellipsis) {
442 PyErr_SetString(PyExc_TypeError,
"invalid indexing of 0-dim memory");
447 if (PyIndex_Check(key)) {
448 Py_ssize_t
index = PyNumber_AsSsize_t(key, PyExc_IndexError);
449 if (
index == -1 && PyErr_Occurred())
452 }
else if (PySlice_Check(key)) {
453 if (view.ndim == 1) {
454 Py_ssize_t start, stop, step, slicelen;
455 if (PySlice_Unpack(key, &start, &stop, &step) < 0)
458 slicelen = PySlice_AdjustIndices(view.shape[0], &start, &stop, step);
460 slicelen = view.shape[0];
462 char* buf = (
char*)self->
get_buf();
463 char* slice_buf =
new char[slicelen * view.itemsize];
464 size_t isize = view.itemsize;
465 for (
size_t i = 0, cur = 0; i < (size_t)slicelen; cur += step, ++i) {
466 for (
size_t j = 0; j < isize; ++j)
467 slice_buf[i * isize + j] = buf[(start + cur) * isize + j];
481 PyErr_SetString(PyExc_NotImplementedError,
482 "multi-dimensional slicing is not implemented");
488 PyErr_SetString(PyExc_NotImplementedError,
489 "multi-dimensional slicing is not implemented");
493 PyErr_SetString(PyExc_TypeError,
"invalid slice key");
504 PyErr_SetString(PyExc_TypeError,
"cannot modify read-only memory");
508 if (
value ==
nullptr) {
509 PyErr_SetString(PyExc_TypeError,
"cannot delete memory");
513 if (view.ndim == 0) {
514 if (key == Py_Ellipsis ||
515 (PyTuple_Check(key) && PyTuple_GET_SIZE(key) == 0)) {
518 PyErr_SetString(PyExc_TypeError,
"invalid indexing of 0-dim memory");
523 if (PyIndex_Check(key)) {
526 PyErr_SetString(PyExc_NotImplementedError,
527 "sub-views are not implemented");
530 index = PyNumber_AsSsize_t(key, PyExc_IndexError);
531 if (
index == -1 && PyErr_Occurred())
540 if (PySlice_Check(key) && view.ndim == 1) {
542 Py_ssize_t arrays[3];
546 if (PyObject_GetBuffer(
value, &
src, PyBUF_FULL_RO) < 0) {
548 PyBuffer_Release(&
src);
553 dest.shape = &arrays[0];
554 dest.shape[0] = view.shape[0];
555 dest.strides = &arrays[1];
556 dest.strides[0] = view.strides[0];
557 if (view.suboffsets) {
558 dest.suboffsets = &arrays[2];
559 dest.suboffsets[0] = view.suboffsets[0];
567 PyBuffer_Release(&
src);
573 if (PyTuple_GET_SIZE(key) < view.ndim) {
574 PyErr_SetString(PyExc_NotImplementedError,
575 "sub-views are not implemented");
586 PyErr_SetString(PyExc_NotImplementedError,
587 "LowLevelView slice assignments are currently restricted "
592 PyErr_SetString(PyExc_TypeError,
"invalid slice key");
603 if (!(flags & PyBUF_FORMAT)) {
612 if ((flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) {
613 PyErr_SetString(PyExc_BufferError,
614 "underlying buffer is not Fortran contiguous");
618 if (!(flags & PyBUF_FORMAT)) {
621 if (view->format != NULL) {
626 "cannot cast to unsigned bytes if the format flag is present");
636 Py_INCREF(view->obj);
658 PyObject_GC_Track(ii);
693 PyObject* shape = PyTuple_New(view.ndim);
696 for (Py_ssize_t idim = 0; idim < view.ndim; ++idim) {
697 PyObject* pydim = PyLong_FromSsize_t(view.shape[idim]);
702 PyTuple_SET_ITEM(shape, idim, pydim);
714 PyErr_Format(PyExc_ValueError,
715 "cannot reshape array of shape %S into shape %S: %s", current,
732 if (!PyTuple_Check(shape)) {
734 PyObject* pystr = PyObject_Str(shape);
736 PyErr_Format(PyExc_TypeError,
"tuple object expected, received %s",
737 PyUnicode_AsUTF8(pystr));
742 PyErr_SetString(PyExc_TypeError,
"tuple object expected");
747 if (view.ndim < 1 || !view.shape || !view.strides) {
748 PyErr_SetString(PyExc_TypeError,
749 "this low level view has no dimensions to set");
758 Py_ssize_t elemsize = view.strides[view.ndim - 1];
759 Py_ssize_t fakemax =
fake_max(elemsize);
760 Py_ssize_t unit0 = view.ndim == 1 ? elemsize : view.itemsize;
762 Py_ssize_t ndim = PyTuple_GET_SIZE(shape);
764 for (Py_ssize_t idim = 0; idim < ndim; ++idim) {
765 Py_ssize_t nlen = PyLong_AsSsize_t(PyTuple_GET_ITEM(shape, idim));
766 if (nlen == -1 && PyErr_Occurred())
769 PyErr_SetString(PyExc_ValueError,
"negative dimensions are not allowed");
774 else if (PY_SSIZE_T_MAX / (idim == 0 ? unit0 : elemsize) < nlen)
779 if (ndim != view.ndim)
782 "the number of dimensions of a low level view is fixed by its type");
784 for (Py_ssize_t idim = 0; idim < ndim; ++idim) {
785 Py_ssize_t cur = view.shape[idim];
787 (idim == 0 && cur == fakemax) || (cur == 0 && !isfix);
788 if (!unknown && dims[idim] != cur)
790 "only dimensions of unknown size can be set");
793 for (Py_ssize_t idim = 0; idim < ndim; ++idim)
794 view.shape[idim] = dims[idim];
798 view.len = dims[0] * unit0;
806 PyErr_SetString(PyExc_TypeError,
"cannot delete the shape of a view");
824 static PyObject* npmod = PyImport_ImportModule(
"numpy");
832 PyErr_SetString(PyExc_TypeError,
833 "__array__ only supports the \"copy\" keyword");
837 docopy = PyObject_IsTrue(pycp);
845 if (!args || PyTuple_GET_SIZE(args) != 1) {
848 dtype = PyObject_CallFunctionObjArgs(npdtype, typecode,
nullptr);
852 dtype = PyTuple_GET_ITEM(args, 0);
864 Py_DECREF(npfrombuf);
871 PyObject_CallFunctionObjArgs(npcopy, (
PyObject*)self,
nullptr);
886 if (strcmp(view.format,
"b") != 0 || view.ndim != 1) {
889 "as_string only supported for 1-dim char strings (format: %s, dim: %d)",
890 view.format, (
int)view.ndim);
894 char* buf = (
char*)self->
get_buf();
895 size_t sz = strnlen(buf, (
size_t)view.shape[0]);
896 return PyUnicode_FromStringAndSize(buf, sz);
901 {(
char*)
"reshape", (PyCFunction)
ll_reshape, METH_O,
902 (
char*)
"change the shape (not layout) of the low level view"},
903 {(
char*)
"as_string", (PyCFunction)
ll_as_string, METH_NOARGS,
904 (
char*)
"interpret memory as a null-terminated char string and return "
906 {(
char*)
"__array__", (PyCFunction)
ll_array, METH_VARARGS | METH_KEYWORDS,
907 (
char*)
"return a numpy array from the low level view"},
908 {(
char*)
nullptr,
nullptr, 0,
nullptr}};
913 (
char*)
"If true, python manages the life time of this buffer",
nullptr},
915 (
char*)
"If true, this array was allocated with C++\'s new[]",
nullptr},
916 {(
char*)
"format", (getter)
ll_typecode,
nullptr,
nullptr,
nullptr},
917 {(
char*)
"typecode", (getter)
ll_typecode,
nullptr,
nullptr,
nullptr},
919 {(
char*)
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}};
925 PyVarObject_HEAD_INIT(&PyType_Type,
926 0)(
char*)
"cppjit.LowLevelView",
944 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
945 (
char*)
"memory view on C++ pointer",
980template <
typename T>
struct typecode_traits {};
981template <>
struct typecode_traits<
bool> {
982 static constexpr const char*
format =
"?";
983 static constexpr const char*
name =
"bool";
985template <>
struct typecode_traits<char> {
986 static constexpr const char*
format =
"b";
987 static constexpr const char*
name =
"char";
989template <>
struct typecode_traits<signed char> {
990 static constexpr const char*
format =
"b";
991 static constexpr const char*
name =
"SCharAsInt";
993template <>
struct typecode_traits<unsigned char> {
994 static constexpr const char*
format =
"B";
995 static constexpr const char*
name =
"UCharAsInt";
997template <>
struct typecode_traits<std::byte> {
998 static constexpr const char*
format =
"B";
999 static constexpr const char*
name =
"UCharAsInt";
1001template <>
struct typecode_traits<char*> {
1002 static constexpr const char*
format =
"b";
1003 static constexpr const char*
name =
"char*";
1005template <>
struct typecode_traits<const char*> {
1006 static constexpr const char*
format =
"b";
1007 static constexpr const char*
name =
"const char*";
1009template <>
struct typecode_traits<short> {
1010 static constexpr const char*
format =
"h";
1011 static constexpr const char*
name =
"short";
1013template <>
struct typecode_traits<unsigned short> {
1014 static constexpr const char*
format =
"H";
1015 static constexpr const char*
name =
"unsigned short";
1017template <>
struct typecode_traits<
int> {
1018 static constexpr const char*
format =
"i";
1019 static constexpr const char*
name =
"int";
1021template <>
struct typecode_traits<unsigned
int> {
1022 static constexpr const char*
format =
"I";
1023 static constexpr const char*
name =
"unsigned int";
1025template <>
struct typecode_traits<long> {
1026 static constexpr const char*
format =
"l";
1027 static constexpr const char*
name =
"long";
1029template <>
struct typecode_traits<unsigned long> {
1030 static constexpr const char*
format =
"L";
1031 static constexpr const char*
name =
"unsigned long";
1033template <>
struct typecode_traits<long long> {
1034 static constexpr const char*
format =
"q";
1035 static constexpr const char*
name =
"long long";
1037template <>
struct typecode_traits<unsigned long long> {
1038 static constexpr const char*
format =
"Q";
1039 static constexpr const char*
name =
"unsigned long long";
1041template <>
struct typecode_traits<float> {
1042 static constexpr const char*
format =
"f";
1043 static constexpr const char*
name =
"float";
1045template <>
struct typecode_traits<
double> {
1046 static constexpr const char*
format =
"d";
1047 static constexpr const char*
name =
"double";
1049template <>
struct typecode_traits<long
double> {
1050 static constexpr const char*
format =
"D";
1051 static constexpr const char*
name =
"long double";
1053template <>
struct typecode_traits<std::complex<float>> {
1054 static constexpr const char*
format =
"Zf";
1055 static constexpr const char*
name =
"std::complex<float>";
1057template <>
struct typecode_traits<std::complex<double>> {
1058 static constexpr const char*
format =
"Zd";
1059 static constexpr const char*
name =
"std::complex<double>";
1061template <>
struct typecode_traits<std::complex<int>> {
1062 static constexpr const char*
format =
"Zi";
1063 static constexpr const char*
name =
"std::complex<int>";
1065template <>
struct typecode_traits<std::complex<long>> {
1066 static constexpr const char*
format =
"Zl";
1067 static constexpr const char*
name =
"std::complex<long>";
1075 if (bi.ndim == 1 && bi.shape) {
1076 bi.len = sz * bi.itemsize;
1085template <
typename T>
1088 const char*
format =
nullptr,
const char*
name =
nullptr,
1089 Py_ssize_t itemsize = -1) {
1104 view.format = (
char*)(
format ?
format : typecode_traits<T>::format);
1106 view.shape = (Py_ssize_t*)PyMem_Malloc(view.ndim *
sizeof(Py_ssize_t));
1108 view.strides = (Py_ssize_t*)PyMem_Malloc(view.ndim *
sizeof(Py_ssize_t));
1109 view.suboffsets =
nullptr;
1113 for (
int i = 0; i < shape.
ndim(); ++i)
1120 if (view.ndim == 1) {
1122 view.len = nx *
sizeof(T);
1123 view.itemsize = (itemsize > 0 ? (size_t)itemsize :
sizeof(T));
1127 const size_t elemsize = isfix ?
sizeof(T) :
sizeof(
void*);
1128 view.len = nx * elemsize;
1129 view.itemsize = elemsize;
1130 for (Py_ssize_t idim = 1; idim < view.ndim; ++idim)
1131 view.shape[idim] = shape[idim];
1134 std::string tname{
name ?
name : typecode_traits<T>::name};
1146template <
typename T>
1149 const char*
format =
nullptr,
const char*
name =
nullptr) {
1153 llp->
set_buf((
void**)address);
1158#define CPPJIT_RET_W_CREATOR(type, fname) \
1159 PyObject* (*c)(type, cdims_t) = &fname; \
1160 ll->fCreator = (LowLevelView::Creator_t)c; \
1161 return (PyObject*)ll
1163#define CPPJIT_IMPL_VIEW_CREATOR(type) \
1164 PyObject* cpyrt::CreateLowLevelView(type* address, cdims_t shape) { \
1165 LowLevelView* ll = CreateLowLevelViewT<type>(address, shape); \
1166 CPPJIT_RET_W_CREATOR(type*, CreateLowLevelView); \
1168 PyObject* cpyrt::CreateLowLevelView(type** address, cdims_t shape) { \
1169 LowLevelView* ll = CreateLowLevelViewT<type>(address, shape); \
1170 CPPJIT_RET_W_CREATOR(type**, CreateLowLevelView); \
1194 LowLevelView* ll = CreateLowLevelViewT<char>(address, shape);
1199 LowLevelView* ll = CreateLowLevelViewT<char>(address, shape);
1204 LowLevelView* ll = CreateLowLevelViewT<char*>(address, shape,
nullptr,
1205 nullptr,
sizeof(
char));
1210 LowLevelView* ll = CreateLowLevelViewT<const char*>(address, shape,
nullptr,
1211 nullptr,
sizeof(
char));
1216 LowLevelView* ll = CreateLowLevelViewT<int8_t>(address, shape,
"b",
"int8_t");
1221 LowLevelView* ll = CreateLowLevelViewT<int8_t>(address, shape,
"b",
"int8_t");
1227 CreateLowLevelViewT<uint8_t>(address, shape,
"B",
"uint8_t");
1233 CreateLowLevelViewT<uint8_t>(address, shape,
"B",
"uint8_t");
1239 CreateLowLevelViewT<int16_t>(address, shape,
"h",
"int16_t");
1245 CreateLowLevelViewT<int16_t>(address, shape,
"h",
"int16_t");
1251 CreateLowLevelViewT<uint16_t>(address, shape,
"H",
"uint16_t");
1257 CreateLowLevelViewT<uint16_t>(address, shape,
"H",
"uint16_t");
1263 CreateLowLevelViewT<int32_t>(address, shape,
"i",
"int32_t");
1269 CreateLowLevelViewT<int32_t>(address, shape,
"i",
"int32_t");
1275 CreateLowLevelViewT<uint32_t>(address, shape,
"I",
"uint32_t");
1281 CreateLowLevelViewT<uint32_t>(address, shape,
"I",
"uint32_t");
static PyObject * ll_shape(cpyrt::LowLevelView *self)
static void * ptr_from_tuple(cpyrt::LowLevelView *llview, PyObject *tup)
#define ADJUST_PTR(ptr, suboffsets, dim)
static int ll_setcpparray(cpyrt::LowLevelView *pyobj, PyObject *value, void *)
static PyObject * ll_getcpparray(cpyrt::LowLevelView *pyobj)
static PyObject * ll_reshape(cpyrt::LowLevelView *self, PyObject *shape)
static PyObject * ll_reshape_error(cpyrt::LowLevelView *self, PyObject *shape, const char *why)
static Py_ssize_t is_multiindex(PyObject *key)
#define CPYRT_LL_FLAG_GETSET(name, flag, doc)
static PySequenceMethods ll_as_sequence
static int ll_getbuf(cpyrt::LowLevelView *self, Py_buffer *view, int flags)
static bool equiv_shape(const Py_buffer *dest, const Py_buffer *src)
static cpyrt::LowLevelView * CreateLowLevelViewT(T *address, cpyrt::cdims_t shape, const char *format=nullptr, const char *name=nullptr, Py_ssize_t itemsize=-1)
static void ll_dealloc(cpyrt::LowLevelView *pyobj)
static PyObject * ll_array(cpyrt::LowLevelView *self, PyObject *args, PyObject *kwds)
static int ll_setshape(cpyrt::LowLevelView *self, PyObject *value, void *)
static Py_ssize_t ll_length(cpyrt::LowLevelView *self)
static cpyrt::LowLevelView * ll_new(PyTypeObject *subtype, PyObject *, PyObject *)
static PyObject * ll_subscript(cpyrt::LowLevelView *self, PyObject *key)
#define CPPJIT_RET_W_CREATOR(type, fname)
static PyObject * ll_as_string(cpyrt::LowLevelView *self)
static int last_dim_is_contiguous(const Py_buffer *dest, const Py_buffer *src)
static int ll_setownership(cpyrt::LowLevelView *pyobj, PyObject *value, void *)
static Py_ssize_t fake_max(size_t elemsize)
static PyObject * ll_item(cpyrt::LowLevelView *self, Py_ssize_t index)
static PyBufferProcs ll_as_buffer
static PyMethodDef ll_methods[]
static bool equiv_structure(const Py_buffer *dest, const Py_buffer *src)
static void copy_base(const Py_ssize_t *shape, Py_ssize_t itemsize, char *dptr, const Py_ssize_t *dstrides, const Py_ssize_t *dsuboffsets, char *sptr, const Py_ssize_t *sstrides, const Py_ssize_t *ssuboffsets, char *mem)
static PyObject * ll_item_multi(cpyrt::LowLevelView *self, PyObject *tup)
static int ll_ass_sub(cpyrt::LowLevelView *self, PyObject *key, PyObject *value)
#define CPPJIT_IMPL_VIEW_CREATOR(type)
static PyMappingMethods ll_as_mapping
static PyGetSetDef ll_getset[]
static int copy_single(Py_buffer *dest, Py_buffer *src)
static void * ptr_from_index(cpyrt::LowLevelView *llview, Py_ssize_t index)
static PyObject * ll_iter(PyObject *self)
static int init_slice(Py_buffer *base, PyObject *_key, int dim)
static void set_strides(Py_buffer &view, size_t itemsize, bool isfix)
static PyObject * ll_getownership(cpyrt::LowLevelView *pyobj)
static PyObject * ll_typecode(cpyrt::LowLevelView *self, void *)
static bool is_multislice(PyObject *key)
static char * lookup_dimension(Py_buffer &view, char *ptr, int dim, Py_ssize_t index)
#define HAVE_SUBOFFSETS_IN_LAST_DIM(view)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t dest
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t nitems
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t format
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
virtual PyObject * FromMemory(void *address)
virtual bool ToMemory(PyObject *value, void *address, PyObject *ctxt=nullptr)
PyObject_HEAD Py_buffer fBufInfo
#define CPYRT_PYTYPE_TAIL
PyObject * CreateLowLevelViewString(char **, cdims_t shape)
CPYRT_EXTERN Converter * CreateConverter(const std::string &name, cdims_t=0)
PyObject * CreateLowLevelView(bool *, cdims_t shape)
PyTypeObject LowLevelView_Type
PyObject * CreateLowLevelView_i8(int8_t *, cdims_t shape)
static const dim_t UNKNOWN_SIZE
PyObject * CreateLowLevelView_i32(int32_t *, cdims_t shape)
PyObject * CreateLowLevelView_i16(int16_t *, cdims_t shape)
PyObject_HEAD PyObject * ii_container