public ImageMapItem SetTypeAtAddressRange(Address address, string userText)
        {
            var parser   = new HungarianParser();
            var dataType = parser.Parse(userText);

            if (dataType == null)
            {
                return(null);
            }
            var arr = dataType as ArrayType;

            if (arr != null && arr.ElementType.Size != 0)
            {
                var range = control.MemoryView.GetAddressRange();
                if (range.IsValid)
                {
                    long size   = (range.End - range.Begin) + 1;
                    int  nElems = (int)(size / arr.ElementType.Size);
                    arr.Length = nElems;
                }
            }
            var item = program.AddUserGlobalItem(address, dataType);

            control.MemoryView.Invalidate();
            return(item);
        }
Exemple #2
0
 public string FormatType(string text)
 {
     try
     {
         var dataType = HungarianParser.Parse(text);
         if (dataType == null)
         {
             return(" - Null - ");
         }
         else
         {
             return(dataType.ToString());
         }
     }
     catch
     {
         return(" - Error - ");
     }
 }
 public void typeMarker_FormatType(object sender, TypeMarkerEventArgs e)
 {
     try
     {
         var parser   = new HungarianParser();
         var dataType = parser.Parse(e.UserText);
         if (dataType == null)
         {
             e.FormattedType = " - Null - ";
         }
         else
         {
             e.FormattedType = dataType.ToString();
         }
     }
     catch
     {
         e.FormattedType = " - Error - ";
     }
 }
Exemple #4
0
        public void ParseWideChar()
        {
            var dt = HungarianParser.Parse("wch");       // 16-bit character

            Assert.AreEqual("wchar_t", dt.ToString());
        }
Exemple #5
0
        public void ParseChar()
        {
            var dt = HungarianParser.Parse("ch");        // 8-bit character

            Assert.AreEqual("char", dt.ToString());
        }
Exemple #6
0
        public void IncompleteArray_Fail()
        {
            var dt = HungarianParser.Parse("a");        // incomplete array, not a valid type

            Assert.AreEqual("(arr <unknown>)", dt.ToString());
        }
Exemple #7
0
        public void Parse_Pointer_To_Integer()
        {
            var dt = HungarianParser.Parse("pi16");

            Assert.AreEqual("(ptr32 int16)", dt.ToString());
        }
 public void typeMarker_FormatType(object sender, TypeMarkerEventArgs e)
 {
     try
     {
         var parser = new HungarianParser();
         var dataType = parser.Parse(e.UserText);
         if (dataType == null)
             e.FormattedType = " - Null - ";
         else
             e.FormattedType = dataType.ToString();
     }
     catch
     {
         e.FormattedType = " - Error - ";
     }
 }
Exemple #9
0
        public void Parse_signed_word()
        {
            var dt = HungarianParser.Parse("iw");

            Assert.AreEqual("int32", dt.ToString());
        }
Exemple #10
0
        public void Parse_ushort()
        {
            var dt = HungarianParser.Parse("us");

            Assert.AreEqual("uint16", dt.ToString());
        }
Exemple #11
0
        public void ParseWord()
        {
            var dt = HungarianParser.Parse("w");

            Assert.AreEqual("word32", dt.ToString());
        }
Exemple #12
0
        public void Length_Prefixed_byte_string()
        {
            var dt = HungarianParser.Parse("si8");

            Assert.AreEqual("(struct (0 int8 length) (1 (arr char) chars))", dt.ToString());
        }
Exemple #13
0
        public void Wide_Zero_Terminated_string()
        {
            var dt = HungarianParser.Parse("wsz");

            Assert.AreEqual("(str wchar_t)", dt.ToString());
        }
Exemple #14
0
        public void Array_Pointers_To_Functions()
        {
            var dt = HungarianParser.Parse("apfn");

            Assert.AreEqual("(arr (ptr32 code))", dt.ToString());
        }
Exemple #15
0
        public void Parse8bit_c_string()
        {
            var dt = HungarianParser.Parse("sz");       // zero-terminated string

            Assert.AreEqual("(str char)", dt.ToString());
        }
Exemple #16
0
        public void ParseEmpty()
        {
            DataType dt = parser.Parse("");

            Assert.AreEqual("<unknown>", dt.ToString());
        }
Exemple #17
0
        public void Parse_single_precision_real()
        {
            var dt = HungarianParser.Parse("r32");

            Assert.AreEqual("real32", dt.ToString());
        }
 public ImageMapItem SetTypeAtAddressRange(Address address, string userText)
 {
     var parser = new HungarianParser();
     var dataType = parser.Parse(userText);
     if (dataType == null)
         return null;
     var arr = dataType as ArrayType;
     if (arr != null && arr.ElementType.Size != 0)
     {
         var range = control.MemoryView.GetAddressRange();
         if (range.IsValid)
         {
             long size = (range.End - range.Begin) + 1;
             int nElems = (int)(size / arr.ElementType.Size);
             arr.Length = nElems;
         }
     }
     var item = program.AddUserGlobalItem(address, dataType);
     control.MemoryView.Invalidate();
     return item;
 }
Exemple #19
0
        public void ParseI32()
        {
            var dt = HungarianParser.Parse("i32");

            Assert.AreEqual("int32", dt.ToString());
        }
Exemple #20
0
 public string FormatType(string text)
 {
     try
     {
         var parser = new HungarianParser();
         var dataType = parser.Parse(text);
         if (dataType == null)
             return " - Null - ";
         else
             return dataType.ToString();
     }
     catch
     {
         return " - Error - ";
     }
 }
Exemple #21
0
        public void ParseBool()
        {
            var dt = HungarianParser.Parse("f");     // 'f' for 'flag'.

            Assert.AreEqual("bool", dt.ToString());
        }
Exemple #22
0
        public void ParseArrayPrefix()
        {
            var dt = HungarianParser.Parse("ab");        // 'array of bytes' of unspecified length.

            Assert.AreEqual("(arr byte)", dt.ToString());
        }
Exemple #23
0
        public void Parse_Pointer_To_Anything()
        {
            var dt = HungarianParser.Parse("p");

            Assert.AreEqual("ptr32", dt.ToString());
        }