bind/objc: use gobind -lang=objc,go to generate code.

Removed checked-in version of go, objective-c proxy code.

Change-Id: Iac2c6ba3156def680746b5ae1fe02d6e712532a7
Reviewed-on: https://go-review.googlesource.com/10842
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
Hyang-Ah (Hana) Kim 2015-06-07 14:15:51 -04:00 коммит произвёл Hyang-Ah Hana Kim
Родитель 26f6ffe0b5
Коммит 9c7482eec9
5 изменённых файлов: 3 добавлений и 340 удалений

Просмотреть файл

@ -18,6 +18,8 @@ function cleanup() {
}
trap cleanup EXIT
(cd testpkg; go generate)
# TODO: package seq.h Testpkg.* and gooutput.a into a statically linked framework.
go build -x -v -buildmode=c-archive -o=${WORK}/libgo.a test_main.go
cp ./seq.h ${WORK}/

Просмотреть файл

@ -1,122 +0,0 @@
// Package go_testpkg is an autogenerated binder stub for package testpkg.
// gobind -lang=go golang.org/x/mobile/bind/objc/testpkg
//
// File is generated by gobind. Do not edit.
package go_testpkg
import (
"golang.org/x/mobile/bind/objc/testpkg"
"golang.org/x/mobile/bind/seq"
)
func proxy_BytesAppend(out, in *seq.Buffer) {
param_a := in.ReadByteArray()
param_b := in.ReadByteArray()
res := testpkg.BytesAppend(param_a, param_b)
out.WriteByteArray(res)
}
func proxy_CallSSum(out, in *seq.Buffer) {
// Must be a Go object
param_s_ref := in.ReadRef()
param_s := param_s_ref.Get().(*testpkg.S)
res := testpkg.CallSSum(param_s)
out.WriteFloat64(res)
}
func proxy_CollectS(out, in *seq.Buffer) {
param_want := in.ReadInt()
param_timeoutSec := in.ReadInt()
res := testpkg.CollectS(param_want, param_timeoutSec)
out.WriteInt(res)
}
func proxy_Hello(out, in *seq.Buffer) {
param_s := in.ReadString()
res := testpkg.Hello(param_s)
out.WriteString(res)
}
func proxy_Hi(out, in *seq.Buffer) {
testpkg.Hi()
}
func proxy_Int(out, in *seq.Buffer) {
param_x := in.ReadInt32()
testpkg.Int(param_x)
}
func proxy_NewS(out, in *seq.Buffer) {
param_x := in.ReadFloat64()
param_y := in.ReadFloat64()
res := testpkg.NewS(param_x, param_y)
out.WriteGoRef(res)
}
const (
proxyS_Descriptor = "go.testpkg.S"
proxyS_X_Get_Code = 0x00f
proxyS_X_Set_Code = 0x01f
proxyS_Y_Get_Code = 0x10f
proxyS_Y_Set_Code = 0x11f
proxyS_Sum_Code = 0x00c
)
type proxyS seq.Ref
func proxyS_X_Set(out, in *seq.Buffer) {
ref := in.ReadRef()
v := in.ReadFloat64()
ref.Get().(*testpkg.S).X = v
}
func proxyS_X_Get(out, in *seq.Buffer) {
ref := in.ReadRef()
v := ref.Get().(*testpkg.S).X
out.WriteFloat64(v)
}
func proxyS_Y_Set(out, in *seq.Buffer) {
ref := in.ReadRef()
v := in.ReadFloat64()
ref.Get().(*testpkg.S).Y = v
}
func proxyS_Y_Get(out, in *seq.Buffer) {
ref := in.ReadRef()
v := ref.Get().(*testpkg.S).Y
out.WriteFloat64(v)
}
func proxyS_Sum(out, in *seq.Buffer) {
ref := in.ReadRef()
v := ref.Get().(*testpkg.S)
res := v.Sum()
out.WriteFloat64(res)
}
func init() {
seq.Register(proxyS_Descriptor, proxyS_X_Set_Code, proxyS_X_Set)
seq.Register(proxyS_Descriptor, proxyS_X_Get_Code, proxyS_X_Get)
seq.Register(proxyS_Descriptor, proxyS_Y_Set_Code, proxyS_Y_Set)
seq.Register(proxyS_Descriptor, proxyS_Y_Get_Code, proxyS_Y_Get)
seq.Register(proxyS_Descriptor, proxyS_Sum_Code, proxyS_Sum)
}
func proxy_Sum(out, in *seq.Buffer) {
param_x := in.ReadInt64()
param_y := in.ReadInt64()
res := testpkg.Sum(param_x, param_y)
out.WriteInt64(res)
}
func init() {
seq.Register("testpkg", 1, proxy_BytesAppend)
seq.Register("testpkg", 2, proxy_CallSSum)
seq.Register("testpkg", 3, proxy_CollectS)
seq.Register("testpkg", 4, proxy_Hello)
seq.Register("testpkg", 5, proxy_Hi)
seq.Register("testpkg", 6, proxy_Int)
seq.Register("testpkg", 7, proxy_NewS)
seq.Register("testpkg", 8, proxy_Sum)
}

