1 /* Copyright (c) 2006-2007 Christopher J. W. Lloyd
3 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
15 #define FOUNDATION_DLLEXPORT
16 #define FOUNDATION_DLLIMPORT
18 #define FOUNDATION_DLLEXPORT __declspec(dllexport)
19 #define FOUNDATION_DLLIMPORT __declspec(dllimport)
24 #if defined(__WIN32__)
25 #if defined(FOUNDATION_INSIDE_BUILD)
26 #define FOUNDATION_EXPORT extern "C" FOUNDATION_DLLEXPORT
28 #define FOUNDATION_EXPORT extern "C" FOUNDATION_DLLIMPORT
31 #define FOUNDATION_EXPORT extern "C"
36 #if defined(__WIN32__)
37 #if defined(FOUNDATION_INSIDE_BUILD)
38 #define FOUNDATION_EXPORT FOUNDATION_DLLEXPORT extern
40 #define FOUNDATION_EXPORT FOUNDATION_DLLIMPORT extern
43 #define FOUNDATION_EXPORT extern
48 #define NS_INLINE static inline
51 #define NS_ROOT_CLASS __attribute__((objc_root_class))
57 #define __has_feature(x) 0
60 #ifndef __has_extension
61 #define __has_extension(x) 0
64 #ifndef __has_attribute
65 #define __has_attribute(x) 0
68 #if __has_feature(attribute_ns_returns_retained)
69 #define NS_RETURNS_RETAINED __attribute__((ns_returns_retained))
71 #define NS_RETURNS_RETAINED
74 #if __has_feature(attribute_ns_returns_not_retained)
75 #define NS_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained))
77 #define NS_RETURNS_NOT_RETAINED
80 #ifndef CF_RETURNS_RETAINED
81 #if __has_feature(attribute_cf_returns_retained)
82 #define CF_RETURNS_RETAINED __attribute__((cf_returns_retained))
84 #define CF_RETURNS_RETAINED
90 #define NSINTEGER_DEFINED 1
93 typedef long NSInteger
;
94 typedef unsigned long NSUInteger
;
95 #define NSIntegerMax LONG_MAX
96 #define NSIntegerMin LONG_MIN
97 #define NSUIntegerMax ULONG_MAX
98 #define NSIntegerFormat "%ld"
99 #define NSUIntegerFormat "%lu"
101 typedef int NSInteger
;
102 typedef unsigned int NSUInteger
;
103 #define NSIntegerMax INT_MAX
104 #define NSIntegerMin INT_MIN
105 #define NSUIntegerMax UINT_MAX
106 #define NSIntegerFormat "%d"
107 #define NSUIntegerFormat "%u"
111 NSOrderedAscending
= -1,
113 NSOrderedDescending
= 1
116 typedef NSInteger NSComparisonResult
;
118 #define NSNotFound NSIntegerMax
121 #define MIN(a, b) ({__typeof__(a) _a = (a); __typeof__(b) _b = (b); (_a < _b) ? _a : _b; })
123 #warning MIN is already defined, MIN(a, b) may not behave as expected.
127 #define MAX(a, b) ({__typeof__(a) _a = (a); __typeof__(b) _b = (b); (_a > _b) ? _a : _b; })
129 #warning MAX is already defined, MAX(a, b) may not not behave as expected.
133 #define ABS(a) ({__typeof__(a) _a = (a); (_a < 0) ? -_a : _a; })
135 #warning ABS is already defined, ABS(a) may not behave as expected.
139 #define NS_ENUM(_type, _name) \
145 #define NS_OPTIONS(_type, _name) \
150 FOUNDATION_EXPORT
void NSLog(NSString
*format
, ...);
151 FOUNDATION_EXPORT
void NSLogv(NSString
*format
, va_list args
);
153 FOUNDATION_EXPORT
const char *NSGetSizeAndAlignment(const char *type
, NSUInteger
*size
, NSUInteger
*alignment
);
155 FOUNDATION_EXPORT SEL
NSSelectorFromString(NSString
*selectorName
);
156 FOUNDATION_EXPORT NSString
*NSStringFromSelector(SEL selector
);
158 FOUNDATION_EXPORT Class
NSClassFromString(NSString
*className
);
159 FOUNDATION_EXPORT NSString
*NSStringFromClass(Class aClass
);