20#if !defined(__has_feature) || !__has_feature(nullability)
29typedef uint32_t (*_Nonnull objc_hashtable_hash_func)(
const void *_Nonnull key);
30typedef bool (*_Nonnull objc_hashtable_equal_func)(
const void *_Nonnull key1,
31 const void *_Nonnull key2);
35 Class _Nullable superclass;
36 const char *_Nonnull name;
37 unsigned long version;
40 struct objc_ivar_list *_Nullable ivars;
41 struct objc_method_list *_Nullable methodList;
42 struct objc_dtable *_Nullable dTable;
43 Class _Nullable *_Nullable subclassList;
44 void *_Nullable siblingClass;
45 struct objc_protocol_list *_Nullable protocols;
46 void *_Nullable GCObjectType;
47 unsigned long ABIVersion;
48 int32_t *_Nonnull *_Nullable ivarOffsets;
49 struct objc_property_list *_Nullable propertyList;
53 OBJC_CLASS_INFO_CLASS = 0x001,
54 OBJC_CLASS_INFO_METACLASS = 0x002,
55 OBJC_CLASS_INFO_NEW_ABI = 0x010,
56 OBJC_CLASS_INFO_SETUP = 0x100,
57 OBJC_CLASS_INFO_LOADED = 0x200,
58 OBJC_CLASS_INFO_DTABLE = 0x400,
59 OBJC_CLASS_INFO_INITIALIZED = 0x800
68 const char *_Nullable typeEncoding;
72 struct objc_selector selector;
73 IMP _Nonnull implementation;
76struct objc_method_list {
77 struct objc_method_list *_Nullable next;
79 struct objc_method methods[1];
83 const char *_Nonnull categoryName;
84 const char *_Nonnull className;
85 struct objc_method_list *_Nullable instanceMethods;
86 struct objc_method_list *_Nullable classMethods;
87 struct objc_protocol_list *_Nullable protocols;
91 const char *_Nonnull name;
92 const char *_Nonnull typeEncoding;
96struct objc_ivar_list {
98 struct objc_ivar ivars[1];
101struct objc_method_description {
102 const char *_Nonnull name;
103 const char *_Nonnull typeEncoding;
106struct objc_method_description_list {
108 struct objc_method_description list[1];
111struct objc_protocol_list {
112 struct objc_protocol_list *_Nullable next;
114 Protocol *__unsafe_unretained _Nonnull list[1];
117#if __has_attribute(__objc_root_class__)
118__attribute__((__objc_root_class__))
124 const char *_Nonnull name;
125 struct objc_protocol_list *_Nullable protocolList;
126 struct objc_method_description_list *_Nullable instanceMethods;
127 struct objc_method_description_list *_Nullable classMethods;
131enum objc_property_attributes {
132 OBJC_PROPERTY_READONLY = 0x01,
133 OBJC_PROPERTY_GETTER = 0x02,
134 OBJC_PROPERTY_ASSIGN = 0x04,
135 OBJC_PROPERTY_READWRITE = 0x08,
136 OBJC_PROPERTY_RETAIN = 0x10,
137 OBJC_PROPERTY_COPY = 0x20,
138 OBJC_PROPERTY_NONATOMIC = 0x40,
139 OBJC_PROPERTY_SETTER = 0x80
142enum objc_property_extended_attributes {
143 OBJC_PROPERTY_SYNTHESIZED = 0x1,
144 OBJC_PROPERTY_DYNAMIC = 0x2,
145 OBJC_PROPERTY_PROTOCOL = 0x3,
146 OBJC_PROPERTY_ATOMIC = 0x4,
147 OBJC_PROPERTY_WEAK = 0x8,
148 OBJC_PROPERTY_STRONG = 0x10,
149 OBJC_PROPERTY_UNSAFE_UNRETAINED = 0x20
152struct objc_property {
153 const char *_Nonnull name;
154 unsigned char attributes, extendedAttributes;
156 const char *_Nullable name;
157 const char *_Nullable typeEncoding;
161struct objc_property_list {
163 struct objc_property_list *_Nullable next;
164 struct objc_property properties[1];
167struct objc_static_instances {
168 const char *_Nonnull className;
169 id _Nullable instances[1];
173 unsigned long unknown;
174 struct objc_selector *_Nullable selectorRefs;
175 uint16_t classDefsCount;
176 uint16_t categoryDefsCount;
177 void *_Nonnull defs[1];
181 unsigned long version;
183 const char *_Nullable name;
184 struct objc_symtab *_Nonnull symtab;
187struct objc_hashtable_bucket {
188 const void *_Nonnull key, *_Nonnull object;
192struct objc_hashtable {
193 objc_hashtable_hash_func hash;
194 objc_hashtable_equal_func equal;
195 uint32_t count, size;
196 struct objc_hashtable_bucket *_Nonnull *_Nullable data;
199struct objc_sparsearray {
200 struct objc_sparsearray_data {
201 void *_Nullable next[256];
207 struct objc_dtable_level2 {
209 struct objc_dtable_level3 {
210 IMP _Nullable buckets[256];
211 } *_Nonnull buckets[256];
213 IMP _Nullable buckets[256];
215 } *_Nonnull buckets[256];
218extern void objc_registerAllCategories(
struct objc_symtab *_Nonnull);
219extern struct objc_category *_Nullable *_Nullable
220 objc_categoriesForClass(Class _Nonnull);
221extern void objc_unregisterAllCategories(
void);
222extern void objc_initializeClass(Class _Nonnull);
223extern void objc_updateDTable(Class _Nonnull);
224extern void objc_registerAllClasses(
struct objc_symtab *_Nonnull);
225extern Class _Nullable objc_classnameToClass(
const char *_Nonnull,
bool);
226extern void objc_unregisterClass(Class _Nonnull);
227extern void objc_unregisterAllClasses(
void);
228extern uint32_t objc_string_hash(
const void *_Nonnull);
229extern bool objc_string_equal(
const void *_Nonnull,
const void *_Nonnull);
230extern struct objc_hashtable *_Nonnull objc_hashtable_new(
231 objc_hashtable_hash_func, objc_hashtable_equal_func, uint32_t);
232extern struct objc_hashtable_bucket objc_deletedBucket;
233extern void objc_hashtable_set(
struct objc_hashtable *_Nonnull,
234 const void *_Nonnull,
const void *_Nonnull);
235extern void *_Nullable objc_hashtable_get(
struct objc_hashtable *_Nonnull,
236 const void *_Nonnull);
237extern void objc_hashtable_delete(
struct objc_hashtable *_Nonnull,
238 const void *_Nonnull);
239extern void objc_hashtable_free(
struct objc_hashtable *_Nonnull);
240extern void objc_registerSelector(
struct objc_selector *_Nonnull);
241extern void objc_registerAllSelectors(
struct objc_symtab *_Nonnull);
242extern void objc_unregisterAllSelectors(
void);
243extern struct objc_sparsearray *_Nonnull objc_sparsearray_new(uint8_t);
244extern void *_Nullable objc_sparsearray_get(
struct objc_sparsearray *_Nonnull,
246extern void objc_sparsearray_set(
struct objc_sparsearray *_Nonnull, uintptr_t,
248extern void objc_sparsearray_free(
struct objc_sparsearray *_Nonnull);
249extern struct objc_dtable *_Nonnull objc_dtable_new(
void);
250extern void objc_dtable_copy(
struct objc_dtable *_Nonnull,
251 struct objc_dtable *_Nonnull);
252extern void objc_dtable_set(
struct objc_dtable *_Nonnull, uint32_t,
254extern void objc_dtable_free(
struct objc_dtable *_Nonnull);
255extern void objc_dtable_cleanup(
void);
256extern void objc_initStaticInstances(
struct objc_symtab *_Nonnull);
257extern void objc_forgetPendingStaticInstances(
void);
258extern void objc_zeroWeakReferences(
id _Nonnull);
259extern Class _Nullable object_getTaggedPointerClass(
id _Nonnull);
260#ifdef OF_HAVE_THREADS
261extern void objc_globalMutex_lock(
void);
262extern void objc_globalMutex_unlock(
void);
263extern void objc_globalMutex_free(
void);
265# define objc_globalMutex_lock()
266# define objc_globalMutex_unlock()
267# define objc_globalMutex_free()
269extern char *_Nullable objc_strdup(
const char *_Nonnull
string);
271static inline IMP _Nullable
272objc_dtable_get(
const struct objc_dtable *_Nonnull dtable, uint32_t idx)
275 uint8_t i = idx >> 16;
276 uint8_t j = idx >> 8;
279 return dtable->buckets[i]->buckets[j]->buckets[k];
281 uint8_t i = idx >> 8;
284 return dtable->buckets[i]->buckets[j];
288extern void OF_NO_RETURN_FUNC objc_error(
const char *_Nonnull title,
289 const char *_Nonnull format, ...);
290#define OBJC_ERROR(...) \
291 objc_error("ObjFWRT @ " __FILE__ ":" OF_STRINGIFY(__LINE__), \
295# if defined(OF_AMD64) || defined(OF_X86) || \
296 defined(OF_POWERPC64) || defined(OF_POWERPC) || \
297 defined(OF_ARM64) || defined(OF_ARM) || \
298 defined(OF_MIPS64_N64) || defined(OF_MIPS) || \
299 defined(OF_SPARC64) || defined(OF_SPARC)
300# define OF_ASM_LOOKUP
302#elif defined(OF_WINDOWS)
303# if defined(OF_AMD64) || defined(OF_X86)
304# define OF_ASM_LOOKUP
308@interface DummyObject
313@property (readonly, nonatomic)
bool allowsWeakReference;
316+ (bool)resolveClassMethod: (nonnull
SEL)selector;
317+ (bool)resolveInstanceMethod: (nonnull
SEL)selector;
320- (nonnull id)autorelease;
322- (nonnull id)mutableCopy;
323- (bool)retainWeakReference;
id(* IMP)(id object, SEL selector,...)
A method implementation.
Definition ObjFWRT.h:142
const struct objc_protocol * Protocol
A protocol.
Definition ObjFWRT.h:113
A pointer to a class.
Definition private.h:33
A pointer to any object.
Definition private.h:62