Browse Source

Rebase on the wasi-cli world. (#100)

* Rebase on the wasi-cli world.

Rebase on the wasi-cli wit files. This incorporates some major renamings
and reorganizations, and updates to use wasi-sockets from the repo rather
than our old prototype files.

At present this depends on several bugfixes in wasmtime and wit-bindgen
so this is using git dependencies for now.

This also temporarily preserves the dedicated stderr interface, which is
useful for debugging the file descriptor table code, which needs to work
before the regular stderr works.

* Update the verify program for the new module names.

* Disable debug-assertions in the adapter build.

This is roughly the same as, the previous `unchecked` option in the
bindings, with the changes in the latest wit-bindgen.

* Update CI to use the new file names.
pull/6374/head
Dan Gohman 2 years ago
committed by GitHub
parent
commit
70a1528f5a
  1. 498
      src/lib.rs
  2. 13
      src/macros.rs

498
src/lib.rs

File diff suppressed because it is too large

13
src/macros.rs

@ -3,6 +3,13 @@
//! We're avoiding static initializers, so we can't have things like string
//! literals. Replace the standard assert macros with simpler implementations.
// TODO: Wire this up to stderr.
#[allow(dead_code)]
#[doc(hidden)]
pub fn print(message: &[u8]) {
crate::bindings::stderr::print(message)
}
/// A minimal `eprint` for debugging.
#[allow(unused_macros)]
macro_rules! eprint {
@ -10,7 +17,7 @@ macro_rules! eprint {
// We have to expand string literals into byte arrays to prevent them
// from getting statically initialized.
let message = byte_array::str!($arg);
crate::bindings::wasi_stderr::print(&message);
$crate::macros::print(&message);
}};
}
@ -21,7 +28,7 @@ macro_rules! eprintln {
// We have to expand string literals into byte arrays to prevent them
// from getting statically initialized.
let message = byte_array::str_nl!($arg);
crate::bindings::wasi_stderr::print(&message);
$crate::macros::print(&message);
}};
}
@ -37,7 +44,7 @@ pub(crate) fn eprint_u32(x: u32) {
eprint_u32_impl(x / 10);
let digit = [b'0' + ((x % 10) as u8)];
crate::bindings::wasi_stderr::print(&digit);
crate::macros::print(&digit);
}
}
}

Loading…
Cancel
Save