Add id to script output
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
.id 681
|
||||
.int_stack_count 0
|
||||
.string_stack_count 0
|
||||
.int_var_count 2
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
.id 91
|
||||
.int_stack_count 2
|
||||
.string_stack_count 1
|
||||
.int_var_count 2
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
.id 1001
|
||||
.int_stack_count 0
|
||||
.string_stack_count 0
|
||||
.int_var_count 0
|
||||
|
||||
Reference in New Issue
Block a user