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