home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Python 1.1 / Include / classobject.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-28  |  2.7 KB  |  80 lines  |  [TEXT/KAHL]

  1. #ifndef Py_CLASSOBJECT_H
  2. #define Py_CLASSOBJECT_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6.  
  7. /***********************************************************
  8. Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
  9. Amsterdam, The Netherlands.
  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.  
  31. /* Class object interface */
  32.  
  33. #ifdef WITH_THREAD
  34. #include "thread.h"
  35. #else
  36. #define get_thread_ident() 1L
  37. #endif
  38.  
  39. /* Revealing some structures (not for general use) */
  40.  
  41. typedef struct {
  42.     OB_HEAD
  43.     object    *cl_bases;    /* A tuple of class objects */
  44.     object    *cl_dict;    /* A dictionary */
  45.     object    *cl_name;    /* A string */
  46.     /* The following three are functions or NULL */
  47.     object    *cl_getattr;
  48.     object    *cl_setattr;
  49.     object    *cl_delattr;
  50. } classobject;
  51.  
  52. typedef struct {
  53.     OB_HEAD
  54.     classobject    *in_class;    /* The class object */
  55.     object        *in_dict;    /* A dictionary */
  56. } instanceobject;
  57.  
  58. extern DL_IMPORT typeobject Classtype, Instancetype, Instancemethodtype;
  59.  
  60. #define is_classobject(op) ((op)->ob_type == &Classtype)
  61. #define is_instanceobject(op) ((op)->ob_type == &Instancetype)
  62. #define is_instancemethodobject(op) ((op)->ob_type == &Instancemethodtype)
  63.  
  64. extern object *newclassobject PROTO((object *, object *, object *));
  65. extern object *newinstanceobject PROTO((object *, object *));
  66. extern object *newinstancemethodobject PROTO((object *, object *, object *));
  67.  
  68. extern object *instancemethodgetfunc PROTO((object *));
  69. extern object *instancemethodgetself PROTO((object *));
  70. extern object *instancemethodgetclass PROTO((object *));
  71.  
  72. extern int issubclass PROTO((object *, object *));
  73.  
  74. extern object *instancebinop PROTO((object *, object *, char *, char *));
  75.  
  76. #ifdef __cplusplus
  77. }
  78. #endif
  79. #endif /* !Py_CLASSOBJECT_H */
  80.