Example #1
0
        //------------------------------------------------------------
        // XDataに実体を書き込む。
        public void XDataWriteEntity(XDataWriter aWriter, string aOwnerPath)
        {
            aWriter.WriteCommentLine("BCFunctionList(" + aOwnerPath + ")");
            using (new XDataWriter.IndentScope(aWriter))
            {
                // アライメントとラベル
                aWriter.WriteAlignLine(4);
                aWriter.WriteLabelLine(XDATA_LABEL + ":" + aOwnerPath);

                // 数
                aWriter.WriteUInt32Line("count", (uint)mList.Count);

                // リファレンス
                foreach (var entry in mList)
                {
                    entry.XDataWriteReference(aWriter);
                }
            }

            // 実体
            {
                foreach (var entry in mList)
                {
                    entry.XDataWriteEntity(aWriter);
                }
            }
        }
Example #2
0
        //------------------------------------------------------------
        // XDataに変換する。
        public string ToXDataXml()
        {
            // 作成
            var xdata = new XDataWriter();

            // BCModule
            xdata.WriteCommentLine("BCModule");
            using (new XDataWriter.IndentScope(xdata))
            {
                {// BCVersion
                    xdata.WriteIndent();
                    xdata.WriteComment("version (" + BC_VERSION_PUBLISH_MAJOR + "." + BC_VERSION_PUBLISH_MINOR + "." + BC_VERSION_PRIVATE_MAJOR + "." + BC_VERSION_PRIVATE_MINOR + ")");
                    xdata.WriteUInt8(BC_VERSION_PUBLISH_MAJOR);
                    xdata.WriteUInt8(BC_VERSION_PUBLISH_MINOR);
                    xdata.WriteUInt8(BC_VERSION_PRIVATE_MAJOR);
                    xdata.WriteUInt8(BC_VERSION_PRIVATE_MINOR);
                    xdata.WriteLine();
                }
                xdata.WriteStringLine("path", SymbolNodeUtil.FullPath(mModuleSymbolNode));
                mConstantValueTable.XDataWriteReference(xdata);
                mSymbolLinkTable.XDataWriteReference(xdata);
                mObjectTypeList.XDataWriteReference(xdata);
            }

            // 各実体
            mConstantValueTable.XDataWriteEntity(xdata);
            mSymbolLinkTable.XDataWriteEntity(xdata);
            mObjectTypeList.XDataWriteEntity(xdata);

            // 結果を返す
            return(xdata.ToXMLText());
        }
Example #3
0
        //------------------------------------------------------------
        // XDataに実体を書き込む。
        public void XDataWriteEntity(XDataWriter aWriter)
        {
            aWriter.WriteCommentLine("BCObjectTypeList");
            using (new XDataWriter.IndentScope(aWriter))
            {
                // アライメントとラベル
                aWriter.WriteAlignLine(4);
                aWriter.WriteLabelLine(XDATA_LABEL);

                // 数
                aWriter.WriteUInt32Line("count", (uint)mList.Count);

                // リファレンス
                foreach (var entry in mList)
                {
                    entry.XDataWriteReference(aWriter);
                }
            }

            // 実体
            {
                foreach (var entry in mList)
                {
                    entry.XDataWriteEntry(aWriter);
                }
            }
        }
Example #4
0
            //------------------------------------------------------------
            // コンストラクタ。
            public IndentScope(XDataWriter aWriter)
            {
                // メモ
                mWriter = aWriter;

                // レベルアップ
                mWriter.IndentInc();
            }
Example #5
0
        //------------------------------------------------------------
        public void XDataWriteEntity(XDataWriter aWriter)
        {
            switch (mKind)
            {
            case Kind.SInt32:
                aWriter.WriteSInt32Line("0x" + mOffset.ToString("X4") + ":", mValSInt32);
                break;

            default:
                Assert.NotReachHere();
                break;
            }
        }
