22#include <unordered_map>
41 using namespace std::string_literals;
55 explicit VM(
State& state)
noexcept;
57 [[deprecated(
"Use VM(State&) instead of VM(State*)")]]
explicit VM(
State* state) noexcept :
74 Value& operator[](const std::
string& name) noexcept;
84 template <typename... Args>
85 Value call(const std::
string& name, Args&&... args);
99 template <typename... Args>
116 void exit(
int code) noexcept;
123 void setUserPointer(
void* ptr) noexcept;
130 void* getUserPointer() noexcept;
155 internal::
Future* createFuture(std::vector<
Value>& args);
163 void deleteFuture(internal::
Future* f);
176 std::vector<std::unique_ptr<internal::
Future>> m_futures;
179 Value m_no_value = internal::Builtins::nil;
182 void* m_user_pointer;
192 int safeRun(internal::
ExecutionContext& context, std::
size_t untilFrameCount = 0);
198 void init() noexcept;
310 uint16_t findNearestVariableIdWithValue(const
Value& value, internal::
ExecutionContext& context) const noexcept;
318 void throwVMError(internal::
ErrorKind kind, const std::
string& message);
336#include "inline/VM.inl"
Host the declaration of all the ArkScript builtins.
Keeping track of the internal data needed by the VM.
Loads .dll/.so/.dynlib files.
The virtual machine scope system.
State used by the virtual machine: it loads the bytecode, can compile it if needed,...
Ark state to handle the dirty job of loading and compiling ArkScript code.
The ArkScript virtual machine, executing ArkScript bytecode.
VM(State *state) noexcept
Handling a shared library as an ArkScript plugin.
const Value False
ArkScript False value.
const Value True
ArkScript True value.
const Value Nil
ArkScript Nil value.