コード例 #1
0
 public void WriteClass([NotNull] string name, LineRef start, LineRef end)
 {
     WriteDebugByte(DEBF.CLASS_DBR);
     WriteDebugString(name);
     WriteDebugLineRef(start);
     WriteDebugLineRef(end);
 }
コード例 #2
0
ファイル: XmlDebugFileWriter.cs プロジェクト: taradinoc/zilf
        public void EndRoutine(LineRef end, int address)
        {
            // close <routine>
            xml.WriteEndElement();

            inRoutine = false;
        }
コード例 #3
0
 void WriteDebugLineRef(LineRef lineRef)
 {
     stream.WriteByte(lineRef.File);
     stream.WriteByte((byte)(lineRef.Line >> 8));
     stream.WriteByte((byte)lineRef.Line);
     stream.WriteByte(lineRef.Col);
 }
コード例 #4
0
 public void WriteObject(ushort number, [NotNull] string name, LineRef start, LineRef end)
 {
     WriteDebugByte(DEBF.OBJECT_DBR);
     WriteDebugWord(number);
     WriteDebugString(name);
     WriteDebugLineRef(start);
     WriteDebugLineRef(end);
 }
コード例 #5
0
ファイル: XmlDebugFileWriter.cs プロジェクト: taradinoc/zilf
        public void WriteLine(LineRef loc, int address)
        {
            xml.WriteStartElement("sequence-point");

            xml.WriteElementString("address", address.ToString());
            WriteSourceCodeLocation(loc, loc);

            xml.WriteEndElement();
        }
コード例 #6
0
        /// <exception cref="InvalidOperationException">The writer is not currently in a routine.</exception>
        public void WriteLine(LineRef loc, int address)
        {
            if (!InRoutine)
            {
                throw new InvalidOperationException("WriteLine must be called inside a routine");
            }

            WriteDebugLineRef(loc);
            WriteDebugWord((ushort)(address - routineStart));
            routinePoints++;
        }
コード例 #7
0
ファイル: XmlDebugFileWriter.cs プロジェクト: taradinoc/zilf
        public void WriteObject(ushort number, string name, LineRef start, LineRef end)
        {
            xml.WriteStartElement("object");

            xml.WriteElementString("identifier", name);
            xml.WriteElementString("value", number.ToString());

            WriteSourceCodeLocation(start, end);

            xml.WriteEndElement();
        }
コード例 #8
0
ファイル: XmlDebugFileWriter.cs プロジェクト: taradinoc/zilf
        public void WriteClass(string name, LineRef start, LineRef end)
        {
            xml.WriteStartElement("object");

            xml.WriteElementString("identifier", name);
            // TODO: <value>

            WriteSourceCodeLocation(start, end);

            xml.WriteEndElement();
        }
コード例 #9
0
        public void EndRoutine(LineRef end, int address)
        {
            // finish LINEREF_DBR block
            var curPosition = stream.Position;

            stream.Position -= 2 + routinePoints * 6;
            WriteDebugWord((ushort)routinePoints);
            stream.Position = curPosition;
            routinePoints   = -1;
            routineStart    = -1;

            // write ROUTINE_END_DBR block
            WriteDebugByte(DEBF.ROUTINE_END_DBR);
            WriteDebugWord(nextRoutineNumber++);
            WriteDebugLineRef(end);
            WriteDebugAddress(address);

            rollbackPosition = -1;
        }
コード例 #10
0
ファイル: XmlDebugFileWriter.cs プロジェクト: taradinoc/zilf
        void WriteSourceCodeLocation(LineRef start, LineRef end)
        {
            xml.WriteStartElement("source-code-location");

            xml.WriteElementString("file-index", start.File.ToString());
            xml.WriteElementString("line", start.Line.ToString());
            xml.WriteElementString("character", start.Col.ToString());
            // TODO: <file-position>

            if (end != start)
            {
                // TODO: handle end.File != start.File

                xml.WriteElementString("end-line", end.Line.ToString());
                xml.WriteElementString("end-character", end.Col.ToString());
                // TODO: <end-file-position>
            }

            xml.WriteEndElement();
        }
コード例 #11
0
        public void StartRoutine(LineRef start, int address, [NotNull] string name, [NotNull] IEnumerable <string> locals)
        {
            WriteDebugByte(DEBF.ROUTINE_DBR);
            WriteDebugWord(nextRoutineNumber);
            WriteDebugLineRef(start);
            WriteDebugAddress(address);
            WriteDebugString(name);
            foreach (var local in locals)
            {
                WriteDebugString(local);
            }
            WriteDebugByte(0);

            // start LINEREF_DBR block
            WriteDebugByte(DEBF.LINEREF_DBR);
            WriteDebugWord(nextRoutineNumber);
            WriteDebugWord(0);      // # sequence points, filled in later

            rollbackPosition = stream.Position;
            routinePoints    = 0;
            routineStart     = address;
        }
コード例 #12
0
ファイル: XmlDebugFileWriter.cs プロジェクト: taradinoc/zilf
        public void StartRoutine(LineRef start, int address, string name, [NotNull] IEnumerable <string> locals)
        {
            xml.WriteStartElement("routine");

            xml.WriteElementString("identifier", name);
            xml.WriteElementString("address", address.ToString());
            // TODO: <value> for packed address?

            int index = 1;

            foreach (var local in locals)
            {
                xml.WriteStartElement("local-variable");

                xml.WriteElementString("identifier", local);
                xml.WriteElementString("index", index.ToString());

                xml.WriteEndElement();
                index++;
            }

            // leave element open...
            inRoutine = true;
        }