18f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall#if __has_feature(objc_arr)
28f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall#define NS_AUTOMATED_REFCOUNT_UNAVAILABLE __attribute__((unavailable("not available in automatic reference counting mode")))
38f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall#else
48f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall#define NS_AUTOMATED_REFCOUNT_UNAVAILABLE
58f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall#endif
68f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall
7e0ac7454bae910ab3d67a92f6e2e5046d3bb8c1aArgyrios Kyrtzidis#define NS_RETURNS_RETAINED __attribute__((ns_returns_retained))
84532b5553db699d5bed250454f9a45e0f66f4bf8Argyrios Kyrtzidis#define CF_CONSUMED __attribute__((cf_consumed))
9684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios Kyrtzidis#define CF_RETURNS_RETAINED __attribute__((cf_returns_retained))
104532b5553db699d5bed250454f9a45e0f66f4bf8Argyrios Kyrtzidis
11e0ac7454bae910ab3d67a92f6e2e5046d3bb8c1aArgyrios Kyrtzidis#define NS_INLINE static __inline__ __attribute__((always_inline))
1218fd0c6915b45c4daafe18e3cd324c13306f913fArgyrios Kyrtzidis#define nil ((void*) 0)
135d2faa41bc63a2a29535ae3dbbc99daabf14ea2fArgyrios Kyrtzidis#define NULL ((void*)0)
1418fd0c6915b45c4daafe18e3cd324c13306f913fArgyrios Kyrtzidis
158f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCalltypedef int BOOL;
168f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCalltypedef unsigned NSUInteger;
178f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCalltypedef int int32_t;
188f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCalltypedef unsigned char uint8_t;
198f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCalltypedef int32_t UChar32;
208f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCalltypedef unsigned char UChar;
218f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall
2218fd0c6915b45c4daafe18e3cd324c13306f913fArgyrios Kyrtzidistypedef struct _NSZone NSZone;
2318fd0c6915b45c4daafe18e3cd324c13306f913fArgyrios Kyrtzidis
2418fd0c6915b45c4daafe18e3cd324c13306f913fArgyrios Kyrtzidistypedef const void * CFTypeRef;
2518fd0c6915b45c4daafe18e3cd324c13306f913fArgyrios KyrtzidisCFTypeRef CFRetain(CFTypeRef cf);
26684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios KyrtzidisCFTypeRef CFMakeCollectable(CFTypeRef cf) NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
27e0ac7454bae910ab3d67a92f6e2e5046d3bb8c1aArgyrios Kyrtzidis
28e0ac7454bae910ab3d67a92f6e2e5046d3bb8c1aArgyrios KyrtzidisNS_INLINE NS_RETURNS_RETAINED id NSMakeCollectable(CFTypeRef CF_CONSUMED cf) NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
2918fd0c6915b45c4daafe18e3cd324c13306f913fArgyrios Kyrtzidis
308f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall@protocol NSObject
318f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall- (BOOL)isEqual:(id)object;
3218fd0c6915b45c4daafe18e3cd324c13306f913fArgyrios Kyrtzidis- (NSZone *)zone NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
338f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall- (id)retain NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
348f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall- (NSUInteger)retainCount NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
358f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall- (oneway void)release NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
368f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall- (id)autorelease NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
378f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall@end
388f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall
398f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall@interface NSObject <NSObject> {}
408f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall- (id)init;
418f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall
428f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall+ (id)new;
438f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall+ (id)alloc;
448f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall- (void)dealloc;
458f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall
468f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall- (void)finalize;
478f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall
488f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall- (id)copy;
498f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall- (id)mutableCopy;
508f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall@end
518f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall
528f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCallNS_AUTOMATED_REFCOUNT_UNAVAILABLE
538f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall@interface NSAutoreleasePool : NSObject {
548f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall@private
558f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall    void    *_token;
568f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall    void    *_reserved3;
578f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall    void    *_reserved2;
588f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall    void    *_reserved;
598f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall}
608f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall
618f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall+ (void)addObject:(id)anObject;
628f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall
638f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall- (void)addObject:(id)anObject;
648f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall
658f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall- (void)drain;
668f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall
678f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall@end
688f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCall
698f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCalltypedef const void* objc_objectptr_t;
708f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCallextern __attribute__((ns_returns_retained)) id objc_retainedObject(objc_objectptr_t __attribute__((cf_consumed)) pointer);
718f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCallextern __attribute__((ns_returns_not_retained)) id objc_unretainedObject(objc_objectptr_t pointer);
728f0e8d22960d56f8390f4971e2c0f2f0a0884602John McCallextern objc_objectptr_t objc_unretainedPointer(id object);
731b8fbd3601e009803565e74d2ec54abecb5cbf73Argyrios Kyrtzidis
741b8fbd3601e009803565e74d2ec54abecb5cbf73Argyrios Kyrtzidis#define dispatch_retain(object) ({ dispatch_object_t _o = (object); _dispatch_object_validate(_o); (void)[_o retain]; })
751b8fbd3601e009803565e74d2ec54abecb5cbf73Argyrios Kyrtzidis#define dispatch_release(object) ({ dispatch_object_t _o = (object); _dispatch_object_validate(_o); [_o release]; })
761b8fbd3601e009803565e74d2ec54abecb5cbf73Argyrios Kyrtzidis#define xpc_retain(object) ({ xpc_object_t _o = (object); _xpc_object_validate(_o); [_o retain]; })
771b8fbd3601e009803565e74d2ec54abecb5cbf73Argyrios Kyrtzidis#define xpc_release(object) ({ xpc_object_t _o = (object); _xpc_object_validate(_o); [_o release]; })
781b8fbd3601e009803565e74d2ec54abecb5cbf73Argyrios Kyrtzidis
791b8fbd3601e009803565e74d2ec54abecb5cbf73Argyrios Kyrtzidistypedef id dispatch_object_t;
801b8fbd3601e009803565e74d2ec54abecb5cbf73Argyrios Kyrtzidistypedef id xpc_object_t;
811b8fbd3601e009803565e74d2ec54abecb5cbf73Argyrios Kyrtzidis
821b8fbd3601e009803565e74d2ec54abecb5cbf73Argyrios Kyrtzidisvoid _dispatch_object_validate(dispatch_object_t object);
831b8fbd3601e009803565e74d2ec54abecb5cbf73Argyrios Kyrtzidisvoid _xpc_object_validate(xpc_object_t object);
84684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios Kyrtzidis
85684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios Kyrtzidis#if __has_feature(objc_arc)
86684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios Kyrtzidis
87684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios KyrtzidisNS_INLINE CF_RETURNS_RETAINED CFTypeRef CFBridgingRetain(id X) {
88684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios Kyrtzidis    return (__bridge_retained CFTypeRef)X;
89684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios Kyrtzidis}
90684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios Kyrtzidis
91684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios KyrtzidisNS_INLINE id CFBridgingRelease(CFTypeRef CF_CONSUMED X) {
92684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios Kyrtzidis    return (__bridge_transfer id)X;
93684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios Kyrtzidis}
94684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios Kyrtzidis
95684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios Kyrtzidis#else
96684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios Kyrtzidis
97684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios KyrtzidisNS_INLINE CF_RETURNS_RETAINED CFTypeRef CFBridgingRetain(id X) {
98684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios Kyrtzidis    return X ? CFRetain((CFTypeRef)X) : NULL;
99684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios Kyrtzidis}
100684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios Kyrtzidis
101684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios KyrtzidisNS_INLINE id CFBridgingRelease(CFTypeRef CF_CONSUMED X) {
102684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios Kyrtzidis    return [(id)CFMakeCollectable(X) autorelease];
103684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios Kyrtzidis}
104684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios Kyrtzidis
105684190b8dbe5258f4708ffbd816b8c5ee5b3502dArgyrios Kyrtzidis#endif
1065d2faa41bc63a2a29535ae3dbbc99daabf14ea2fArgyrios Kyrtzidis
1075d2faa41bc63a2a29535ae3dbbc99daabf14ea2fArgyrios Kyrtzidisvoid *_Block_copy(const void *aBlock);
1085d2faa41bc63a2a29535ae3dbbc99daabf14ea2fArgyrios Kyrtzidisvoid _Block_release(const void *aBlock);
1095d2faa41bc63a2a29535ae3dbbc99daabf14ea2fArgyrios Kyrtzidis#define Block_copy(...) ((__typeof(__VA_ARGS__))_Block_copy((const void *)(__VA_ARGS__)))
1105d2faa41bc63a2a29535ae3dbbc99daabf14ea2fArgyrios Kyrtzidis#define Block_release(...) _Block_release((const void *)(__VA_ARGS__))
111