Reorganize makefile and scripts.
This commit is contained in:
+8
-6
@@ -9,9 +9,6 @@
|
||||
// This is the source file for the standalone command line interpreter. It is
|
||||
// not needed if you are embedding Wren in an application.
|
||||
|
||||
// TODO: Don't hardcode this.
|
||||
#define MAX_LINE 1024
|
||||
|
||||
static void failIf(bool condition, int exitCode, const char* format, ...)
|
||||
{
|
||||
if (!condition) return;
|
||||
@@ -66,8 +63,10 @@ static int runRepl(WrenVM* vm)
|
||||
for (;;)
|
||||
{
|
||||
printf("> ");
|
||||
char line[MAX_LINE];
|
||||
fgets(line, MAX_LINE, stdin);
|
||||
|
||||
char* line = NULL;
|
||||
size_t size = 0;
|
||||
getline(&line, &size, stdin);
|
||||
|
||||
// If stdin was closed (usually meaning the used entered Ctrl-D), exit.
|
||||
if (feof(stdin))
|
||||
@@ -77,7 +76,10 @@ static int runRepl(WrenVM* vm)
|
||||
}
|
||||
|
||||
// TODO: Handle failure.
|
||||
wrenInterpret(vm, "(repl)", line);
|
||||
wrenInterpret(vm, "Prompt", line);
|
||||
|
||||
free(line);
|
||||
|
||||
// TODO: Figure out how this should work with wren API.
|
||||
/*
|
||||
ObjFn* fn = compile(vm, line);
|
||||
|
||||
+4
-2
@@ -478,7 +478,8 @@ static bool runInterpreter(WrenVM* vm)
|
||||
&&code_CLASS,
|
||||
&&code_SUBCLASS,
|
||||
&&code_METHOD_INSTANCE,
|
||||
&&code_METHOD_STATIC
|
||||
&&code_METHOD_STATIC,
|
||||
&&code_END
|
||||
};
|
||||
|
||||
#define INTERPRET_LOOP DISPATCH();
|
||||
@@ -1022,7 +1023,8 @@ static bool runInterpreter(WrenVM* vm)
|
||||
CASE_CODE(END):
|
||||
// A CODE_END should always be preceded by a CODE_RETURN. If we get here,
|
||||
// the compiler generated wrong code.
|
||||
ASSERT(0, "Should not execute past end of bytecode.");
|
||||
UNREACHABLE();
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
ASSERT(0, "Should not reach end of interpret.");
|
||||
|
||||
Reference in New Issue
Block a user