feat: add a histrical wit-bindgen

This commit is contained in:
2023-01-01 00:25:48 +08:00
parent 01e8f5a959
commit aa50d63aec
419 changed files with 45283 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
(component
(type (;0;) (flags "b0"))
(type (;1;) (func (param "x" 0) (result 0)))
(type (;2;) (flags "b0" "b1"))
(type (;3;) (func (param "x" 2) (result 2)))
(type (;4;) (flags "b0" "b1" "b2" "b3"))
(type (;5;) (func (param "x" 4) (result 4)))
(type (;6;) (flags "b0" "b1" "b2" "b3" "b4" "b5" "b6" "b7"))
(type (;7;) (func (param "x" 6) (result 6)))
(type (;8;) (flags "b0" "b1" "b2" "b3" "b4" "b5" "b6" "b7" "b8" "b9" "b10" "b11" "b12" "b13" "b14" "b15"))
(type (;9;) (func (param "x" 8) (result 8)))
(type (;10;) (flags "b0" "b1" "b2" "b3" "b4" "b5" "b6" "b7" "b8" "b9" "b10" "b11" "b12" "b13" "b14" "b15" "b16" "b17" "b18" "b19" "b20" "b21" "b22" "b23" "b24" "b25" "b26" "b27" "b28" "b29" "b30" "b31"))
(type (;11;) (func (param "x" 10) (result 10)))
(type (;12;) (flags "b0" "b1" "b2" "b3" "b4" "b5" "b6" "b7" "b8" "b9" "b10" "b11" "b12" "b13" "b14" "b15" "b16" "b17" "b18" "b19" "b20" "b21" "b22" "b23" "b24" "b25" "b26" "b27" "b28" "b29" "b30" "b31" "b32" "b33" "b34" "b35" "b36" "b37" "b38" "b39" "b40" "b41" "b42" "b43" "b44" "b45" "b46" "b47" "b48" "b49" "b50" "b51" "b52" "b53" "b54" "b55" "b56" "b57" "b58" "b59" "b60" "b61" "b62" "b63"))
(type (;13;) (func (param "x" 12) (result 12)))
(export "flag1" (type 0))
(export "roundtrip-flag1" (type 1))
(export "flag2" (type 2))
(export "roundtrip-flag2" (type 3))
(export "flag4" (type 4))
(export "roundtrip-flag4" (type 5))
(export "flag8" (type 6))
(export "roundtrip-flag8" (type 7))
(export "flag16" (type 8))
(export "roundtrip-flag16" (type 9))
(export "flag32" (type 10))
(export "roundtrip-flag32" (type 11))
(export "flag64" (type 12))
(export "roundtrip-flag64" (type 13))
)

View File

@@ -0,0 +1,162 @@
flags flag1 {
b0,
}
flags flag2 {
b0,
b1,
}
flags flag4 {
b0,
b1,
b2,
b3,
}
flags flag8 {
b0,
b1,
b2,
b3,
b4,
b5,
b6,
b7,
}
flags flag16 {
b0,
b1,
b2,
b3,
b4,
b5,
b6,
b7,
b8,
b9,
b10,
b11,
b12,
b13,
b14,
b15,
}
flags flag32 {
b0,
b1,
b2,
b3,
b4,
b5,
b6,
b7,
b8,
b9,
b10,
b11,
b12,
b13,
b14,
b15,
b16,
b17,
b18,
b19,
b20,
b21,
b22,
b23,
b24,
b25,
b26,
b27,
b28,
b29,
b30,
b31,
}
flags flag64 {
b0,
b1,
b2,
b3,
b4,
b5,
b6,
b7,
b8,
b9,
b10,
b11,
b12,
b13,
b14,
b15,
b16,
b17,
b18,
b19,
b20,
b21,
b22,
b23,
b24,
b25,
b26,
b27,
b28,
b29,
b30,
b31,
b32,
b33,
b34,
b35,
b36,
b37,
b38,
b39,
b40,
b41,
b42,
b43,
b44,
b45,
b46,
b47,
b48,
b49,
b50,
b51,
b52,
b53,
b54,
b55,
b56,
b57,
b58,
b59,
b60,
b61,
b62,
b63,
}
roundtrip-flag1: func(x: flag1) -> flag1
roundtrip-flag2: func(x: flag2) -> flag2
roundtrip-flag4: func(x: flag4) -> flag4
roundtrip-flag8: func(x: flag8) -> flag8
roundtrip-flag16: func(x: flag16) -> flag16
roundtrip-flag32: func(x: flag32) -> flag32
roundtrip-flag64: func(x: flag64) -> flag64

