jpayne@69: /* Descriptors */ jpayne@69: #ifndef Py_DESCROBJECT_H jpayne@69: #define Py_DESCROBJECT_H jpayne@69: #ifdef __cplusplus jpayne@69: extern "C" { jpayne@69: #endif jpayne@69: jpayne@69: typedef PyObject *(*getter)(PyObject *, void *); jpayne@69: typedef int (*setter)(PyObject *, PyObject *, void *); jpayne@69: jpayne@69: typedef struct PyGetSetDef { jpayne@69: const char *name; jpayne@69: getter get; jpayne@69: setter set; jpayne@69: const char *doc; jpayne@69: void *closure; jpayne@69: } PyGetSetDef; jpayne@69: jpayne@69: #ifndef Py_LIMITED_API jpayne@69: typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args, jpayne@69: void *wrapped); jpayne@69: jpayne@69: typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args, jpayne@69: void *wrapped, PyObject *kwds); jpayne@69: jpayne@69: struct wrapperbase { jpayne@69: const char *name; jpayne@69: int offset; jpayne@69: void *function; jpayne@69: wrapperfunc wrapper; jpayne@69: const char *doc; jpayne@69: int flags; jpayne@69: PyObject *name_strobj; jpayne@69: }; jpayne@69: jpayne@69: /* Flags for above struct */ jpayne@69: #define PyWrapperFlag_KEYWORDS 1 /* wrapper function takes keyword args */ jpayne@69: jpayne@69: /* Various kinds of descriptor objects */ jpayne@69: jpayne@69: typedef struct { jpayne@69: PyObject_HEAD jpayne@69: PyTypeObject *d_type; jpayne@69: PyObject *d_name; jpayne@69: PyObject *d_qualname; jpayne@69: } PyDescrObject; jpayne@69: jpayne@69: #define PyDescr_COMMON PyDescrObject d_common jpayne@69: jpayne@69: #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) jpayne@69: #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) jpayne@69: jpayne@69: typedef struct { jpayne@69: PyDescr_COMMON; jpayne@69: PyMethodDef *d_method; jpayne@69: vectorcallfunc vectorcall; jpayne@69: } PyMethodDescrObject; jpayne@69: jpayne@69: typedef struct { jpayne@69: PyDescr_COMMON; jpayne@69: struct PyMemberDef *d_member; jpayne@69: } PyMemberDescrObject; jpayne@69: jpayne@69: typedef struct { jpayne@69: PyDescr_COMMON; jpayne@69: PyGetSetDef *d_getset; jpayne@69: } PyGetSetDescrObject; jpayne@69: jpayne@69: typedef struct { jpayne@69: PyDescr_COMMON; jpayne@69: struct wrapperbase *d_base; jpayne@69: void *d_wrapped; /* This can be any function pointer */ jpayne@69: } PyWrapperDescrObject; jpayne@69: #endif /* Py_LIMITED_API */ jpayne@69: jpayne@69: PyAPI_DATA(PyTypeObject) PyClassMethodDescr_Type; jpayne@69: PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type; jpayne@69: PyAPI_DATA(PyTypeObject) PyMemberDescr_Type; jpayne@69: PyAPI_DATA(PyTypeObject) PyMethodDescr_Type; jpayne@69: PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type; jpayne@69: PyAPI_DATA(PyTypeObject) PyDictProxy_Type; jpayne@69: #ifndef Py_LIMITED_API jpayne@69: PyAPI_DATA(PyTypeObject) _PyMethodWrapper_Type; jpayne@69: #endif /* Py_LIMITED_API */ jpayne@69: jpayne@69: PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *); jpayne@69: PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *); jpayne@69: struct PyMemberDef; /* forward declaration for following prototype */ jpayne@69: PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *, jpayne@69: struct PyMemberDef *); jpayne@69: PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *, jpayne@69: struct PyGetSetDef *); jpayne@69: #ifndef Py_LIMITED_API jpayne@69: PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *, jpayne@69: struct wrapperbase *, void *); jpayne@69: #define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL) jpayne@69: #endif jpayne@69: jpayne@69: PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *); jpayne@69: PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *); jpayne@69: jpayne@69: jpayne@69: PyAPI_DATA(PyTypeObject) PyProperty_Type; jpayne@69: #ifdef __cplusplus jpayne@69: } jpayne@69: #endif jpayne@69: #endif /* !Py_DESCROBJECT_H */ jpayne@69: