mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Adjusted the interpreter's version guard
This commit is contained in:
@@ -2370,8 +2370,10 @@ void runInterpreter(Interpreter* interpreter, unsigned char* bytecode, int lengt
|
|||||||
const unsigned char minor = readByte(interpreter->bytecode, &interpreter->count);
|
const unsigned char minor = readByte(interpreter->bytecode, &interpreter->count);
|
||||||
const unsigned char patch = readByte(interpreter->bytecode, &interpreter->count);
|
const unsigned char patch = readByte(interpreter->bytecode, &interpreter->count);
|
||||||
|
|
||||||
if (major != TOY_VERSION_MAJOR || minor != TOY_VERSION_MINOR || patch != TOY_VERSION_PATCH) {
|
if (major != TOY_VERSION_MAJOR || minor > TOY_VERSION_MINOR) {
|
||||||
interpreter->errorOutput("Interpreter/bytecode version mismatch\n");
|
char buffer[MAX_STRING_LENGTH];
|
||||||
|
snprintf(buffer, MAX_STRING_LENGTH, "Interpreter/bytecode version mismatch (expected %d.%d.%d or earlier, given %d.%d.%d)\n", TOY_VERSION_MAJOR, TOY_VERSION_MINOR, TOY_VERSION_PATCH, major, minor, patch);
|
||||||
|
interpreter->errorOutput(buffer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,15 @@ import runner;
|
|||||||
s.freeScript();
|
s.freeScript();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//test running an external binary file
|
||||||
|
{
|
||||||
|
var s = loadScriptBytecode("scripts:/lib/runner/sample_bytecode.tb");
|
||||||
|
|
||||||
|
s.runScript();
|
||||||
|
|
||||||
|
s.freeScript();
|
||||||
|
}
|
||||||
|
|
||||||
//test resetting an external script
|
//test resetting an external script
|
||||||
{
|
{
|
||||||
var s = loadScript("scripts:/runner_sample_code.toy");
|
var s = loadScript("scripts:/runner_sample_code.toy");
|
||||||
|
|||||||
Reference in New Issue
Block a user