1#include <sysio/vm/backend.hpp>
2#include <sysio/vm/error_codes.hpp>
3#include <sysio/vm/host_function.hpp>
4#include <sysio/vm/watchdog.hpp>
17 void print_name(
const char* nm) { std::cout <<
"Name : " << nm <<
" " <<
field <<
"\n"; }
19 void*
memset(
char* ptr,
int x,
size_t n) { return ::memset(ptr, x, n); }
24 std::cout << msg << std::endl;
30 std::cout <<
"Span : " << std::string{
s.data(),
s.size()} <<
"\n";
35 using type_converter::type_converter;
54 std::cerr <<
"Please enter three numbers\n";
64 rhf_t::add<&example_host_methods::print_num>(
"env",
"print_num");
66 rhf_t::add<&example_host_methods::sysio_assert>(
"env",
"sysio_assert");
68 rhf_t::add<&example_host_methods::print_name, test_name>(
"env",
"print_name");
70 rhf_t::add<&example_host_methods::memset>(
"env",
"memset");
71 rhf_t::add<&example_host_methods::print_span>(
"env",
"print_span");
85 }
catch (...) { std::cerr <<
"sys-vm interpreter error\n"; }
Triggers a callback after a given time elapses.
std::vector< uint8_t > hello_wasm
backend_t bkend(hello_wasm, ehm, &wa)
unsigned __int64 uint64_t
SYS_VM_FROM_WASM(char *,(void *ptr))
SYS_VM_FROM_WASM(const char *,(void *ptr))
SYS_VM_FROM_WASM(bool,(uint32_t value))
void print_name(const char *nm)
void print_span(span< const char > s)
void sysio_assert(bool test, const char *msg)
void print_num(uint64_t n)
void * memset(char *ptr, int x, size_t n)
auto from_wasm(vm::wasm_ptr_t ptr) const -> std::enable_if_t< std::is_pointer_v< T >, vm::argument_proxy< T > >
#define SYS_VM_PRECONDITION(NAME,...)
#define SYS_VM_INVOKE_ON(TYPE, CONDITION)