| 1 |
#if __has_feature(objc_arr) |
| 2 |
#define NS_AUTOMATED_REFCOUNT_UNAVAILABLE __attribute__((unavailable("not available in automatic reference counting mode"))) |
| 3 |
#else |
| 4 |
#define NS_AUTOMATED_REFCOUNT_UNAVAILABLE |
| 5 |
#endif |
| 6 |
|
| 7 |
#define NS_RETURNS_RETAINED __attribute__((ns_returns_retained)) |
| 8 |
#define CF_CONSUMED __attribute__((cf_consumed)) |
| 9 |
#define CF_RETURNS_RETAINED __attribute__((cf_returns_retained)) |
| 10 |
|
| 11 |
#define NS_INLINE static __inline__ __attribute__((always_inline)) |
| 12 |
#define nil ((void*) 0) |
| 13 |
#define NULL ((void*)0) |
| 14 |
|
| 15 |
typedef int BOOL; |
| 16 |
typedef unsigned NSUInteger; |
| 17 |
typedef int int32_t; |
| 18 |
typedef unsigned char uint8_t; |
| 19 |
typedef int32_t UChar32; |
| 20 |
typedef unsigned char UChar; |
| 21 |
|
| 22 |
typedef struct _NSZone NSZone; |
| 23 |
|
| 24 |
typedef const void * CFTypeRef; |
| 25 |
CFTypeRef CFRetain(CFTypeRef cf); |
| 26 |
CFTypeRef CFMakeCollectable(CFTypeRef cf) NS_AUTOMATED_REFCOUNT_UNAVAILABLE; |
| 27 |
|
| 28 |
NS_INLINE NS_RETURNS_RETAINED id NSMakeCollectable(CFTypeRef CF_CONSUMED cf) NS_AUTOMATED_REFCOUNT_UNAVAILABLE; |
| 29 |
|
| 30 |
@protocol NSObject |
| 31 |
- (BOOL)isEqual:(id)object; |
| 32 |
- (NSZone *)zone NS_AUTOMATED_REFCOUNT_UNAVAILABLE; |
| 33 |
- (id)retain NS_AUTOMATED_REFCOUNT_UNAVAILABLE; |
| 34 |
- (NSUInteger)retainCount NS_AUTOMATED_REFCOUNT_UNAVAILABLE; |
| 35 |
- (oneway void)release NS_AUTOMATED_REFCOUNT_UNAVAILABLE; |
| 36 |
- (id)autorelease NS_AUTOMATED_REFCOUNT_UNAVAILABLE; |
| 37 |
@end |
| 38 |
|
| 39 |
@interface NSObject <NSObject> {} |
| 40 |
- (id)init; |
| 41 |
|
| 42 |
+ (id)new; |
| 43 |
+ (id)alloc; |
| 44 |
- (void)dealloc; |
| 45 |
|
| 46 |
- (void)finalize; |
| 47 |
|
| 48 |
- (id)copy; |
| 49 |
- (id)mutableCopy; |
| 50 |
@end |
| 51 |
|
| 52 |
NS_AUTOMATED_REFCOUNT_UNAVAILABLE |
| 53 |
@interface NSAutoreleasePool : NSObject { |
| 54 |
@private |
| 55 |
void *_token; |
| 56 |
void *_reserved3; |
| 57 |
void *_reserved2; |
| 58 |
void *_reserved; |
| 59 |
} |
| 60 |
|
| 61 |
+ (void)addObject:(id)anObject; |
| 62 |
|
| 63 |
- (void)addObject:(id)anObject; |
| 64 |
|
| 65 |
- (void)drain; |
| 66 |
|
| 67 |
@end |
| 68 |
|
| 69 |
typedef const void* objc_objectptr_t; |
| 70 |
extern __attribute__((ns_returns_retained)) id objc_retainedObject(objc_objectptr_t __attribute__((cf_consumed)) pointer); |
| 71 |
extern __attribute__((ns_returns_not_retained)) id objc_unretainedObject(objc_objectptr_t pointer); |
| 72 |
extern objc_objectptr_t objc_unretainedPointer(id object); |
| 73 |
|
| 74 |
#define dispatch_retain(object) ({ dispatch_object_t _o = (object); _dispatch_object_validate(_o); (void)[_o retain]; }) |
| 75 |
#define dispatch_release(object) ({ dispatch_object_t _o = (object); _dispatch_object_validate(_o); [_o release]; }) |
| 76 |
#define xpc_retain(object) ({ xpc_object_t _o = (object); _xpc_object_validate(_o); [_o retain]; }) |
| 77 |
#define xpc_release(object) ({ xpc_object_t _o = (object); _xpc_object_validate(_o); [_o release]; }) |
| 78 |
|
| 79 |
typedef id dispatch_object_t; |
| 80 |
typedef id xpc_object_t; |
| 81 |
|
| 82 |
void _dispatch_object_validate(dispatch_object_t object); |
| 83 |
void _xpc_object_validate(xpc_object_t object); |
| 84 |
|
| 85 |
#if __has_feature(objc_arc) |
| 86 |
|
| 87 |
NS_INLINE CF_RETURNS_RETAINED CFTypeRef CFBridgingRetain(id X) { |
| 88 |
return (__bridge_retained CFTypeRef)X; |
| 89 |
} |
| 90 |
|
| 91 |
NS_INLINE id CFBridgingRelease(CFTypeRef CF_CONSUMED X) { |
| 92 |
return (__bridge_transfer id)X; |
| 93 |
} |
| 94 |
|
| 95 |
#else |
| 96 |
|
| 97 |
NS_INLINE CF_RETURNS_RETAINED CFTypeRef CFBridgingRetain(id X) { |
| 98 |
return X ? CFRetain((CFTypeRef)X) : NULL; |
| 99 |
} |
| 100 |
|
| 101 |
NS_INLINE id CFBridgingRelease(CFTypeRef CF_CONSUMED X) { |
| 102 |
return [(id)CFMakeCollectable(X) autorelease]; |
| 103 |
} |
| 104 |
|
| 105 |
#endif |
| 106 |
|
| 107 |
void *_Block_copy(const void *aBlock); |
| 108 |
void _Block_release(const void *aBlock); |
| 109 |
#define Block_copy(...) ((__typeof(__VA_ARGS__))_Block_copy((const void *)(__VA_ARGS__))) |
| 110 |
#define Block_release(...) _Block_release((const void *)(__VA_ARGS__)) |