diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/prebuilt/wasm2c.include.h | 53 | ||||
-rw-r--r-- | src/wasm2c.h.tmpl | 53 |
2 files changed, 2 insertions, 104 deletions
diff --git a/src/prebuilt/wasm2c.include.h b/src/prebuilt/wasm2c.include.h index d5ada500..d2657c5a 100644 --- a/src/prebuilt/wasm2c.include.h +++ b/src/prebuilt/wasm2c.include.h @@ -4,14 +4,9 @@ const char SECTION_NAME(top)[] = "extern \"C\" {\n" "#endif\n" "\n" -"#ifndef WASM_RT_INCLUDED_\n" -"#define WASM_RT_INCLUDED_\n" -"\n" "#include <stdint.h>\n" "\n" -"#ifndef WASM_RT_MAX_CALL_STACK_DEPTH\n" -"#define WASM_RT_MAX_CALL_STACK_DEPTH 500\n" -"#endif\n" +"#include \"wasm-rt.h\"\n" "\n" "#ifndef WASM_RT_MODULE_PREFIX\n" "#define WASM_RT_MODULE_PREFIX\n" @@ -35,52 +30,6 @@ const char SECTION_NAME(top)[] = "typedef float f32;\n" "typedef double f64;\n" "\n" -"typedef enum {\n" -" WASM_RT_TRAP_NONE,\n" -" WASM_RT_TRAP_OOB,\n" -" WASM_RT_TRAP_INT_OVERFLOW,\n" -" WASM_RT_TRAP_DIV_BY_ZERO,\n" -" WASM_RT_TRAP_INVALID_CONVERSION,\n" -" WASM_RT_TRAP_UNREACHABLE,\n" -" WASM_RT_TRAP_CALL_INDIRECT,\n" -" WASM_RT_TRAP_EXHAUSTION,\n" -"} wasm_rt_trap_t;\n" -"\n" -"typedef enum {\n" -" WASM_RT_I32,\n" -" WASM_RT_I64,\n" -" WASM_RT_F32,\n" -" WASM_RT_F64,\n" -"} wasm_rt_type_t;\n" -"\n" -"typedef void (*wasm_rt_anyfunc_t)(void);\n" -"\n" -"typedef struct {\n" -" uint32_t func_type;\n" -" wasm_rt_anyfunc_t func;\n" -"} wasm_rt_elem_t;\n" -"\n" -"typedef struct {\n" -" uint8_t* data;\n" -" uint32_t pages, max_pages;\n" -" uint32_t size;\n" -"} wasm_rt_memory_t;\n" -"\n" -"typedef struct {\n" -" wasm_rt_elem_t* data;\n" -" uint32_t max_size;\n" -" uint32_t size;\n" -"} wasm_rt_table_t;\n" -"\n" -"extern void wasm_rt_trap(wasm_rt_trap_t) __attribute__((noreturn));\n" -"extern uint32_t wasm_rt_register_func_type(uint32_t params, uint32_t results, ...);\n" -"extern void wasm_rt_allocate_memory(wasm_rt_memory_t*, uint32_t initial_pages, uint32_t max_pages);\n" -"extern uint32_t wasm_rt_grow_memory(wasm_rt_memory_t*, uint32_t pages);\n" -"extern void wasm_rt_allocate_table(wasm_rt_table_t*, uint32_t elements, uint32_t max_elements);\n" -"extern uint32_t wasm_rt_call_stack_depth;\n" -"\n" -"#endif /* WASM_RT_INCLUDED_ */\n" -"\n" "extern void WASM_RT_ADD_PREFIX(init)(void);\n" ; diff --git a/src/wasm2c.h.tmpl b/src/wasm2c.h.tmpl index 24b1af23..d4a80d64 100644 --- a/src/wasm2c.h.tmpl +++ b/src/wasm2c.h.tmpl @@ -3,14 +3,9 @@ extern "C" { #endif -#ifndef WASM_RT_INCLUDED_ -#define WASM_RT_INCLUDED_ - #include <stdint.h> -#ifndef WASM_RT_MAX_CALL_STACK_DEPTH -#define WASM_RT_MAX_CALL_STACK_DEPTH 500 -#endif +#include "wasm-rt.h" #ifndef WASM_RT_MODULE_PREFIX #define WASM_RT_MODULE_PREFIX @@ -34,52 +29,6 @@ typedef int64_t s64; typedef float f32; typedef double f64; -typedef enum { - WASM_RT_TRAP_NONE, - WASM_RT_TRAP_OOB, - WASM_RT_TRAP_INT_OVERFLOW, - WASM_RT_TRAP_DIV_BY_ZERO, - WASM_RT_TRAP_INVALID_CONVERSION, - WASM_RT_TRAP_UNREACHABLE, - WASM_RT_TRAP_CALL_INDIRECT, - WASM_RT_TRAP_EXHAUSTION, -} wasm_rt_trap_t; - -typedef enum { - WASM_RT_I32, - WASM_RT_I64, - WASM_RT_F32, - WASM_RT_F64, -} wasm_rt_type_t; - -typedef void (*wasm_rt_anyfunc_t)(void); - -typedef struct { - uint32_t func_type; - wasm_rt_anyfunc_t func; -} wasm_rt_elem_t; - -typedef struct { - uint8_t* data; - uint32_t pages, max_pages; - uint32_t size; -} wasm_rt_memory_t; - -typedef struct { - wasm_rt_elem_t* data; - uint32_t max_size; - uint32_t size; -} wasm_rt_table_t; - -extern void wasm_rt_trap(wasm_rt_trap_t) __attribute__((noreturn)); -extern uint32_t wasm_rt_register_func_type(uint32_t params, uint32_t results, ...); -extern void wasm_rt_allocate_memory(wasm_rt_memory_t*, uint32_t initial_pages, uint32_t max_pages); -extern uint32_t wasm_rt_grow_memory(wasm_rt_memory_t*, uint32_t pages); -extern void wasm_rt_allocate_table(wasm_rt_table_t*, uint32_t elements, uint32_t max_elements); -extern uint32_t wasm_rt_call_stack_depth; - -#endif /* WASM_RT_INCLUDED_ */ - extern void WASM_RT_ADD_PREFIX(init)(void); %%bottom #ifdef __cplusplus |