1 #ifndef Py_CLASSOBJECT_H
2 #define Py_CLASSOBJECT_H
7 /***********************************************************
8 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
13 Permission to use, copy, modify, and distribute this software and its
14 documentation for any purpose and without fee is hereby granted,
15 provided that the above copyright notice appear in all copies and that
16 both that copyright notice and this permission notice appear in
17 supporting documentation, and that the names of Stichting Mathematisch
18 Centrum or CWI or Corporation for National Research Initiatives or
19 CNRI not be used in advertising or publicity pertaining to
20 distribution of the software without specific, written prior
23 While CWI is the initial source for this software, a modified version
24 is made available by the Corporation for National Research Initiatives
25 (CNRI) at the Internet address ftp://ftp.python.org.
27 STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
28 REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
29 MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
30 CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
31 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
32 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
33 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
34 PERFORMANCE OF THIS SOFTWARE.
36 ******************************************************************/
38 /* Class object interface */
40 /* Revealing some structures (not for general use) */
44 PyObject
*cl_bases
; /* A tuple of class objects */
45 PyObject
*cl_dict
; /* A dictionary */
46 PyObject
*cl_name
; /* A string */
47 /* The following three are functions or NULL */
55 PyClassObject
*in_class
; /* The class object */
56 PyObject
*in_dict
; /* A dictionary */
61 PyObject
*im_func
; /* The callable object implementing the method */
62 PyObject
*im_self
; /* The instance it is bound to, or NULL */
63 PyObject
*im_class
; /* The class that defined the method */
66 extern DL_IMPORT(PyTypeObject
) PyClass_Type
, PyInstance_Type
, PyMethod_Type
;
68 #define PyClass_Check(op) ((op)->ob_type == &PyClass_Type)
69 #define PyInstance_Check(op) ((op)->ob_type == &PyInstance_Type)
70 #define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type)
72 extern PyObject
*PyClass_New
Py_PROTO((PyObject
*, PyObject
*, PyObject
*));
73 extern PyObject
*PyInstance_New
Py_PROTO((PyObject
*, PyObject
*, PyObject
*));
74 extern PyObject
*PyMethod_New
Py_PROTO((PyObject
*, PyObject
*, PyObject
*));
76 extern PyObject
*PyMethod_Function
Py_PROTO((PyObject
*));
77 extern PyObject
*PyMethod_Self
Py_PROTO((PyObject
*));
78 extern PyObject
*PyMethod_Class
Py_PROTO((PyObject
*));
80 /* Macros for direct access to these values. Type checks are *not*
81 done, so use with care. */
82 #define PyMethod_GET_FUNCTION(meth) \
83 (((PyMethodObject *)meth) -> im_func)
84 #define PyMethod_GET_SELF(meth) \
85 (((PyMethodObject *)meth) -> im_self)
86 #define PyMethod_GET_CLASS(meth) \
87 (((PyMethodObject *)meth) -> im_class)
89 extern int PyClass_IsSubclass
Py_PROTO((PyObject
*, PyObject
*));
91 extern PyObject
*PyInstance_DoBinOp
92 Py_PROTO((PyObject
*, PyObject
*,
94 PyObject
* (*) Py_PROTO((PyObject
*, PyObject
*)) ));
99 #endif /* !Py_CLASSOBJECT_H */