Example #6
0
        //------------------------------------------------------------
        // XDataに実体を書き込む。
        public void XDataWriteEntity(XDataWriter aWriter)
        {
            aWriter.WriteCommentLine("BCSymbolTable");
            using (new XDataWriter.IndentScope(aWriter))
            {
                // アライメントとラベル
                aWriter.WriteAlignLine(8);
                aWriter.WriteLabelLine(XDATA_LABEL);

                // 要素数
                aWriter.WriteUInt32Line("count", (uint)mList.Count);

                // 各シンボル
                foreach (var entry in mList)
                {
                    // 値
                    entry.XDataWriteEntity(aWriter);
                }
            }
        }
Example #7
0
        //------------------------------------------------------------
        // XDataに実体を書き込む。
        public void XDataWriteEntry(XDataWriter aWriter)
        {
            // フルパスのメモ
            string fullPath = mTypeSymbolNode.GetUniqueFullPath();

            // 実体
            aWriter.WriteCommentLine("BCObjectType(" + fullPath + ")");
            using (new XDataWriter.IndentScope(aWriter))
            {
                // アライメントとラベル。
                aWriter.WriteAlignLine(4);
                aWriter.WriteLabelLine(XDATA_LABEL + ":" + fullPath);

                // パス
                aWriter.WriteStringLine("path", fullPath);

                // 関数リスト
                mFunctionList.XDataWriteReference(aWriter, fullPath);
            }

            // その他
            mFunctionList.XDataWriteEntity(aWriter, fullPath);
        }
Example #8
0
        //------------------------------------------------------------
        // XDataに実体を書き込む。
        public void XDataWriteEntity(XDataWriter aWriter)
        {
            // フルパスのメモ
            string fullPath = mFunctionSymbolNode.GetUniqueFullPath();

            // 実体
            aWriter.WriteCommentLine("BCFunction(" + fullPath + ")");
            using (new XDataWriter.IndentScope(aWriter))
            {
                // アライメントとラベル
                aWriter.WriteAlignLine(4);
                aWriter.WriteLabelLine(XDATA_LABEL + ":" + fullPath);

                // シンボル名
                aWriter.WriteStringLine("name", mFunctionSymbolNode.GetIdentifier().String());

                // 命令コード
                aWriter.WriteReferenceLine(XDATA_LABEL_OP_CODE + ":" + fullPath);
            }

            // その他
            {// 命令コード
                aWriter.WriteCommentLine("BCOpCode(" + fullPath + ")-" + mBCOpCodeList.Count * 4 + "bytes");
                using (new XDataWriter.IndentScope(aWriter))
                {
                    // アライメントとラベル
                    aWriter.WriteAlignLine(4);
                    aWriter.WriteLabelLine(XDATA_LABEL_OP_CODE + ":" + fullPath);
                    uint index = 0;
                    foreach (var entry in mBCOpCodeList)
                    {
                        entry.XDataWrite(aWriter, index);
                        ++index;
                    }
                }
            }
        }
Example #9
0
        //------------------------------------------------------------
        // XDataに実体を書き込む。
        public void XDataWriteEntity(XDataWriter aWriter)
        {
            aWriter.WriteCommentLine("BCConstantValueTable");
            using (new XDataWriter.IndentScope(aWriter))
            {
                // アライメントとラベル
                aWriter.WriteAlignLine(8);
                aWriter.WriteLabelLine(XDATA_LABEL);

                // テーブルのサイズ
                aWriter.WriteUInt32Line("size", mSize);

                // 各定数
                uint pos = 0;
                foreach (var entry in mList)
                {
                    // オフセット位置までpadding
                    uint offset = entry.Offset();
                    if (pos < offset)
                    {
                        uint padSize = offset - pos;
                        aWriter.WriteIndent();
                        aWriter.WriteComment("padding (" + padSize + ")");
                        for (uint i = 0; i < padSize; ++i)
                        {
                            aWriter.WriteUInt8(0xFF);
                        }
                        aWriter.WriteLine();
                    }
                    pos = offset;

                    // 値
                    entry.XDataWriteEntity(aWriter);
                    pos += entry.Size();
                }
            }
        }
Example #10
0
 //------------------------------------------------------------
 // XDataにリファレンスタグを書き込む。
 public void XDataWriteReference(XDataWriter aWriter)
 {
     aWriter.WriteReferenceLine("Function", XDATA_LABEL + ":" + SymbolNodeUtil.FullPath(mFunctionSymbolNode));
 }
