2
0
mirror of synced 2025-02-23 14:58:12 +00:00
mobile/bind/testdata/doc.go.golden
Elias Naur 4600df55ca bind, cmd: generate complete standalone bindings from gobind
The gobind and gomobile bind tools have historically overlapped:
gobind outputs generated bindings, and gomobile bind will generate
bindings before building them. However, the gobind bindings were
never used for building and thus allowed to not be complete.

To simplify version control, debugging, instrumentation and build
system flexibility, this CL upgrades the gobind tool to be the
canonical binding generator and change gomobile bind to use gobind
instead of its own generator code.

This greatly simplifies gomobile bind, but also paves the way to skip
gomobile bind entirely. For example:

$ gobind -outdir=$GOPATH golang.org/x/mobile/example/bind/hello
$ GOOS=android GOARCH=arm64 CC=<ndk-toolchain>/bin/clang go build -buildmode=c-shared -o libgobind.so gobind
$ ls libgobind.*
libgobind.h  libgobind.so

The same applies to iOS, although the go build command line is more
involved.

By skipping gomobile it is possible to freely customize the Android
or iOS SDK level or any other flags not supported by gomobile bind.
By checking in the generated source code, the cost of supporting
gomobile in a custom build system is also decreased.

Change-Id: I59c14a77d625ac1377c23b3213672e0d83a48c85
Reviewed-on: https://go-review.googlesource.com/99316
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-03-16 06:47:34 +00:00

188 lines
3.7 KiB
Plaintext

// Package main is an autogenerated binder stub for package doc.
// gobind -lang=go doc
//
// File is generated by gobind. Do not edit.
package main
/*
#include <stdlib.h>
#include <stdint.h>
#include "seq.h"
#include "doc.h"
*/
import "C"
import (
"doc"
_seq "golang.org/x/mobile/bind/seq"
)
// suppress the error if seq ends up unused
var _ = _seq.FromRefNum
//export new_doc_NoDoc
func new_doc_NoDoc() C.int32_t {
return C.int32_t(_seq.ToRefNum(new(doc.NoDoc)))
}
//export proxydoc_S_SF_Set
func proxydoc_S_SF_Set(refnum C.int32_t, v C.nstring) {
ref := _seq.FromRefNum(int32(refnum))
_v := decodeString(v)
ref.Get().(*doc.S).SF = _v
}
//export proxydoc_S_SF_Get
func proxydoc_S_SF_Get(refnum C.int32_t) C.nstring {
ref := _seq.FromRefNum(int32(refnum))
v := ref.Get().(*doc.S).SF
_v := encodeString(v)
return _v
}
//export proxydoc_S_S2_Set
func proxydoc_S_S2_Set(refnum C.int32_t, v C.int32_t) {
ref := _seq.FromRefNum(int32(refnum))
// Must be a Go object
var _v *doc.S2
if _v_ref := _seq.FromRefNum(int32(v)); _v_ref != nil {
_v = _v_ref.Get().(*doc.S2)
}
ref.Get().(*doc.S).S2 = _v
}
//export proxydoc_S_S2_Get
func proxydoc_S_S2_Get(refnum C.int32_t) C.int32_t {
ref := _seq.FromRefNum(int32(refnum))
v := ref.Get().(*doc.S).S2
var _v C.int32_t = _seq.NullRefNum
if v != nil {
_v = C.int32_t(_seq.ToRefNum(v))
}
return _v
}
//export proxydoc_S_F1_Set
func proxydoc_S_F1_Set(refnum C.int32_t, v C.nstring) {
ref := _seq.FromRefNum(int32(refnum))
_v := decodeString(v)
ref.Get().(*doc.S).F1 = _v
}
//export proxydoc_S_F1_Get
func proxydoc_S_F1_Get(refnum C.int32_t) C.nstring {
ref := _seq.FromRefNum(int32(refnum))
v := ref.Get().(*doc.S).F1
_v := encodeString(v)
return _v
}
//export proxydoc_S_F2_Set
func proxydoc_S_F2_Set(refnum C.int32_t, v C.nstring) {
ref := _seq.FromRefNum(int32(refnum))
_v := decodeString(v)
ref.Get().(*doc.S).F2 = _v
}
//export proxydoc_S_F2_Get
func proxydoc_S_F2_Get(refnum C.int32_t) C.nstring {
ref := _seq.FromRefNum(int32(refnum))
v := ref.Get().(*doc.S).F2
_v := encodeString(v)
return _v
}
//export proxydoc_S_After
func proxydoc_S_After(refnum C.int32_t) {
ref := _seq.FromRefNum(int32(refnum))
v := ref.Get().(*doc.S)
v.After()
}
//export proxydoc_S_Before
func proxydoc_S_Before(refnum C.int32_t) {
ref := _seq.FromRefNum(int32(refnum))
v := ref.Get().(*doc.S)
v.Before()
}
//export new_doc_S
func new_doc_S() C.int32_t {
return C.int32_t(_seq.ToRefNum(new(doc.S)))
}
//export new_doc_S2
func new_doc_S2() C.int32_t {
return C.int32_t(_seq.ToRefNum(new(doc.S2)))
}
//export proxydoc_I_IM
func proxydoc_I_IM(refnum C.int32_t) {
ref := _seq.FromRefNum(int32(refnum))
v := ref.Get().(doc.I)
v.IM()
}
type proxydoc_I _seq.Ref
func (p *proxydoc_I) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() }
func (p *proxydoc_I) IM() {
C.cproxydoc_I_IM(C.int32_t(p.Bind_proxy_refnum__()))
}
//export var_setdoc_NoDocVar
func var_setdoc_NoDocVar(v C.double) {
_v := float64(v)
doc.NoDocVar = _v
}
//export var_getdoc_NoDocVar
func var_getdoc_NoDocVar() C.double {
v := doc.NoDocVar
_v := C.double(v)
return _v
}
//export var_setdoc_Specific
func var_setdoc_Specific(v C.nstring) {
_v := decodeString(v)
doc.Specific = _v
}
//export var_getdoc_Specific
func var_getdoc_Specific() C.nstring {
v := doc.Specific
_v := encodeString(v)
return _v
}
//export var_setdoc_V
func var_setdoc_V(v C.nstring) {
_v := decodeString(v)
doc.V = _v
}
//export var_getdoc_V
func var_getdoc_V() C.nstring {
v := doc.V
_v := encodeString(v)
return _v
}
//export proxydoc__F
func proxydoc__F() {
doc.F()
}
//export proxydoc__NewS
func proxydoc__NewS() C.int32_t {
res_0 := doc.NewS()
var _res_0 C.int32_t = _seq.NullRefNum
if res_0 != nil {
_res_0 = C.int32_t(_seq.ToRefNum(res_0))
}
return _res_0
}