home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Headers / objc / objc-runtime.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-03  |  2.5 KB  |  102 lines

  1. /*
  2.  *    objc-runtime.h
  3.  *    Copyright 1988-1996, NeXT Software, Inc.
  4.  */
  5.  
  6. #ifndef _OBJC_RUNTIME_H_
  7. #define _OBJC_RUNTIME_H_
  8.  
  9. #import <objc/objc.h>
  10. #import <objc/objc-class.h>
  11. #import <objc/hashtable2.h>
  12. #import <objc/Object.h>
  13.  
  14. typedef struct objc_symtab *Symtab;
  15.  
  16. struct objc_symtab {
  17.     unsigned long     sel_ref_cnt;
  18.     SEL         *refs;        
  19.     unsigned short     cls_def_cnt;
  20.     unsigned short     cat_def_cnt;
  21. #ifdef NeXT_PDO
  22.     arith_t        obj_defs;
  23.     arith_t        proto_defs;
  24. #endif
  25.     void          *defs[1];    /* variable size */
  26. };
  27.  
  28. typedef struct objc_module *Module;
  29.  
  30. struct objc_module {
  31.     unsigned long    version;
  32.     unsigned long    size;
  33.     const char    *name;
  34.     Symtab         symtab;    
  35. };
  36.  
  37. struct objc_super {
  38.     id receiver;
  39. #ifdef __cplusplus
  40.     Class theClass;
  41. #else
  42.     Class class;
  43. #endif
  44. };
  45.  
  46. /* kernel operations */
  47.  
  48. OBJC_EXPORT id objc_getClass(const char *name);
  49. OBJC_EXPORT id objc_getMetaClass(const char *name);
  50. OBJC_EXPORT id objc_msgSend(id self, SEL op, ...);
  51. OBJC_EXPORT id objc_msgSendSuper(struct objc_super *super, SEL op, ...);
  52.  
  53. /* forwarding operations */
  54.  
  55. OBJC_EXPORT id objc_msgSendv(id self, SEL op, unsigned arg_size, marg_list arg_frame);
  56.  
  57. /* 
  58.    iterating over all the classes in the application...
  59.   
  60.    NXHashTable *class_hash = objc_getClasses();
  61.    NXHashState state = NXInitHashState(class_hash);
  62.    Class class;
  63.   
  64.    while (NXNextHashState(class_hash, &state, &class)
  65.      ...;
  66.  */
  67. OBJC_EXPORT NXHashTable *objc_getClasses(void);
  68. OBJC_EXPORT Module *objc_getModules(void);
  69. OBJC_EXPORT id objc_lookUpClass(const char *name);
  70. OBJC_EXPORT void objc_addClass(Class myClass);
  71.  
  72. /* customizing the error handling for objc_getClass/objc_getMetaClass */
  73.  
  74. OBJC_EXPORT void objc_setClassHandler(int (*)(const char *));
  75.  
  76. /* Making the Objective-C runtime thread safe. */
  77. OBJC_EXPORT void objc_setMultithreaded (BOOL flag);
  78.  
  79. /* overriding the default object allocation and error handling routines */
  80.  
  81. OBJC_EXPORT id    (*_alloc)(Class, unsigned int);
  82. OBJC_EXPORT id    (*_copy)(Object *, unsigned int);
  83. OBJC_EXPORT id    (*_realloc)(Object *, unsigned int);
  84. OBJC_EXPORT id    (*_dealloc)(Object *);
  85. OBJC_EXPORT id    (*_zoneAlloc)(Class, unsigned int, NXZone *);
  86. OBJC_EXPORT id    (*_zoneRealloc)(Object *, unsigned int, NXZone *);
  87. OBJC_EXPORT id    (*_zoneCopy)(Object *, unsigned int, NXZone *);
  88.  
  89. #if defined(NeXT_PDO)
  90.     OBJC_EXPORT void   (*_error)();
  91. #else
  92.     OBJC_EXPORT void    (*_error)(Object *, const char *, va_list);
  93. #endif
  94.  
  95. #if defined(WIN32)
  96. /* This seems like a strange place to put this, but there's really
  97.    no very appropriate place! */
  98. OBJC_EXPORT const char* NSRootDirectory(void);
  99. #endif 
  100.  
  101. #endif /* _OBJC_RUNTIME_H_ */
  102.