View File

@@ -0,0 +1,10 @@
(component
(type (;0;) (func (param "x" float32)))
(type (;1;) (func (param "x" float64)))
(type (;2;) (func (result float32)))
(type (;3;) (func (result float64)))
(export "float32-param" (type 0))
(export "float64-param" (type 1))
(export "float32-result" (type 2))
(export "float64-result" (type 3))
)

View File

@@ -0,0 +1,8 @@
float32-param: func(x: float32)
float64-param: func(x: float64)
float32-result: func() -> float32
float64-result: func() -> float64

View File

@@ -0,0 +1,40 @@
(component
(type (;0;) (func (param "x" u8)))
(type (;1;) (func (param "x" s8)))
(type (;2;) (func (param "x" u16)))
(type (;3;) (func (param "x" s16)))
(type (;4;) (func (param "x" u32)))
(type (;5;) (func (param "x" s32)))
(type (;6;) (func (param "x" u64)))
(type (;7;) (func (param "x" s64)))
(type (;8;) (func (param "p1" u8) (param "p2" s8) (param "p3" u16) (param "p4" s16) (param "p5" u32) (param "p6" s32) (param "p7" u64) (param "p8" s64)))
(type (;9;) (func (result u8)))
(type (;10;) (func (result s8)))
(type (;11;) (func (result u16)))
(type (;12;) (func (result s16)))
(type (;13;) (func (result u32)))
(type (;14;) (func (result s32)))
(type (;15;) (func (result u64)))
(type (;16;) (func (result s64)))
(type (;17;) (tuple s64 u8))
(type (;18;) (func (result 17)))
(export "a1" (type 0))
(export "a2" (type 1))
(export "a3" (type 2))
(export "a4" (type 3))
(export "a5" (type 4))
(export "a6" (type 5))
(export "a7" (type 6))
(export "a8" (type 7))
(export "a9" (type 8))
(export "r1" (type 9))
(export "r2" (type 10))
(export "r3" (type 11))
(export "r4" (type 12))
(export "r5" (type 13))
(export "r6" (type 14))
(export "r7" (type 15))
(export "r8" (type 16))
(export "pair-ret" (type 18))
(export "multi-ret" (type 18))
)

View File

@@ -0,0 +1,38 @@
a1: func(x: u8)
a2: func(x: s8)
a3: func(x: u16)
a4: func(x: s16)
a5: func(x: u32)
a6: func(x: s32)
a7: func(x: u64)
a8: func(x: s64)
a9: func(p1: u8, p2: s8, p3: u16, p4: s16, p5: u32, p6: s32, p7: u64, p8: s64)
r1: func() -> u8
r2: func() -> s8
r3: func() -> u16
r4: func() -> s16
r5: func() -> u32
r6: func() -> s32
r7: func() -> u64
r8: func() -> s64
pair-ret: func() -> tuple<s64, u8>
multi-ret: func() -> tuple<s64, u8>

View File

