wrenReturn___() -> wrenSlotSet___().

This turns those functions into general-purpose functions for writing
raw C values into slots on the foreign call stack.

Writing a return just means writing a value to slot 0.
This commit is contained in:
Bob Nystrom
2015-12-16 13:00:13 -08:00
parent 4b3c818ec5
commit 7fcdcf2f1a
16 changed files with 215 additions and 152 deletions
+3 -3
View File
@@ -165,7 +165,7 @@ void fileClose(WrenVM* vm)
// If it's already closed, we're done.
if (fd == -1)
{
wrenReturnBool(vm, true);
wrenSetSlotBool(vm, 0, true);
return;
}
@@ -174,14 +174,14 @@ void fileClose(WrenVM* vm)
uv_fs_t* request = createRequest(wrenGetSlotValue(vm, 1));
uv_fs_close(getLoop(), request, fd, closeCallback);
wrenReturnBool(vm, false);
wrenSetSlotBool(vm, 0, false);
}
void fileDescriptor(WrenVM* vm)
{
int* foreign = (int*)wrenGetSlotForeign(vm, 0);
int fd = *foreign;
wrenReturnDouble(vm, fd);
wrenSetSlotDouble(vm, 0, fd);
}
static void fileReadBytesCallback(uv_fs_t* request)