annotate DEPENDENCIES/mingw32/Python27/include/memoryobject.h @ 118:770eb830ec19 emscripten

Typo fix
author Chris Cannam
date Wed, 18 May 2016 16:14:08 +0100
parents 2a2c65a20a8b
children
rev   line source
Chris@87 1 /* Memory view object. In Python this is available as "memoryview". */
Chris@87 2
Chris@87 3 #ifndef Py_MEMORYOBJECT_H
Chris@87 4 #define Py_MEMORYOBJECT_H
Chris@87 5 #ifdef __cplusplus
Chris@87 6 extern "C" {
Chris@87 7 #endif
Chris@87 8
Chris@87 9 PyAPI_DATA(PyTypeObject) PyMemoryView_Type;
Chris@87 10
Chris@87 11 #define PyMemoryView_Check(op) (Py_TYPE(op) == &PyMemoryView_Type)
Chris@87 12
Chris@87 13 /* Get a pointer to the underlying Py_buffer of a memoryview object. */
Chris@87 14 #define PyMemoryView_GET_BUFFER(op) (&((PyMemoryViewObject *)(op))->view)
Chris@87 15 /* Get a pointer to the PyObject from which originates a memoryview object. */
Chris@87 16 #define PyMemoryView_GET_BASE(op) (((PyMemoryViewObject *)(op))->view.obj)
Chris@87 17
Chris@87 18
Chris@87 19 PyAPI_FUNC(PyObject *) PyMemoryView_GetContiguous(PyObject *base,
Chris@87 20 int buffertype,
Chris@87 21 char fort);
Chris@87 22
Chris@87 23 /* Return a contiguous chunk of memory representing the buffer
Chris@87 24 from an object in a memory view object. If a copy is made then the
Chris@87 25 base object for the memory view will be a *new* bytes object.
Chris@87 26
Chris@87 27 Otherwise, the base-object will be the object itself and no
Chris@87 28 data-copying will be done.
Chris@87 29
Chris@87 30 The buffertype argument can be PyBUF_READ, PyBUF_WRITE,
Chris@87 31 PyBUF_SHADOW to determine whether the returned buffer
Chris@87 32 should be READONLY, WRITABLE, or set to update the
Chris@87 33 original buffer if a copy must be made. If buffertype is
Chris@87 34 PyBUF_WRITE and the buffer is not contiguous an error will
Chris@87 35 be raised. In this circumstance, the user can use
Chris@87 36 PyBUF_SHADOW to ensure that a a writable temporary
Chris@87 37 contiguous buffer is returned. The contents of this
Chris@87 38 contiguous buffer will be copied back into the original
Chris@87 39 object after the memoryview object is deleted as long as
Chris@87 40 the original object is writable and allows setting an
Chris@87 41 exclusive write lock. If this is not allowed by the
Chris@87 42 original object, then a BufferError is raised.
Chris@87 43
Chris@87 44 If the object is multi-dimensional and if fortran is 'F',
Chris@87 45 the first dimension of the underlying array will vary the
Chris@87 46 fastest in the buffer. If fortran is 'C', then the last
Chris@87 47 dimension will vary the fastest (C-style contiguous). If
Chris@87 48 fortran is 'A', then it does not matter and you will get
Chris@87 49 whatever the object decides is more efficient.
Chris@87 50
Chris@87 51 A new reference is returned that must be DECREF'd when finished.
Chris@87 52 */
Chris@87 53
Chris@87 54 PyAPI_FUNC(PyObject *) PyMemoryView_FromObject(PyObject *base);
Chris@87 55
Chris@87 56 PyAPI_FUNC(PyObject *) PyMemoryView_FromBuffer(Py_buffer *info);
Chris@87 57 /* create new if bufptr is NULL
Chris@87 58 will be a new bytesobject in base */
Chris@87 59
Chris@87 60
Chris@87 61 /* The struct is declared here so that macros can work, but it shouldn't
Chris@87 62 be considered public. Don't access those fields directly, use the macros
Chris@87 63 and functions instead! */
Chris@87 64 typedef struct {
Chris@87 65 PyObject_HEAD
Chris@87 66 PyObject *base;
Chris@87 67 Py_buffer view;
Chris@87 68 } PyMemoryViewObject;
Chris@87 69
Chris@87 70
Chris@87 71 #ifdef __cplusplus
Chris@87 72 }
Chris@87 73 #endif
Chris@87 74 #endif /* !Py_MEMORYOBJECT_H */