| 1 | use crate::object::*; |
| 2 | use crate::pyport::Py_ssize_t; |
| 3 | use std::os::raw::{c_char, c_int}; |
| 4 | use std::ptr::addr_of_mut; |
| 5 | |
| 6 | #[cfg_attr (windows, link(name = "pythonXY" ))] |
| 7 | unsafeextern "C" { |
| 8 | #[cfg (not(Py_LIMITED_API))] |
| 9 | pub static mut _PyManagedBuffer_Type: PyTypeObject; |
| 10 | |
| 11 | #[cfg_attr (PyPy, link_name = "PyPyMemoryView_Type" )] |
| 12 | pub unsafestatic mut PyMemoryView_Type: PyTypeObject; |
| 13 | } |
| 14 | |
| 15 | #[inline ] |
| 16 | pub unsafe fn PyMemoryView_Check(op: *mut PyObject) -> c_int { |
| 17 | (Py_TYPE(ob:op) == addr_of_mut!(PyMemoryView_Type)) as c_int |
| 18 | } |
| 19 | |
| 20 | // skipped non-limited PyMemoryView_GET_BUFFER |
| 21 | // skipped non-limited PyMemeryView_GET_BASE |
| 22 | |
| 23 | unsafeextern "C" { |
| 24 | #[cfg_attr (PyPy, link_name = "PyPyMemoryView_FromObject" )] |
| 25 | pub unsafefn PyMemoryView_FromObject(base: *mut PyObject) -> *mut PyObject; |
| 26 | #[cfg_attr (PyPy, link_name = "PyPyMemoryView_FromMemory" )] |
| 27 | pub unsafefn PyMemoryView_FromMemory( |
| 28 | mem: *mut c_char, |
| 29 | size: Py_ssize_t, |
| 30 | flags: c_int, |
| 31 | ) -> *mut PyObject; |
| 32 | #[cfg (any(Py_3_11, not(Py_LIMITED_API)))] |
| 33 | #[cfg_attr (PyPy, link_name = "PyPyMemoryView_FromBuffer" )] |
| 34 | pub fn PyMemoryView_FromBuffer(view: *const crate::Py_buffer) -> *mut PyObject; |
| 35 | #[cfg_attr (PyPy, link_name = "PyPyMemoryView_GetContiguous" )] |
| 36 | pub unsafefn PyMemoryView_GetContiguous( |
| 37 | base: *mut PyObject, |
| 38 | buffertype: c_int, |
| 39 | order: c_char, |
| 40 | ) -> *mut PyObject; |
| 41 | } |
| 42 | |
| 43 | // skipped remainder of file with comment: |
| 44 | /* The structs are declared here so that macros can work, but they shouldn't |
| 45 | be considered public. Don't access their fields directly, use the macros |
| 46 | and functions instead! */ |
| 47 | |