37 lines
924 B
Plaintext
37 lines
924 B
Plaintext
(use "errno.witx")
|
|
(use "excuse.witx")
|
|
|
|
(typename $const_excuse_array (array (@witx const_pointer $excuse)))
|
|
(typename $excuse_array (array (@witx pointer $excuse)))
|
|
|
|
(module $arrays
|
|
(@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)
|
|
)
|
|
)
|
|
|
|
(typename $pair_ints
|
|
(struct
|
|
(field $first s32)
|
|
(field $second s32)))
|
|
|
|
(module $array_traversal
|
|
(@interface func (export "sum_of_element")
|
|
(param $elements (array $pair_ints))
|
|
(param $index (@witx usize))
|
|
(result $error $errno)
|
|
(result $sum s32))
|
|
|
|
(@interface func (export "sum_of_elements")
|
|
(param $elements (array $pair_ints))
|
|
(param $start (@witx usize))
|
|
(param $end (@witx usize))
|
|
(result $error $errno)
|
|
(result $sum s32)))
|