Example #11
0
 //------------------------------------------------------------
 // XDataにリファレンスタグを書き込む。
 public void XDataWriteReference(XDataWriter aWriter, string aOwnerPath)
 {
     aWriter.WriteReferenceLine("FunctionList", XDATA_LABEL + ":" + aOwnerPath);
 }
Example #12
0
        //------------------------------------------------------------
        // XDataに書き込む。
        public void XDataWrite(XDataWriter aWriter, uint aIndex)
        {
            aWriter.WriteIndent();
            aWriter.WriteComment("[" + aIndex.ToString("X4") + "]" + ToASMText());
            aWriter.WriteUInt8((byte)mOp);
            switch (mFormat)
            {
            case OpFormat.CS2:
            {
                aWriter.WriteUInt8(0xFF);         // dummy
                aWriter.WriteSInt16(mCS2);
            }
            break;

            case OpFormat.CU1:
            {
                aWriter.WriteUInt8(mCU1A);
                aWriter.WriteUInt16(0xFFFF);         // dummy
            }
            break;

            case OpFormat.CU1_CU1:
            {
                aWriter.WriteUInt8(mCU1A);
                aWriter.WriteUInt8(mCU1B);
                aWriter.WriteUInt8(0xFF);         // dummy
            }
            break;

            case OpFormat.FR1_SR1:
            {
                aWriter.WriteUInt8(mFR1);
                aWriter.WriteUInt8(mSR1.Index());
                aWriter.WriteUInt8(0xFF);         // dummy
            }
            break;

            case OpFormat.SR1:
            {
                aWriter.WriteUInt8(mSR1.Index());
                aWriter.WriteUInt16(0xFFFF);         // dummy
            }
            break;

            case OpFormat.SR1_CS2:
            {
                aWriter.WriteUInt8(mSR1.Index());
                aWriter.WriteSInt16(mCS2);
            }
            break;

            case OpFormat.SR1_CTI:
            {
                aWriter.WriteUInt8(mSR1.Index());
                aWriter.WriteUInt16((ushort)mConstantValue.Offset());
            }
            break;

            case OpFormat.SR1_SR2:
            {
                aWriter.WriteUInt8(mSR1.Index());
                aWriter.WriteUInt8(mSR2.Index());
                aWriter.WriteUInt8(0xFF);         // dummy
            }
            break;

            case OpFormat.SR1_SR2_SR3:
            {
                aWriter.WriteUInt8(mSR1.Index());
                aWriter.WriteUInt8(mSR2.Index());
                aWriter.WriteUInt8(mSR3.Index());
            }
            break;

            case OpFormat.STI:
            {
                aWriter.WriteUInt8(0xFF);         // dummy
                aWriter.WriteUInt16(mSymbolLink.Index);
            }
            break;

            default:
                Assert.NotReachHere();
                break;
            }
            aWriter.WriteLine();
        }
Example #13
0
 //------------------------------------------------------------
 // XDataに実体を書き込む。
 public void XDataWriteEntity(XDataWriter aWriter)
 {
     aWriter.WriteStringLine(TargetNode.GetUniqueFullPath());
 }
Example #14
0
 //------------------------------------------------------------
 // XDataにリファレンスタグを書き込む。
 public void XDataWriteReference(XDataWriter aWriter)
 {
     aWriter.WriteReferenceLine("constantTable", XDATA_LABEL);
 }
Example #15
0
 //------------------------------------------------------------
 // XDataにリファレンスタグを書き込む。
 public void XDataWriteReference(XDataWriter aWriter)
 {
     aWriter.WriteReferenceLine("objectTypeList", XDATA_LABEL);
 }
Example #16
0
 //------------------------------------------------------------
 // XDataにリファレンスタグを書き込む。
 public void XDataWriteReference(XDataWriter aWriter)
 {
     aWriter.WriteReferenceLine("symbolTable", XDATA_LABEL);
 }
Example #17
0
 //------------------------------------------------------------
 // XDataにリファレンスタグを書き込む。
 public void XDataWriteReference(XDataWriter aWriter)
 {
     aWriter.WriteReferenceLine(XDATA_LABEL + ":" + SymbolNodeUtil.FullPath(mTypeSymbolNode));
 }