Phasor 2.2.0
Stack VM based Programming Language
Loading...
Searching...
No Matches
ffi.cpp File Reference
#include "ffi.hpp"
#include <vector>
#include <iostream>
#include <memory>
#include <string>
#include <stdexcept>
#include <sstream>
#include <filesystem>
Include dependency graph for ffi.cpp:

Go to the source code of this file.

Namespaces

namespace  Phasor
 The Phasor Programming Language and Runtime.

Macros

#define INSTANCED_FFI(fn)
#define VM_PRINT(str)

Functions

static Phasor::Value Phasor::from_c_value (const PhasorValue &c_value)
 Converts a C-style FFI value to a C++ VM value.
static PhasorValue Phasor::to_c_value (const Phasor::Value &cpp_value, std::vector< std::unique_ptr< char[]> > &string_arena, std::vector< std::unique_ptr< PhasorValue[]> > &array_arena)
 Converts a C++ VM value to a C-style FFI value.
static Phasor::Value Phasor::c_native_func_wrapper (PhasorNativeFunction c_func, Phasor::VM *vm, const std::vector< Phasor::Value > &args)
 The "trampoline" that wraps a C function from a plugin.
static void Phasor::register_native_c_func (PhasorVM *vm, const char *name, PhasorNativeFunction func)
 The concrete implementation of the PhasorRegisterFunction API call.

Macro Definition Documentation

◆ INSTANCED_FFI

#define INSTANCED_FFI ( fn)
Value:
[this](const std::vector<Value> &args, VM *vm) { return this->fn(args, vm); }

Definition at line 15 of file ffi.cpp.

◆ VM_PRINT

#define VM_PRINT ( str)
Value:
vm->setRegister(VM::r0, str); vm->operation(OpCode::PRINT_R, VM::r0);

Definition at line 17 of file ffi.cpp.