pyforge_ffi/cpython/
descrobject.rs1use crate::{PyGetSetDef, PyMethodDef, PyObject, PyTypeObject};
2use std::ffi::{c_char, c_int, c_void};
3
4use crate::PyMemberDef;
5
6pub type wrapperfunc = Option<
7 unsafe extern "C" fn(
8 slf: *mut PyObject,
9 args: *mut PyObject,
10 wrapped: *mut c_void,
11 ) -> *mut PyObject,
12>;
13
14pub type wrapperfunc_kwds = Option<
15 unsafe extern "C" fn(
16 slf: *mut PyObject,
17 args: *mut PyObject,
18 wrapped: *mut c_void,
19 kwds: *mut PyObject,
20 ) -> *mut PyObject,
21>;
22
23#[repr(C)]
24pub struct wrapperbase {
25 pub name: *const c_char,
26 pub offset: c_int,
27 pub function: *mut c_void,
28 pub wrapper: wrapperfunc,
29 pub doc: *const c_char,
30 pub flags: c_int,
31 pub name_strobj: *mut PyObject,
32}
33
34pub const PyWrapperFlag_KEYWORDS: c_int = 1;
35
36#[repr(C)]
37pub struct PyDescrObject {
38 pub ob_base: PyObject,
39 pub d_type: *mut PyTypeObject,
40 pub d_name: *mut PyObject,
41 pub d_qualname: *mut PyObject,
42}
43
44#[repr(C)]
48pub struct PyMethodDescrObject {
49 pub d_common: PyDescrObject,
50 pub d_method: *mut PyMethodDef,
51 pub vectorcall: Option<crate::vectorcallfunc>,
52}
53
54#[repr(C)]
55pub struct PyMemberDescrObject {
56 pub d_common: PyDescrObject,
57 pub d_member: *mut PyMemberDef,
58}
59
60#[repr(C)]
61pub struct PyGetSetDescrObject {
62 pub d_common: PyDescrObject,
63 pub d_getset: *mut PyGetSetDef,
64}
65
66#[repr(C)]
67pub struct PyWrapperDescrObject {
68 pub d_common: PyDescrObject,
69 pub d_base: *mut wrapperbase,
70 pub d_wrapped: *mut c_void,
71}
72
73