vidya7732/AI_Doctor_LLM_GenModel
0
1/* Memory view object. In Python this is available as "memoryview". */2 3#ifndef Py_MEMORYOBJECT_H4#define Py_MEMORYOBJECT_H5#ifdef __cplusplus6extern "C" {7#endif8 9#ifndef Py_LIMITED_API10PyAPI_DATA(PyTypeObject) _PyManagedBuffer_Type;11#endif12PyAPI_DATA(PyTypeObject) PyMemoryView_Type;13 14#define PyMemoryView_Check(op) Py_IS_TYPE(op, &PyMemoryView_Type)15 16#ifndef Py_LIMITED_API17/* Get a pointer to the memoryview's private copy of the exporter's buffer. */18#define PyMemoryView_GET_BUFFER(op) (&((PyMemoryViewObject *)(op))->view)19/* Get a pointer to the exporting object (this may be NULL!). */20#define PyMemoryView_GET_BASE(op) (((PyMemoryViewObject *)(op))->view.obj)21#endif22 23PyAPI_FUNC(PyObject *) PyMemoryView_FromObject(PyObject *base);24#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x0303000025PyAPI_FUNC(PyObject *) PyMemoryView_FromMemory(char *mem, Py_ssize_t size,26 int flags);27#endif28#ifndef Py_LIMITED_API29PyAPI_FUNC(PyObject *) PyMemoryView_FromBuffer(Py_buffer *info);30#endif31PyAPI_FUNC(PyObject *) PyMemoryView_GetContiguous(PyObject *base,32 int buffertype,33 char order);34 35 36/* The structs are declared here so that macros can work, but they shouldn't37 be considered public. Don't access their fields directly, use the macros38 and functions instead! */39#ifndef Py_LIMITED_API40#define _Py_MANAGED_BUFFER_RELEASED 0x001 /* access to exporter blocked */41#define _Py_MANAGED_BUFFER_FREE_FORMAT 0x002 /* free format */42typedef struct {43 PyObject_HEAD44 int flags; /* state flags */45 Py_ssize_t exports; /* number of direct memoryview exports */46 Py_buffer master; /* snapshot buffer obtained from the original exporter */47} _PyManagedBufferObject;48 49 50/* memoryview state flags */51#define _Py_MEMORYVIEW_RELEASED 0x001 /* access to master buffer blocked */52#define _Py_MEMORYVIEW_C 0x002 /* C-contiguous layout */53#define _Py_MEMORYVIEW_FORTRAN 0x004 /* Fortran contiguous layout */54#define _Py_MEMORYVIEW_SCALAR 0x008 /* scalar: ndim = 0 */55#define _Py_MEMORYVIEW_PIL 0x010 /* PIL-style layout */56 57typedef struct {58 PyObject_VAR_HEAD59 _PyManagedBufferObject *mbuf; /* managed buffer */60 Py_hash_t hash; /* hash value for read-only views */61 int flags; /* state flags */62 Py_ssize_t exports; /* number of buffer re-exports */63 Py_buffer view; /* private copy of the exporter's view */64 PyObject *weakreflist;65 Py_ssize_t ob_array[1]; /* shape, strides, suboffsets */66} PyMemoryViewObject;67#endif68 69#ifdef __cplusplus70}71#endif72#endif /* !Py_MEMORYOBJECT_H */73 