|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights ! 7: * Reserved. This file contains Original Code and/or Modifications of ! 8: * Original Code as defined in and that are subject to the Apple Public ! 9: * Source License Version 1.0 (the 'License'). You may not use this file ! 10: * except in compliance with the License. Please obtain a copy of the ! 11: * License at http://www.apple.com/publicsource and read it before using ! 12: * this file. ! 13: * ! 14: * The Original Code and all software distributed under the License are ! 15: * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 19: * License for the specific language governing rights and limitations ! 20: * under the License." ! 21: * ! 22: * @APPLE_LICENSE_HEADER_END@ ! 23: */ ! 24: /* ! 25: * objc-runtime.h ! 26: * Copyright 1988, NeXT, Inc. ! 27: */ ! 28: ! 29: #ifndef _OBJC_RUNTIME_H_ ! 30: #define _OBJC_RUNTIME_H_ ! 31: ! 32: #import "objc.h" ! 33: #import "objc-class.h" ! 34: #import "hashtable.h" ! 35: #import "Object.h" ! 36: ! 37: typedef struct objc_symtab *Symtab; ! 38: ! 39: struct objc_symtab { ! 40: unsigned long sel_ref_cnt; ! 41: SEL *refs; ! 42: unsigned short cls_def_cnt; ! 43: unsigned short cat_def_cnt; ! 44: void *defs[1]; /* variable size */ ! 45: }; ! 46: ! 47: typedef struct objc_module *Module; ! 48: ! 49: struct objc_module { ! 50: unsigned long version; ! 51: unsigned long size; ! 52: const char *name; ! 53: Symtab symtab; ! 54: }; ! 55: ! 56: struct objc_super { ! 57: id receiver; ! 58: Class class; ! 59: }; ! 60: ! 61: /* kernel operations */ ! 62: ! 63: extern id objc_getClass(const char *name); ! 64: extern id objc_getMetaClass(const char *name); ! 65: extern id objc_msgSend(id self, SEL op, ...); ! 66: extern id objc_msgSendSuper(struct objc_super *super, SEL op, ...); ! 67: ! 68: /* forwarding operations */ ! 69: ! 70: extern id objc_msgSendv(id self, SEL op, unsigned arg_size, marg_list arg_frame); ! 71: ! 72: /* ! 73: iterating over all the classes in the application... ! 74: ! 75: NXHashTable *class_hash = objc_getClasses(); ! 76: NXHashState state = NXInitHashState(class_hash); ! 77: Class class; ! 78: ! 79: while (NXNextHashState(class_hash, &state, &class) ! 80: ...; ! 81: */ ! 82: extern NXHashTable *objc_getClasses(); ! 83: extern Module *objc_getModules(); ! 84: extern id objc_lookUpClass(const char *name); ! 85: extern void objc_addClass(Class myClass); ! 86: ! 87: /* customizing the error handling for objc_getClass/objc_getMetaClass */ ! 88: ! 89: extern void objc_setClassHandler(int (*)(const char *)); ! 90: ! 91: /* Making the Objective-C runtime thread safe. */ ! 92: extern void objc_setMultithreaded (BOOL flag); ! 93: ! 94: /* overriding the default object allocation and error handling routines */ ! 95: ! 96: extern id (*_alloc)(Class, unsigned int); ! 97: extern id (*_copy)(Object *, unsigned int); ! 98: extern id (*_realloc)(Object *, unsigned int); ! 99: extern id (*_dealloc)(Object *); ! 100: extern id (*_zoneAlloc)(Class, unsigned int, NXZone *); ! 101: extern id (*_zoneRealloc)(Object *, unsigned int, NXZone *); ! 102: extern id (*_zoneCopy)(Object *, unsigned int, NXZone *); ! 103: extern void (*_error)(Object *, const char *, va_list); ! 104: ! 105: #endif /* _OBJC_RUNTIME_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.