rename macro. add comments to invocation.

This commit is contained in:
Pat Hickey
2020-06-23 14:16:53 -07:00
parent abc3982234
commit bb339aaba0
2 changed files with 7 additions and 2 deletions

View File

@@ -6,10 +6,15 @@ pub use wasi_common::{WasiCtx, WasiCtxBuilder};
// Defines a `struct Wasi` with member fields and appropriate APIs for dealing // Defines a `struct Wasi` with member fields and appropriate APIs for dealing
// with all the various WASI exports. // with all the various WASI exports.
wasmtime_wiggle::define_struct_for_wiggle!({ wasmtime_wiggle::define_wasmtime_integration!({
// The wiggle code to integrate with lives here:
target: wasi_common::wasi, target: wasi_common::wasi,
// This must be the same witx document as used above:
witx: ["../wasi-common/WASI/phases/snapshot/witx/wasi_snapshot_preview1.witx"], witx: ["../wasi-common/WASI/phases/snapshot/witx/wasi_snapshot_preview1.witx"],
// This must be the same ctx type as used for the target:
ctx: WasiCtx, ctx: WasiCtx,
// This macro will emit a struct to represent the instance,
// with this name and docs:
instance: { instance: {
name: Wasi, name: Wasi,
docs: "An instantiated instance of the wasi exports. docs: "An instantiated instance of the wasi exports.

View File

@@ -9,7 +9,7 @@ mod config;
use config::{InstanceConf, TargetConf}; use config::{InstanceConf, TargetConf};
#[proc_macro] #[proc_macro]
pub fn define_struct_for_wiggle(args: TokenStream) -> TokenStream { pub fn define_wasmtime_integration(args: TokenStream) -> TokenStream {
let mut config = parse_macro_input!(args as config::Config); let mut config = parse_macro_input!(args as config::Config);
config.witx.make_paths_relative_to( config.witx.make_paths_relative_to(
std::env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR env var"), std::env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR env var"),