Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / include / python2.4 / classobject.h
CommitLineData
86530b38
AT
1#ifndef Py_CLASSOBJECT_H
2#define Py_CLASSOBJECT_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7typedef struct {
8 PyObject_HEAD
9 PyObject *cl_bases; /* A tuple of class objects */
10 PyObject *cl_dict; /* A dictionary */
11 PyObject *cl_name; /* A string */
12 /* The following three are functions or NULL */
13 PyObject *cl_getattr;
14 PyObject *cl_setattr;
15 PyObject *cl_delattr;
16} PyClassObject;
17
18typedef struct {
19 PyObject_HEAD
20 PyClassObject *in_class; /* The class object */
21 PyObject *in_dict; /* A dictionary */
22 PyObject *in_weakreflist; /* List of weak references */
23} PyInstanceObject;
24
25typedef struct {
26 PyObject_HEAD
27 PyObject *im_func; /* The callable object implementing the method */
28 PyObject *im_self; /* The instance it is bound to, or NULL */
29 PyObject *im_class; /* The class that asked for the method */
30 PyObject *im_weakreflist; /* List of weak references */
31} PyMethodObject;
32
33PyAPI_DATA(PyTypeObject) PyClass_Type, PyInstance_Type, PyMethod_Type;
34
35#define PyClass_Check(op) ((op)->ob_type == &PyClass_Type)
36#define PyInstance_Check(op) ((op)->ob_type == &PyInstance_Type)
37#define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type)
38
39PyAPI_FUNC(PyObject *) PyClass_New(PyObject *, PyObject *, PyObject *);
40PyAPI_FUNC(PyObject *) PyInstance_New(PyObject *, PyObject *,
41 PyObject *);
42PyAPI_FUNC(PyObject *) PyInstance_NewRaw(PyObject *, PyObject *);
43PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *);
44
45PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *);
46PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);
47PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *);
48
49/* Look up attribute with name (a string) on instance object pinst, using
50 * only the instance and base class dicts. If a descriptor is found in
51 * a class dict, the descriptor is returned without calling it.
52 * Returns NULL if nothing found, else a borrowed reference to the
53 * value associated with name in the dict in which name was found.
54 * The point of this routine is that it never calls arbitrary Python
55 * code, so is always "safe": all it does is dict lookups. The function
56 * can't fail, never sets an exception, and NULL is not an error (it just
57 * means "not found").
58 */
59PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name);
60
61/* Macros for direct access to these values. Type checks are *not*
62 done, so use with care. */
63#define PyMethod_GET_FUNCTION(meth) \
64 (((PyMethodObject *)meth) -> im_func)
65#define PyMethod_GET_SELF(meth) \
66 (((PyMethodObject *)meth) -> im_self)
67#define PyMethod_GET_CLASS(meth) \
68 (((PyMethodObject *)meth) -> im_class)
69
70PyAPI_FUNC(int) PyClass_IsSubclass(PyObject *, PyObject *);
71
72
73#ifdef __cplusplus
74}
75#endif
76#endif /* !Py_CLASSOBJECT_H */