24 #if !defined(__has_feature) || !__has_feature(nullability) 33 typedef uint32_t (*_Nonnull objc_hashtable_hash_func)(
const void *_Nonnull key);
34 typedef bool (*_Nonnull objc_hashtable_equal_func)(
const void *_Nonnull key1,
35 const void *_Nonnull key2);
39 Class _Nullable superclass;
40 const char *_Nonnull name;
41 unsigned long version;
44 struct objc_ivar_list *_Nullable ivars;
45 struct objc_method_list *_Nullable methodList;
46 struct objc_dtable *_Nullable dTable;
47 Class _Nullable *_Nullable subclassList;
48 void *_Nullable siblingClass;
49 struct objc_protocol_list *_Nullable protocols;
50 void *_Nullable GCObjectType;
51 unsigned long ABIVersion;
52 int32_t *_Nonnull *_Nullable ivarOffsets;
53 struct objc_property_list *_Nullable propertyList;
56 enum objc_class_info {
57 OBJC_CLASS_INFO_CLASS = 0x001,
58 OBJC_CLASS_INFO_METACLASS = 0x002,
59 OBJC_CLASS_INFO_NEW_ABI = 0x010,
60 OBJC_CLASS_INFO_SETUP = 0x100,
61 OBJC_CLASS_INFO_LOADED = 0x200,
62 OBJC_CLASS_INFO_DTABLE = 0x400,
63 OBJC_CLASS_INFO_INITIALIZED = 0x800
70 struct objc_selector {
72 const char *_Nullable typeEncoding;
76 struct objc_selector selector;
77 IMP _Nonnull implementation;
80 struct objc_method_list {
81 struct objc_method_list *_Nullable next;
83 struct objc_method methods[1];
86 struct objc_category {
87 const char *_Nonnull categoryName;
88 const char *_Nonnull className;
89 struct objc_method_list *_Nullable instanceMethods;
90 struct objc_method_list *_Nullable classMethods;
91 struct objc_protocol_list *_Nullable protocols;
95 const char *_Nonnull name;
96 const char *_Nonnull typeEncoding;
100 struct objc_ivar_list {
102 struct objc_ivar ivars[1];
105 struct objc_method_description {
106 const char *_Nonnull name;
107 const char *_Nonnull typeEncoding;
110 struct objc_method_description_list {
112 struct objc_method_description list[1];
115 struct objc_protocol_list {
116 struct objc_protocol_list *_Nullable next;
118 Protocol *__unsafe_unretained _Nonnull list[1];
121 #if __has_attribute(__objc_root_class__) 122 __attribute__((__objc_root_class__))
128 const char *_Nonnull name;
129 struct objc_protocol_list *_Nullable protocolList;
130 struct objc_method_description_list *_Nullable instanceMethods;
131 struct objc_method_description_list *_Nullable classMethods;
135 enum objc_property_attributes {
136 OBJC_PROPERTY_READONLY = 0x01,
137 OBJC_PROPERTY_GETTER = 0x02,
138 OBJC_PROPERTY_ASSIGN = 0x04,
139 OBJC_PROPERTY_READWRITE = 0x08,
140 OBJC_PROPERTY_RETAIN = 0x10,
141 OBJC_PROPERTY_COPY = 0x20,
142 OBJC_PROPERTY_NONATOMIC = 0x40,
143 OBJC_PROPERTY_SETTER = 0x80
146 enum objc_property_extended_attributes {
147 OBJC_PROPERTY_SYNTHESIZED = 0x1,
148 OBJC_PROPERTY_DYNAMIC = 0x2,
149 OBJC_PROPERTY_PROTOCOL = 0x3,
150 OBJC_PROPERTY_ATOMIC = 0x4,
151 OBJC_PROPERTY_WEAK = 0x8,
152 OBJC_PROPERTY_STRONG = 0x10,
153 OBJC_PROPERTY_UNSAFE_UNRETAINED = 0x20
156 struct objc_property {
157 const char *_Nonnull name;
158 unsigned char attributes, extendedAttributes;
160 const char *_Nullable name;
161 const char *_Nullable typeEncoding;
165 struct objc_property_list {
167 struct objc_property_list *_Nullable next;
168 struct objc_property properties[1];
171 struct objc_static_instances {
172 const char *_Nonnull className;
173 id _Nullable instances[1];
177 unsigned long unknown;
178 struct objc_selector *_Nullable selectorRefs;
179 uint16_t classDefsCount;
180 uint16_t categoryDefsCount;
181 void *_Nonnull defs[1];
184 struct _objc_module {
185 unsigned long version;
187 const char *_Nullable name;
188 struct objc_symtab *_Nonnull symtab;
191 struct objc_hashtable_bucket {
192 const void *_Nonnull key, *_Nonnull object;
196 struct objc_hashtable {
197 objc_hashtable_hash_func hash;
198 objc_hashtable_equal_func equal;
199 uint32_t count, size;
200 struct objc_hashtable_bucket *_Nonnull *_Nullable data;
203 struct objc_sparsearray {
204 struct objc_sparsearray_data {
205 void *_Nullable next[256];
211 struct objc_dtable_level2 {
213 struct objc_dtable_level3 {
214 IMP _Nullable buckets[256];
215 } *_Nonnull buckets[256];
217 IMP _Nullable buckets[256];
219 } *_Nonnull buckets[256];
222 extern void objc_registerAllCategories(
struct objc_symtab *_Nonnull)
223 OF_VISIBILITY_HIDDEN;
224 extern struct objc_category *_Nullable *_Nullable
225 objc_categoriesForClass(Class _Nonnull) OF_VISIBILITY_HIDDEN;
226 extern void objc_processCategoriesLoadQueue(
void) OF_VISIBILITY_HIDDEN;
227 extern void objc_unregisterAllCategories(
void) OF_VISIBILITY_HIDDEN;
228 extern void objc_initializeClass(Class _Nonnull) OF_VISIBILITY_HIDDEN;
229 extern void objc_updateDTable(Class _Nonnull) OF_VISIBILITY_HIDDEN;
230 extern void objc_registerAllClasses(
struct objc_symtab *_Nonnull)
231 OF_VISIBILITY_HIDDEN;
232 extern Class _Nullable objc_classnameToClass(
const char *_Nonnull,
bool)
233 OF_VISIBILITY_HIDDEN;
234 extern void objc_unregisterClass(Class _Nonnull) OF_VISIBILITY_HIDDEN;
235 extern void objc_unregisterAllClasses(
void) OF_VISIBILITY_HIDDEN;
236 extern uint32_t objc_string_hash(
const void *_Nonnull) OF_VISIBILITY_HIDDEN;
237 extern bool objc_string_equal(
const void *_Nonnull,
const void *_Nonnull)
238 OF_VISIBILITY_HIDDEN;
239 extern struct objc_hashtable *_Nonnull objc_hashtable_new(
240 objc_hashtable_hash_func, objc_hashtable_equal_func, uint32_t)
241 OF_VISIBILITY_HIDDEN;
242 extern struct objc_hashtable_bucket objc_deletedBucket OF_VISIBILITY_HIDDEN;
243 extern void objc_hashtable_set(
struct objc_hashtable *_Nonnull,
244 const void *_Nonnull,
const void *_Nonnull) OF_VISIBILITY_HIDDEN;
245 extern void *_Nullable objc_hashtable_get(
struct objc_hashtable *_Nonnull,
246 const void *_Nonnull) OF_VISIBILITY_HIDDEN;
247 extern void objc_hashtable_delete(
struct objc_hashtable *_Nonnull,
248 const void *_Nonnull) OF_VISIBILITY_HIDDEN;
249 extern void objc_hashtable_free(
struct objc_hashtable *_Nonnull)
250 OF_VISIBILITY_HIDDEN;
251 extern void objc_registerSelector(
struct objc_selector *_Nonnull)
252 OF_VISIBILITY_HIDDEN;
253 extern void objc_registerAllSelectors(
struct objc_symtab *_Nonnull)
254 OF_VISIBILITY_HIDDEN;
255 extern void objc_unregisterAllSelectors(
void) OF_VISIBILITY_HIDDEN;
256 extern struct objc_sparsearray *_Nonnull objc_sparsearray_new(uint8_t)
257 OF_VISIBILITY_HIDDEN;
258 extern void *_Nullable objc_sparsearray_get(
struct objc_sparsearray *_Nonnull,
259 uintptr_t) OF_VISIBILITY_HIDDEN;
260 extern void objc_sparsearray_set(
struct objc_sparsearray *_Nonnull, uintptr_t,
261 void *_Nullable) OF_VISIBILITY_HIDDEN;
262 extern void objc_sparsearray_free(
struct objc_sparsearray *_Nonnull)
263 OF_VISIBILITY_HIDDEN;
264 extern struct objc_dtable *_Nonnull objc_dtable_new(
void) OF_VISIBILITY_HIDDEN;
265 extern void objc_dtable_copy(
struct objc_dtable *_Nonnull,
266 struct objc_dtable *_Nonnull) OF_VISIBILITY_HIDDEN;
267 extern void objc_dtable_set(
struct objc_dtable *_Nonnull, uint32_t,
268 IMP _Nullable) OF_VISIBILITY_HIDDEN;
269 extern void objc_dtable_free(
struct objc_dtable *_Nonnull) OF_VISIBILITY_HIDDEN;
270 extern void objc_dtable_cleanup(
void) OF_VISIBILITY_HIDDEN;
271 extern void objc_initStaticInstances(
struct objc_symtab *_Nonnull)
272 OF_VISIBILITY_HIDDEN;
273 extern void objc_forgetPendingStaticInstances(
void) OF_VISIBILITY_HIDDEN;
274 extern void objc_zeroWeakReferences(
id _Nonnull) OF_VISIBILITY_HIDDEN;
275 extern Class _Nullable object_getTaggedPointerClass(
id _Nonnull)
276 OF_VISIBILITY_HIDDEN;
277 #ifdef OF_HAVE_THREADS 278 extern void objc_globalMutex_lock(
void) OF_VISIBILITY_HIDDEN;
279 extern void objc_globalMutex_unlock(
void) OF_VISIBILITY_HIDDEN;
280 extern void objc_globalMutex_free(
void) OF_VISIBILITY_HIDDEN;
282 # define objc_globalMutex_lock() 283 # define objc_globalMutex_unlock() 284 # define objc_globalMutex_free() 286 extern char *_Nullable objc_strdup(
const char *_Nonnull
string)
287 OF_VISIBILITY_HIDDEN;
289 static OF_INLINE
IMP _Nullable
290 objc_dtable_get(
const struct objc_dtable *_Nonnull dtable, uint32_t idx)
293 uint8_t i = idx >> 16;
294 uint8_t j = idx >> 8;
297 return dtable->buckets[i]->buckets[j]->buckets[k];
299 uint8_t i = idx >> 8;
302 return dtable->buckets[i]->buckets[j];
306 extern void OF_NO_RETURN_FUNC objc_error(
const char *_Nonnull title,
307 const char *_Nonnull format, ...) OF_VISIBILITY_HIDDEN;
308 #define OBJC_ERROR(...) \ 309 objc_error("ObjFWRT @ " __FILE__ ":" OF_STRINGIFY(__LINE__), \ 313 # if defined(OF_AMD64) || defined(OF_X86) || \ 314 defined(OF_POWERPC64) || defined(OF_POWERPC) || \ 315 defined(OF_ARM64) || defined(OF_ARM) || \ 316 defined(OF_MIPS64_N64) || defined(OF_MIPS) || \ 317 defined(OF_SPARC64) || defined(OF_SPARC) || \ 318 defined(OF_RISCV64) || defined(OF_LOONGARCH64) 319 # define OF_ASM_LOOKUP 321 #elif defined(OF_MACH_O) 322 # if defined(OF_AMD64) 323 # define OF_ASM_LOOKUP 325 #elif defined(OF_WINDOWS) 326 # if defined(OF_AMD64) || defined(OF_X86) || defined(OF_ARM64) 327 # define OF_ASM_LOOKUP 331 @interface DummyObject
336 @property (readonly, nonatomic)
bool allowsWeakReference;
339 + (bool)resolveClassMethod: (nonnull
SEL)selector;
340 + (bool)resolveInstanceMethod: (nonnull
SEL)selector;
341 - (nonnull id)retain;
343 - (nonnull id)autorelease;
345 - (nonnull id)mutableCopy;
346 - (bool)retainWeakReference;
A pointer to a class.
Definition: private.h:37
A pointer to any object.
Definition: private.h:66
const struct objc_protocol * Protocol
A protocol.
Definition: ObjFWRT.h:117
id(* IMP)(id object, SEL selector,...)
A method implementation.
Definition: ObjFWRT.h:146