SWIG can generate interface for other languages to call C++ functions. If C++ codes are separeted to mutiple directories, we may have some trouble.
- Prepare directories like this.
- invoke
- invoke.cpp
int main() { | |
auto mod = wasmparser::Parser::doParse("../testdata/fibonacci.wasm"); | |
std::cout << mod.code_sec.size << std::endl; | |
auto decoder = wasmparser::InstructionDecoder(&mod); | |
// using Byte = unsigned char; | |
// { | |
// Byte buf1[1] = {0x04}; | |
// uint32_t a; | |
// wasmparser::decodeULEB128(&buf1[0], &buf1[0], &a); | |
// std::cout << a << std::endl; |
#include <iostream> | |
int main() { | |
int a = 0; | |
int l = 1; | |
printf("%i | ", l); | |
for (auto s : cs->value.elem) { | |
printf("0x%.2x ", s); | |
if (a == 7) { | |
std::cout << std::endl; |
enum class InstructionSymbol : Byte { | |
// ==== Control Instructions ==== | |
UNREACHABLE = 0x00, | |
NOP = 0x01, | |
BLOCK = 0x02, | |
LOOP = 0x03, | |
IF = 0x04, | |
ELSE = 0x05, | |
END = 0x0B, | |
BR = 0x0C, |
# <op> ::= + | - | * | |
# <number> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | |
# <factor> ::= <number> | '(' <expr> ')' | |
# <expr> ::= <factor> [<op> <factor>]* | |
class Parser(): | |
def __init__(self, eq): | |
self.idx = 0 | |
self.eq = list(eq) | |
self.nums = list("0123456789") | |
self.op = list("+-*") |
package main | |
import ( | |
"fmt" | |
"sync" | |
"time" | |
) | |
type PubSub struct { | |
mux sync.RWMutex |
#include <algorithm> | |
#include <array> | |
#include <cassert> | |
#include <cstddef> | |
#include <iostream> | |
#include <optional> | |
#include <ostream> | |
#include <set> | |
#include <vector> |
#include <iostream> | |
#include <string> | |
#include <vector> | |
class Record { | |
public: | |
// continueフラグは、msecに変換する際、初期値から換算するか否かを区別するのに用いる | |
Record(const std::string &record_str) : record_str_(record_str) { | |
parse(); | |
calculateTimestamp(); |
use std::cmp; | |
fn main() { | |
let base: &str = "kitten"; | |
let changed: &str = "sitting"; | |
let mut dp: Vec<Vec<i8>> = vec![]; | |
let x_len: usize = base.len() + 1; | |
let y_len: usize = changed.len() + 1; | |
for _ in 0..y_len { | |
let elem: Vec<i8> = vec![-1; x_len]; |
static_resources: | |
listeners: | |
- address: | |
socket_address: | |
address: 0.0.0.0 | |
port_value: 8000 | |
filter_chains: | |
- filters: | |
- name: envoy.http_connection_manager | |
typed_config: |