Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
hello_driver.cpp File Reference
#include <sysio/vm/backend.hpp>
#include <sysio/vm/error_codes.hpp>
#include <sysio/vm/host_function.hpp>
#include <sysio/vm/watchdog.hpp>
#include <iostream>
#include <string>
#include "hello.wasm.hpp"
Include dependency graph for hello_driver.cpp:

Go to the source code of this file.

Classes

struct  example_host_methods
 
struct  cnv
 

Typedefs

using rhf_t = sysio::vm::registered_host_functions<example_host_methods, execution_interface, cnv>
 
using backend_t = sysio::vm::backend<rhf_t>
 

Functions

 SYS_VM_PRECONDITION (test_name, SYS_VM_INVOKE_ON(const char *, [&](auto &&nm, auto &&... rest) { std::string s=nm;if(s=="sys-vm2") throw "failure";})) int main(int argc
 
 rhf_t::add<&example_host_methods::print_num > ("env", "print_num")
 
 rhf_t::add<&example_host_methods::sysio_assert > ("env", "sysio_assert")
 
 rhf_t::add<&example_host_methods::print_name, test_name > ("env", "print_name")
 
 rhf_t::add<&example_host_methods::memset > ("env", "memset")
 
 rhf_t::add<&example_host_methods::print_span > ("env", "print_span")
 
backend_t bkend (hello_wasm, ehm, &wa)
 
 bkend (ehm, "env", "apply",(uint64_t) std::atoi(argv[1]),(uint64_t) std::atoi(argv[2]),(uint64_t) std::atoi(argv[3]))
 
 catch (...)
 

Variables

char ** argv
 
watchdog wd {std::chrono::seconds(3)}
 
 try
 
ehm field = "testing"
 
 return
 

Typedef Documentation

◆ backend_t

Definition at line 61 of file hello_driver.cpp.

◆ rhf_t

Function Documentation

◆ bkend() [1/2]

bkend ( ehm ,
"env" ,
"apply" ,
(uint64_t) std::atoi(argv[1]) ,
(uint64_t) std::atoi(argv[2]) ,
(uint64_t) std::atoi(argv[3])  )

◆ bkend() [2/2]

backend_t bkend ( hello_wasm ,
ehm ,
& wa )

◆ catch()

catch ( ...)

Definition at line 85 of file hello_driver.cpp.

85{ std::cerr << "sys-vm interpreter error\n"; }
Here is the caller graph for this function:

◆ rhf_t::add<&example_host_methods::memset >()

rhf_t::add<&example_host_methods::memset > ( "env" ,
"memset"  )

◆ rhf_t::add<&example_host_methods::print_name, test_name >()

rhf_t::add<&example_host_methods::print_name, test_name > ( "env" ,
"print_name"  )

◆ rhf_t::add<&example_host_methods::print_num >()

rhf_t::add<&example_host_methods::print_num > ( "env" ,
"print_num"  )

◆ rhf_t::add<&example_host_methods::print_span >()

rhf_t::add<&example_host_methods::print_span > ( "env" ,
"print_span"  )

◆ rhf_t::add<&example_host_methods::sysio_assert >()

rhf_t::add<&example_host_methods::sysio_assert > ( "env" ,
"sysio_assert"  )

◆ SYS_VM_PRECONDITION()

SYS_VM_PRECONDITION ( test_name ,
SYS_VM_INVOKE_ON(const char *,[&](auto &&nm, auto &&... rest) { std::string s=nm; if(s=="sys-vm2") throw "failure"; })  )

Simple implementation of an interpreter using sys-vm.

Variable Documentation

◆ argv

char** argv
Initial value:
{
if (argc < 4) {
std::cerr << "Please enter three numbers\n";
return -1;
}
wasm_allocator wa
Definition main.cpp:10

Definition at line 52 of file hello_driver.cpp.

52 {
53 if (argc < 4) {
54 std::cerr << "Please enter three numbers\n";
55 return -1;
56 }

◆ field

ehm field = "testing"

Definition at line 80 of file hello_driver.cpp.

◆ return

return

Definition at line 86 of file hello_driver.cpp.

◆ try

try
Initial value:

Definition at line 74 of file hello_driver.cpp.

◆ wd

watchdog wd {std::chrono::seconds(3)}

Definition at line 73 of file hello_driver.cpp.

73{std::chrono::seconds(3)};