1 /**
2   Mirror _memoryobject.h
3   */
4 module deimos.python.memoryobject;
5 
6 import deimos.python.pyport;
7 import deimos.python.object;
8 
9 extern(C):
10 // Python-header-file: Include/memoryobject.h:
11 version(Python_2_7_Or_Later) {
12     /// Availability: >= 2.7
13     mixin(PyAPI_DATA!"PyTypeObject PyMemoryView_Type");
14 
15     /// Availability: >= 2.7
16     int PyMemoryView_Check()(PyObject* op) {
17         return Py_TYPE(op) == &PyMemoryView_Type;
18     }
19 
20     /// Availability: >= 2.7
21     auto PyMemoryView_GET_BUFFER()(PyObject* op) {
22         return &(cast(PyMemoryViewObject*)op).view;
23     }
24 
25     /// Availability: >= 2.7
26     auto PyMemoryView_GET_BASE()(PyObject* op) {
27         return (cast(PyMemoryViewObject*) op).view.obj;
28     }
29 
30     /// Availability: >= 2.7
31     PyObject* PyMemoryView_GetContiguous(PyObject* base,
32             int buffertype, char fort);
33 
34     /// Availability: >= 2.7
35     PyObject* PyMemoryView_FromObject(PyObject* base);
36 
37     /// Availability: >= 2.7
38     PyObject* PyMemoryView_FromBuffer(Py_buffer* info);
39 
40     /// subclass of PyObject
41     /// Availability: >= 2.7
42     struct PyMemoryViewObject {
43         mixin PyObject_HEAD;
44         version(Python_3_0_Or_Later) {
45         }else{
46             /// Availability: 2.7
47             PyObject* base;
48         }
49         /// _
50         Py_buffer view;
51     }
52 
53 }