From a9323376eccc1c0be070f8f7dcbf41aba91d2c0b Mon Sep 17 00:00:00 2001 From: Bob Nystrom Date: Sun, 29 Dec 2013 10:14:38 -0800 Subject: [PATCH] "native" -> "foreign". --- src/wren_vm.c | 22 +++++++++++----------- src/wren_vm.h | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/wren_vm.c b/src/wren_vm.c index 6ac21ee8..a2e4d128 100644 --- a/src/wren_vm.c +++ b/src/wren_vm.c @@ -64,8 +64,8 @@ WrenVM* wrenNewVM(WrenConfiguration* configuration) vm->globals[i] = NULL_VAL; } - vm->nativeCallSlot = NULL; - vm->nativeCallNumArgs = 0; + vm->foreignCallSlot = NULL; + vm->foreignCallNumArgs = 0; wrenInitializeCore(vm); return vm; @@ -572,10 +572,10 @@ static void bindMethod(int methodType, int symbol, ObjClass* classObj, static void callForeign(WrenVM* vm, ObjFiber* fiber, Method* method, int numArgs) { - vm->nativeCallSlot = &fiber->stack[fiber->stackSize - numArgs]; + vm->foreignCallSlot = &fiber->stack[fiber->stackSize - numArgs]; // Don't include the receiver. - vm->nativeCallNumArgs = numArgs - 1; + vm->foreignCallNumArgs = numArgs - 1; method->native(vm); @@ -584,10 +584,10 @@ static void callForeign(WrenVM* vm, ObjFiber* fiber, Method* method, int numArgs fiber->stackSize -= numArgs - 1; // If nothing was returned, implicitly return null. - if (vm->nativeCallSlot != NULL) + if (vm->foreignCallSlot != NULL) { - *vm->nativeCallSlot = NULL_VAL; - vm->nativeCallSlot = NULL; + *vm->foreignCallSlot = NULL_VAL; + vm->foreignCallSlot = NULL; } } @@ -1294,13 +1294,13 @@ double wrenGetArgumentDouble(WrenVM* vm, int index) // + 1 to shift past the receiver. // TODO: Check actual value type first. - return AS_NUM(*(vm->nativeCallSlot + index + 1)); + return AS_NUM(*(vm->foreignCallSlot + index + 1)); } void wrenReturnDouble(WrenVM* vm, double value) { - ASSERT(vm->nativeCallSlot != NULL, "Must be in foreign call."); + ASSERT(vm->foreignCallSlot != NULL, "Must be in foreign call."); - *vm->nativeCallSlot = NUM_VAL(value); - vm->nativeCallSlot = NULL; + *vm->foreignCallSlot = NUM_VAL(value); + vm->foreignCallSlot = NULL; } diff --git a/src/wren_vm.h b/src/wren_vm.h index e4d2b68b..9eb81c49 100644 --- a/src/wren_vm.h +++ b/src/wren_vm.h @@ -247,11 +247,11 @@ struct WrenVM // During a foreign function call, this will point to the first argument (the // receiver) of the call on the fiber's stack. - Value* nativeCallSlot; + Value* foreignCallSlot; // During a foreign function call, this will contain the number of arguments // to the function. - int nativeCallNumArgs; + int foreignCallNumArgs; }; // A generic allocation function that handles all explicit memory management.