Do some work on wrenCall().
- Add an explicit va_list version. That lets variadic functions forward to it. - Fix a GC bug in wrenCall() with return values. - Make the call API test not re-enter the VM.
This commit is contained in:
+6
-1
@@ -12,6 +12,7 @@ static WrenVM* vm;
|
||||
|
||||
static WrenBindForeignMethodFn bindMethodFn = NULL;
|
||||
static WrenBindForeignClassFn bindClassFn = NULL;
|
||||
static WrenForeignMethodFn afterLoadFn = NULL;
|
||||
|
||||
static uv_loop_t* loop;
|
||||
|
||||
@@ -204,6 +205,8 @@ void runFile(const char* path)
|
||||
|
||||
WrenInterpretResult result = wrenInterpret(vm, path, source);
|
||||
|
||||
if (afterLoadFn != NULL) afterLoadFn(vm);
|
||||
|
||||
if (result == WREN_RESULT_SUCCESS)
|
||||
{
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
@@ -260,8 +263,10 @@ uv_loop_t* getLoop()
|
||||
}
|
||||
|
||||
void setTestCallbacks(WrenBindForeignMethodFn bindMethod,
|
||||
WrenBindForeignClassFn bindClass)
|
||||
WrenBindForeignClassFn bindClass,
|
||||
WrenForeignMethodFn afterLoad)
|
||||
{
|
||||
bindMethodFn = bindMethod;
|
||||
bindClassFn = bindClass;
|
||||
afterLoadFn = afterLoad;
|
||||
}
|
||||
|
||||
+2
-1
@@ -23,6 +23,7 @@ uv_loop_t* getLoop();
|
||||
// Used by the API test executable to let it wire up its own foreign functions.
|
||||
// This must be called before calling [createVM()].
|
||||
void setTestCallbacks(WrenBindForeignMethodFn bindMethod,
|
||||
WrenBindForeignClassFn bindClass);
|
||||
WrenBindForeignClassFn bindClass,
|
||||
void (*afterLoad)(WrenVM* vm));
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user