2011-06-16 07:25:17 +08:00
|
|
|
#if __has_feature(objc_arr)
|
|
|
|
#define NS_AUTOMATED_REFCOUNT_UNAVAILABLE __attribute__((unavailable("not available in automatic reference counting mode")))
|
|
|
|
#else
|
|
|
|
#define NS_AUTOMATED_REFCOUNT_UNAVAILABLE
|
|
|
|
#endif
|
|
|
|
|
2011-11-04 23:58:08 +08:00
|
|
|
#define NS_RETURNS_RETAINED __attribute__((ns_returns_retained))
|
2011-09-15 02:17:09 +08:00
|
|
|
#define CF_CONSUMED __attribute__((cf_consumed))
|
2012-06-01 08:10:47 +08:00
|
|
|
#define CF_RETURNS_RETAINED __attribute__((cf_returns_retained))
|
2011-09-15 02:17:09 +08:00
|
|
|
|
2011-11-04 23:58:08 +08:00
|
|
|
#define NS_INLINE static __inline__ __attribute__((always_inline))
|
2011-07-27 13:28:18 +08:00
|
|
|
#define nil ((void*) 0)
|
2013-01-03 11:17:17 +08:00
|
|
|
#define NULL ((void*)0)
|
2011-07-27 13:28:18 +08:00
|
|
|
|
2011-06-16 07:25:17 +08:00
|
|
|
typedef int BOOL;
|
|
|
|
typedef unsigned NSUInteger;
|
|
|
|
typedef int int32_t;
|
|
|
|
typedef unsigned char uint8_t;
|
|
|
|
typedef int32_t UChar32;
|
|
|
|
typedef unsigned char UChar;
|
|
|
|
|
2011-07-27 13:28:18 +08:00
|
|
|
typedef struct _NSZone NSZone;
|
|
|
|
|
|
|
|
typedef const void * CFTypeRef;
|
|
|
|
CFTypeRef CFRetain(CFTypeRef cf);
|
2012-06-01 08:10:47 +08:00
|
|
|
CFTypeRef CFMakeCollectable(CFTypeRef cf) NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
|
2011-11-04 23:58:08 +08:00
|
|
|
|
|
|
|
NS_INLINE NS_RETURNS_RETAINED id NSMakeCollectable(CFTypeRef CF_CONSUMED cf) NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
|
2011-07-27 13:28:18 +08:00
|
|
|
|
2011-06-16 07:25:17 +08:00
|
|
|
@protocol NSObject
|
|
|
|
- (BOOL)isEqual:(id)object;
|
2011-07-27 13:28:18 +08:00
|
|
|
- (NSZone *)zone NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
|
2011-06-16 07:25:17 +08:00
|
|
|
- (id)retain NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
|
|
|
|
- (NSUInteger)retainCount NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
|
|
|
|
- (oneway void)release NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
|
|
|
|
- (id)autorelease NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface NSObject <NSObject> {}
|
|
|
|
- (id)init;
|
|
|
|
|
|
|
|
+ (id)new;
|
|
|
|
+ (id)alloc;
|
|
|
|
- (void)dealloc;
|
|
|
|
|
|
|
|
- (void)finalize;
|
|
|
|
|
|
|
|
- (id)copy;
|
|
|
|
- (id)mutableCopy;
|
|
|
|
@end
|
|
|
|
|
|
|
|
NS_AUTOMATED_REFCOUNT_UNAVAILABLE
|
|
|
|
@interface NSAutoreleasePool : NSObject {
|
|
|
|
@private
|
|
|
|
void *_token;
|
|
|
|
void *_reserved3;
|
|
|
|
void *_reserved2;
|
|
|
|
void *_reserved;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (void)addObject:(id)anObject;
|
|
|
|
|
|
|
|
- (void)addObject:(id)anObject;
|
|
|
|
|
|
|
|
- (void)drain;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
typedef const void* objc_objectptr_t;
|
|
|
|
extern __attribute__((ns_returns_retained)) id objc_retainedObject(objc_objectptr_t __attribute__((cf_consumed)) pointer);
|
|
|
|
extern __attribute__((ns_returns_not_retained)) id objc_unretainedObject(objc_objectptr_t pointer);
|
|
|
|
extern objc_objectptr_t objc_unretainedPointer(id object);
|
2012-05-24 05:50:04 +08:00
|
|
|
|
|
|
|
#define dispatch_retain(object) ({ dispatch_object_t _o = (object); _dispatch_object_validate(_o); (void)[_o retain]; })
|
|
|
|
#define dispatch_release(object) ({ dispatch_object_t _o = (object); _dispatch_object_validate(_o); [_o release]; })
|
|
|
|
#define xpc_retain(object) ({ xpc_object_t _o = (object); _xpc_object_validate(_o); [_o retain]; })
|
|
|
|
#define xpc_release(object) ({ xpc_object_t _o = (object); _xpc_object_validate(_o); [_o release]; })
|
|
|
|
|
|
|
|
typedef id dispatch_object_t;
|
|
|
|
typedef id xpc_object_t;
|
|
|
|
|
|
|
|
void _dispatch_object_validate(dispatch_object_t object);
|
|
|
|
void _xpc_object_validate(xpc_object_t object);
|
2012-06-01 08:10:47 +08:00
|
|
|
|
|
|
|
#if __has_feature(objc_arc)
|
|
|
|
|
|
|
|
NS_INLINE CF_RETURNS_RETAINED CFTypeRef CFBridgingRetain(id X) {
|
|
|
|
return (__bridge_retained CFTypeRef)X;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_INLINE id CFBridgingRelease(CFTypeRef CF_CONSUMED X) {
|
|
|
|
return (__bridge_transfer id)X;
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
NS_INLINE CF_RETURNS_RETAINED CFTypeRef CFBridgingRetain(id X) {
|
|
|
|
return X ? CFRetain((CFTypeRef)X) : NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_INLINE id CFBridgingRelease(CFTypeRef CF_CONSUMED X) {
|
|
|
|
return [(id)CFMakeCollectable(X) autorelease];
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2013-01-03 11:17:17 +08:00
|
|
|
|
|
|
|
void *_Block_copy(const void *aBlock);
|
|
|
|
void _Block_release(const void *aBlock);
|
|
|
|
#define Block_copy(...) ((__typeof(__VA_ARGS__))_Block_copy((const void *)(__VA_ARGS__)))
|
|
|
|
#define Block_release(...) _Block_release((const void *)(__VA_ARGS__))
|