-
Notifications
You must be signed in to change notification settings - Fork 284
/
Copy pathobjc-common.g
68 lines (59 loc) · 1.26 KB
/
objc-common.g
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* Common information for all objc runtime tests.
*/
#include <stdlib.h>
#include <objc/objc.h>
#if __GNU_LIBOBJC__
# include <objc/runtime.h>
# include <objc/message.h>
#else
# include <objc/objc-api.h>
#endif
#include <objc/Object.h>
#ifdef __GNUSTEP_RUNTIME__
#include <objc/hooks.h>
#endif
/* Provide an implementation of NXConstantString for an old libobjc when
built stand-alone without an NXConstantString implementation. */
#if !defined(NeXT_RUNTIME) && !defined(__GNUSTEP_RUNTIME__)
@implementation NXConstantString
- (const char*) cString
{
return 0;
}
- (unsigned int) length
{
return 0;
}
@end
#endif
#if HAVE_OBJC_ROOT_CLASS_ATTRIBUTE
#define GS_OBJC_ROOT_CLASS __attribute__((objc_root_class))
#else
#define GS_OBJC_ROOT_CLASS
#endif
#if !defined(__APPLE__)
/* Provide dummy implementations for NSObject and NSConstantString
* for libobjc2 which needs them.
*/
GS_OBJC_ROOT_CLASS @interface NSObject
{
id isa;
}
@end
@implementation NSObject
+ (id)new
{
NSObject *obj = calloc(sizeof(id), 1);
obj->isa = self;
return obj;
}
#if defined(NeXT_RUNTIME)
/* The Apple runtime always calls this method */
+ (void)initialize { }
#endif
@end
@interface NSConstantString : NSObject
@end
@implementation NSConstantString
@end
#endif /* __APPLE__ */