| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
#ifndef Py_CLASSOBJECT_H |
| 7 |
#define Py_CLASSOBJECT_H |
| 8 |
#ifdef __cplusplus |
| 9 |
extern "C" { |
| 10 |
#endif |
| 11 |
|
| 12 |
typedef struct { |
| 13 |
PyObject_HEAD |
| 14 |
PyObject *cl_bases; |
| 15 |
PyObject *cl_dict; |
| 16 |
PyObject *cl_name; |
| 17 |
|
| 18 |
PyObject *cl_getattr; |
| 19 |
PyObject *cl_setattr; |
| 20 |
PyObject *cl_delattr; |
| 21 |
PyObject *cl_weakreflist; |
| 22 |
} PyClassObject; |
| 23 |
|
| 24 |
typedef struct { |
| 25 |
PyObject_HEAD |
| 26 |
PyClassObject *in_class; |
| 27 |
PyObject *in_dict; |
| 28 |
PyObject *in_weakreflist; |
| 29 |
} PyInstanceObject; |
| 30 |
|
| 31 |
typedef struct { |
| 32 |
PyObject_HEAD |
| 33 |
PyObject *im_func; |
| 34 |
PyObject *im_self; |
| 35 |
PyObject *im_class; |
| 36 |
PyObject *im_weakreflist; |
| 37 |
} PyMethodObject; |
| 38 |
|
| 39 |
PyAPI_DATA(PyTypeObject) PyClass_Type, PyInstance_Type, PyMethod_Type; |
| 40 |
|
| 41 |
#define PyClass_Check(op) ((op)->ob_type == &PyClass_Type) |
| 42 |
#define PyInstance_Check(op) ((op)->ob_type == &PyInstance_Type) |
| 43 |
#define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type) |
| 44 |
|
| 45 |
PyAPI_FUNC(PyObject *) PyClass_New(PyObject *, PyObject *, PyObject *); |
| 46 |
PyAPI_FUNC(PyObject *) PyInstance_New(PyObject *, PyObject *, |
| 47 |
PyObject *); |
| 48 |
PyAPI_FUNC(PyObject *) PyInstance_NewRaw(PyObject *, PyObject *); |
| 49 |
PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *); |
| 50 |
|
| 51 |
PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *); |
| 52 |
PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *); |
| 53 |
PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *); |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name); |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
#define PyMethod_GET_FUNCTION(meth) \ |
| 70 |
(((PyMethodObject *)meth) -> im_func) |
| 71 |
#define PyMethod_GET_SELF(meth) \ |
| 72 |
(((PyMethodObject *)meth) -> im_self) |
| 73 |
#define PyMethod_GET_CLASS(meth) \ |
| 74 |
(((PyMethodObject *)meth) -> im_class) |
| 75 |
|
| 76 |
PyAPI_FUNC(int) PyClass_IsSubclass(PyObject *, PyObject *); |
| 77 |
|
| 78 |
PyAPI_FUNC(int) PyMethod_ClearFreeList(void); |
| 79 |
|
| 80 |
#ifdef __cplusplus |
| 81 |
} |
| 82 |
#endif |
| 83 |
#endif |