Esempio n. 1
0
        private HashSet <JumpSet> FindJumpSets()
        {
            var jumpSets = new Dictionary <int, JumpSet>();
            var labelCol = m_HeaderCols["Label"];
            var asmCol   = m_HeaderCols["ASM"];

            for (int row = 2; row <= m_Worksheet.Dimension.Rows; ++row)
            {
                var asmCell = m_Worksheet.Cells[row, asmCol];
                var label   = AsmUtils.GetJumpToLabel(asmCell.Text);
                if (string.IsNullOrEmpty(label))
                {
                    continue;
                }
                int labelRow;
                if (!m_LabelRows.TryGetValue(label + ":", out labelRow))
                {
                    continue;
                }

                JumpSet jumpSet;
                if (!jumpSets.TryGetValue(labelRow, out jumpSet))
                {
                    jumpSet            = new JumpSet(labelRow);
                    jumpSets[labelRow] = jumpSet;
                }
                jumpSet.AddSource(row);
            }

            return(new HashSet <JumpSet>(jumpSets.Values));
        }
Esempio n. 2
0
        private void AddJumpSetToLevel(JumpSet js, HashSet <JumpSet> level)
        {
            var rejected = new HashSet <JumpSet>();

            foreach (var existing in level)
            {
                if (!existing.Overlaps(js))
                {
                    continue;
                }

                if (existing.IsSupersetOf(js) || existing.Sources.Contains(js.Target) || js.Min < existing.Min && js.Max < existing.Max)
                {
                    rejected.Add(existing);
                }
                else
                {
                    return;
                }
            }

            level.ExceptWith(rejected);
            level.Add(js);
        }
Esempio n. 3
0
 public bool Overlaps(JumpSet o)
 {
     return(Max >= o.Min && Min <= o.Max);
 }
Esempio n. 4
0
 public bool IsSupersetOf(JumpSet o)
 {
     return(Min <= o.Min && Max >= o.Max);
 }