-
Notifications
You must be signed in to change notification settings - Fork 0
Running and Compiling
Axel Faes edited this page Sep 13, 2015
·
2 revisions
Some functions can return an error code: CardinalLangResult
.
Possible errors are:
- Compile error
CARDINAL_COMPILE_ERROR
- Runtime error
CARDINAL_RUNTIME_ERROR
- No error, succes running
CARDINAL_SUCCESS
Compiles and runs the string of source in the given VM
CardinalLangResult cardinalInterpret(CardinalVM* vm, const char* sourcePath, const char* source);
Runs a fiber loaded with a function [val] in the virtual machine [vm].
CardinalLangResult cardinalRunFunction(CardinalVM* vm, CardinalValue* val);
Runs [source], a string of Cardinal source code in a new fiber in [vm].
CardinalLangResult cardinalInterpretModule(CardinalVM* vm, const char* sourcePath, const char* source, const char* module);
Compiles [source], a string of Cardinal source code, to an [ObjFn] that will execute that code when invoked.
CardinalValue* cardinalCompileScript(CardinalVM* vm, const char* sourcePath, const char* source);
Compiles [source], a string of Cardinal source code, to an [ObjFn] that will execute that code when invoked.
CardinalValue* cardinalCompileScriptModule(CardinalVM* vm, const char* sourcePath, const char* source, const char* module);
Loads [source], a string of Cardinal byte code, to an [ObjFn] that will execute that code when invoked.
CardinalValue* cardinalLoadByteCode(CardinalVM* vm, const char* sourcePath, const char* source);
Saves the entire state of the VM to a string The value has to be released by the host application
CardinalValue* cardinalSaveByteCode(CardinalVM* vm);
Sets the debug mode of the VM [vm] to boolean value [set]
void cardinalSetDebugMode(CardinalVM* vm, bool set);