annotate DEPENDENCIES/mingw32/Python27/include/methodobject.h @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2a2c65a20a8b
children
rev   line source
Chris@87 1
Chris@87 2 /* Method object interface */
Chris@87 3
Chris@87 4 #ifndef Py_METHODOBJECT_H
Chris@87 5 #define Py_METHODOBJECT_H
Chris@87 6 #ifdef __cplusplus
Chris@87 7 extern "C" {
Chris@87 8 #endif
Chris@87 9
Chris@87 10 /* This is about the type 'builtin_function_or_method',
Chris@87 11 not Python methods in user-defined classes. See classobject.h
Chris@87 12 for the latter. */
Chris@87 13
Chris@87 14 PyAPI_DATA(PyTypeObject) PyCFunction_Type;
Chris@87 15
Chris@87 16 #define PyCFunction_Check(op) (Py_TYPE(op) == &PyCFunction_Type)
Chris@87 17
Chris@87 18 typedef PyObject *(*PyCFunction)(PyObject *, PyObject *);
Chris@87 19 typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *,
Chris@87 20 PyObject *);
Chris@87 21 typedef PyObject *(*PyNoArgsFunction)(PyObject *);
Chris@87 22
Chris@87 23 PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *);
Chris@87 24 PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *);
Chris@87 25 PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *);
Chris@87 26
Chris@87 27 /* Macros for direct access to these values. Type checks are *not*
Chris@87 28 done, so use with care. */
Chris@87 29 #define PyCFunction_GET_FUNCTION(func) \
Chris@87 30 (((PyCFunctionObject *)func) -> m_ml -> ml_meth)
Chris@87 31 #define PyCFunction_GET_SELF(func) \
Chris@87 32 (((PyCFunctionObject *)func) -> m_self)
Chris@87 33 #define PyCFunction_GET_FLAGS(func) \
Chris@87 34 (((PyCFunctionObject *)func) -> m_ml -> ml_flags)
Chris@87 35 PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *);
Chris@87 36
Chris@87 37 struct PyMethodDef {
Chris@87 38 const char *ml_name; /* The name of the built-in function/method */
Chris@87 39 PyCFunction ml_meth; /* The C function that implements it */
Chris@87 40 int ml_flags; /* Combination of METH_xxx flags, which mostly
Chris@87 41 describe the args expected by the C func */
Chris@87 42 const char *ml_doc; /* The __doc__ attribute, or NULL */
Chris@87 43 };
Chris@87 44 typedef struct PyMethodDef PyMethodDef;
Chris@87 45
Chris@87 46 PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, const char *);
Chris@87 47
Chris@87 48 #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
Chris@87 49 PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
Chris@87 50 PyObject *);
Chris@87 51
Chris@87 52 /* Flag passed to newmethodobject */
Chris@87 53 #define METH_OLDARGS 0x0000
Chris@87 54 #define METH_VARARGS 0x0001
Chris@87 55 #define METH_KEYWORDS 0x0002
Chris@87 56 /* METH_NOARGS and METH_O must not be combined with the flags above. */
Chris@87 57 #define METH_NOARGS 0x0004
Chris@87 58 #define METH_O 0x0008
Chris@87 59
Chris@87 60 /* METH_CLASS and METH_STATIC are a little different; these control
Chris@87 61 the construction of methods for a class. These cannot be used for
Chris@87 62 functions in modules. */
Chris@87 63 #define METH_CLASS 0x0010
Chris@87 64 #define METH_STATIC 0x0020
Chris@87 65
Chris@87 66 /* METH_COEXIST allows a method to be entered eventhough a slot has
Chris@87 67 already filled the entry. When defined, the flag allows a separate
Chris@87 68 method, "__contains__" for example, to coexist with a defined
Chris@87 69 slot like sq_contains. */
Chris@87 70
Chris@87 71 #define METH_COEXIST 0x0040
Chris@87 72
Chris@87 73 typedef struct PyMethodChain {
Chris@87 74 PyMethodDef *methods; /* Methods of this type */
Chris@87 75 struct PyMethodChain *link; /* NULL or base type */
Chris@87 76 } PyMethodChain;
Chris@87 77
Chris@87 78 PyAPI_FUNC(PyObject *) Py_FindMethodInChain(PyMethodChain *, PyObject *,
Chris@87 79 const char *);
Chris@87 80
Chris@87 81 typedef struct {
Chris@87 82 PyObject_HEAD
Chris@87 83 PyMethodDef *m_ml; /* Description of the C function to call */
Chris@87 84 PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */
Chris@87 85 PyObject *m_module; /* The __module__ attribute, can be anything */
Chris@87 86 } PyCFunctionObject;
Chris@87 87
Chris@87 88 PyAPI_FUNC(int) PyCFunction_ClearFreeList(void);
Chris@87 89
Chris@87 90 #ifdef __cplusplus
Chris@87 91 }
Chris@87 92 #endif
Chris@87 93 #endif /* !Py_METHODOBJECT_H */