Просмотреть файл

@ -1,32 +0,0 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Output of gobind -lang=objc
#ifndef __GoTestpkg_H__
#define __GoTestpkg_H__
#include "seq.h"
@interface GoTestpkg_S : NSObject {
}
@property(strong, readonly) GoSeqRef *ref;
- (id)initWithRef:(GoSeqRef*)ref;
- (double)X;
- (void)setX:(double)x;
- (double)Y;
- (void)setY:(double)y;
- (double)Sum;
@end
FOUNDATION_EXPORT NSData *GoTestpkg_BytesAppend(NSData *a, NSData *b);
FOUNDATION_EXPORT double GoTestpkg_CallSSum(GoTestpkg_S* s);
FOUNDATION_EXPORT int GoTestpkg_CollectS(int want, int timeoutSec);
FOUNDATION_EXPORT NSString *GoTestpkg_Hello(NSString *s);
FOUNDATION_EXPORT void GoTestpkg_Hi();
FOUNDATION_EXPORT void GoTestpkg_Int(int32_t x);
FOUNDATION_EXPORT GoTestpkg_S *GoTestpkg_NewS(double x, double y);
FOUNDATION_EXPORT int64_t GoTestpkg_Sum(int64_t x, int64_t y);
#endif

Просмотреть файл