@@ -0,0 +1,92 @@
(component
(type (;0;) (list u8))
(type (;1;) (func (param "x" 0)))
(type (;2;) (list u16))
(type (;3;) (func (param "x" 2)))
(type (;4;) (list u32))
(type (;5;) (func (param "x" 4)))
(type (;6;) (list u64))
(type (;7;) (func (param "x" 6)))
(type (;8;) (list s8))
(type (;9;) (func (param "x" 8)))
(type (;10;) (list s16))
(type (;11;) (func (param "x" 10)))
(type (;12;) (list s32))
(type (;13;) (func (param "x" 12)))
(type (;14;) (list s64))
(type (;15;) (func (param "x" 14)))
(type (;16;) (list float32))
(type (;17;) (func (param "x" 16)))
(type (;18;) (list float64))
(type (;19;) (func (param "x" 18)))
(type (;20;) (func (result 0)))
(type (;21;) (func (result 2)))
(type (;22;) (func (result 4)))
(type (;23;) (func (result 6)))
(type (;24;) (func (result 8)))
(type (;25;) (func (result 10)))
(type (;26;) (func (result 12)))
(type (;27;) (func (result 14)))
(type (;28;) (func (result 16)))
(type (;29;) (func (result 18)))
(type (;30;) (tuple u8 s8))
(type (;31;) (list 30))
(type (;32;) (tuple s64 u32))
(type (;33;) (list 32))
(type (;34;) (func (param "x" 31) (result 33)))
(type (;35;) (list string))
(type (;36;) (func (param "a" 35)))
(type (;37;) (func (result 35)))
(type (;38;) (tuple u8 string))
(type (;39;) (list 38))
(type (;40;) (tuple string u8))
(type (;41;) (list 40))
(type (;42;) (func (param "x" 39) (result 41)))
(type (;43;) (func (param "x" 35) (result 35)))
(type (;44;) (record (field "a1" u32) (field "a2" u64) (field "a3" s32) (field "a4" s64) (field "b" string) (field "c" 0)))
(type (;45;) (record (field "x" string) (field "y" 44) (field "c1" u32) (field "c2" u64) (field "c3" s32) (field "c4" s64)))
(type (;46;) (list 45))
(type (;47;) (list 44))
(type (;48;) (func (param "x" 46) (result 47)))
(type (;49;) (variant (case $c0 "a" unit) (case $c1 "b" u32) (case $c2 "c" string)))
(type (;50;) (list 49))
(type (;51;) (variant (case $c0 "a" string) (case $c1 "b" unit) (case $c2 "c" u32) (case $c3 "d" 50)))
(type (;52;) (list 51))
(type (;53;) (func (param "x" 52) (result 50)))
(type (;54;) (tuple string u8 s8 u16 s16 u32 s32 u64 s64 float32 float64 char))
(type (;55;) (list 54))
(type (;56;) (func (param "a" 55) (result 55)))
(export "list-u8-param" (type 1))
(export "list-u16-param" (type 3))
(export "list-u32-param" (type 5))
(export "list-u64-param" (type 7))
(export "list-s8-param" (type 9))
(export "list-s16-param" (type 11))
(export "list-s32-param" (type 13))
(export "list-s64-param" (type 15))
(export "list-float32-param" (type 17))
(export "list-float64-param" (type 19))
(export "list-u8-ret" (type 20))
(export "list-u16-ret" (type 21))
(export "list-u32-ret" (type 22))
(export "list-u64-ret" (type 23))
(export "list-s8-ret" (type 24))
(export "list-s16-ret" (type 25))
(export "list-s32-ret" (type 26))
(export "list-s64-ret" (type 27))
(export "list-float32-ret" (type 28))
(export "list-float64-ret" (type 29))
(export "tuple-list" (type 34))
(export "string-list-arg" (type 36))
(export "string-list-ret" (type 37))
(export "tuple-string-list" (type 42))
(export "string-list" (type 43))
(export "other-record" (type 44))
(export "some-record" (type 45))
(export "record-list" (type 48))
(export "other-variant" (type 49))
(export "some-variant" (type 51))
(export "variant-list" (type 53))
(export "load-store-all-sizes" (type 55))
(export "load-store-everything" (type 56))
)

View File

@@ -0,0 +1,89 @@
record other-record {
a1: u32,
a2: u64,
a3: s32,
a4: s64,
b: string,
c: list<u8>,
}
record some-record {
x: string,
y: other-record,
c1: u32,
c2: u64,
c3: s32,
c4: s64,
}
variant other-variant {
a,
b(u32),
c(string),
}
variant some-variant {
a(string),
b,
c(u32),
d(list<other-variant>),
}
type load-store-all-sizes = list<tuple<string, u8, s8, u16, s16, u32, s32, u64, s64, float32, float64, char>>
list-u8-param: func(x: list<u8>)
list-u16-param: func(x: list<u16>)
list-u32-param: func(x: list<u32>)
list-u64-param: func(x: list<u64>)
list-s8-param: func(x: list<s8>)
list-s16-param: func(x: list<s16>)
list-s32-param: func(x: list<s32>)
list-s64-param: func(x: list<s64>)
list-float32-param: func(x: list<float32>)
list-float64-param: func(x: list<float64>)
list-u8-ret: func() -> list<u8>
list-u16-ret: func() -> list<u16>
list-u32-ret: func() -> list<u32>
list-u64-ret: func() -> list<u64>
list-s8-ret: func() -> list<s8>
list-s16-ret: func() -> list<s16>
list-s32-ret: func() -> list<s32>
list-s64-ret: func() -> list<s64>
list-float32-ret: func() -> list<float32>
list-float64-ret: func() -> list<float64>
tuple-list: func(x: list<tuple<u8, s8>>) -> list<tuple<s64, u32>>
string-list-arg: func(a: list<string>)
string-list-ret: func() -> list<string>
tuple-string-list: func(x: list<tuple<u8, string>>) -> list<tuple<string, u8>>
string-list: func(x: list<string>) -> list<string>
record-list: func(x: list<some-record>) -> list<other-record>
variant-list: func(x: list<some-variant>) -> list<other-variant>
load-store-everything: func(a: load-store-all-sizes) -> load-store-all-sizes

View File

