Exemplo n.º 1
0
		public void DontSimplifySegmentStruct()
		{
			StructureType s = new StructureType(null, 0) { Fields = { { 0, PrimitiveType.Int32 } } };
			s.IsSegment = true;
			DataType dt = s.Simplify();
			Assert.AreEqual("(segment (0 int32 dw0000))", dt.ToString());
		}
Exemplo n.º 2
0
        public DataType VisitStructure(StructureType str)
        {
            if (visitedTypes.Contains(str))
            {
                return(str);
            }
            visitedTypes.Add(str);
            foreach (var field in str.Fields)
            {
                field.DataType = field.DataType.Accept(this);
            }
            StructureType strNew = MergeStructureFields(str);

            if (strNew.Fields.Count != str.Fields.Count)
            {
                Changed = true;
            }
            MergeStaggeredArrays(strNew);
            DataType dt = strNew.Simplify();

            if (dt != strNew)
            {
                Changed = true;
            }
            return(dt);
        }
Exemplo n.º 3
0
        public DataType VisitStructure(StructureType str)
        {
            // Do not transform user-defined types
            if (str.UserDefined)
            {
                return(str);
            }
            if (visitedTypes.Contains(str))
            {
                return(str);
            }
            visitedTypes.Add(str);
            foreach (var field in str.Fields)
            {
                field.DataType = field.DataType.Accept(this);
            }
            StructureType strNew = MergeStructureFields(str);

            if (strNew.Fields.Count != str.Fields.Count)
            {
                Changed = true;
            }
            MergeStaggeredArrays(strNew);
            if (ShouldSimplify(strNew))
            {
                DataType dt = strNew.Simplify();
                if (dt != strNew)
                {
                    Changed = true;
                }
                return(dt);
            }
            return(strNew);
        }
Exemplo n.º 4
0
        public void SimplifyNonSimpleStruct()
        {
            StructureType s = new StructureType(null, 0)
            {
                Fields = { { 4, PrimitiveType.Int32 } }
            };
            DataType dt = s.Simplify();

            Assert.AreEqual("(struct (4 int32 dw0004))", dt.ToString());
        }
Exemplo n.º 5
0
        public void SimplifySimpleStruct()
        {
            StructureType s = new StructureType(null, 0)
            {
                Fields = { { 0, PrimitiveType.Int32 } }
            };
            DataType dt = s.Simplify();

            Assert.AreEqual("int32", dt.ToString());
        }
Exemplo n.º 6
0
        public void DontSimplifySegmentStruct()
        {
            StructureType s = new StructureType(null, 0)
            {
                Fields = { { 0, PrimitiveType.Int32 } }
            };

            s.IsSegment = true;
            DataType dt = s.Simplify();

            Assert.AreEqual("(segment (0 int32 dw0000))", dt.ToString());
        }
Exemplo n.º 7
0
		public void SimplifyNonSimpleStruct()
		{
            StructureType s = new StructureType(null, 0) { Fields = { { 4, PrimitiveType.Int32 } } };
			DataType dt = s.Simplify();
			Assert.AreEqual("(struct (4 int32 dw0004))", dt.ToString());
		}
Exemplo n.º 8
0
		public void SimplifySimpleStruct()
		{
            StructureType s = new StructureType(null, 0) { Fields = { { 0, PrimitiveType.Int32 } } };
			DataType dt = s.Simplify();
			Assert.AreEqual("int32", dt.ToString());
		}