|
|
|
|
| #ifndef Py_BUFFER_H
|
| #define Py_BUFFER_H
|
| #ifdef __cplusplus
|
| extern "C" {
|
| #endif
|
|
|
| #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030b0000
|
|
|
| |
| |
| |
| |
| |
| |
| |
|
|
|
|
| typedef struct {
|
| void *buf;
|
| PyObject *obj;
|
| Py_ssize_t len;
|
| Py_ssize_t itemsize; |
|
|
| int readonly;
|
| int ndim;
|
| char *format;
|
| Py_ssize_t *shape;
|
| Py_ssize_t *strides;
|
| Py_ssize_t *suboffsets;
|
| void *internal;
|
| } Py_buffer;
|
|
|
|
|
| PyAPI_FUNC(int) PyObject_CheckBuffer(PyObject *obj);
|
|
|
| |
| |
| |
| |
|
|
| PyAPI_FUNC(int) PyObject_GetBuffer(PyObject *obj, Py_buffer *view,
|
| int flags);
|
|
|
| |
|
|
| PyAPI_FUNC(void *) PyBuffer_GetPointer(const Py_buffer *view, const Py_ssize_t *indices);
|
|
|
| |
|
|
| PyAPI_FUNC(Py_ssize_t) PyBuffer_SizeFromFormat(const char *format);
|
|
|
|
|
| PyAPI_FUNC(int) PyBuffer_ToContiguous(void *buf, const Py_buffer *view,
|
| Py_ssize_t len, char order);
|
|
|
| PyAPI_FUNC(int) PyBuffer_FromContiguous(const Py_buffer *view, const void *buf,
|
| Py_ssize_t len, char order);
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| PyAPI_FUNC(int) PyObject_CopyData(PyObject *dest, PyObject *src);
|
|
|
|
|
| PyAPI_FUNC(int) PyBuffer_IsContiguous(const Py_buffer *view, char fort);
|
|
|
| |
| |
| |
|
|
| PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims,
|
| Py_ssize_t *shape,
|
| Py_ssize_t *strides,
|
| int itemsize,
|
| char fort);
|
|
|
| |
| |
| |
| |
|
|
| PyAPI_FUNC(int) PyBuffer_FillInfo(Py_buffer *view, PyObject *o, void *buf,
|
| Py_ssize_t len, int readonly,
|
| int flags);
|
|
|
|
|
| PyAPI_FUNC(void) PyBuffer_Release(Py_buffer *view);
|
|
|
|
|
| #define PyBUF_MAX_NDIM 64
|
|
|
|
|
| #define PyBUF_SIMPLE 0
|
| #define PyBUF_WRITABLE 0x0001
|
|
|
| #ifndef Py_LIMITED_API
|
|
|
| #define PyBUF_WRITEABLE PyBUF_WRITABLE
|
| #endif
|
|
|
| #define PyBUF_FORMAT 0x0004
|
| #define PyBUF_ND 0x0008
|
| #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
|
| #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
|
| #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
|
| #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
|
| #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
|
|
|
| #define PyBUF_CONTIG (PyBUF_ND | PyBUF_WRITABLE)
|
| #define PyBUF_CONTIG_RO (PyBUF_ND)
|
|
|
| #define PyBUF_STRIDED (PyBUF_STRIDES | PyBUF_WRITABLE)
|
| #define PyBUF_STRIDED_RO (PyBUF_STRIDES)
|
|
|
| #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_WRITABLE | PyBUF_FORMAT)
|
| #define PyBUF_RECORDS_RO (PyBUF_STRIDES | PyBUF_FORMAT)
|
|
|
| #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_WRITABLE | PyBUF_FORMAT)
|
| #define PyBUF_FULL_RO (PyBUF_INDIRECT | PyBUF_FORMAT)
|
|
|
|
|
| #define PyBUF_READ 0x100
|
| #define PyBUF_WRITE 0x200
|
|
|
| #endif
|
|
|
| #ifdef __cplusplus
|
| }
|
| #endif
|
| #endif
|
|
|