| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#ifndef Py_METHODOBJECT_H |
| 5 |
#define Py_METHODOBJECT_H |
| 6 |
#ifdef __cplusplus |
| 7 |
extern "C" { |
| 8 |
#endif |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
PyAPI_DATA(PyTypeObject) PyCFunction_Type; |
| 15 |
|
| 16 |
#define PyCFunction_Check(op) (Py_TYPE(op) == &PyCFunction_Type) |
| 17 |
|
| 18 |
typedef PyObject *(*PyCFunction)(PyObject *, PyObject *); |
| 19 |
typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *, |
| 20 |
PyObject *); |
| 21 |
typedef PyObject *(*PyNoArgsFunction)(PyObject *); |
| 22 |
|
| 23 |
PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *); |
| 24 |
PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *); |
| 25 |
PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *); |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
#define PyCFunction_GET_FUNCTION(func) \ |
| 30 |
(((PyCFunctionObject *)func) -> m_ml -> ml_meth) |
| 31 |
#define PyCFunction_GET_SELF(func) \ |
| 32 |
(((PyCFunctionObject *)func) -> m_self) |
| 33 |
#define PyCFunction_GET_FLAGS(func) \ |
| 34 |
(((PyCFunctionObject *)func) -> m_ml -> ml_flags) |
| 35 |
PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *); |
| 36 |
|
| 37 |
struct PyMethodDef { |
| 38 |
const char *ml_name; |
| 39 |
PyCFunction ml_meth; |
| 40 |
int ml_flags; |
| 41 |
|
| 42 |
const char *ml_doc; |
| 43 |
}; |
| 44 |
typedef struct PyMethodDef PyMethodDef; |
| 45 |
|
| 46 |
PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, const char *); |
| 47 |
|
| 48 |
#define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL) |
| 49 |
PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *, |
| 50 |
PyObject *); |
| 51 |
|
| 52 |
|
| 53 |
#define METH_OLDARGS 0x0000 |
| 54 |
#define METH_VARARGS 0x0001 |
| 55 |
#define METH_KEYWORDS 0x0002 |
| 56 |
|
| 57 |
#define METH_NOARGS 0x0004 |
| 58 |
#define METH_O 0x0008 |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
#define METH_CLASS 0x0010 |
| 64 |
#define METH_STATIC 0x0020 |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
#define METH_COEXIST 0x0040 |
| 72 |
|
| 73 |
typedef struct PyMethodChain { |
| 74 |
PyMethodDef *methods; |
| 75 |
struct PyMethodChain *link; |
| 76 |
} PyMethodChain; |
| 77 |
|
| 78 |
PyAPI_FUNC(PyObject *) Py_FindMethodInChain(PyMethodChain *, PyObject *, |
| 79 |
const char *); |
| 80 |
|
| 81 |
typedef struct { |
| 82 |
PyObject_HEAD |
| 83 |
PyMethodDef *m_ml; |
| 84 |
PyObject *m_self; |
| 85 |
PyObject *m_module; |
| 86 |
} PyCFunctionObject; |
| 87 |
|
| 88 |
PyAPI_FUNC(int) PyCFunction_ClearFreeList(void); |
| 89 |
|
| 90 |
#ifdef __cplusplus |
| 91 |
} |
| 92 |
#endif |
| 93 |
#endif |