Made variable symbols write a custom name.

This commit is contained in:
arookas 2015-12-23 20:20:13 -05:00
parent 684a8a3197
commit 0ab5431c5f

View file

@ -201,6 +201,8 @@ namespace arookas
public int Display { get; private set; }
public int Index { get; private set; }
string TableName { get { return String.Format("varsym_{0}_{1}", Display, Index); } }
// symbol table
public override sunSymbolType Type { get { return sunSymbolType.Variable; } }
public override uint Data { get { return (uint)Index; } }
@ -211,6 +213,16 @@ namespace arookas
Display = display;
Index = index;
}
public override int WriteSymbolTable(aBinaryWriter writer, int ofs)
{
base.WriteSymbolTable(writer, ofs);
return writer.Encoding.GetByteCount(TableName) + 1; // include null terminator
}
public override void WriteStringTable(aBinaryWriter writer)
{
writer.WriteString(TableName, aBinaryStringFormat.NullTerminated);
}
}
enum sunSymbolType