📄 objc-api.h
字号:
#define _CLS_INITIALIZED 0x04L#define CLS_ISINITIALIZED(cls) __CLS_ISINFO(cls, _CLS_INITIALIZED)#define CLS_SETINITIALIZED(cls) __CLS_SETINFO(cls, _CLS_INITIALIZED)/*** The class number of this class. This must be the same for both the ** class and its meta class object*/#define CLS_GETNUMBER(cls) (__CLS_INFO(cls) >> (HOST_BITS_PER_LONG/2))#define CLS_SETNUMBER(cls, num) \ ({ (cls)->info <<= (HOST_BITS_PER_LONG/2); \ (cls)->info >>= (HOST_BITS_PER_LONG/2); \ __CLS_SETINFO(cls, (((unsigned long)num) << (HOST_BITS_PER_LONG/2))); })/*** The compiler generates one of these structures for each category. A class** may have many categories and contain both instance and factory methods. */typedef struct objc_category { const char* category_name; /* Name of the category. Name contained in the () of the category definition. */ const char* class_name; /* Name of the class to which the category belongs. */ MethodList_t instance_methods; /* Linked list of instance methods defined in the category. NULL indicates no instance methods defined. */ MethodList_t class_methods; /* Linked list of factory methods defined in the category. NULL indicates no class methods defined. */ struct objc_protocol_list *protocols; /* List of Protocols conformed to */} Category, *Category_t;/*** Structure used when a message is send to a class's super class. The** compiler generates one of these structures and passes it to** objc_msg_super.*/typedef struct objc_super { id self; /* Id of the object sending the message. */ Class class; /* Object's super class. */} Super, *Super_t;IMP objc_msg_lookup_super(Super_t super, SEL sel);retval_t objc_msg_sendv(id, SEL, arglist_t);/*** This is a hook which is called by objc_lookup_class and** objc_get_class if the runtime is not able to find the class.** This may e.g. try to load in the class using dynamic loading.** The function is guaranteed to be passed a non-NULL name string.*/extern Class (*_objc_lookup_class)(const char *name);/*** This is a hook which is called by __objc_exec_class every time a class** or a category is loaded into the runtime. This may e.g. help a** dynamic loader determine the classes that have been loaded when** an object file is dynamically linked in.*/extern void (*_objc_load_callback)(Class class, Category* category);/*** Hook functions for allocating, copying and disposing of instances*/extern id (*_objc_object_alloc)(Class class);extern id (*_objc_object_copy)(id object);extern id (*_objc_object_dispose)(id object);/*** Standard functions for memory allocation and disposal.** Users should use these functions in their ObjC programs so** that they work properly with garbage collectors as well as** can take advantage of the exception/error handling available.*/void *objc_malloc(size_t size);void *objc_atomic_malloc(size_t size);void *objc_valloc(size_t size);void *objc_realloc(void *mem, size_t size);void *objc_calloc(size_t nelem, size_t size);voidobjc_free(void *mem);/*** Hook functions for memory allocation and disposal.** This makes it easy to substitute garbage collection systems** such as Boehm's GC by assigning these function pointers** to the GC's allocation routines. By default these point** to the ANSI standard malloc, realloc, free, etc.**** Users should call the normal objc routines above for** memory allocation and disposal within their programs.*/extern void *(*_objc_malloc)(size_t);extern void *(*_objc_atomic_malloc)(size_t);extern void *(*_objc_valloc)(size_t);extern void *(*_objc_realloc)(void *, size_t);extern void *(*_objc_calloc)(size_t, size_t);extern void (*_objc_free)(void *);Method_t class_get_class_method(MetaClass class, SEL aSel);Method_t class_get_instance_method(Class class, SEL aSel);Class class_pose_as(Class impostor, Class superclass);Class objc_get_class(const char *name);Class objc_lookup_class(const char *name);Class objc_next_class(void **enum_state);const char *sel_get_name(SEL selector);const char *sel_get_type(SEL selector);SEL sel_get_uid(const char *name);SEL sel_get_any_uid(const char *name);SEL sel_get_any_typed_uid(const char *name);SEL sel_get_typed_uid(const char *name, const char*);SEL sel_register_name(const char *name);SEL sel_register_typed_name(const char *name, const char*type);BOOL sel_is_mapped (SEL aSel);extern id class_create_instance(Class class);static inline const char *class_get_class_name(Class class){ return CLS_ISCLASS(class)?class->name:((class==Nil)?"Nil":0);}static inline longclass_get_instance_size(Class class){ return CLS_ISCLASS(class)?class->instance_size:0;}static inline MetaClassclass_get_meta_class(Class class){ return CLS_ISCLASS(class)?class->class_pointer:Nil;}static inline Classclass_get_super_class(Class class){ return CLS_ISCLASS(class)?class->super_class:Nil;}static inline intclass_get_version(Class class){ return CLS_ISCLASS(class)?class->version:-1;}static inline BOOLclass_is_class(Class class){ return CLS_ISCLASS(class);}static inline BOOLclass_is_meta_class(Class class){ return CLS_ISMETA(class);}static inline voidclass_set_version(Class class, long version){ if (CLS_ISCLASS(class)) class->version = version;}static inline void *class_get_gc_object_type (Class class){ return CLS_ISCLASS(class) ? class->gc_object_type : NULL;}/* Mark the instance variable as innaccessible to the garbage collector */extern void class_ivar_set_gcinvisible (Class class, const char* ivarname, BOOL gcInvisible);static inline IMPmethod_get_imp(Method_t method){ return (method!=METHOD_NULL)?method->method_imp:(IMP)0;}IMP get_imp (Class class, SEL sel);/* Redefine on NeXTSTEP so as not to conflict with system function */#ifdef __NeXT__#define object_copy gnu_object_copy#define object_dispose gnu_object_dispose#endifid object_copy(id object);id object_dispose(id object);static inline Classobject_get_class(id object){ return ((object!=nil) ? (CLS_ISCLASS(object->class_pointer) ? object->class_pointer : (CLS_ISMETA(object->class_pointer) ? (Class)object : Nil)) : Nil);}static inline const char *object_get_class_name(id object){ return ((object!=nil)?(CLS_ISCLASS(object->class_pointer) ?object->class_pointer->name :((Class)object)->name) :"Nil");}static inline MetaClassobject_get_meta_class(id object){ return ((object!=nil)?(CLS_ISCLASS(object->class_pointer) ?object->class_pointer->class_pointer :(CLS_ISMETA(object->class_pointer) ?object->class_pointer :Nil)) :Nil);}static inline Classobject_get_super_class(id object){ return ((object!=nil)?(CLS_ISCLASS(object->class_pointer) ?object->class_pointer->super_class :(CLS_ISMETA(object->class_pointer) ?((Class)object)->super_class :Nil)) :Nil);}static inline BOOLobject_is_class(id object){ return CLS_ISCLASS((Class)object);}static inline BOOLobject_is_instance(id object){ return (object!=nil)&&CLS_ISCLASS(object->class_pointer);}static inline BOOLobject_is_meta_class(id object){ return CLS_ISMETA((Class)object);}struct sarray* objc_get_uninstalled_dtable(void);#endif /* not __objc_api_INCLUDE_GNU */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -