7#ifndef TOY_INTERPRETER_H_
8#define TOY_INTERPRETER_H_
Definition: toy_interpreter.h:25
const unsigned char * bytecode
Definition: toy_interpreter.h:27
Toy_LiteralArray literalCache
Definition: toy_interpreter.h:31
Toy_PrintFn printOutput
Definition: toy_interpreter.h:41
Toy_PrintFn errorOutput
Definition: toy_interpreter.h:43
int count
Definition: toy_interpreter.h:29
Toy_LiteralDictionary * hooks
Definition: toy_interpreter.h:38
bool panic
Definition: toy_interpreter.h:46
int depth
Definition: toy_interpreter.h:45
int length
Definition: toy_interpreter.h:28
Toy_PrintFn assertOutput
Definition: toy_interpreter.h:42
Toy_Scope * scope
Definition: toy_interpreter.h:34
int codeStart
Definition: toy_interpreter.h:30
Toy_LiteralArray stack
Definition: toy_interpreter.h:35
@????@
Definition: toy_literal_array.h:20
Definition: toy_literal_dictionary.h:31
Definition: toy_literal.h:85
Definition: toy_scope.h:21
TOY_API void Toy_initInterpreter(Toy_Interpreter *interpreter)
Initializes the Toy_Interpreter. It allocates memory for internal systems such as the stack,...
TOY_API void Toy_setInterpreterAssert(Toy_Interpreter *interpreter, Toy_PrintFn assertOutput)
Sets the function called by the assert keyword on failure. By default, the following wrapper is used:...
TOY_API void Toy_runInterpreter(Toy_Interpreter *interpreter, const unsigned char *bytecode, size_t length)
Takes a Toy_Interpreter and bytecode (as well as the length of the bytecode), checks its version info...
TOY_API bool Toy_parseIdentifierToValue(Toy_Interpreter *interpreter, Toy_Literal *literalPtr)
Sometimes, native functions will receive Toy_Literal identifiers instead of the values - the values c...
TOY_API bool Toy_injectNativeHook(Toy_Interpreter *interpreter, const char *name, Toy_HookFn hook)
Will inject the given native function hook into the Toy_Interpreter's hook cache, with the name passe...
TOY_API bool Toy_callFn(Toy_Interpreter *interpreter, const char *name, Toy_LiteralArray *arguments, Toy_LiteralArray *returns)
Utility function that will find a Toy_literal within the Toy_Interpreter's scope with a name that mat...
TOY_API void Toy_freeInterpreter(Toy_Interpreter *interpreter)
Frees a Toy_Interpreter, clearing all of the memory used within. That interpreter is no longer valid ...
TOY_API void Toy_setInterpreterPrint(Toy_Interpreter *interpreter, Toy_PrintFn printOutput)
This function sets the function called by the print keyword. By default, the following wrapper is use...
TOY_API bool Toy_injectNativeFn(Toy_Interpreter *interpreter, const char *name, Toy_NativeFn func)
Will inject the given native function func into the Toy_Interpreter's current scope,...
TOY_API bool Toy_callLiteralFn(Toy_Interpreter *interpreter, Toy_Literal func, Toy_LiteralArray *arguments, Toy_LiteralArray *returns)
Calls a Toy_Literal which contains a function, with the arguments to that function passed in as argum...
TOY_API void Toy_setInterpreterError(Toy_Interpreter *interpreter, Toy_PrintFn errorOutput)
Sets the function called when an error occurs within the interpreter. By default, the following wrapp...
TOY_API void Toy_resetInterpreter(Toy_Interpreter *interpreter)
Frees any environment that the scripts have built up, and generates a new one. It also injects severa...
void(* Toy_PrintFn)(const char *)
@???@
Definition: toy_literal.h:48
int(* Toy_HookFn)(struct Toy_Interpreter *interpreter, struct Toy_Literal identifier, struct Toy_Literal alias)
@???@
Definition: toy_literal.h:41
int(* Toy_NativeFn)(struct Toy_Interpreter *interpreter, struct Toy_LiteralArray *arguments)
@???@
Definition: toy_literal.h:30