![]() |
F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
|
#include <stdbool.h>#include <stdint.h>#include <stddef.h>Go to the source code of this file.
Classes | |
| struct | spacewasm_host_t |
| union | spacewasm_value_payload_t |
| struct | spacewasm_value_t |
| struct | spacewasm_compiler_options_t |
Macros | |
| #define | SPACEWASM_NORETURN /* Fallback: do nothing on unsupported compilers */ |
| #define | CustomSection_MAX_NAME_LENGTH 32 |
Typedefs | |
| typedef int32_t | spacewasm_status_t |
| typedef int32_t | spacewasm_hostcall_result_t |
| typedef uint8_t | spacewasm_valtype_t |
| typedef int32_t | spacewasm_read_result_t |
| typedef int32_t | spacewasm_run_status_t |
| typedef int32_t | spacewasm_trap_t |
| typedef struct spacewasm_allocator_t | spacewasm_allocator_t |
| typedef struct spacewasm_t | spacewasm_t |
| typedef struct spacewasm_host_module_t | spacewasm_host_module_t |
| typedef struct spacewasm_caller_t | spacewasm_caller_t |
| typedef uint8_t *(* | spacewasm_alloc_fn_t) (void *userdata, size_t size, size_t align) |
| typedef uint8_t *(* | spacewasm_realloc_fn_t) (void *userdata, uint8_t *ptr, size_t old_size, size_t new_size, size_t align) |
| typedef void(* | spacewasm_dealloc_fn_t) (void *userdata, uint8_t *ptr, size_t size, size_t align) |
| typedef struct spacewasm_host_t | spacewasm_host_t |
| typedef union spacewasm_value_payload_t | spacewasm_value_payload_t |
| typedef struct spacewasm_value_t | spacewasm_value_t |
| typedef 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) |
| typedef spacewasm_read_result_t(* | spacewasm_read_fn_t) (void *userdata, const uint8_t **out_buf, size_t *out_len) |
| typedef struct spacewasm_compiler_options_t | spacewasm_compiler_options_t |
| typedef uint8_t *(* | spacewasm_global_alloc_fn_t) (void *userdata, size_t size, size_t align) |
| typedef void(* | spacewasm_global_dealloc_fn_t) (void *userdata, uint8_t *ptr, size_t size, size_t align) |
Functions | |
| struct spacewasm_allocator_t * | spacewasm_allocator_new (spacewasm_alloc_fn_t alloc, spacewasm_realloc_fn_t realloc, spacewasm_dealloc_fn_t dealloc, void *userdata) |
| void | spacewasm_allocator_destroy (struct spacewasm_allocator_t *allocator) |
| spacewasm_status_t | spacewasm_host_new (size_t len, struct spacewasm_host_t *dest) |
| 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_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_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) |
| 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) |
| void | spacewasm_host_destroy (struct spacewasm_host_t *host) |
| spacewasm_status_t | spacewasm_find_module (struct spacewasm_t *engine, const char *name, uint32_t *out_index) |
| spacewasm_status_t | spacewasm_find_export_func (struct spacewasm_t *engine, uint32_t module_idx, const char *name, uint32_t *out_index) |
| 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_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_find_global (struct spacewasm_t *engine, uint32_t module_idx, const char *name, uint32_t *out_index) |
| 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_set_global (struct spacewasm_t *engine, uint32_t module_idx, uint32_t global_index, struct spacewasm_value_t value) |
| 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) |
| spacewasm_run_status_t | spacewasm_run (struct spacewasm_t *engine, size_t fuel, spacewasm_trap_t *out_trap) |
| spacewasm_status_t | spacewasm_resume (struct spacewasm_t *engine) |
| spacewasm_status_t | spacewasm_resume_value (struct spacewasm_t *engine, struct spacewasm_value_t resume_value) |
| spacewasm_status_t | spacewasm_reset (struct spacewasm_t *engine) |
| spacewasm_status_t | spacewasm_get_result (struct spacewasm_t *engine, spacewasm_valtype_t expected, struct spacewasm_value_t *out) |
| void | spacewasm_destroy (struct spacewasm_t *engine) |
| spacewasm_status_t | spacewasm_mem_read (struct spacewasm_caller_t *caller, uint32_t addr, uint8_t *dst, size_t len) |
| spacewasm_status_t | spacewasm_mem_write (struct spacewasm_caller_t *caller, uint32_t addr, const uint8_t *src, size_t len) |
| spacewasm_status_t | spacewasm_mem_size (struct spacewasm_caller_t *caller, uint32_t *out_pages) |
| 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_set_global_allocator (spacewasm_global_alloc_fn_t alloc, spacewasm_global_dealloc_fn_t dealloc, void *userdata) |
| #define CustomSection_MAX_NAME_LENGTH 32 |
Definition at line 31 of file spacewasm.h.
| #define SPACEWASM_NORETURN /* Fallback: do nothing on unsupported compilers */ |
Definition at line 27 of file spacewasm.h.
| typedef uint8_t*(* spacewasm_alloc_fn_t) (void *userdata, size_t size, size_t align) |
Definition at line 374 of file spacewasm.h.
| typedef struct spacewasm_allocator_t spacewasm_allocator_t |
Definition at line 355 of file spacewasm.h.
| typedef struct spacewasm_caller_t spacewasm_caller_t |
Definition at line 369 of file spacewasm.h.
| typedef struct spacewasm_compiler_options_t spacewasm_compiler_options_t |
| typedef void(* spacewasm_dealloc_fn_t) (void *userdata, uint8_t *ptr, size_t size, size_t align) |
Definition at line 389 of file spacewasm.h.
| typedef uint8_t*(* spacewasm_global_alloc_fn_t) (void *userdata, size_t size, size_t align) |
Definition at line 461 of file spacewasm.h.
| typedef void(* spacewasm_global_dealloc_fn_t) (void *userdata, uint8_t *ptr, size_t size, size_t align) |
Definition at line 466 of file spacewasm.h.
| typedef 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) |
Definition at line 419 of file spacewasm.h.
| typedef struct spacewasm_host_module_t spacewasm_host_module_t |
Definition at line 363 of file spacewasm.h.
| typedef struct spacewasm_host_t spacewasm_host_t |
| typedef int32_t spacewasm_hostcall_result_t |
Definition at line 186 of file spacewasm.h.
| typedef spacewasm_read_result_t(* spacewasm_read_fn_t) (void *userdata, const uint8_t **out_buf, size_t *out_len) |
Definition at line 431 of file spacewasm.h.
| typedef int32_t spacewasm_read_result_t |
Definition at line 237 of file spacewasm.h.
| typedef uint8_t*(* spacewasm_realloc_fn_t) (void *userdata, uint8_t *ptr, size_t old_size, size_t new_size, size_t align) |
Definition at line 380 of file spacewasm.h.
| typedef int32_t spacewasm_run_status_t |
Definition at line 258 of file spacewasm.h.
| typedef int32_t spacewasm_status_t |
Definition at line 153 of file spacewasm.h.
| typedef struct spacewasm_t spacewasm_t |
Definition at line 361 of file spacewasm.h.
| typedef int32_t spacewasm_trap_t |
Definition at line 344 of file spacewasm.h.
| typedef uint8_t spacewasm_valtype_t |
Definition at line 207 of file spacewasm.h.
| typedef union spacewasm_value_payload_t spacewasm_value_payload_t |
| typedef struct spacewasm_value_t spacewasm_value_t |
| Enumerator | |
|---|---|
| SPACEWASM_CONTINUE_NONE | |
| SPACEWASM_CONTINUE_SOME | |
| SPACEWASM_TRAP | |
| SPACEWASM_PAUSE | |
Definition at line 160 of file spacewasm.h.
| Enumerator | |
|---|---|
| SPACEWASM_READ_OK | |
| SPACEWASM_READ_EOF | |
| SPACEWASM_READ_ERROR | |
Definition at line 214 of file spacewasm.h.
| Enumerator | |
|---|---|
| SPACEWASM_RUN_FINISHED | |
| SPACEWASM_RUN_OUT_OF_FUEL | |
| SPACEWASM_RUN_PAUSE | |
| SPACEWASM_RUN_TRAP | |
Definition at line 244 of file spacewasm.h.
| enum spacewasm_status_t |
Definition at line 37 of file spacewasm.h.
| enum spacewasm_trap_t |
Definition at line 266 of file spacewasm.h.
| enum spacewasm_valtype_t |
| Enumerator | |
|---|---|
| SPACEWASM_I32 | |
| SPACEWASM_I64 | |
| SPACEWASM_F32 | |
| SPACEWASM_F64 | |
Definition at line 193 of file spacewasm.h.
| 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_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 | ||
| ) |
| void spacewasm_allocator_destroy | ( | struct spacewasm_allocator_t * | allocator | ) |
| struct spacewasm_allocator_t* spacewasm_allocator_new | ( | spacewasm_alloc_fn_t | alloc, |
| spacewasm_realloc_fn_t | realloc, | ||
| spacewasm_dealloc_fn_t | dealloc, | ||
| void * | userdata | ||
| ) |
| 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 | ||
| ) |
| void spacewasm_destroy | ( | struct spacewasm_t * | engine | ) |
| spacewasm_status_t spacewasm_find_export_func | ( | struct spacewasm_t * | engine, |
| uint32_t | module_idx, | ||
| const char * | name, | ||
| uint32_t * | out_index | ||
| ) |
| spacewasm_status_t spacewasm_find_global | ( | struct spacewasm_t * | engine, |
| uint32_t | module_idx, | ||
| const char * | name, | ||
| uint32_t * | out_index | ||
| ) |
| spacewasm_status_t spacewasm_find_module | ( | struct spacewasm_t * | engine, |
| const char * | name, | ||
| uint32_t * | out_index | ||
| ) |
| 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_get_result | ( | struct spacewasm_t * | engine, |
| spacewasm_valtype_t | expected, | ||
| struct spacewasm_value_t * | out | ||
| ) |
| void spacewasm_host_destroy | ( | struct spacewasm_host_t * | host | ) |
| 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 | ||
| ) |
| 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 | ||
| ) |
| spacewasm_status_t spacewasm_mem_read | ( | struct spacewasm_caller_t * | caller, |
| uint32_t | addr, | ||
| uint8_t * | dst, | ||
| size_t | len | ||
| ) |
| spacewasm_status_t spacewasm_mem_size | ( | struct spacewasm_caller_t * | caller, |
| uint32_t * | out_pages | ||
| ) |
| spacewasm_status_t spacewasm_mem_write | ( | struct spacewasm_caller_t * | caller, |
| uint32_t | addr, | ||
| const uint8_t * | src, | ||
| size_t | len | ||
| ) |
| 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_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 | ||
| ) |
| 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_reset | ( | struct spacewasm_t * | engine | ) |
| spacewasm_status_t spacewasm_resume | ( | struct spacewasm_t * | engine | ) |
| spacewasm_status_t spacewasm_resume_value | ( | struct spacewasm_t * | engine, |
| struct spacewasm_value_t | resume_value | ||
| ) |
| spacewasm_run_status_t spacewasm_run | ( | struct spacewasm_t * | engine, |
| size_t | fuel, | ||
| spacewasm_trap_t * | out_trap | ||
| ) |
| spacewasm_status_t spacewasm_set_global | ( | struct spacewasm_t * | engine, |
| uint32_t | module_idx, | ||
| uint32_t | global_index, | ||
| struct spacewasm_value_t | value | ||
| ) |
| spacewasm_status_t spacewasm_set_global_allocator | ( | spacewasm_global_alloc_fn_t | alloc, |
| spacewasm_global_dealloc_fn_t | dealloc, | ||
| void * | userdata | ||
| ) |