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