Files
wasmtime/tests/test.witx

85 lines
2.1 KiB
Plaintext

(use "errno.witx")
(typename $excuse
(enum u8
$dog_ate
$traffic
$sleeping))
(typename $car_config
(flags u8
$automatic
$awd
$suv))
(typename $cookie
(int u64
(const $start 0)))
(typename $bool
(enum u8
$false
$true))
(typename $pair_ints
(struct
(field $first s32)
(field $second s32)))
(typename $pair_int_ptrs
(struct
(field $first (@witx const_pointer s32))
(field $second (@witx const_pointer s32))))
(typename $named_ptr (@witx pointer f32))
(typename $named_ptr_to_ptr (@witx pointer (@witx pointer f64)))
(typename $const_excuse_array (array (@witx const_pointer $excuse)))
(typename $excuse_array (array (@witx pointer $excuse)))
(module $foo
(@interface func (export "baz")
(param $an_excuse $excuse)
(param $an_excuse_by_reference (@witx pointer $excuse))
(param $a_lamer_excuse (@witx const_pointer $excuse))
(param $two_layers_of_excuses (@witx pointer (@witx const_pointer $excuse)))
(result $error $errno))
(@interface func (export "bat")
(param $an_int u32)
(result $error $errno)
(result $doubled_it f32))
(@interface func (export "sum_of_pair")
(param $an_pair $pair_ints)
(result $error $errno)
(result $doubled s64))
(@interface func (export "sum_of_pair_of_ptrs")
(param $an_pair $pair_int_ptrs)
(result $error $errno)
(result $doubled s64))
(@interface func (export "reduce_excuses")
(param $excuses $const_excuse_array)
(result $error $errno)
(result $reduced $excuse)
)
(@interface func (export "populate_excuses")
(param $excuses $excuse_array)
(result $error $errno)
)
(@interface func (export "configure_car")
(param $old_config $car_config)
(param $old_config_by_ptr (@witx const_pointer $car_config))
(result $error $errno)
(result $new_config $car_config)
)
(@interface func (export "hello_string")
(param $a_string string)
(result $error $errno)
(result $total_bytes u32)
)
(@interface func (export "cookie_cutter")
(param $init_cookie $cookie)
(result $error $errno)
(result $is_start $bool)
)
)