@ -1,186 +0,0 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Output of gobind -lang=objc
#include "GoTestpkg.h"
#include <Foundation/Foundation.h>
#include "seq.h"
#define _DESCRIPTOR_ "testpkg"
#define _CALL_BytesAppend_ 1
#define _CALL_CallSSum_ 2
#define _CALL_CollectS_ 3
#define _CALL_Hello_ 4
#define _CALL_Hi_ 5
#define _CALL_Int_ 6
#define _CALL_NewS_ 7
#define _CALL_Sum_ 8
NSData *GoTestpkg_BytesAppend(NSData *a, NSData *b) {
GoSeq in = {};
GoSeq out = {};
go_seq_writeByteArray(&in, a);
go_seq_writeByteArray(&in, b);
go_seq_send(_DESCRIPTOR_, _CALL_BytesAppend_, &in, &out);
NSData *ret = go_seq_readByteArray(&out);
go_seq_free(&out);
go_seq_free(&in);
return ret;
}
double GoTestpkg_CallSSum(GoTestpkg_S* s) {
GoSeq in = {};
GoSeq out = {};
go_seq_writeRef(&in, s.ref);
go_seq_send(_DESCRIPTOR_, _CALL_CallSSum_, &in, &out);
double ret = go_seq_readFloat64(&out);
go_seq_free(&out);
go_seq_free(&in);
return ret;
}
void GoTestpkg_Hi() {
// No input, output.
GoSeq in = {};
GoSeq out = {};
go_seq_send(_DESCRIPTOR_, _CALL_Hi_, &in, &out);
go_seq_free(&out);
go_seq_free(&in);
}
void GoTestpkg_Int(int32_t x) {
GoSeq in = {};
GoSeq out = {};
go_seq_writeInt32(&in, x);
go_seq_send(_DESCRIPTOR_, _CALL_Int_, &in, &out);
go_seq_free(&out);
go_seq_free(&in);
}
int64_t GoTestpkg_Sum(int64_t x, int64_t y) {
GoSeq in = {};
GoSeq out = {};
go_seq_writeInt64(&in, x);
go_seq_writeInt64(&in, y);
go_seq_send(_DESCRIPTOR_, _CALL_Sum_, &in, &out);
int64_t res = go_seq_readInt64(&out);
go_seq_free(&out);
go_seq_free(&in);
return res;
}
NSString *GoTestpkg_Hello(NSString *s) {
GoSeq in = {};
GoSeq out = {};
go_seq_writeUTF8(&in, s);
go_seq_send(_DESCRIPTOR_, _CALL_Hello_, &in, &out);
NSString *res = go_seq_readUTF8(&out);
go_seq_free(&out);
go_seq_free(&in);
return res;
}
GoTestpkg_S *GoTestpkg_NewS(double x, double y) {
GoSeq in = {};
GoSeq out = {};
go_seq_writeFloat64(&in, x);
go_seq_writeFloat64(&in, y);
go_seq_send(_DESCRIPTOR_, _CALL_NewS_, &in, &out);
GoSeqRef *ref = go_seq_readRef(&out);
GoTestpkg_S *ret = ref.obj;
if (ret == NULL) { // Go object.
ret = [[GoTestpkg_S alloc] initWithRef:ref];
}
ref = NULL;
go_seq_free(&out);
go_seq_free(&in);
return ret;
}
int GoTestpkg_CollectS(int want, int timeoutSec) {
GoSeq in = {};
GoSeq out = {};
go_seq_writeInt64(&in, want);
go_seq_writeInt64(&in, timeoutSec);
go_seq_send(_DESCRIPTOR_, _CALL_CollectS_, &in, &out);
int ret = go_seq_readInt64(&out);
go_seq_free(&out);
go_seq_free(&in);
return ret;
}
#define _GO_TESTPKG_S_DESCRIPTOR_ "go.testpkg.S"
#define _GO_TESTPKG_S_FIELD_X_GET_ 0x00f
#define _GO_TESTPKG_S_FIELD_X_SET_ 0x01f
#define _GO_TESTPKG_S_FIELD_Y_GET_ 0x10f
#define _GO_TESTPKG_S_FIELD_Y_SET_ 0x11f
#define _GO_TESTPKG_S_SUM_ 0x00c
@implementation GoTestpkg_S {
}
- (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_TESTPKG_S_DESCRIPTOR_, _GO_TESTPKG_S_FIELD_X_GET_, &in, &out);
double res = go_seq_readFloat64(&out);
go_seq_free(&out);
go_seq_free(&in);
return res;
}
- (void)setX:(double)x {
GoSeq in = {};
GoSeq out = {};
go_seq_writeRef(&in, self.ref);
go_seq_writeFloat64(&in, x);
go_seq_send(_GO_TESTPKG_S_DESCRIPTOR_, _GO_TESTPKG_S_FIELD_X_SET_, &in, &out);
go_seq_free(&out);
go_seq_free(&in);
}
- (double)Y {
GoSeq in = {};
GoSeq out = {};
go_seq_writeRef(&in, self.ref);
go_seq_send(_GO_TESTPKG_S_DESCRIPTOR_, _GO_TESTPKG_S_FIELD_Y_GET_, &in, &out);
double res = go_seq_readFloat64(&out);
go_seq_free(&out);
go_seq_free(&in);
return res;
}
- (void)setY:(double)y {
GoSeq in = {};
GoSeq out = {};
go_seq_writeRef(&in, self.ref);
go_seq_writeFloat64(&in, y);
go_seq_send(_GO_TESTPKG_S_DESCRIPTOR_, _GO_TESTPKG_S_FIELD_Y_SET_, &in, &out);
go_seq_free(&out);
go_seq_free(&in);
}
- (double)Sum {
GoSeq in = {};
GoSeq out = {};
go_seq_writeRef(&in, self.ref);
go_seq_send(_GO_TESTPKG_S_DESCRIPTOR_, _GO_TESTPKG_S_SUM_, &in, &out);
double res = go_seq_readFloat64(&out);
go_seq_free(&out);
go_seq_free(&in);
return res;
}
@end

Просмотреть файл

@ -5,6 +5,7 @@
package testpkg
//go:generate gobind -lang=go -outdir=go_testpkg .
//go:generate gobind -lang=objc -outdir=objc_testpkg .
import (
"fmt"