]>
git.saurik.com Git - apple/objc4.git/blob - runtime/objc.h
2 * Copyright (c) 1999-2007 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
25 * Copyright 1988-1996, NeXT Software, Inc.
31 #include <sys/types.h> // for __DARWIN_NULL
32 #include <Availability.h>
33 #include <objc/objc-api.h>
36 typedef struct objc_class
*Class
;
37 typedef struct objc_object
{
42 typedef struct objc_selector
*SEL
;
44 #if !OBJC_OLD_DISPATCH_PROTOTYPES
45 typedef void (*IMP
)(void /* id, SEL, ... */ );
47 typedef id (*IMP
)(id
, SEL
, ...);
50 #define OBJC_BOOL_DEFINED
52 typedef signed char BOOL
;
53 // BOOL is explicitly signed so @encode(BOOL) == "c" rather than "C"
54 // even if -funsigned-char is used.
56 #if __has_feature(objc_bool)
57 #define YES __objc_yes
65 # if __has_feature(cxx_nullptr)
68 # define Nil __DARWIN_NULL
73 # if __has_feature(cxx_nullptr)
76 # define nil __DARWIN_NULL
80 #if ! (defined(__OBJC_GC__) || __has_feature(objc_arr))
81 #define __strong /* empty */
84 #if !__has_feature(objc_arr)
85 #define __unsafe_unretained /* empty */
86 #define __autoreleasing /* empty */
90 OBJC_EXPORT
const char *sel_getName(SEL sel
)
91 __OSX_AVAILABLE_STARTING(__MAC_10_0
, __IPHONE_2_0
);
92 OBJC_EXPORT SEL
sel_registerName(const char *str
)
93 __OSX_AVAILABLE_STARTING(__MAC_10_0
, __IPHONE_2_0
);
94 OBJC_EXPORT
const char *object_getClassName(id obj
)
95 __OSX_AVAILABLE_STARTING(__MAC_10_0
, __IPHONE_2_0
);
96 OBJC_EXPORT
void *object_getIndexedIvars(id obj
)
97 __OSX_AVAILABLE_STARTING(__MAC_10_0
, __IPHONE_2_0
);
98 OBJC_EXPORT BOOL
sel_isMapped(SEL sel
)
99 __OSX_AVAILABLE_STARTING(__MAC_10_0
, __IPHONE_2_0
);
100 OBJC_EXPORT SEL
sel_getUid(const char *str
)
101 __OSX_AVAILABLE_STARTING(__MAC_10_0
, __IPHONE_2_0
);
104 // Obsolete ARC conversions. Deprecation forthcoming.
105 // Use CFBridgingRetain, CFBridgingRelease, and __bridge casts instead.
107 typedef const void* objc_objectptr_t
;
109 #if __has_feature(objc_arc)
110 # define objc_retainedObject(o) ((__bridge_transfer id)(objc_objectptr_t)(o))
111 # define objc_unretainedObject(o) ((__bridge id)(objc_objectptr_t)(o))
112 # define objc_unretainedPointer(o) ((__bridge objc_objectptr_t)(id)(o))
114 # define objc_retainedObject(o) ((id)(objc_objectptr_t)(o))
115 # define objc_unretainedObject(o) ((id)(objc_objectptr_t)(o))
116 # define objc_unretainedPointer(o) ((objc_objectptr_t)(id)(o))
122 // The following declarations are provided here for source compatibility.
124 #if defined(__LP64__)
125 typedef long arith_t
;
126 typedef unsigned long uarith_t
;
127 # define ARITH_SHIFT 32
130 typedef unsigned uarith_t
;
131 # define ARITH_SHIFT 16
136 #define ISSELECTOR(sel) sel_isMapped(sel)
137 #define SELNAME(sel) sel_getName(sel)
138 #define SELUID(str) sel_getUid(str)
139 #define NAMEOF(obj) object_getClassName(obj)
140 #define IV(obj) object_getIndexedIvars(obj)
144 #endif /* _OBJC_OBJC_H_ */