Lines Matching refs:view
59 #define ND_GETBUF_UNDEFINED 0x080 /* undefined view.obj */
1417 ndarray_getbuf(NDArrayObject *self, Py_buffer *view, int flags)
1425 return PyObject_GetBuffer(base->obj, view, flags);
1429 *view = *base;
1430 view->obj = NULL;
1433 if (view->format == NULL)
1434 view->format = "B";
1451 view->obj = (PyObject *)0x1; /* wrong but permitted in <= 3.2 */
1462 view->itemsize is the _previous_ itemsize. If shape is present,
1466 view->format = NULL;
1495 view->strides = NULL;
1500 if (view->format != NULL) {
1510 view->ndim = 1;
1511 view->shape = NULL;
1515 if (ND_C_CONTIGUOUS(baseflags) != PyBuffer_IsContiguous(view, 'C') ||
1517 (view->format != NULL && view->shape != NULL &&
1518 ND_FORTRAN_CONTIGUOUS(baseflags) != PyBuffer_IsContiguous(view, 'F')) ||
1520 (view->format == NULL && view->shape == NULL &&
1521 !PyBuffer_IsContiguous(view, 'F'))) {
1527 view->obj = (PyObject *)self;
1528 Py_INCREF(view->obj);
1535 ndarray_releasebuf(NDArrayObject *self, Py_buffer *view)
1538 ndbuf_t *ndbuf = view->internal;
2228 Obviously this is fragile and only one such view may be active at any
2235 const Py_buffer *view = &nd->head->base;
2246 else if (NDArray_Check(view->obj) && !ND_IS_CONSUMER(view->obj))
2248 ndbuf = ((NDArrayObject *)view->obj)->head;
2256 info = *view;
2269 info.buf = infobuf + ((char *)view->buf - ndbuf->data);
2271 if (view->format) {
2272 if (strlen(view->format) > ND_MAX_NDIM) {
2278 strcpy(format, view->format);
2281 if (view->ndim > ND_MAX_NDIM) {
2286 if (view->shape) {
2287 memcpy(shape, view->shape, view->ndim * sizeof(Py_ssize_t));
2290 if (view->strides) {
2291 memcpy(strides, view->strides, view->ndim * sizeof(Py_ssize_t));
2294 if (view->suboffsets) {
2295 memcpy(suboffsets, view->suboffsets, view->ndim * sizeof(Py_ssize_t));
2309 Py_buffer view;
2319 if (PyObject_GetBuffer(bufobj, &view, PyBUF_FULL_RO) < 0)
2322 if (view.ndim > ND_MAX_NDIM) {
2327 if (PySequence_Fast_GET_SIZE(seq) != view.ndim) {
2333 for (i = 0; i < view.ndim; i++) {
2338 if (indices[i] < 0 || indices[i] >= view.shape[i]) {
2346 ptr = PyBuffer_GetPointer(&view, indices);
2347 ret = unpack_single(ptr, view.format, view.itemsize);
2350 PyBuffer_Release(&view);
2435 Py_buffer view;
2442 if (PyObject_GetBuffer(obj, &view, flags) < 0) {
2451 buf = PyMem_Malloc(view.len);
2457 if (PyBuffer_ToContiguous(buf, &view, view.len, ord) < 0) {
2461 ret = PyBytes_FromStringAndSize(buf, view.len);
2464 PyBuffer_Release(&view);
2572 Py_buffer view, *base;
2590 if (PyObject_GetBuffer(obj, &view, PyBUF_FULL_RO) < 0) {
2596 ret = PyBuffer_IsContiguous(&view, ord) ? Py_True : Py_False;
2597 PyBuffer_Release(&view);
2608 const Py_buffer *view = &nd->head->base;
2612 if (!view->readonly) {
2617 if (view->obj != NULL && PyObject_Hash(view->obj) == -1) {
2692 int legacy_mode; /* if true, use the view.obj==NULL hack */
2743 staticarray_getbuf(StaticArrayObject *self, Py_buffer *view, int flags)
2745 *view = static_buffer;
2748 view->obj = NULL; /* Don't use this in new code. */
2751 view->obj = (PyObject *)self;
2752 Py_INCREF(view->obj);