13 #if !defined(SPACEWASM_NORETURN) && defined(__has_c_attribute) 14 # if __has_c_attribute(noreturn) 15 # define SPACEWASM_NORETURN [[noreturn]] 19 #if !defined(SPACEWASM_NORETURN) 20 # if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) 21 # define SPACEWASM_NORETURN _Noreturn 22 # elif defined(__GNUC__) || defined(__clang__) 23 # define SPACEWASM_NORETURN __attribute__((noreturn)) 24 # elif defined(_MSC_VER) 25 # define SPACEWASM_NORETURN __declspec(noreturn) 27 # define SPACEWASM_NORETURN 31 #define CustomSection_MAX_NAME_LENGTH 32 38 #if defined(__cplusplus) || __STDC_VERSION__ >= 202311L 40 #endif // defined(__cplusplus) || __STDC_VERSION__ >= 202311L 150 #if __STDC_VERSION__ >= 202311L 154 #endif // __STDC_VERSION__ >= 202311L 155 #endif // __cplusplus 161 #if defined(__cplusplus) || __STDC_VERSION__ >= 202311L 163 #endif // defined(__cplusplus) || __STDC_VERSION__ >= 202311L 183 #if __STDC_VERSION__ >= 202311L 187 #endif // __STDC_VERSION__ >= 202311L 188 #endif // __cplusplus 194 #if defined(__cplusplus) || __STDC_VERSION__ >= 202311L 196 #endif // defined(__cplusplus) || __STDC_VERSION__ >= 202311L 204 #if __STDC_VERSION__ >= 202311L 208 #endif // __STDC_VERSION__ >= 202311L 209 #endif // __cplusplus 215 #if defined(__cplusplus) || __STDC_VERSION__ >= 202311L 217 #endif // defined(__cplusplus) || __STDC_VERSION__ >= 202311L 234 #if __STDC_VERSION__ >= 202311L 238 #endif // __STDC_VERSION__ >= 202311L 239 #endif // __cplusplus 245 #if defined(__cplusplus) || __STDC_VERSION__ >= 202311L 247 #endif // defined(__cplusplus) || __STDC_VERSION__ >= 202311L 255 #if __STDC_VERSION__ >= 202311L 259 #endif // __STDC_VERSION__ >= 202311L 260 #endif // __cplusplus 267 #if defined(__cplusplus) || __STDC_VERSION__ >= 202311L 269 #endif // defined(__cplusplus) || __STDC_VERSION__ >= 202311L 341 #if __STDC_VERSION__ >= 202311L 345 #endif // __STDC_VERSION__ >= 202311L 346 #endif // __cplusplus 374 typedef uint8_t *(*spacewasm_alloc_fn_t)(
void *userdata,
size_t size,
size_t align);
380 typedef uint8_t *(*spacewasm_realloc_fn_t)(
void *userdata,
432 const uint8_t **out_buf,
461 typedef uint8_t *(*spacewasm_global_alloc_fn_t)(
void *userdata,
size_t size,
size_t align);
475 #endif // __cplusplus 516 size_t max_functions,
531 const char *params_sig,
532 const char *returns_sig,
555 uint32_t *out_module_idx);
606 uint32_t *out_index);
618 uint32_t *out_index);
642 uint32_t *out_module_idx,
643 uint32_t *out_func_index);
670 const char *params_sig,
671 const char *returns_sig);
694 uint32_t *out_index);
709 uint32_t global_index,
732 uint32_t global_index,
895 #endif // __cplusplus
struct spacewasm_host_module_t * ptr
union spacewasm_value_payload_t u
void spacewasm_host_destroy(struct spacewasm_host_t *host)
spacewasm_run_status_t spacewasm_run(struct spacewasm_t *engine, size_t fuel, spacewasm_trap_t *out_trap)
spacewasm_status_t spacewasm_mem_write(struct spacewasm_caller_t *caller, uint32_t addr, const uint8_t *src, size_t len)
uint32_t max_backpatch_iterations
struct spacewasm_allocator_t * spacewasm_allocator_new(spacewasm_alloc_fn_t alloc, spacewasm_realloc_fn_t realloc, spacewasm_dealloc_fn_t dealloc, void *userdata)
uint8_t *(* spacewasm_realloc_fn_t)(void *userdata, uint8_t *ptr, size_t old_size, size_t new_size, size_t align)
void(* spacewasm_global_dealloc_fn_t)(void *userdata, uint8_t *ptr, size_t size, size_t align)
spacewasm_status_t spacewasm_module_start(struct spacewasm_t *engine, uint32_t module_idx, uint32_t *out_module_idx, uint32_t *out_func_index)
spacewasm_status_t spacewasm_load_module(struct spacewasm_t *engine, const char *name, spacewasm_read_fn_t read, void *read_userdata, struct spacewasm_allocator_t *allocator, uint32_t *out_module_idx)
struct spacewasm_caller_t spacewasm_caller_t
spacewasm_status_t spacewasm_get_global(struct spacewasm_t *engine, uint32_t module_idx, uint32_t global_index, struct spacewasm_value_t *out)
spacewasm_status_t spacewasm_add_host_function(struct spacewasm_host_t *host, uint32_t module_idx, const char *name, const char *params_sig, const char *returns_sig, spacewasm_host_fn_t f, void *userdata)
spacewasm_read_result_t(* spacewasm_read_fn_t)(void *userdata, const uint8_t **out_buf, size_t *out_len)
spacewasm_status_t spacewasm_mem_read(struct spacewasm_caller_t *caller, uint32_t addr, uint8_t *dst, size_t len)
spacewasm_status_t spacewasm_find_export_func(struct spacewasm_t *engine, uint32_t module_idx, const char *name, uint32_t *out_index)
uint8_t *(* spacewasm_global_alloc_fn_t)(void *userdata, size_t size, size_t align)
union spacewasm_value_payload_t spacewasm_value_payload_t
spacewasm_status_t spacewasm_set_global_allocator(spacewasm_global_alloc_fn_t alloc, spacewasm_global_dealloc_fn_t dealloc, void *userdata)
struct spacewasm_host_module_t spacewasm_host_module_t
struct spacewasm_compiler_options_t spacewasm_compiler_options_t
spacewasm_status_t spacewasm_get_result(struct spacewasm_t *engine, spacewasm_valtype_t expected, struct spacewasm_value_t *out)
spacewasm_status_t spacewasm_resume_value(struct spacewasm_t *engine, struct spacewasm_value_t resume_value)
spacewasm_status_t spacewasm_add_host_module(struct spacewasm_host_t *host, const char *name, size_t max_functions, size_t max_globals, uint32_t *out_idx)
spacewasm_status_t spacewasm_find_global(struct spacewasm_t *engine, uint32_t module_idx, const char *name, uint32_t *out_index)
spacewasm_hostcall_result_t
uint8_t *(* spacewasm_alloc_fn_t)(void *userdata, size_t size, size_t align)
spacewasm_status_t spacewasm_new(struct spacewasm_host_t *host, size_t stack_size, size_t max_modules, struct spacewasm_compiler_options_t options, struct spacewasm_t **out_engine)
struct spacewasm_t spacewasm_t
#define SPACEWASM_NORETURN
spacewasm_status_t spacewasm_reset(struct spacewasm_t *engine)
spacewasm_status_t spacewasm_check_func_signature(struct spacewasm_t *engine, uint32_t module_idx, uint32_t func_index, const char *params_sig, const char *returns_sig)
spacewasm_status_t spacewasm_host_new(size_t len, struct spacewasm_host_t *dest)
spacewasm_status_t spacewasm_invoke(struct spacewasm_t *engine, uint32_t module_idx, uint32_t func_index, const struct spacewasm_value_t *params, size_t n)
void spacewasm_destroy(struct spacewasm_t *engine)
SPACEWASM_NORETURN void spacewasm_panic(const uint8_t *filename, size_t filename_len, uint32_t line, const uint8_t *msg, size_t len)
spacewasm_status_t spacewasm_find_module(struct spacewasm_t *engine, const char *name, uint32_t *out_index)
spacewasm_hostcall_result_t(* spacewasm_host_fn_t)(struct spacewasm_caller_t *caller, void *userdata, const struct spacewasm_value_t *params, size_t n_params, struct spacewasm_value_t *out_result)
struct spacewasm_host_t spacewasm_host_t
spacewasm_status_t spacewasm_set_global(struct spacewasm_t *engine, uint32_t module_idx, uint32_t global_index, struct spacewasm_value_t value)
void spacewasm_allocator_destroy(struct spacewasm_allocator_t *allocator)
struct spacewasm_value_t spacewasm_value_t
struct spacewasm_allocator_t spacewasm_allocator_t
spacewasm_status_t spacewasm_resume(struct spacewasm_t *engine)
spacewasm_status_t spacewasm_mem_size(struct spacewasm_caller_t *caller, uint32_t *out_pages)
void(* spacewasm_dealloc_fn_t)(void *userdata, uint8_t *ptr, size_t size, size_t align)