summaryrefslogtreecommitdiff
path: root/src/prebuilt/wasm2c.include.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/prebuilt/wasm2c.include.h')
-rw-r--r--src/prebuilt/wasm2c.include.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/src/prebuilt/wasm2c.include.h b/src/prebuilt/wasm2c.include.h
new file mode 100644
index 00000000..d5ada500
--- /dev/null
+++ b/src/prebuilt/wasm2c.include.h
@@ -0,0 +1,91 @@
+/* Generated from 'wasm2c.h.tmpl' by wasm2c_tmpl.py, do not edit! */
+const char SECTION_NAME(top)[] =
+"#ifdef __cplusplus\n"
+"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"
+"\n"
+"#ifndef WASM_RT_MODULE_PREFIX\n"
+"#define WASM_RT_MODULE_PREFIX\n"
+"#endif\n"
+"\n"
+"#define WASM_RT_PASTE_(x, y) x ## y\n"
+"#define WASM_RT_PASTE(x, y) WASM_RT_PASTE_(x, y)\n"
+"#define WASM_RT_ADD_PREFIX(x) WASM_RT_PASTE(WASM_RT_MODULE_PREFIX, x)\n"
+"\n"
+"#define WASM_RT_DEFINE_EXTERNAL(decl, target) decl = &target;\n"
+"\n"
+"/* TODO(binji): only use stdint.h types in header */\n"
+"typedef uint8_t u8;\n"
+"typedef int8_t s8;\n"
+"typedef uint16_t u16;\n"
+"typedef int16_t s16;\n"
+"typedef uint32_t u32;\n"
+"typedef int32_t s32;\n"
+"typedef uint64_t u64;\n"
+"typedef int64_t s64;\n"
+"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"
+;
+
+const char SECTION_NAME(bottom)[] =
+"#ifdef __cplusplus\n"
+"}\n"
+"#endif\n"
+;