blob: a244ef80d9c221608735f6f0ac1e5f785d942e73 [file] [log] [blame]
Guido van Rossuma3309961993-07-28 09:05:47 +00001#ifndef Py_CLASSOBJECT_H
2#define Py_CLASSOBJECT_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
Guido van Rossumf70e43a1991-02-19 12:39:46 +00007/***********************************************************
Guido van Rossum9bfef441993-03-29 10:43:31 +00008Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
9Amsterdam, The Netherlands.
Guido van Rossumf70e43a1991-02-19 12:39:46 +000010
11 All Rights Reserved
12
13Permission to use, copy, modify, and distribute this software and its
14documentation for any purpose and without fee is hereby granted,
15provided that the above copyright notice appear in all copies and that
16both that copyright notice and this permission notice appear in
17supporting documentation, and that the names of Stichting Mathematisch
18Centrum or CWI not be used in advertising or publicity pertaining to
19distribution of the software without specific, written prior permission.
20
21STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
22THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
23FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
24FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
25WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
26ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
27OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
28
29******************************************************************/
30
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000031/* Class object interface */
32
Guido van Rossumb3f72581993-05-21 19:56:10 +000033/* Revealing some structures (not for general use) */
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000034
Guido van Rossum81daa321993-05-20 14:24:46 +000035typedef struct {
36 OB_HEAD
37 object *cl_bases; /* A tuple of class objects */
38 object *cl_dict; /* A dictionary */
39 object *cl_name; /* A string */
40} classobject;
41
Guido van Rossumb3f72581993-05-21 19:56:10 +000042typedef struct {
43 OB_HEAD
44 classobject *in_class; /* The class object */
45 object *in_dict; /* A dictionary */
46} instanceobject;
47
Guido van Rossumfaf9c961991-05-05 20:04:55 +000048extern typeobject Classtype, Instancetype, Instancemethodtype;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000049
50#define is_classobject(op) ((op)->ob_type == &Classtype)
Guido van Rossumfaf9c961991-05-05 20:04:55 +000051#define is_instanceobject(op) ((op)->ob_type == &Instancetype)
52#define is_instancemethodobject(op) ((op)->ob_type == &Instancemethodtype)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000053
Guido van Rossum2b9d6e21991-10-20 20:12:10 +000054extern object *newclassobject PROTO((object *, object *, object *));
Guido van Rossum25831651993-05-19 14:50:45 +000055extern object *newinstanceobject PROTO((object *, object *));
Guido van Rossum81daa321993-05-20 14:24:46 +000056extern object *newinstancemethodobject PROTO((object *, object *, object *));
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000057
Guido van Rossumfaf9c961991-05-05 20:04:55 +000058extern object *instancemethodgetfunc PROTO((object *));
59extern object *instancemethodgetself PROTO((object *));
Guido van Rossum81daa321993-05-20 14:24:46 +000060extern object *instancemethodgetclass PROTO((object *));
Guido van Rossum04691fc1992-08-12 15:35:34 +000061
Guido van Rossum81daa321993-05-20 14:24:46 +000062extern int issubclass PROTO((object *, object *));
Guido van Rossuma3309961993-07-28 09:05:47 +000063
64#ifdef __cplusplus
65}
66#endif
67#endif /* !Py_CLASSOBJECT_H */