Member field naming convention.

This commit is contained in:
arookas 2015-12-27 21:03:38 -05:00
parent 063a092730
commit a5ec72e1f9
2 changed files with 30 additions and 30 deletions

View file

@ -25,13 +25,13 @@ namespace arookas
class sunNode : IEnumerable<sunNode>
{
List<sunNode> children;
List<sunNode> mChildren;
public sunNode Parent { get; private set; }
public sunSourceLocation Location { get; private set; }
public int Count { get { return children.Count; } }
public sunNode this[int index] { get { return index >= 0 && index < Count ? children[index] : null; } }
public int Count { get { return mChildren.Count; } }
public sunNode this[int index] { get { return index >= 0 && index < Count ? mChildren[index] : null; } }
public bool IsRoot { get { return Parent == null; } }
public bool IsBranch { get { return Count > 0; } }
@ -68,7 +68,7 @@ namespace arookas
public sunNode(sunSourceLocation location)
{
children = new List<sunNode>(5);
mChildren = new List<sunNode>(5);
Location = location;
}
@ -83,7 +83,7 @@ namespace arookas
node.Parent.Remove(node);
}
node.Parent = this;
children.Add(node);
mChildren.Add(node);
}
public void Remove(sunNode node)
{
@ -93,7 +93,7 @@ namespace arookas
}
if (node.Parent == this)
{
children.Remove(node);
mChildren.Remove(node);
node.Parent = null;
}
}
@ -103,7 +103,7 @@ namespace arookas
{
child.Parent = null;
}
children.Clear();
mChildren.Clear();
}
public virtual void Compile(sunContext context)
@ -126,7 +126,7 @@ namespace arookas
return false;
}
public IEnumerator<sunNode> GetEnumerator() { return children.GetEnumerator(); }
public IEnumerator<sunNode> GetEnumerator() { return mChildren.GetEnumerator(); }
IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); }
}

View file

@ -8,9 +8,9 @@ namespace arookas
{
class sunContext
{
aBinaryWriter writer;
uint textOffset, dataOffset, symbolOffset;
int varCount;
aBinaryWriter mWriter;
uint mTextOffset, mDataOffset, mSymbolOffset;
int mVarCount;
public sunWriter Text { get; private set; }
public sunDataTable DataTable { get; private set; }
@ -47,15 +47,15 @@ namespace arookas
Scopes.Clear();
Loops.Clear();
ImportResolver = importResolver;
writer = new aBinaryWriter(output, Endianness.Big, Encoding.GetEncoding(932));
Text = new sunWriter(writer);
writer.PushAnchor();
mWriter = new aBinaryWriter(output, Endianness.Big, Encoding.GetEncoding(932));
Text = new sunWriter(mWriter);
mWriter.PushAnchor();
WriteHeader(); // dummy header
// begin text block
textOffset = (uint)writer.Position;
writer.PushAnchor(); // match code offsets and writer offsets
mTextOffset = (uint)mWriter.Position;
mWriter.PushAnchor(); // match code offsets and writer offsets
// add system builtins
DeclareSystemBuiltin("yield", false);
@ -70,12 +70,12 @@ namespace arookas
}
public void Close()
{
writer.PopAnchor();
dataOffset = (uint)writer.Position;
DataTable.Write(writer);
symbolOffset = (uint)writer.Position;
SymbolTable.Write(writer);
writer.Goto(0);
mWriter.PopAnchor();
mDataOffset = (uint)mWriter.Position;
DataTable.Write(mWriter);
mSymbolOffset = (uint)mWriter.Position;
SymbolTable.Write(mWriter);
mWriter.Goto(0);
WriteHeader();
}
@ -95,7 +95,7 @@ namespace arookas
ImportResolver.EnterFile(file);
var parser = new sunParser();
var tree = parser.Parse(file);
varCount += tree.MaxLocalCount;
mVarCount += tree.MaxLocalCount;
tree.Compile(this);
ImportResolver.ExitFile(file);
}
@ -234,13 +234,13 @@ namespace arookas
void WriteHeader()
{
writer.WriteString("SPCB");
writer.Write32(textOffset);
writer.Write32(dataOffset);
writer.WriteS32(DataTable.Count);
writer.Write32(symbolOffset);
writer.WriteS32(SymbolTable.Count);
writer.WriteS32(varCount);
mWriter.WriteString("SPCB");
mWriter.Write32(mTextOffset);
mWriter.Write32(mDataOffset);
mWriter.WriteS32(DataTable.Count);
mWriter.Write32(mSymbolOffset);
mWriter.WriteS32(SymbolTable.Count);
mWriter.WriteS32(mVarCount);
}
}
}