| Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 1 | #ifndef Py_CLASSOBJECT_H | 
 | 2 | #define Py_CLASSOBJECT_H | 
 | 3 | #ifdef __cplusplus | 
 | 4 | extern "C" { | 
 | 5 | #endif | 
 | 6 |  | 
| Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 7 | /*********************************************************** | 
| Guido van Rossum | 9bfef44 | 1993-03-29 10:43:31 +0000 | [diff] [blame] | 8 | Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, | 
 | 9 | Amsterdam, The Netherlands. | 
| Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 10 |  | 
 | 11 |                         All Rights Reserved | 
 | 12 |  | 
 | 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 not be used in advertising or publicity pertaining to | 
 | 19 | distribution of the software without specific, written prior permission. | 
 | 20 |  | 
 | 21 | STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO | 
 | 22 | THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | 
 | 23 | FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE | 
 | 24 | FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 
 | 25 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 
 | 26 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT | 
 | 27 | OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 
 | 28 |  | 
 | 29 | ******************************************************************/ | 
 | 30 |  | 
| Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 31 | /* Class object interface */ | 
 | 32 |  | 
| Guido van Rossum | b3f7258 | 1993-05-21 19:56:10 +0000 | [diff] [blame] | 33 | /* Revealing some structures (not for general use) */ | 
| Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 34 |  | 
| Guido van Rossum | 81daa32 | 1993-05-20 14:24:46 +0000 | [diff] [blame] | 35 | typedef 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 Rossum | b3f7258 | 1993-05-21 19:56:10 +0000 | [diff] [blame] | 42 | typedef struct { | 
 | 43 | 	OB_HEAD | 
 | 44 | 	classobject	*in_class;	/* The class object */ | 
 | 45 | 	object		*in_dict;	/* A dictionary */ | 
 | 46 | } instanceobject; | 
 | 47 |  | 
| Guido van Rossum | faf9c96 | 1991-05-05 20:04:55 +0000 | [diff] [blame] | 48 | extern typeobject Classtype, Instancetype, Instancemethodtype; | 
| Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 49 |  | 
 | 50 | #define is_classobject(op) ((op)->ob_type == &Classtype) | 
| Guido van Rossum | faf9c96 | 1991-05-05 20:04:55 +0000 | [diff] [blame] | 51 | #define is_instanceobject(op) ((op)->ob_type == &Instancetype) | 
 | 52 | #define is_instancemethodobject(op) ((op)->ob_type == &Instancemethodtype) | 
| Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 53 |  | 
| Guido van Rossum | 2b9d6e2 | 1991-10-20 20:12:10 +0000 | [diff] [blame] | 54 | extern object *newclassobject PROTO((object *, object *, object *)); | 
| Guido van Rossum | 2583165 | 1993-05-19 14:50:45 +0000 | [diff] [blame] | 55 | extern object *newinstanceobject PROTO((object *, object *)); | 
| Guido van Rossum | 81daa32 | 1993-05-20 14:24:46 +0000 | [diff] [blame] | 56 | extern object *newinstancemethodobject PROTO((object *, object *, object *)); | 
| Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 57 |  | 
| Guido van Rossum | faf9c96 | 1991-05-05 20:04:55 +0000 | [diff] [blame] | 58 | extern object *instancemethodgetfunc PROTO((object *)); | 
 | 59 | extern object *instancemethodgetself PROTO((object *)); | 
| Guido van Rossum | 81daa32 | 1993-05-20 14:24:46 +0000 | [diff] [blame] | 60 | extern object *instancemethodgetclass PROTO((object *)); | 
| Guido van Rossum | 04691fc | 1992-08-12 15:35:34 +0000 | [diff] [blame] | 61 |  | 
| Guido van Rossum | 81daa32 | 1993-05-20 14:24:46 +0000 | [diff] [blame] | 62 | extern int issubclass PROTO((object *, object *)); | 
| Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 63 |  | 
 | 64 | #ifdef __cplusplus | 
 | 65 | } | 
 | 66 | #endif | 
 | 67 | #endif /* !Py_CLASSOBJECT_H */ |