The OpenD Programming Language

mir.ndslice.connect.cpython

Utilities for Python Buffer Protocol.

Members

Aliases

Py_buffer
alias Py_buffer = bufferinfo

Python Buffer structure.

Enums

PythonBufferErrorCode
enum PythonBufferErrorCode

Error codes for ndslice - Py_buffer conversion.

Functions

fromPythonBuffer
PythonBufferErrorCode fromPythonBuffer(Slice!(T*, N, kind) slice, Py_buffer view)

Fills the slice (structure) from the python view. The view should be created by $(PGB) that was called with pythonBufferFlags.

toPythonBuffer
PythonBufferErrorCode toPythonBuffer(Slice!(T*, N, kind) slice, Py_buffer view, int flags, Structure!N structureBuffer)

Fills the python view (structure) from the slice.

Manifest constants

PyBuf_any_contiguous
enum PyBuf_any_contiguous;
PyBuf_c_contiguous
enum PyBuf_c_contiguous;
PyBuf_contig
enum PyBuf_contig;
PyBuf_contig_ro
enum PyBuf_contig_ro;
PyBuf_f_contiguous
enum PyBuf_f_contiguous;
PyBuf_format
enum PyBuf_format;
PyBuf_indirect
enum PyBuf_indirect;
PyBuf_max_ndim
enum PyBuf_max_ndim;
PyBuf_nd
enum PyBuf_nd;
PyBuf_records
enum PyBuf_records;
PyBuf_records_ro
enum PyBuf_records_ro;
PyBuf_simple
enum PyBuf_simple;
PyBuf_strided
enum PyBuf_strided;
PyBuf_strided_ro
enum PyBuf_strided_ro;
PyBuf_strides
enum PyBuf_strides;
PyBuf_writable
enum PyBuf_writable;
PyBuf_writeable
enum PyBuf_writeable;

Structs

bufferinfo
struct bufferinfo

Python Buffer structure.

Templates

pythonBufferFormat
template pythonBufferFormat(T)

Returns python format (type) string. For example, "O" for PyObject and "B" for ubyte.

Variables

pythonBufferFlags
enum int pythonBufferFlags(SliceKind kind, T);

Construct flags for $(PGB). If T is not const or immutable then the flags require writable buffer. If slice kind is Contiguous then the flags require c_contiguous buffer.

Meta

Authors

Ilia Ki