| |
|
|
| #ifndef Py_MEMORYOBJECT_H |
| #define Py_MEMORYOBJECT_H |
| #ifdef __cplusplus |
| extern "C" { |
| #endif |
|
|
| #ifndef Py_LIMITED_API |
| PyAPI_DATA(PyTypeObject) _PyManagedBuffer_Type; |
| #endif |
| PyAPI_DATA(PyTypeObject) PyMemoryView_Type; |
|
|
| #define PyMemoryView_Check(op) Py_IS_TYPE(op, &PyMemoryView_Type) |
|
|
| #ifndef Py_LIMITED_API |
| |
| #define PyMemoryView_GET_BUFFER(op) (&((PyMemoryViewObject *)(op))->view) |
| |
| #define PyMemoryView_GET_BASE(op) (((PyMemoryViewObject *)(op))->view.obj) |
| #endif |
|
|
| PyAPI_FUNC(PyObject *) PyMemoryView_FromObject(PyObject *base); |
| #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 |
| PyAPI_FUNC(PyObject *) PyMemoryView_FromMemory(char *mem, Py_ssize_t size, |
| int flags); |
| #endif |
| #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030b0000 |
| PyAPI_FUNC(PyObject *) PyMemoryView_FromBuffer(const Py_buffer *info); |
| #endif |
| PyAPI_FUNC(PyObject *) PyMemoryView_GetContiguous(PyObject *base, |
| int buffertype, |
| char order); |
|
|
|
|
| |
| |
| |
| #ifndef Py_LIMITED_API |
| #define _Py_MANAGED_BUFFER_RELEASED 0x001 |
| #define _Py_MANAGED_BUFFER_FREE_FORMAT 0x002 |
| typedef struct { |
| PyObject_HEAD |
| int flags; |
| Py_ssize_t exports; |
| Py_buffer master; |
| } _PyManagedBufferObject; |
|
|
|
|
| |
| #define _Py_MEMORYVIEW_RELEASED 0x001 |
| #define _Py_MEMORYVIEW_C 0x002 |
| #define _Py_MEMORYVIEW_FORTRAN 0x004 |
| #define _Py_MEMORYVIEW_SCALAR 0x008 |
| #define _Py_MEMORYVIEW_PIL 0x010 |
|
|
| typedef struct { |
| PyObject_VAR_HEAD |
| _PyManagedBufferObject *mbuf; |
| Py_hash_t hash; |
| int flags; |
| Py_ssize_t exports; |
| Py_buffer view; |
| PyObject *weakreflist; |
| Py_ssize_t ob_array[1]; |
| } PyMemoryViewObject; |
| #endif |
|
|
| #ifdef __cplusplus |
| } |
| #endif |
| #endif |
|
|