Exemplo n.º 1
0
        public Offset PostProcessWithCut(out AnonymousStruct lastStruct, out int beginIndex)
        {
            // just to satisfy c# compiler (can't you be smarter?)
            beginIndex = -1;

            AnonymousStruct last         = (AnonymousStruct)_members.Last();
            Offset          maxBotOffset = Offset.Zero;

            foreach (AnonymousStruct struc in _members)
            {
                Offset offset;
                if (object.ReferenceEquals(last, struc))
                {
                    Offset offsetBeforeCut;
                    offset = struc.PostProcessWithCut(
                        maxBotOffset,
                        out beginIndex,
                        out offsetBeforeCut
                        );
                    _botOffset = Offset.Max(maxBotOffset, offsetBeforeCut);
                }
                else
                {
                    offset = struc.PostProcessWithoutCut();
                }
                maxBotOffset = Offset.Max(offset, maxBotOffset);
            }
            lastStruct = last;
            return(maxBotOffset);
        }
Exemplo n.º 2
0
        public Offset PostProcessWithCut(out AnonymousStruct lastStruct, out int beginIndex)
        {
            // just to satisfy c# compiler (can't you be smarter?)
            beginIndex = -1;

            AnonymousStruct last = (AnonymousStruct)_members.Last();
            Offset maxBotOffset = Offset.Zero;

            foreach (AnonymousStruct struc in _members)
            {
                Offset offset;
                if (object.ReferenceEquals(last, struc))
                {
                    Offset offsetBeforeCut;
                    offset = struc.PostProcessWithCut(
                        maxBotOffset,
                        out beginIndex,
                        out offsetBeforeCut
                    );
                    _botOffset = Offset.Max(maxBotOffset, offsetBeforeCut);
                }
                else
                {
                    offset = struc.PostProcessWithoutCut();
                }
                maxBotOffset = Offset.Max(offset, maxBotOffset);
            }
            lastStruct = last;
            return maxBotOffset;
        }
Exemplo n.º 3
0
        private void TransferMembers(int fromIndex, AnonymousStruct another)
        {
            int total = _members.Count;

            for (int i = fromIndex; i < total; i++)
            {
                another._members.Add(_members[i]);
            }
            _members.RemoveRange(fromIndex, total - fromIndex);
        }
Exemplo n.º 4
0
        public CStruct CollectStruct(IDiaEnumSymbols symbols)
        {
            LeafMembers allMembers = new LeafMembers(symbols);
            Columns     columns    = allMembers.CalculateColumns();

            columns.CalculateResetters();
            AnonymousStruct struc = columns.CollectStruct();

            struc.PostProcess();
            struc.SinglizeStructs();
            return((CStruct)struc.ToCType(_translator));
        }
Exemplo n.º 5
0
 public void SinglizeStructs()
 {
     for (int i = 0; i < _members.Count; i++)
     {
         AnonymousStruct struc = (AnonymousStruct)_members[i];
         // TODO: any optimization here?
         struc.SinglizeStructs();
         if (struc.Members.Count == 1)
         {
             _members[i] = struc.Members[0];
         }
     }
 }
Exemplo n.º 6
0
        public AnonymousStruct CollectStruct(int membersIndex, int resetterIndex)
        {
            AnonymousStruct result = new AnonymousStruct();
            if (resetterIndex == -1)
            {
                for (int i = membersIndex; i < _endIndex; i++)
                {
                    result.Add(_allMembers[i]);
                }
                return result;
            }

            Column resetter = _resetters[resetterIndex];
            Offset offset = resetter.TopOffset;
            int nextMembersIndex = FindMatchedMemberIndex(offset);
            for (int i = membersIndex; i < nextMembersIndex; i++)
            {
                result.Add(_allMembers[i]);
            }
            result.Add(CollectUnion(nextMembersIndex, resetterIndex, offset));
            return result;
        }
Exemplo n.º 7
0
        public AnonymousStruct CollectStruct(int membersIndex, int resetterIndex)
        {
            AnonymousStruct result = new AnonymousStruct();

            if (resetterIndex == -1)
            {
                for (int i = membersIndex; i < _endIndex; i++)
                {
                    result.Add(_allMembers[i]);
                }
                return(result);
            }

            Column resetter         = _resetters[resetterIndex];
            Offset offset           = resetter.TopOffset;
            int    nextMembersIndex = FindMatchedMemberIndex(offset);

            for (int i = membersIndex; i < nextMembersIndex; i++)
            {
                result.Add(_allMembers[i]);
            }
            result.Add(CollectUnion(nextMembersIndex, resetterIndex, offset));
            return(result);
        }
Exemplo n.º 8
0
 private void TransferMembers(int fromIndex, AnonymousStruct another)
 {
     int total = _members.Count;
     for (int i = fromIndex; i < total; i++)
     {
         another._members.Add(_members[i]);
     }
     _members.RemoveRange(fromIndex, total - fromIndex);
 }