Before this change, func Hello() of mypkg package generated a function GoMypkg_Hello to distinguish the prefix from the function name. It seems the use of '_' is very rare in Objective-C though. After this change, it generates GoMypkgHello. Change-Id: Ic7aa2b667363a447a5ff3500262502d3137d6853 Reviewed-on: https://go-review.googlesource.com/11893 Reviewed-by: Damien Neil <dneil@google.com>
150 lines
3.9 KiB
Plaintext
150 lines
3.9 KiB
Plaintext
// Objective-C API for talking to structs Go package.
|
|
// gobind -lang=objc structs
|
|
//
|
|
// File is generated by gobind. Do not edit.
|
|
|
|
#include "GoStructs.h"
|
|
#include <Foundation/Foundation.h>
|
|
#include "seq.h"
|
|
|
|
static NSString *errDomain = @"go.structs";
|
|
|
|
#define _DESCRIPTOR_ "structs"
|
|
|
|
#define _CALL_Identity_ 1
|
|
#define _CALL_IdentityWithError_ 2
|
|
|
|
#define _GO_structs_S_DESCRIPTOR_ "go.structs.S"
|
|
#define _GO_structs_S_FIELD_X_GET_ (0x00f)
|
|
#define _GO_structs_S_FIELD_X_SET_ (0x01f)
|
|
#define _GO_structs_S_FIELD_Y_GET_ (0x10f)
|
|
#define _GO_structs_S_FIELD_Y_SET_ (0x11f)
|
|
#define _GO_structs_S_Identity_ (0x00c)
|
|
#define _GO_structs_S_Sum_ (0x10c)
|
|
|
|
@implementation GoStructsS {
|
|
}
|
|
|
|
- (id)initWithRef:(GoSeqRef*)ref {
|
|
self = [super init];
|
|
if (self) { _ref = ref; }
|
|
return self;
|
|
}
|
|
|
|
- (double)X {
|
|
GoSeq in_ = {};
|
|
GoSeq out_ = {};
|
|
go_seq_writeRef(&in_, self.ref);
|
|
go_seq_send(_GO_structs_S_DESCRIPTOR_, _GO_structs_S_FIELD_X_GET_, &in_, &out_);
|
|
double ret_ = go_seq_readFloat64(&out_);
|
|
go_seq_free(&in_);
|
|
go_seq_free(&out_);
|
|
return ret_;
|
|
}
|
|
|
|
- (void)setX:(double)v {
|
|
GoSeq in_ = {};
|
|
GoSeq out_ = {};
|
|
go_seq_writeRef(&in_, self.ref);
|
|
go_seq_writeFloat64(&in_, v);
|
|
go_seq_send(_GO_structs_S_DESCRIPTOR_, _GO_structs_S_FIELD_X_SET_, &in_, &out_);
|
|
go_seq_free(&in_);
|
|
go_seq_free(&out_);
|
|
}
|
|
|
|
- (double)Y {
|
|
GoSeq in_ = {};
|
|
GoSeq out_ = {};
|
|
go_seq_writeRef(&in_, self.ref);
|
|
go_seq_send(_GO_structs_S_DESCRIPTOR_, _GO_structs_S_FIELD_Y_GET_, &in_, &out_);
|
|
double ret_ = go_seq_readFloat64(&out_);
|
|
go_seq_free(&in_);
|
|
go_seq_free(&out_);
|
|
return ret_;
|
|
}
|
|
|
|
- (void)setY:(double)v {
|
|
GoSeq in_ = {};
|
|
GoSeq out_ = {};
|
|
go_seq_writeRef(&in_, self.ref);
|
|
go_seq_writeFloat64(&in_, v);
|
|
go_seq_send(_GO_structs_S_DESCRIPTOR_, _GO_structs_S_FIELD_Y_SET_, &in_, &out_);
|
|
go_seq_free(&in_);
|
|
go_seq_free(&out_);
|
|
}
|
|
|
|
- (BOOL)Identity:(GoStructsS**)ret0_ error:(NSError**)error {
|
|
GoSeq in_ = {};
|
|
GoSeq out_ = {};
|
|
go_seq_writeRef(&in_, self.ref);
|
|
go_seq_send(_GO_structs_S_DESCRIPTOR_, _GO_structs_S_Identity_, &in_, &out_);
|
|
GoSeqRef* ret0__ref = go_seq_readRef(&out_);
|
|
if (ret0_ != NULL) {
|
|
*ret0_ = ret0__ref.obj;
|
|
if (*ret0_ == NULL) {
|
|
*ret0_ = [[GoStructsS alloc] initWithRef:ret0__ref];
|
|
}
|
|
}
|
|
NSString* _error = go_seq_readUTF8(&out_);
|
|
if ([_error length] != 0 && error != nil) {
|
|
NSMutableDictionary *details = [NSMutableDictionary dictionary];
|
|
[details setValue:_error forKey:NSLocalizedDescriptionKey];
|
|
*error = [NSError errorWithDomain:errDomain code:1 userInfo:details];
|
|
}
|
|
go_seq_free(&in_);
|
|
go_seq_free(&out_);
|
|
return ([_error length] == 0);
|
|
}
|
|
|
|
- (double)Sum {
|
|
GoSeq in_ = {};
|
|
GoSeq out_ = {};
|
|
go_seq_writeRef(&in_, self.ref);
|
|
go_seq_send(_GO_structs_S_DESCRIPTOR_, _GO_structs_S_Sum_, &in_, &out_);
|
|
double ret0_ = go_seq_readFloat64(&out_);
|
|
go_seq_free(&in_);
|
|
go_seq_free(&out_);
|
|
return ret0_;
|
|
}
|
|
|
|
@end
|
|
|
|
GoStructsS* GoStructsIdentity(GoStructsS* s) {
|
|
GoSeq in_ = {};
|
|
GoSeq out_ = {};
|
|
go_seq_writeRef(&in_, s.ref);
|
|
go_seq_send(_DESCRIPTOR_, _CALL_Identity_, &in_, &out_);
|
|
GoSeqRef* ret0__ref = go_seq_readRef(&out_);
|
|
GoStructsS* ret0_ = ret0__ref.obj;
|
|
if (ret0_ == NULL) {
|
|
ret0_ = [[GoStructsS alloc] initWithRef:ret0__ref];
|
|
}
|
|
go_seq_free(&in_);
|
|
go_seq_free(&out_);
|
|
return ret0_;
|
|
}
|
|
|
|
BOOL GoStructsIdentityWithError(GoStructsS* s, GoStructsS** ret0_, NSError** error) {
|
|
GoSeq in_ = {};
|
|
GoSeq out_ = {};
|
|
go_seq_writeRef(&in_, s.ref);
|
|
go_seq_send(_DESCRIPTOR_, _CALL_IdentityWithError_, &in_, &out_);
|
|
GoSeqRef* ret0__ref = go_seq_readRef(&out_);
|
|
if (ret0_ != NULL) {
|
|
*ret0_ = ret0__ref.obj;
|
|
if (*ret0_ == NULL) {
|
|
*ret0_ = [[GoStructsS alloc] initWithRef:ret0__ref];
|
|
}
|
|
}
|
|
NSString* _error = go_seq_readUTF8(&out_);
|
|
if ([_error length] != 0 && error != nil) {
|
|
NSMutableDictionary *details = [NSMutableDictionary dictionary];
|
|
[details setValue:_error forKey:NSLocalizedDescriptionKey];
|
|
*error = [NSError errorWithDomain:errDomain code:1 userInfo:details];
|
|
}
|
|
go_seq_free(&in_);
|
|
go_seq_free(&out_);
|
|
return ([_error length] == 0);
|
|
}
|
|
|