コード例 #1
0
            public void Write(IO.EndianWriter stream)
            {
                Compiler comp   = stream.Owner as Compiler;
                Import   import = comp.OwnerState.Importer as Import;

                int real_count = import.Groups.Count;

                stream.Write("dynamic tag groups", false);
                stream.Write((short)DataArray.MaxValue);
                stream.Write((short)Item.Size);
                stream.Write(true);
                stream.Write(true);
                stream.Write((short)0);
                MiscGroups.data.Write(stream);
                stream.Write((short)real_count);                //stream.Write((short)Datums.Count);
                stream.Write((short)real_count);                //stream.Write((short)Datums.Count);
                stream.Write(real_count);
                stream.WritePointer(stream.PositionUnsigned + 4);

                #region Write tag group datums
                foreach (Import.TagGroup tg in import.Groups.Values)
                {
                    stream.Write((short)0);                     // Header
                    stream.Write((short)0);                     // Flags
                    comp.AddLocationFixup(tg.Name, stream, false);
                    stream.Write((int)0);
                }
                #endregion

                #region Write null datums
                Item i     = new Item();
                int  count = DataArray.MaxValue - real_count;
                for (int x = 0; x < count; x++)
                {
                    i.Write(stream);
                }
                #endregion
            }
コード例 #2
0
            public override void Write(IO.EndianWriter stream)
            {
                Compiler comp = stream.Owner as Compiler;

                #region TypeIndex
                if (field.TypeIndex == comp.TypeIndexStringId)
                {
                    stream.Write(comp.TypeIndexTagReference);
                }
                else
                {
                    stream.Write(field.TypeIndex);
                }
                #endregion

                if (field.TypeIndex != comp.TypeIndexPad)
                {
                    stream.Write(field.Name);
                }
                else
                {
                    stream.Write((int)0);
                }

                if (field.TypeIndex == comp.TypeIndexArrayStart ||
                    field.TypeIndex == comp.TypeIndexPad ||
                    field.TypeIndex == comp.TypeIndexSkip)
                {
                    stream.Write(field.ToInt());
                }
                else if (field.TypeIndex == comp.TypeIndexCustom)
                {
                    stream.WriteTag(field.ToString());
                }
                else if (field.TypeIndex == comp.TypeIndexExplanation)
                {
                    if (field.Definition != string.Empty)
                    {
                        stream.Write(field.ToPointer());
                    }
                    else
                    {
                        stream.Write(comp.Strings.GetNull());
                    }
                }
                else if (field.TypeIndex == comp.TypeIndexByteFlags ||
                         field.TypeIndex == comp.TypeIndexEnum ||
                         field.TypeIndex == comp.TypeIndexWordFlags ||
                         field.TypeIndex == comp.TypeIndexShortBlockIndex ||
                         field.TypeIndex == comp.TypeIndexLongFlags ||
                         field.TypeIndex == comp.TypeIndexLongBlockIndex ||
                         field.TypeIndex == comp.TypeIndexTagReference ||
                         field.TypeIndex == comp.TypeIndexData ||
                         field.TypeIndex == comp.TypeIndexBlock ||

                         field.TypeIndex == comp.TypeIndexStringId)
                {
                    comp.AddLocationFixup(field.Definition, stream);

                    stream.Write((int)0);                     // should come back later and write the address
                }
                else
                {
                    stream.Write((int)0);
                }
            }