public override void Write(IO.EndianWriter stream)
            {
                Compiler comp = stream.Owner as Compiler;

                comp.MarkLocationFixup(glob.Name, stream, false);
                stream.Write(glob.Name);
                stream.Write(glob.type.Opcode);
                stream.Write((short)(glob.IsInternal ? 1 : 0));                //stream.Write(ushort.MinValue);
                stream.Write(uint.MaxValue);
                stream.Write(uint.MinValue);
            }
Exemple #2
0
            public override void Write(IO.EndianWriter stream)
            {
                Compiler comp = stream.Owner as Compiler;

                uint fieldsAddress = new FieldsWriter(tagBlock.Fields).WriteFields(stream, comp);

                comp.MarkLocationFixup(tagBlock.Name, stream, false);

                int flags = 0;

                stream.Write(tagBlock.Name);
                stream.Write(flags);
                stream.Write(tagBlock.MaxElements);
                stream.Write(tagBlock.CalculateSize(comp.OwnerState));
                stream.Write((int)0);
                stream.WritePointer(fieldsAddress);

                // procs
                stream.Write((int)0); stream.Write((int)0); stream.Write((int)0); stream.Write((int)0);

                stream.Write((int)0);                 // byte swap codes address
            }
            public override void Write(IO.EndianWriter stream)
            {
                Compiler comp = stream.Owner as Compiler;

                comp.MarkLocationFixup(func.Name, stream, false);
                stream.Write(func.returnType.Opcode);
                stream.Write((short)(func.IsInternal ? 1 : 0));                //stream.Write(ushort.MinValue);
                stream.Write(func.Name);
                stream.Write(uint.MaxValue);
                stream.Write(uint.MaxValue);
                stream.Write(func.Help);
                stream.Write(func.HelpArg);
                stream.Write(ushort.MinValue);
                short count; stream.Write(count = (short)func.Arguments.Count);

                foreach (Import.ScriptFunctionArg arg in func.Arguments)
                {
                    stream.Write(arg.type.Opcode);
                }
                if ((count % 2) > 0)
                {
                    stream.Write(ushort.MinValue);
                }
            }
            public override void Write(IO.EndianWriter stream)
            {
                Compiler comp = stream.Owner as Compiler;

                int flags;

                #region Block
                var  tag_block     = tagGroup.Block as Import.TagBlock;
                uint fieldsAddress = new FieldsWriter(tag_block.Fields).WriteFields(stream, comp);
                //comp.MarkLocationFixup(tag_block.Name, stream, false);

                flags = (
                    (tag_block.DontReadChildren ? 1 << 0 : 0)
                    );

                uint blockAddress = stream.PositionUnsigned;
                stream.Write(tagGroup.BlockName);
                stream.Write(flags);
                stream.Write((int)1);                 // max elements
                stream.Write(tag_block.CalculateSize(comp.OwnerState));
                stream.Write((int)0);
                stream.WritePointer(fieldsAddress);

                // procs
                stream.Write((int)0); stream.Write((int)0); stream.Write((int)0); stream.Write((int)0);

                stream.Write((int)0);                 // byte swap codes address
                #endregion

                comp.MarkLocationFixup(tagGroup.Name, stream, false);

                flags = (
                    (tagGroup.IsIncludedInTagGroupsChecksum ? 1 << 0 : 0)
                    );

                stream.Write(tagGroup.Name);
                stream.Write(flags);
                if (string.IsNullOrEmpty(tagGroup.GroupTag))
                {
                    Debug.LogFile.WriteLine("CheApe: tag_group '{0}' has a bad group-tag...check your XML?");
                }
                stream.WriteTag(tagGroup.GroupTag);
                if (tagGroup.ParentTag != null)
                {
                    if (string.IsNullOrEmpty(tagGroup.GroupTag))
                    {
                        Debug.LogFile.WriteLine("CheApe: tag_group '{0}' has a bad parent group-tag...check your XML?");
                    }
                    stream.WriteTag(tagGroup.ParentTag);
                }
                else
                {
                    stream.Write((int)-1);
                }
                stream.Write(tagGroup.Version); stream.Write((short)0);
                stream.Write((int)0);                 // post process proc
                stream.WritePointer(blockAddress);
                for (int x = 0; x < 17; x++)
                {
                    stream.Write((int)0);             // child group tags
                }
                stream.Write((int)0);                 // we don't support that shit, gtfo
                stream.Write((int)0);
            }