2010-02-15 09:35:20 +00:00
|
|
|
/* Common information for all objc runtime tests.
|
|
|
|
*/
|
2011-08-17 11:46:06 +00:00
|
|
|
#include <stdlib.h>
|
2010-02-15 09:35:20 +00:00
|
|
|
#include <objc/objc.h>
|
2010-12-22 23:47:12 +00:00
|
|
|
|
|
|
|
#if __GNU_LIBOBJC__
|
|
|
|
# include <objc/runtime.h>
|
|
|
|
# include <objc/message.h>
|
|
|
|
#else
|
|
|
|
# include <objc/objc-api.h>
|
|
|
|
#endif
|
2010-02-15 09:35:20 +00:00
|
|
|
|
|
|
|
#include <objc/Object.h>
|
|
|
|
|
2010-09-09 23:22:46 +00:00
|
|
|
#ifdef __GNUSTEP_RUNTIME__
|
|
|
|
#include <objc/hooks.h>
|
|
|
|
#endif
|
|
|
|
|
2010-12-22 23:47:12 +00:00
|
|
|
/* Provide an implementation of NXConstantString for an old libobjc when
|
|
|
|
built stand-alone without an NXConstantString implementation. */
|
2010-09-09 23:22:46 +00:00
|
|
|
#if !defined(NeXT_RUNTIME) && !defined(__GNUSTEP_RUNTIME__)
|
2013-02-17 15:51:57 +00:00
|
|
|
@implementation NXConstantString
|
2010-02-15 09:35:20 +00:00
|
|
|
- (const char*) cString
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
- (unsigned int) length
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
#endif
|
|
|
|
|
2016-08-19 12:20:24 +00:00
|
|
|
#if HAVE_OBJC_ROOT_CLASS_ATTRIBUTE
|
|
|
|
#define GS_OBJC_ROOT_CLASS __attribute__((objc_root_class))
|
|
|
|
#else
|
|
|
|
#define GS_OBJC_ROOT_CLASS
|
|
|
|
#endif
|
|
|
|
|
2017-03-17 09:22:57 +00:00
|
|
|
#if !defined(__APPLE__)
|
|
|
|
|
2010-02-15 09:35:20 +00:00
|
|
|
/* Provide dummy implementations for NSObject and NSConstantString
|
2010-12-22 23:47:12 +00:00
|
|
|
* for libobjc2 which needs them.
|
2010-02-15 09:35:20 +00:00
|
|
|
*/
|
2012-08-16 12:31:16 +00:00
|
|
|
GS_OBJC_ROOT_CLASS @interface NSObject
|
2010-10-16 20:43:33 +00:00
|
|
|
{
|
2010-09-09 23:22:46 +00:00
|
|
|
id isa;
|
2010-10-16 20:43:33 +00:00
|
|
|
}
|
2010-02-15 09:35:20 +00:00
|
|
|
@end
|
|
|
|
@implementation NSObject
|
2011-02-10 18:54:37 +00:00
|
|
|
+ (id)new
|
|
|
|
{
|
|
|
|
NSObject *obj = calloc(sizeof(id), 1);
|
|
|
|
obj->isa = self;
|
|
|
|
return obj;
|
|
|
|
}
|
2013-07-14 16:45:29 +00:00
|
|
|
#if defined(NeXT_RUNTIME)
|
|
|
|
/* The Apple runtime always calls this method */
|
|
|
|
+ (void)initialize { }
|
|
|
|
#endif
|
2010-02-15 09:35:20 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
@interface NSConstantString : NSObject
|
|
|
|
@end
|
|
|
|
@implementation NSConstantString
|
|
|
|
@end
|
2016-08-19 12:20:24 +00:00
|
|
|
#endif /* __APPLE__ */
|
|
|
|
|