mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-13 00:51:20 +00:00
feat(runtime-c-api) Extract the value
module.
This commit is contained in:
@ -21,6 +21,10 @@ use wasmer_runtime_core::module::{ExportIndex, ImportName};
|
||||
use wasmer_runtime_core::types::{ElementType, FuncSig, MemoryDescriptor, TableDescriptor, Type};
|
||||
use wasmer_runtime_core::units::{Bytes, Pages};
|
||||
|
||||
pub mod value;
|
||||
|
||||
use value::{wasmer_value, wasmer_value_t, wasmer_value_tag};
|
||||
|
||||
#[repr(C)]
|
||||
pub struct wasmer_module_t;
|
||||
|
||||
@ -40,32 +44,6 @@ pub enum wasmer_result_t {
|
||||
WASMER_ERROR = 2,
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
#[repr(u32)]
|
||||
#[derive(Clone)]
|
||||
pub enum wasmer_value_tag {
|
||||
WASM_I32,
|
||||
WASM_I64,
|
||||
WASM_F32,
|
||||
WASM_F64,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub union wasmer_value {
|
||||
I32: int32_t,
|
||||
I64: int64_t,
|
||||
F32: f32,
|
||||
F64: f64,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone)]
|
||||
pub struct wasmer_value_t {
|
||||
tag: wasmer_value_tag,
|
||||
value: wasmer_value,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone)]
|
||||
pub struct wasmer_global_descriptor_t {
|
||||
|
29
lib/runtime-c-api/src/value.rs
Normal file
29
lib/runtime-c-api/src/value.rs
Normal file
@ -0,0 +1,29 @@
|
||||
//! Wasm values.
|
||||
|
||||
use libc::{int32_t, int64_t};
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
#[repr(u32)]
|
||||
#[derive(Clone)]
|
||||
pub enum wasmer_value_tag {
|
||||
WASM_I32,
|
||||
WASM_I64,
|
||||
WASM_F32,
|
||||
WASM_F64,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub union wasmer_value {
|
||||
pub I32: int32_t,
|
||||
pub I64: int64_t,
|
||||
pub F32: f32,
|
||||
pub F64: f64,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone)]
|
||||
pub struct wasmer_value_t {
|
||||
pub tag: wasmer_value_tag,
|
||||
pub value: wasmer_value,
|
||||
}
|
Reference in New Issue
Block a user