]>
Commit | Line | Data |
---|---|---|
b3962a83 A |
1 | /* |
2 | * Copyright (c) 1999-2007 Apple Inc. All Rights Reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * This file contains Original Code and/or Modifications of Original Code | |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. Please obtain a copy of the License at | |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
11 | * file. | |
12 | * | |
13 | * The Original Code and all software distributed under the License are | |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
18 | * Please see the License for the specific language governing rights and | |
19 | * limitations under the License. | |
20 | * | |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
23 | ||
24 | #ifndef _OBJC_RUNTIME_H | |
25 | #define _OBJC_RUNTIME_H | |
26 | ||
27 | #import <objc/objc.h> | |
28 | ||
29 | #import <sys/types.h> | |
30 | #import <stdarg.h> | |
31 | #import <stdint.h> | |
32 | #import <stddef.h> | |
33 | #import <AvailabilityMacros.h> | |
34 | ||
35 | ||
36 | /* Types */ | |
37 | ||
38 | typedef struct objc_method *Method; | |
39 | typedef struct objc_ivar *Ivar; | |
40 | typedef struct objc_category *Category; | |
41 | typedef struct objc_property *objc_property_t; | |
42 | ||
43 | struct objc_class { | |
44 | Class isa; | |
45 | ||
46 | #if !__OBJC2__ | |
47 | Class super_class OBJC2_UNAVAILABLE; | |
48 | const char *name OBJC2_UNAVAILABLE; | |
49 | long version OBJC2_UNAVAILABLE; | |
50 | long info OBJC2_UNAVAILABLE; | |
51 | long instance_size OBJC2_UNAVAILABLE; | |
52 | struct objc_ivar_list *ivars OBJC2_UNAVAILABLE; | |
53 | struct objc_method_list **methodLists OBJC2_UNAVAILABLE; | |
54 | struct objc_cache *cache OBJC2_UNAVAILABLE; | |
55 | struct objc_protocol_list *protocols OBJC2_UNAVAILABLE; | |
56 | #endif | |
57 | ||
58 | } OBJC2_UNAVAILABLE; | |
59 | /* Use `Class` instead of `struct objc_class *` */ | |
60 | ||
61 | #ifdef __OBJC__ | |
62 | @class Protocol; | |
63 | #else | |
64 | typedef struct objc_object Protocol; | |
65 | #endif | |
66 | ||
67 | struct objc_method_description { | |
68 | SEL name; | |
69 | char *types; | |
70 | }; | |
71 | struct objc_method_description_list { | |
72 | int count; | |
73 | struct objc_method_description list[1]; | |
74 | }; | |
75 | ||
76 | struct objc_protocol_list { | |
77 | struct objc_protocol_list *next; | |
78 | long count; | |
79 | Protocol *list[1]; | |
80 | }; | |
81 | ||
82 | ||
83 | /* Functions */ | |
84 | ||
85 | OBJC_EXPORT id object_copy(id obj, size_t size); | |
86 | OBJC_EXPORT id object_dispose(id obj); | |
87 | ||
88 | OBJC_EXPORT Class object_getClass(id obj) | |
89 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
90 | OBJC_EXPORT Class object_setClass(id obj, Class cls) | |
91 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
92 | ||
93 | OBJC_EXPORT const char *object_getClassName(id obj); | |
94 | OBJC_EXPORT void *object_getIndexedIvars(id obj); | |
95 | ||
96 | OBJC_EXPORT id object_getIvar(id obj, Ivar ivar) | |
97 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
98 | OBJC_EXPORT void object_setIvar(id obj, Ivar ivar, id value) | |
99 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
100 | ||
101 | OBJC_EXPORT Ivar object_setInstanceVariable(id obj, const char *name, void *value); | |
102 | OBJC_EXPORT Ivar object_getInstanceVariable(id obj, const char *name, void **outValue); | |
103 | ||
104 | OBJC_EXPORT id objc_getClass(const char *name); | |
105 | OBJC_EXPORT id objc_getMetaClass(const char *name); | |
106 | OBJC_EXPORT id objc_lookUpClass(const char *name); | |
107 | OBJC_EXPORT id objc_getRequiredClass(const char *name); | |
108 | OBJC_EXPORT Class objc_getFutureClass(const char *name) | |
109 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
110 | OBJC_EXPORT void objc_setFutureClass(Class cls, const char *name) | |
111 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
112 | OBJC_EXPORT int objc_getClassList(Class *buffer, int bufferCount); | |
113 | ||
114 | OBJC_EXPORT Protocol *objc_getProtocol(const char *name) | |
115 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
116 | OBJC_EXPORT Protocol **objc_copyProtocolList(unsigned int *outCount) | |
117 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
118 | ||
119 | OBJC_EXPORT const char *class_getName(Class cls) | |
120 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
121 | OBJC_EXPORT BOOL class_isMetaClass(Class cls) | |
122 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
123 | OBJC_EXPORT Class class_getSuperclass(Class cls) | |
124 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
125 | OBJC_EXPORT Class class_setSuperclass(Class cls, Class newSuper) | |
126 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER OBJC2_UNAVAILABLE; | |
127 | ||
128 | OBJC_EXPORT int class_getVersion(Class cls); | |
129 | OBJC_EXPORT void class_setVersion(Class cls, int version); | |
130 | ||
131 | OBJC_EXPORT size_t class_getInstanceSize(Class cls) | |
132 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
133 | ||
134 | OBJC_EXPORT Ivar class_getInstanceVariable(Class cls, const char *name); | |
135 | OBJC_EXPORT Ivar class_getClassVariable(Class cls, const char *name) | |
136 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
137 | OBJC_EXPORT Ivar *class_copyIvarList(Class cls, unsigned int *outCount) | |
138 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
139 | ||
140 | OBJC_EXPORT Method class_getInstanceMethod(Class cls, SEL name); | |
141 | OBJC_EXPORT Method class_getClassMethod(Class cls, SEL name); | |
142 | OBJC_EXPORT IMP class_getMethodImplementation(Class cls, SEL name) | |
143 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
144 | OBJC_EXPORT IMP class_getMethodImplementation_stret(Class cls, SEL name) | |
145 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
146 | OBJC_EXPORT BOOL class_respondsToSelector(Class cls, SEL sel) | |
147 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
148 | OBJC_EXPORT Method *class_copyMethodList(Class cls, unsigned int *outCount) | |
149 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
150 | ||
151 | OBJC_EXPORT BOOL class_conformsToProtocol(Class cls, Protocol *protocol) | |
152 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
153 | OBJC_EXPORT Protocol **class_copyProtocolList(Class cls, unsigned int *outCount) | |
154 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
155 | ||
156 | OBJC_EXPORT objc_property_t class_getProperty(Class cls, const char *name) | |
157 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
158 | OBJC_EXPORT objc_property_t *class_copyPropertyList(Class cls, unsigned int *outCount) | |
159 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
160 | ||
161 | OBJC_EXPORT const char *class_getIvarLayout(Class cls) | |
162 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
163 | OBJC_EXPORT const char *class_getWeakIvarLayout(Class cls) | |
164 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
165 | ||
166 | OBJC_EXPORT id class_createInstance(Class cls, size_t extraBytes); | |
167 | ||
168 | OBJC_EXPORT Class objc_allocateClassPair(Class superclass, const char *name, | |
169 | size_t extraBytes) | |
170 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
171 | OBJC_EXPORT void objc_registerClassPair(Class cls) | |
172 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
173 | OBJC_EXPORT Class objc_duplicateClass(Class original, const char *name, | |
174 | size_t extraBytes) | |
175 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
176 | OBJC_EXPORT void objc_disposeClassPair(Class cls) | |
177 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
178 | ||
179 | OBJC_EXPORT BOOL class_addMethod(Class cls, SEL name, IMP imp, | |
180 | const char *types) | |
181 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
182 | OBJC_EXPORT IMP class_replaceMethod(Class cls, SEL name, IMP imp, | |
183 | const char *types) | |
184 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
185 | OBJC_EXPORT BOOL class_addIvar(Class cls, const char *name, size_t size, | |
186 | uint8_t alignment, const char *types) | |
187 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
188 | OBJC_EXPORT BOOL class_addProtocol(Class cls, Protocol *protocol) | |
189 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
190 | OBJC_EXPORT void class_setIvarLayout(Class cls, const char *layout) | |
191 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
192 | OBJC_EXPORT void class_setWeakIvarLayout(Class cls, const char *layout) | |
193 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
194 | ||
195 | ||
196 | OBJC_EXPORT SEL method_getName(Method m) | |
197 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
198 | OBJC_EXPORT IMP method_getImplementation(Method m) | |
199 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
200 | OBJC_EXPORT const char *method_getTypeEncoding(Method m) | |
201 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
202 | ||
203 | OBJC_EXPORT unsigned int method_getNumberOfArguments(Method m); | |
204 | OBJC_EXPORT char *method_copyReturnType(Method m) | |
205 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
206 | OBJC_EXPORT char *method_copyArgumentType(Method m, unsigned int index) | |
207 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
208 | OBJC_EXPORT void method_getReturnType(Method m, char *dst, size_t dst_len) | |
209 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
210 | OBJC_EXPORT void method_getArgumentType(Method m, unsigned int index, | |
211 | char *dst, size_t dst_len) | |
212 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
213 | OBJC_EXPORT struct objc_method_description *method_getDescription(Method m) | |
214 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
215 | ||
216 | OBJC_EXPORT IMP method_setImplementation(Method m, IMP imp) | |
217 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
218 | OBJC_EXPORT void method_exchangeImplementations(Method m1, Method m2) | |
219 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
220 | ||
221 | OBJC_EXPORT const char *ivar_getName(Ivar v) | |
222 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
223 | OBJC_EXPORT const char *ivar_getTypeEncoding(Ivar v) | |
224 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
225 | OBJC_EXPORT ptrdiff_t ivar_getOffset(Ivar v) | |
226 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
227 | ||
228 | OBJC_EXPORT const char *property_getName(objc_property_t property) | |
229 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
230 | OBJC_EXPORT const char *property_getAttributes(objc_property_t property) | |
231 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
232 | ||
233 | OBJC_EXPORT BOOL protocol_conformsToProtocol(Protocol *proto, Protocol *other) | |
234 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
235 | OBJC_EXPORT BOOL protocol_isEqual(Protocol *proto, Protocol *other) | |
236 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
237 | OBJC_EXPORT const char *protocol_getName(Protocol *p) | |
238 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
239 | OBJC_EXPORT struct objc_method_description protocol_getMethodDescription(Protocol *p, SEL aSel, BOOL isRequiredMethod, BOOL isInstanceMethod) | |
240 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
241 | OBJC_EXPORT struct objc_method_description *protocol_copyMethodDescriptionList(Protocol *p, BOOL isRequiredMethod, BOOL isInstanceMethod, unsigned int *outCount) | |
242 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
243 | OBJC_EXPORT objc_property_t protocol_getProperty(Protocol *proto, const char *name, BOOL isRequiredProperty, BOOL isInstanceProperty) | |
244 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
245 | OBJC_EXPORT objc_property_t *protocol_copyPropertyList(Protocol *proto, unsigned int *outCount) | |
246 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
247 | OBJC_EXPORT Protocol **protocol_copyProtocolList(Protocol *proto, unsigned int *outCount) | |
248 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
249 | ||
250 | OBJC_EXPORT const char **objc_copyImageNames(unsigned int *outCount) | |
251 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
252 | OBJC_EXPORT const char *class_getImageName(Class cls) | |
253 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
254 | OBJC_EXPORT const char **objc_copyClassNamesForImage(const char *image, | |
255 | unsigned int *outCount) | |
256 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
257 | ||
258 | OBJC_EXPORT const char *sel_getName(SEL sel); | |
259 | OBJC_EXPORT SEL sel_getUid(const char *str); | |
260 | OBJC_EXPORT SEL sel_registerName(const char *str); | |
261 | OBJC_EXPORT BOOL sel_isEqual(SEL lhs, SEL rhs) | |
262 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
263 | ||
264 | OBJC_EXPORT void objc_enumerationMutation(id) | |
265 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
266 | OBJC_EXPORT void objc_setEnumerationMutationHandler(void (*handler)(id)) | |
267 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
268 | ||
269 | OBJC_EXPORT void objc_setForwardHandler(void *fwd, void *fwd_stret) | |
270 | AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; | |
271 | ||
272 | #define _C_ID '@' | |
273 | #define _C_CLASS '#' | |
274 | #define _C_SEL ':' | |
275 | #define _C_CHR 'c' | |
276 | #define _C_UCHR 'C' | |
277 | #define _C_SHT 's' | |
278 | #define _C_USHT 'S' | |
279 | #define _C_INT 'i' | |
280 | #define _C_UINT 'I' | |
281 | #define _C_LNG 'l' | |
282 | #define _C_ULNG 'L' | |
283 | #define _C_LNG_LNG 'q' | |
284 | #define _C_ULNG_LNG 'Q' | |
285 | #define _C_FLT 'f' | |
286 | #define _C_DBL 'd' | |
287 | #define _C_BFLD 'b' | |
288 | #define _C_BOOL 'B' | |
289 | #define _C_VOID 'v' | |
290 | #define _C_UNDEF '?' | |
291 | #define _C_PTR '^' | |
292 | #define _C_CHARPTR '*' | |
293 | #define _C_ATOM '%' | |
294 | #define _C_ARY_B '[' | |
295 | #define _C_ARY_E ']' | |
296 | #define _C_UNION_B '(' | |
297 | #define _C_UNION_E ')' | |
298 | #define _C_STRUCT_B '{' | |
299 | #define _C_STRUCT_E '}' | |
300 | #define _C_VECTOR '!' | |
301 | #define _C_CONST 'r' | |
302 | ||
303 | ||
304 | /* Obsolete types */ | |
305 | ||
306 | #if !__OBJC2__ | |
307 | ||
308 | #define CLS_GETINFO(cls,infomask) ((cls)->info & (infomask)) | |
309 | #define CLS_SETINFO(cls,infomask) ((cls)->info |= (infomask)) | |
310 | ||
311 | // class is not a metaclass | |
312 | #define CLS_CLASS 0x1 | |
313 | // class is a metaclass | |
314 | #define CLS_META 0x2 | |
315 | // class's +initialize method has completed | |
316 | #define CLS_INITIALIZED 0x4 | |
317 | // class is posing | |
318 | #define CLS_POSING 0x8 | |
319 | // unused | |
320 | #define CLS_MAPPED 0x10 | |
321 | // class and subclasses need cache flush during image loading | |
322 | #define CLS_FLUSH_CACHE 0x20 | |
323 | // method cache should grow when full | |
324 | #define CLS_GROW_CACHE 0x40 | |
325 | // unused | |
326 | #define CLS_NEED_BIND 0x80 | |
327 | // methodLists is array of method lists | |
328 | #define CLS_METHOD_ARRAY 0x100 | |
329 | // the JavaBridge constructs classes with these markers | |
330 | #define CLS_JAVA_HYBRID 0x200 | |
331 | #define CLS_JAVA_CLASS 0x400 | |
332 | // thread-safe +initialize | |
333 | #define CLS_INITIALIZING 0x800 | |
334 | // bundle unloading | |
335 | #define CLS_FROM_BUNDLE 0x1000 | |
336 | // C++ ivar support | |
337 | #define CLS_HAS_CXX_STRUCTORS 0x2000 | |
338 | // Lazy method list arrays | |
339 | #define CLS_NO_METHOD_ARRAY 0x4000 | |
340 | // +load implementation | |
341 | #define CLS_HAS_LOAD_METHOD 0x8000 | |
342 | // objc_allocateClassPair API | |
343 | #define CLS_CONSTRUCTING 0x10000 | |
344 | // class compiled with bigger class structure | |
345 | #define CLS_EXT 0x20000 | |
346 | ||
347 | ||
348 | struct objc_category { | |
349 | char *category_name OBJC2_UNAVAILABLE; | |
350 | char *class_name OBJC2_UNAVAILABLE; | |
351 | struct objc_method_list *instance_methods OBJC2_UNAVAILABLE; | |
352 | struct objc_method_list *class_methods OBJC2_UNAVAILABLE; | |
353 | struct objc_protocol_list *protocols OBJC2_UNAVAILABLE; | |
354 | } OBJC2_UNAVAILABLE; | |
355 | ||
356 | ||
357 | struct objc_ivar { | |
358 | char *ivar_name OBJC2_UNAVAILABLE; | |
359 | char *ivar_type OBJC2_UNAVAILABLE; | |
360 | int ivar_offset OBJC2_UNAVAILABLE; | |
361 | #ifdef __LP64__ | |
362 | int space OBJC2_UNAVAILABLE; | |
363 | #endif | |
364 | } OBJC2_UNAVAILABLE; | |
365 | ||
366 | struct objc_ivar_list { | |
367 | int ivar_count OBJC2_UNAVAILABLE; | |
368 | #ifdef __LP64__ | |
369 | int space OBJC2_UNAVAILABLE; | |
370 | #endif | |
371 | /* variable length structure */ | |
372 | struct objc_ivar ivar_list[1] OBJC2_UNAVAILABLE; | |
373 | } OBJC2_UNAVAILABLE; | |
374 | ||
375 | ||
376 | struct objc_method { | |
377 | SEL method_name OBJC2_UNAVAILABLE; | |
378 | char *method_types OBJC2_UNAVAILABLE; | |
379 | IMP method_imp OBJC2_UNAVAILABLE; | |
380 | } OBJC2_UNAVAILABLE; | |
381 | ||
382 | struct objc_method_list { | |
383 | struct objc_method_list *obsolete OBJC2_UNAVAILABLE; | |
384 | ||
385 | int method_count OBJC2_UNAVAILABLE; | |
386 | #ifdef __LP64__ | |
387 | int space OBJC2_UNAVAILABLE; | |
388 | #endif | |
389 | /* variable length structure */ | |
390 | struct objc_method method_list[1] OBJC2_UNAVAILABLE; | |
391 | } OBJC2_UNAVAILABLE; | |
392 | ||
393 | ||
394 | typedef struct objc_symtab *Symtab OBJC2_UNAVAILABLE; | |
395 | ||
396 | struct objc_symtab { | |
397 | unsigned long sel_ref_cnt OBJC2_UNAVAILABLE; | |
398 | SEL *refs OBJC2_UNAVAILABLE; | |
399 | unsigned short cls_def_cnt OBJC2_UNAVAILABLE; | |
400 | unsigned short cat_def_cnt OBJC2_UNAVAILABLE; | |
401 | void *defs[1] /* variable size */ OBJC2_UNAVAILABLE; | |
402 | } OBJC2_UNAVAILABLE; | |
403 | ||
404 | ||
405 | typedef struct objc_cache *Cache OBJC2_UNAVAILABLE; | |
406 | ||
407 | #define CACHE_BUCKET_NAME(B) ((B)->method_name) | |
408 | #define CACHE_BUCKET_IMP(B) ((B)->method_imp) | |
409 | #define CACHE_BUCKET_VALID(B) (B) | |
410 | #ifndef __LP64__ | |
411 | #define CACHE_HASH(sel, mask) (((uintptr_t)(sel)>>2) & (mask)) | |
412 | #else | |
413 | #define CACHE_HASH(sel, mask) (((unsigned int)((uintptr_t)(sel)>>3)) & (mask)) | |
414 | #endif | |
415 | struct objc_cache { | |
416 | unsigned int mask /* total = mask + 1 */ OBJC2_UNAVAILABLE; | |
417 | unsigned int occupied OBJC2_UNAVAILABLE; | |
418 | Method buckets[1] OBJC2_UNAVAILABLE; | |
419 | } /* GrP fixme should be OBJC2_UNAVAILABLE, but isn't because of spurious warnings in [super ...] calls */; | |
420 | ||
421 | ||
422 | typedef struct objc_module *Module OBJC2_UNAVAILABLE; | |
423 | ||
424 | struct objc_module { | |
425 | unsigned long version OBJC2_UNAVAILABLE; | |
426 | unsigned long size OBJC2_UNAVAILABLE; | |
427 | const char *name OBJC2_UNAVAILABLE; | |
428 | Symtab symtab OBJC2_UNAVAILABLE; | |
429 | } OBJC2_UNAVAILABLE; | |
430 | ||
431 | #else | |
432 | ||
433 | struct objc_method_list; | |
434 | ||
435 | #endif | |
436 | ||
437 | ||
438 | /* Obsolete functions */ | |
439 | ||
440 | OBJC_EXPORT BOOL sel_isMapped(SEL sel) OBJC2_UNAVAILABLE; | |
441 | ||
442 | OBJC_EXPORT id object_copyFromZone(id anObject, size_t nBytes, void *z) OBJC2_UNAVAILABLE; | |
443 | OBJC_EXPORT id object_realloc(id anObject, size_t nBytes) OBJC2_UNAVAILABLE; | |
444 | OBJC_EXPORT id object_reallocFromZone(id anObject, size_t nBytes, void *z) OBJC2_UNAVAILABLE; | |
445 | ||
446 | #define OBSOLETE_OBJC_GETCLASSES 1 | |
447 | OBJC_EXPORT void *objc_getClasses(void) OBJC2_UNAVAILABLE; | |
448 | OBJC_EXPORT void objc_addClass(Class myClass) OBJC2_UNAVAILABLE; | |
449 | OBJC_EXPORT void objc_setClassHandler(int (*)(const char *)) OBJC2_UNAVAILABLE; | |
450 | OBJC_EXPORT void objc_setMultithreaded (BOOL flag) OBJC2_UNAVAILABLE; | |
451 | ||
452 | OBJC_EXPORT id class_createInstanceFromZone(Class, size_t idxIvars, void *z) OBJC2_UNAVAILABLE; | |
453 | ||
454 | OBJC_EXPORT void class_addMethods(Class, struct objc_method_list *) OBJC2_UNAVAILABLE; | |
455 | OBJC_EXPORT void class_removeMethods(Class, struct objc_method_list *) OBJC2_UNAVAILABLE; | |
456 | ||
457 | OBJC_EXPORT Class class_poseAs(Class imposter, Class original) OBJC2_UNAVAILABLE; | |
458 | ||
459 | OBJC_EXPORT unsigned int method_getSizeOfArguments(Method m) OBJC2_UNAVAILABLE; | |
460 | OBJC_EXPORT unsigned method_getArgumentInfo(struct objc_method *m, int arg, const char **type, int *offset) OBJC2_UNAVAILABLE; | |
461 | ||
462 | OBJC_EXPORT BOOL class_respondsToMethod(Class, SEL) OBJC2_UNAVAILABLE; | |
463 | OBJC_EXPORT IMP class_lookupMethod(Class, SEL) OBJC2_UNAVAILABLE; | |
464 | OBJC_EXPORT Class objc_getOrigClass(const char *name) OBJC2_UNAVAILABLE; | |
465 | #define OBJC_NEXT_METHOD_LIST 1 | |
466 | OBJC_EXPORT struct objc_method_list *class_nextMethodList(Class, void **) OBJC2_UNAVAILABLE; | |
467 | // usage for nextMethodList | |
468 | // | |
469 | // void *iterator = 0; | |
470 | // struct objc_method_list *mlist; | |
471 | // while ( mlist = class_nextMethodList( cls, &iterator ) ) | |
472 | // ; | |
473 | ||
474 | OBJC_EXPORT id (*_alloc)(Class, size_t) OBJC2_UNAVAILABLE; | |
475 | OBJC_EXPORT id (*_copy)(id, size_t) OBJC2_UNAVAILABLE; | |
476 | OBJC_EXPORT id (*_realloc)(id, size_t) OBJC2_UNAVAILABLE; | |
477 | OBJC_EXPORT id (*_dealloc)(id) OBJC2_UNAVAILABLE; | |
478 | OBJC_EXPORT id (*_zoneAlloc)(Class, size_t, void *) OBJC2_UNAVAILABLE; | |
479 | OBJC_EXPORT id (*_zoneRealloc)(id, size_t, void *) OBJC2_UNAVAILABLE; | |
480 | OBJC_EXPORT id (*_zoneCopy)(id, size_t, void *) OBJC2_UNAVAILABLE; | |
481 | OBJC_EXPORT void (*_error)(id, const char *, va_list) OBJC2_UNAVAILABLE; | |
482 | ||
483 | #endif |