Files
kotlin-fork/kotlin-native/backend.native/tests/interop/objc/smoke.h
T
Stanislav Erokhin f624800b84 Move everything under kotlin-native folder
I was forced to manually do update the following files, because otherwise
they would be ignored according .gitignore settings. Probably they
should be deleted from repo.

Interop/.idea/compiler.xml
Interop/.idea/gradle.xml
Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_3.xml
Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_3.xml
Interop/.idea/modules.xml
Interop/.idea/modules/Indexer/Indexer.iml
Interop/.idea/modules/Runtime/Runtime.iml
Interop/.idea/modules/StubGenerator/StubGenerator.iml
backend.native/backend.native.iml
backend.native/bc.frontend/bc.frontend.iml
backend.native/cli.bc/cli.bc.iml
backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt
backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt
backend.native/tests/link/lib/foo.kt
backend.native/tests/link/lib/foo2.kt
backend.native/tests/teamcity-test.property
2020-10-27 21:00:28 +03:00

118 lines
2.5 KiB
Objective-C

#import <objc/NSObject.h>
#import <CoreFoundation/CoreFoundation.h>
@class Foo;
@protocol Printer;
@protocol Printer;
@protocol Empty
@end;
@protocol Forward;
@class Forward;
void useForward1(Forward * p) {}
void useForward2(id<Forward> p) {}
typedef NSString NSStringTypedef;
@interface Foo : NSObject <Empty>
@property NSStringTypedef* name;
-(void)helloWithPrinter:(id <Printer>)printer;
@end;
@interface Foo (FooExtensions)
-(void)hello;
@end;
@protocol Printer
@required
-(void)print:(const char*)string;
@end;
@protocol MutablePair
@required
@property (readonly) int first;
@property (readonly) int second;
-(void)update:(int)index add:(int)delta;
-(void)update:(int)index sub:(int)delta;
@end;
void replacePairElements(id <MutablePair> pair, int first, int second);
int invoke1(int arg, int (^block)(int)) {
return block(arg);
}
void invoke2(void (^block)(void)) {
block();
}
int (^getSupplier(int x))(void);
Class (^ _Nonnull getClassGetter(NSObject* obj))(void);
extern NSString* globalString;
extern NSObject* globalObject;
int formatStringLength(NSString* format, ...);
#define STRING_MACRO @"String macro"
#define CFSTRING_MACRO CFSTR("CFString macro")
typedef NS_ENUM(int32_t, ForwardDeclaredEnum);
typedef NS_ENUM(int32_t, ForwardDeclaredEnum) {
ZERO, ONE, TWO,
};
@protocol ObjectFactory
@required
-(id)create;
@end;
id createObjectWithFactory(id<ObjectFactory> factory) {
return [factory create];
}
@protocol CustomRetainMethods
@required
-(id)returnRetained:(id)obj __attribute__((ns_returns_retained));
-(void)consume:(id) __attribute__((ns_consumed)) obj;
-(void)consumeSelf __attribute__((ns_consumes_self));
-(void (^)(void))returnRetainedBlock:(void (^)(void))block __attribute__((ns_returns_retained));
@end;
extern BOOL unexpectedDeallocation;
@interface MustNotBeDeallocated : NSObject
@end;
@interface CustomRetainMethodsImpl : MustNotBeDeallocated <CustomRetainMethods>
@end;
static MustNotBeDeallocated* retainedObj;
static void (^retainedBlock)(void);
void useCustomRetainMethods(id<CustomRetainMethods> p) {
MustNotBeDeallocated* obj = [MustNotBeDeallocated new];
retainedObj = obj; // Retain to detect possible over-release.
[p returnRetained:obj];
[p consume:p];
[p consumeSelf];
MustNotBeDeallocated* capturedObj = [MustNotBeDeallocated new];
retainedBlock = ^{ [capturedObj description]; }; // Retain to detect possible over-release.
[p returnRetainedBlock:retainedBlock]();
}
id getPrinterProtocolRaw() {
return @protocol(Printer);
}
Protocol* getPrinterProtocol() {
return @protocol(Printer);
}