Phasor 3.3.0
Stack VM based Programming Language
Loading...
Searching...
No Matches
memory.cpp
Go to the documentation of this file.
1#include "StdLib.hpp"
2
3namespace Phasor
4{
5
10
11Value StdLib::var_free(const std::vector<Value> &args, VM *vm)
12{
13 checkArgCount(args, 1, "stdmem");
14
15 const Value &arg = args[0];
16
17 if (!arg.isString())
18 throw std::runtime_error("stdmem(): argument must be a string");
19
21 return Value();
22}
23
24} // namespace Phasor
static void registerMemoryFunctions(VM *vm)
Definition memory.cpp:6
static void checkArgCount(const std::vector< Value > &args, size_t minimumArguments, const std::string &name, bool allowMoreArguments=false)
Definition StdLib.cpp:44
static Value var_free(const std::vector< Value > &args, VM *vm)
Free a variable.
Definition memory.cpp:11
Virtual Machine.
Definition VM.hpp:33
void registerNativeFunction(const std::string &name, NativeFunction fn)
Register a native function.
Definition Native.cpp:5
void freeVariableByName(const std::string &name)
Free a variable by name in the VM.
Definition Variables.cpp:30
A value in the Phasor VM.
Definition Value.hpp:58
bool isString() const noexcept
Definition Value.hpp:145
std::string asString() const noexcept
Get the value as a string.
Definition Value.hpp:185
The Phasor Programming Language and Runtime.
Definition AST.hpp:12