@@ -0,0 +1,37 @@
(component
(type (;0;) (tuple char u32))
(type (;1;) (func (param "x" 0)))
(type (;2;) (func (result 0)))
(type (;3;) (record))
(type (;4;) (func (param "x" 3)))
(type (;5;) (func (result 3)))
(type (;6;) (record (field "a" u32) (field "b" u32)))
(type (;7;) (func (param "x" 6)))
(type (;8;) (func (result 6)))
(type (;9;) (flags "a" "b" "c" "d" "e" "f" "g" "h" "i"))
(type (;10;) (func (param "x" 9)))
(type (;11;) (func (result 9)))
(type (;12;) (record (field "a" 6) (field "b" u32) (field "c" 3) (field "d" string) (field "e" 9)))
(type (;13;) (func (param "x" 12)))
(type (;14;) (func (result 12)))
(type (;15;) s32)
(type (;16;) (tuple 15))
(type (;17;) (func (param "e" 16) (result s32)))
(export "tuple-arg" (type 1))
(export "tuple-result" (type 2))
(export "empty" (type 3))
(export "empty-arg" (type 4))
(export "empty-result" (type 5))
(export "scalars" (type 6))
(export "scalar-arg" (type 7))
(export "scalar-result" (type 8))
(export "really-flags" (type 9))
(export "flags-arg" (type 10))
(export "flags-result" (type 11))
(export "aggregates" (type 12))
(export "aggregate-arg" (type 13))
(export "aggregate-result" (type 14))
(export "int-typedef" (type 15))
(export "tuple-typedef2" (type 16))
(export "typedef-inout" (type 17))
)

View File

@@ -0,0 +1,54 @@
record empty {
}
record scalars {
a: u32,
b: u32,
}
flags really-flags {
a,
b,
c,
d,
e,
f,
g,
h,
i,
}
record aggregates {
a: scalars,
b: u32,
c: empty,
d: string,
e: really-flags,
}
type int-typedef = s32
type tuple-typedef2 = tuple<int-typedef>
tuple-arg: func(x: tuple<char, u32>)
tuple-result: func() -> tuple<char, u32>
empty-arg: func(x: empty)
empty-result: func() -> empty
scalar-arg: func(x: scalars)
scalar-result: func() -> scalars
flags-arg: func(x: really-flags)
flags-result: func() -> really-flags
aggregate-arg: func(x: aggregates)
aggregate-result: func() -> aggregates
typedef-inout: func(e: tuple-typedef2) -> s32

View File

