Add id to script output

This commit is contained in:
Magic fTail
2018-11-26 07:59:48 +01:00
parent 6c1169c776
commit fb37e494d4
5 changed files with 7 additions and 2 deletions

View File

@@ -218,11 +218,13 @@ public class Disassembler
private void writerHeader(StringBuilder writer, ScriptDefinition script)
{
int id = script.getId();
int intStackCount = script.getIntStackCount();
int stringStackCount = script.getStringStackCount();
int localIntCount = script.getLocalIntCount();
int localStringCount = script.getLocalStringCount();
writer.append(".id ").append(id).append('\n');
writer.append(".int_stack_count ").append(intStackCount).append('\n');
writer.append(".string_stack_count ").append(stringStackCount).append('\n');
writer.append(".int_var_count ").append(localIntCount).append('\n');

View File

@@ -48,7 +48,7 @@ public class ScriptSaverTest
instructions.init();
ScriptDefinition script = new Assembler(instructions).assemble(getClass().getResourceAsStream(SCRIPT_RESOURCE));
byte[] saved = new ScriptSaver().save(script);
ScriptDefinition loadedScripot = new ScriptLoader().load(0, saved);
ScriptDefinition loadedScripot = new ScriptLoader().load(91, saved);
assertEquals(script, loadedScripot);
}
@@ -59,7 +59,7 @@ public class ScriptSaverTest
instructions.init();
ScriptDefinition script = new Assembler(instructions).assemble(getClass().getResourceAsStream(SCRIPT_RESOURCE_UNICODE));
byte[] saved = new ScriptSaver().save(script);
ScriptDefinition loadedScripot = new ScriptLoader().load(0, saved);
ScriptDefinition loadedScripot = new ScriptLoader().load(1001, saved);
assertEquals(script, loadedScripot);
}

View File

@@ -1,3 +1,4 @@
.id 681
.int_stack_count 0
.string_stack_count 0
.int_var_count 2

View File

@@ -1,3 +1,4 @@
.id 91
.int_stack_count 2
.string_stack_count 1
.int_var_count 2

View File

@@ -1,3 +1,4 @@
.id 1001
.int_stack_count 0
.string_stack_count 0
.int_var_count 0