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 | 5799b52 | 1995-01-04 19:06:22 +0000 | [diff] [blame] | 8 | Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, |
| 9 | The Netherlands. |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 10 | |
| 11 | All Rights Reserved |
| 12 | |
Guido van Rossum | d266eb4 | 1996-10-25 14:44:06 +0000 | [diff] [blame^] | 13 | Permission to use, copy, modify, and distribute this software and its |
| 14 | documentation for any purpose and without fee is hereby granted, |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 15 | provided that the above copyright notice appear in all copies and that |
Guido van Rossum | d266eb4 | 1996-10-25 14:44:06 +0000 | [diff] [blame^] | 16 | both that copyright notice and this permission notice appear in |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 17 | supporting documentation, and that the names of Stichting Mathematisch |
Guido van Rossum | d266eb4 | 1996-10-25 14:44:06 +0000 | [diff] [blame^] | 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 |
| 21 | permission. |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 22 | |
Guido van Rossum | d266eb4 | 1996-10-25 14:44:06 +0000 | [diff] [blame^] | 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. |
| 26 | |
| 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. |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 35 | |
| 36 | ******************************************************************/ |
| 37 | |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 38 | /* Class object interface */ |
| 39 | |
Guido van Rossum | e149fa2 | 1994-08-12 12:49:46 +0000 | [diff] [blame] | 40 | #ifdef WITH_THREAD |
| 41 | #include "thread.h" |
| 42 | #else |
| 43 | #define get_thread_ident() 1L |
| 44 | #endif |
| 45 | |
Guido van Rossum | b3f7258 | 1993-05-21 19:56:10 +0000 | [diff] [blame] | 46 | /* Revealing some structures (not for general use) */ |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 47 | |
Guido van Rossum | 81daa32 | 1993-05-20 14:24:46 +0000 | [diff] [blame] | 48 | typedef struct { |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 49 | PyObject_HEAD |
| 50 | PyObject *cl_bases; /* A tuple of class objects */ |
| 51 | PyObject *cl_dict; /* A dictionary */ |
| 52 | PyObject *cl_name; /* A string */ |
Guido van Rossum | 03a9096 | 1994-09-06 09:48:43 +0000 | [diff] [blame] | 53 | /* The following three are functions or NULL */ |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 54 | PyObject *cl_getattr; |
| 55 | PyObject *cl_setattr; |
| 56 | PyObject *cl_delattr; |
| 57 | } PyClassObject; |
Guido van Rossum | 81daa32 | 1993-05-20 14:24:46 +0000 | [diff] [blame] | 58 | |
Guido van Rossum | b3f7258 | 1993-05-21 19:56:10 +0000 | [diff] [blame] | 59 | typedef struct { |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 60 | PyObject_HEAD |
| 61 | PyClassObject *in_class; /* The class object */ |
| 62 | PyObject *in_dict; /* A dictionary */ |
| 63 | } PyInstanceObject; |
Guido van Rossum | b3f7258 | 1993-05-21 19:56:10 +0000 | [diff] [blame] | 64 | |
Guido van Rossum | 051ab12 | 1995-02-27 10:17:52 +0000 | [diff] [blame] | 65 | extern DL_IMPORT(PyTypeObject) PyClass_Type, PyInstance_Type, PyMethod_Type; |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 66 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 67 | #define PyClass_Check(op) ((op)->ob_type == &PyClass_Type) |
| 68 | #define PyInstance_Check(op) ((op)->ob_type == &PyInstance_Type) |
| 69 | #define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type) |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 70 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 71 | extern PyObject *PyClass_New Py_PROTO((PyObject *, PyObject *, PyObject *)); |
Guido van Rossum | bebdc37 | 1995-07-26 17:58:29 +0000 | [diff] [blame] | 72 | extern PyObject *PyInstance_New Py_PROTO((PyObject *, PyObject *, PyObject *)); |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 73 | extern PyObject *PyMethod_New Py_PROTO((PyObject *, PyObject *, PyObject *)); |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 74 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 75 | extern PyObject *PyMethod_Function Py_PROTO((PyObject *)); |
| 76 | extern PyObject *PyMethod_Self Py_PROTO((PyObject *)); |
| 77 | extern PyObject *PyMethod_Class Py_PROTO((PyObject *)); |
Guido van Rossum | 04691fc | 1992-08-12 15:35:34 +0000 | [diff] [blame] | 78 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 79 | extern int PyClass_IsSubclass Py_PROTO((PyObject *, PyObject *)); |
Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 80 | |
Guido van Rossum | 855d0b3 | 1995-01-20 16:52:42 +0000 | [diff] [blame] | 81 | extern PyObject *PyInstance_DoBinOp |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 82 | Py_PROTO((PyObject *, PyObject *, |
| 83 | char *, char *, |
| 84 | PyObject * (*) Py_PROTO((PyObject *, PyObject *)) )); |
Guido van Rossum | c5d92e1 | 1994-09-28 15:44:39 +0000 | [diff] [blame] | 85 | |
Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 86 | #ifdef __cplusplus |
| 87 | } |
| 88 | #endif |
| 89 | #endif /* !Py_CLASSOBJECT_H */ |