@@ -0,0 +1,92 @@
(component
(type (;0;) (enum "a"))
(type (;1;) (func (param "x" 0)))
(type (;2;) (func (result 0)))
(type (;3;) (union u32 float32))
(type (;4;) (func (param "x" 3)))
(type (;5;) (func (result 3)))
(type (;6;) (record))
(type (;7;) (variant (case $c0 "a" unit) (case $c1 "b" 3) (case $c2 "c" 0) (case $c3 "d" string) (case $c4 "e" 6) (case $c5 "f" unit) (case $c6 "g" u32)))
(type (;8;) (func (param "x" 7)))
(type (;9;) (func (result 7)))
(type (;10;) (func (param "x" bool)))
(type (;11;) (func (result bool)))
(type (;12;) (option bool))
(type (;13;) (tuple))
(type (;14;) (option 13))
(type (;15;) (option u32))
(type (;16;) (option 0))
(type (;17;) (option float32))
(type (;18;) (option 3))
(type (;19;) (option 12))
(type (;20;) (func (param "a" 12) (param "b" 14) (param "c" 15) (param "d" 16) (param "e" 17) (param "f" 18) (param "g" 19)))
(type (;21;) (tuple 12 14 15 16 17 18 19))
(type (;22;) (func (result 21)))
(type (;23;) (variant (case $c0 "a" s32) (case $c1 "b" float32)))
(type (;24;) (variant (case $c0 "a" float64) (case $c1 "b" float32)))
(type (;25;) (variant (case $c0 "a" float64) (case $c1 "b" u64)))
(type (;26;) (variant (case $c0 "a" u32) (case $c1 "b" s64)))
(type (;27;) (variant (case $c0 "a" float32) (case $c1 "b" s64)))
(type (;28;) (tuple float32 u32))
(type (;29;) (tuple u32 u32))
(type (;30;) (variant (case $c0 "a" 28) (case $c1 "b" 29)))
(type (;31;) (tuple 23 24 25 26 27 30))
(type (;32;) (func (param "a" 23) (param "b" 24) (param "c" 25) (param "d" 26) (param "e" 27) (param "f" 30) (result 31)))
(type (;33;) (expected unit unit))
(type (;34;) (expected unit 0))
(type (;35;) (expected 0 unit))
(type (;36;) (expected 13 13))
(type (;37;) (expected u32 7))
(type (;38;) (list u8))
(type (;39;) (expected string 38))
(type (;40;) (func (param "a" 33) (param "b" 34) (param "c" 35) (param "d" 36) (param "e" 37) (param "f" 39)))
(type (;41;) (tuple 33 34 35 36 37 39))
(type (;42;) (func (result 41)))
(type (;43;) (enum "bad1" "bad2"))
(type (;44;) (expected s32 43))
(type (;45;) (func (result 44)))
(type (;46;) (expected unit 43))
(type (;47;) (func (result 46)))
(type (;48;) (expected 43 43))
(type (;49;) (func (result 48)))
(type (;50;) (tuple s32 u32))
(type (;51;) (expected 50 43))
(type (;52;) (func (result 51)))
(type (;53;) (option s32))
(type (;54;) (func (result 53)))
(type (;55;) (option 43))
(type (;56;) (func (result 55)))
(type (;57;) (expected u32 s32))
(type (;58;) (func (result 57)))
(export "e1" (type 0))
(export "e1-arg" (type 1))
(export "e1-result" (type 2))
(export "u1" (type 3))
(export "u1-arg" (type 4))
(export "u1-result" (type 5))
(export "empty" (type 6))
(export "v1" (type 7))
(export "v1-arg" (type 8))
(export "v1-result" (type 9))
(export "bool-arg" (type 10))
(export "bool-result" (type 11))
(export "option-arg" (type 20))
(export "option-result" (type 22))
(export "casts1" (type 23))
(export "casts2" (type 24))
(export "casts3" (type 25))
(export "casts4" (type 26))
(export "casts5" (type 27))
(export "casts6" (type 30))
(export "casts" (type 32))
(export "expected-arg" (type 40))
(export "expected-result" (type 42))
(export "my-errno" (type 43))
(export "return-expected-sugar" (type 45))
(export "return-expected-sugar2" (type 47))
(export "return-expected-sugar3" (type 49))
(export "return-expected-sugar4" (type 52))
(export "return-option-sugar" (type 54))
(export "return-option-sugar2" (type 56))
(export "expected-simple" (type 58))
)

View File

@@ -0,0 +1,97 @@
enum e1 {
a,
}
union u1 {
u32,
float32,
}
record empty {
}
variant v1 {
a,
b(u1),
c(e1),
d(string),
e(empty),
f,
g(u32),
}
variant casts1 {
a(s32),
b(float32),
}
variant casts2 {
a(float64),
b(float32),
}
variant casts3 {
a(float64),
b(u64),
}
variant casts4 {
a(u32),
b(s64),
}
variant casts5 {
a(float32),
b(s64),
}
variant casts6 {
a(tuple<float32, u32>),
b(tuple<u32, u32>),
}
enum my-errno {
bad1,
bad2,
}
e1-arg: func(x: e1)
e1-result: func() -> e1
u1-arg: func(x: u1)
u1-result: func() -> u1
v1-arg: func(x: v1)
v1-result: func() -> v1
bool-arg: func(x: bool)
bool-result: func() -> bool
option-arg: func(a: option<bool>, b: option<tuple<>>, c: option<u32>, d: option<e1>, e: option<float32>, f: option<u1>, g: option<option<bool>>)
option-result: func() -> tuple<option<bool>, option<tuple<>>, option<u32>, option<e1>, option<float32>, option<u1>, option<option<bool>>>
casts: func(a: casts1, b: casts2, c: casts3, d: casts4, e: casts5, f: casts6) -> tuple<casts1, casts2, casts3, casts4, casts5, casts6>
expected-arg: func(a: expected<unit, unit>, b: expected<unit, e1>, c: expected<e1, unit>, d: expected<tuple<>, tuple<>>, e: expected<u32, v1>, f: expected<string, list<u8>>)
expected-result: func() -> tuple<expected<unit, unit>, expected<unit, e1>, expected<e1, unit>, expected<tuple<>, tuple<>>, expected<u32, v1>, expected<string, list<u8>>>
return-expected-sugar: func() -> expected<s32, my-errno>
return-expected-sugar2: func() -> expected<unit, my-errno>
return-expected-sugar3: func() -> expected<my-errno, my-errno>
return-expected-sugar4: func() -> expected<tuple<s32, u32>, my-errno>
return-option-sugar: func() -> option<s32>
return-option-sugar2: func() -> option<my-errno>
expected-simple: func() -> expected<u32, s32>