Move hostcalls impl into separate module

This commit is contained in:
Jakub Konka
2019-07-22 19:42:16 +02:00
committed by Dan Gohman
parent c4704ba573
commit 7f0219e6d0
8 changed files with 1569 additions and 1720 deletions

13
src/macros.rs Normal file
View File

@@ -0,0 +1,13 @@
macro_rules! hostcalls {
($(pub fn $name:ident($($arg:ident: $ty:ty,)*) -> $ret:ty;)*) => ($(
#[wasi_common_cbindgen::wasi_common_cbindgen]
pub fn $name($($arg: $ty,)*) -> $ret {
let ret = match crate::hostcalls_impl::$name($($arg,)*) {
Ok(()) => crate::host::__WASI_ESUCCESS,
Err(e) => e,
};
crate::hostcalls::return_enc_errno(ret)
}
)*)
}