blob: 8844c4976df0277626ccbcaa3e7a9023ffd3833a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
mod c_header;
use anyhow::Result;
pub use c_header::{to_c, Generated};
use std::path::{Path, PathBuf};
use witx::load;
pub fn generate<P: AsRef<Path>>(inputs: &[P]) -> Result<Generated> {
let doc = load(&inputs)?;
let inputs_str = &inputs
.iter()
.map(|p| {
p.as_ref()
.file_name()
.unwrap()
.to_str()
.unwrap()
.to_string()
})
.collect::<Vec<_>>()
.join(", ");
Ok(to_c(&doc, &inputs_str))
}
pub fn snapshot_witx_files() -> Result<Vec<PathBuf>> {
witx::phases::snapshot()
}
pub fn libc_wasi_api_header() -> PathBuf {
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("../../libc-bottom-half/headers/public/wasi/api.h")
}
pub fn libc_wasi_api_source() -> PathBuf {
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("../../libc-bottom-half/sources/__wasilibc_real.c")
}
|