blob: 982a1a6be60579d737ff0542e546914cee2a032d [file] [log] [blame]
// Copyright 2018 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.
library bindingstest;
using zx;
struct TestSimple {
int64 x;
};
struct TestSimpleBool {
bool x;
};
struct TestAlignment1 {
int8 x;
int8 y;
uint32 z;
};
struct TestAlignment2 {
uint32 a;
uint32 b;
int8 c;
int8 d;
int8 e;
uint8 f;
uint32 g;
uint16 h;
uint16 i;
};
struct TestFloat1 {
float32 a;
};
struct TestFloat2 {
float64 a;
};
struct TestFloat3 {
float32 a;
float64 b;
uint64 c;
float32 d;
};
struct TestArray1 {
array<int8>:5 a;
};
struct TestArray2 {
float64 a;
array<float32>:1 b;
};
struct TestArray3 {
int32 a;
array<uint16>:3 b;
uint64 c;
};
struct TestArray4 {
array<bool>:9 a;
};
struct TestString1 {
string a;
string? b;
};
struct TestString2 {
array<string>:2 a;
};
struct TestString3 {
array<string:4>:2 a;
array<string:4?>:2 b;
};
struct TestVector1 {
vector<int8> a;
vector<int16>? b;
vector<int32>:2 c;
vector<int64>:2? d;
};
struct TestVector2 {
array<vector<int8>>:2 a;
vector<vector<int8>>:2 b;
vector<vector<string:5>:2?>:2 c;
};
struct TestStruct1 {
TestSimple a;
TestSimple? b;
};
struct TestStruct2 {
TestArray1 a;
TestFloat1 b;
TestVector1 c;
TestString1? d;
};
union Union1 {
array<int8>:3 a;
TestSimple b;
TestSimple? c;
float32 d;
};
struct TestUnion1 {
Union1 a;
Union1? b;
};
struct TestUnion2 {
vector<Union1> a;
vector<Union1?> b;
};
struct TestHandle1 {
handle a;
handle? b;
handle<vmo> c;
handle<vmo>? d;
};
struct TestHandle2 {
vector<handle>:1 a;
vector<handle<vmo>?>:1 b;
};
interface Test1 {
10: Echo(string? in) -> (string? out);
11: -> Surprise(string foo);
};
struct TestInterface1 {
Test1 a;
Test1? b;
request<Test1> c;
request<Test1>? d;
};
table SimpleTable {
1: int64 x;
2: reserved;
3: reserved;
4: reserved;
5: int64 y;
};
struct TestSimpleTable {
SimpleTable table;
};
// A variant of SimpleTable that has just the first few fields.
// Think of this as an older variant of that type!
table OlderSimpleTable {
1: int64 x;
2: reserved;
};
struct TestOlderSimpleTable {
OlderSimpleTable table;
};
struct TestOptSimpleTable {
SimpleTable? opt_table;
};
// A variant of SimpleTable that has some additional new fields.
// Think of this as an newer variant of that type!
table NewerSimpleTable {
1: int64 x;
2: reserved;
3: reserved;
4: reserved;
5: int64 y;
6: int64 z;
7: reserved;
};
struct TestNewerSimpleTable {
NewerSimpleTable table;
};
// examples from fuchsia world.
const uint64 kMaxBuf = 8192;
struct TestFuchsiaIoReadAtResponse {
zx.status s;
vector<uint8>:kMaxBuf data;
};
struct TestFuchsiaIoWriteAtRequest {
vector<uint8>:kMaxBuf data;
uint64 offset;
};