Merge branch 'amalgamation' of git://github.com/lluchs/wren into lluchs-amalgamation

This commit is contained in:
Bob Nystrom
2015-04-23 07:27:32 -07:00
8 changed files with 92 additions and 26 deletions
+20 -20
View File
@@ -11,7 +11,7 @@
#include "wren_value.h"
// This string literal is generated automatically from core. Do not edit.
static const char* libSource =
static const char* coreLibSource =
"class Bool {}\n"
"class Fiber {}\n"
"class Fn {}\n"
@@ -485,7 +485,7 @@ DEF_PRIMITIVE(fn_arity)
RETURN_NUM(AS_FN(args[0])->arity);
}
static PrimitiveResult callFunction(WrenVM* vm, Value* args, int numArgs)
static PrimitiveResult callFn(WrenVM* vm, Value* args, int numArgs)
{
ObjFn* fn;
if (IS_CLOSURE(args[0]))
@@ -502,23 +502,23 @@ static PrimitiveResult callFunction(WrenVM* vm, Value* args, int numArgs)
return PRIM_CALL;
}
DEF_PRIMITIVE(fn_call0) { return callFunction(vm, args, 0); }
DEF_PRIMITIVE(fn_call1) { return callFunction(vm, args, 1); }
DEF_PRIMITIVE(fn_call2) { return callFunction(vm, args, 2); }
DEF_PRIMITIVE(fn_call3) { return callFunction(vm, args, 3); }
DEF_PRIMITIVE(fn_call4) { return callFunction(vm, args, 4); }
DEF_PRIMITIVE(fn_call5) { return callFunction(vm, args, 5); }
DEF_PRIMITIVE(fn_call6) { return callFunction(vm, args, 6); }
DEF_PRIMITIVE(fn_call7) { return callFunction(vm, args, 7); }
DEF_PRIMITIVE(fn_call8) { return callFunction(vm, args, 8); }
DEF_PRIMITIVE(fn_call9) { return callFunction(vm, args, 9); }
DEF_PRIMITIVE(fn_call10) { return callFunction(vm, args, 10); }
DEF_PRIMITIVE(fn_call11) { return callFunction(vm, args, 11); }
DEF_PRIMITIVE(fn_call12) { return callFunction(vm, args, 12); }
DEF_PRIMITIVE(fn_call13) { return callFunction(vm, args, 13); }
DEF_PRIMITIVE(fn_call14) { return callFunction(vm, args, 14); }
DEF_PRIMITIVE(fn_call15) { return callFunction(vm, args, 15); }
DEF_PRIMITIVE(fn_call16) { return callFunction(vm, args, 16); }
DEF_PRIMITIVE(fn_call0) { return callFn(vm, args, 0); }
DEF_PRIMITIVE(fn_call1) { return callFn(vm, args, 1); }
DEF_PRIMITIVE(fn_call2) { return callFn(vm, args, 2); }
DEF_PRIMITIVE(fn_call3) { return callFn(vm, args, 3); }
DEF_PRIMITIVE(fn_call4) { return callFn(vm, args, 4); }
DEF_PRIMITIVE(fn_call5) { return callFn(vm, args, 5); }
DEF_PRIMITIVE(fn_call6) { return callFn(vm, args, 6); }
DEF_PRIMITIVE(fn_call7) { return callFn(vm, args, 7); }
DEF_PRIMITIVE(fn_call8) { return callFn(vm, args, 8); }
DEF_PRIMITIVE(fn_call9) { return callFn(vm, args, 9); }
DEF_PRIMITIVE(fn_call10) { return callFn(vm, args, 10); }
DEF_PRIMITIVE(fn_call11) { return callFn(vm, args, 11); }
DEF_PRIMITIVE(fn_call12) { return callFn(vm, args, 12); }
DEF_PRIMITIVE(fn_call13) { return callFn(vm, args, 13); }
DEF_PRIMITIVE(fn_call14) { return callFn(vm, args, 14); }
DEF_PRIMITIVE(fn_call15) { return callFn(vm, args, 15); }
DEF_PRIMITIVE(fn_call16) { return callFn(vm, args, 16); }
DEF_PRIMITIVE(fn_toString)
{
@@ -1331,7 +1331,7 @@ void wrenInitializeCore(WrenVM* vm)
// '---------' '--------------' -'
// The rest of the classes can now be defined normally.
wrenInterpret(vm, "", libSource);
wrenInterpret(vm, "", coreLibSource);
vm->boolClass = AS_CLASS(wrenFindVariable(vm, "Bool"));
PRIMITIVE(vm->boolClass, "toString", bool_toString);
+3
View File
@@ -333,6 +333,9 @@ static int dumpInstruction(WrenVM* vm, ObjFn* fn, int i, int* lastLine)
// Return how many bytes this instruction takes, or -1 if it's an END.
if (code == CODE_END) return -1;
return i - start;
#undef READ_BYTE
#undef READ_SHORT
}
int wrenDumpInstruction(WrenVM* vm, ObjFn* fn, int i)
+2 -2
View File
@@ -10,7 +10,7 @@
#define MAX_READ_LEN 1024
// This string literal is generated automatically from io.wren. Do not edit.
static const char* libSource =
static const char* ioLibSource =
"class IO {\n"
" static print {\n"
" IO.writeString_(\"\n\")\n"
@@ -142,7 +142,7 @@ static void ioTime(WrenVM* vm)
void wrenLoadIOLibrary(WrenVM* vm)
{
wrenInterpret(vm, "", libSource);
wrenInterpret(vm, "", ioLibSource);
}
WrenForeignMethodFn wrenBindIOForeignMethod(WrenVM* vm, const char* className,
+2 -2
View File
@@ -7,7 +7,7 @@
#include "wren_primitive.h"
// This string literal is generated automatically from meta.wren. Do not edit.
static const char* libSource =
static const char* metaLibSource =
"class Meta {}\n";
DEF_PRIMITIVE(meta_eval)
@@ -43,7 +43,7 @@ DEF_PRIMITIVE(meta_eval)
void wrenLoadMetaLibrary(WrenVM* vm)
{
wrenInterpret(vm, "", libSource);
wrenInterpret(vm, "", metaLibSource);
// The methods on "Meta" are static, so get the metaclass for the Meta class.
ObjClass* meta = AS_CLASS(wrenFindVariable(vm, "Meta"))->obj.classObj;
+2
View File
@@ -1219,6 +1219,8 @@ static bool runInterpreter(WrenVM* vm)
UNREACHABLE();
return false;
}
#undef READ_BYTE
#undef READ_SHORT
// Creates an [ObjFn] that invokes a method with [signature] when called.
static ObjFn* makeCallStub(WrenVM* vm, ObjModule* module, const char* signature)