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); }
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 - "; } }
public void ParseWideChar() { var dt = HungarianParser.Parse("wch"); // 16-bit character Assert.AreEqual("wchar_t", dt.ToString()); }
public void ParseChar() { var dt = HungarianParser.Parse("ch"); // 8-bit character Assert.AreEqual("char", dt.ToString()); }
public void IncompleteArray_Fail() { var dt = HungarianParser.Parse("a"); // incomplete array, not a valid type Assert.AreEqual("(arr <unknown>)", dt.ToString()); }
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 - "; } }
public void Parse_signed_word() { var dt = HungarianParser.Parse("iw"); Assert.AreEqual("int32", dt.ToString()); }
public void Parse_ushort() { var dt = HungarianParser.Parse("us"); Assert.AreEqual("uint16", dt.ToString()); }
public void ParseWord() { var dt = HungarianParser.Parse("w"); Assert.AreEqual("word32", dt.ToString()); }
public void Length_Prefixed_byte_string() { var dt = HungarianParser.Parse("si8"); Assert.AreEqual("(struct (0 int8 length) (1 (arr char) chars))", dt.ToString()); }
public void Wide_Zero_Terminated_string() { var dt = HungarianParser.Parse("wsz"); Assert.AreEqual("(str wchar_t)", dt.ToString()); }
public void Array_Pointers_To_Functions() { var dt = HungarianParser.Parse("apfn"); Assert.AreEqual("(arr (ptr32 code))", dt.ToString()); }
public void Parse8bit_c_string() { var dt = HungarianParser.Parse("sz"); // zero-terminated string Assert.AreEqual("(str char)", dt.ToString()); }
public void ParseEmpty() { DataType dt = parser.Parse(""); Assert.AreEqual("<unknown>", dt.ToString()); }
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; }
public void ParseI32() { var dt = HungarianParser.Parse("i32"); Assert.AreEqual("int32", dt.ToString()); }
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 - "; } }
public void ParseBool() { var dt = HungarianParser.Parse("f"); // 'f' for 'flag'. Assert.AreEqual("bool", dt.ToString()); }
public void ParseArrayPrefix() { var dt = HungarianParser.Parse("ab"); // 'array of bytes' of unspecified length. Assert.AreEqual("(arr byte)", dt.ToString()); }
public void Parse_Pointer_To_Anything() { var dt = HungarianParser.Parse("p"); Assert.AreEqual("ptr32", dt.ToString()); }