21 throw std::runtime_error(
"Function 'phs_op' expects at most 4 arguments, but got " +
22 std::to_string(args.size()));
24 throw std::runtime_error(
"Function 'phs_op' expects an OpCode (int) as the first argument");
27 args.size() > 1 ?
static_cast<int>(args[1].asInt()) : 0,
28 args.size() > 2 ?
static_cast<int>(args[2].asInt()) : 0,
29 args.size() > 3 ?
static_cast<int>(args[3].asInt()) : 0);
37 throw std::runtime_error(
"Function 'phs_stack_run' expects an OpCode (int) as the first argument");
40 for (
size_t i = args.size(); i-- > 1;)
51 return PHASOR_VERSION_STRING;
static void checkArgCount(const std::vector< Value > &args, size_t minimumArguments, const std::string &name, bool allowMoreArguments=false)
static Value meta_stack_run(const std::vector< Value > &args, VM *vm)
static void registerMetaFunctions(VM *vm)
static std::string meta_get_version(const std::vector< Value > &args, VM *vm)
static int64_t meta_operation(const std::vector< Value > &args, VM *vm)
Value operation(const OpCode &op, const int &operand1=0, const int &operand2=0, const int &operand3=0)
Execute a single operation.
Value pop()
Pop a value from the stack.
void registerNativeFunction(const std::string &name, NativeFunction fn)
Register a native function.
void push(const Value &value)
Push a value onto the stack.
A value in the Phasor VM.
int64_t asInt() const noexcept
Get the value as an integer.
The Phasor Programming Language and Runtime.