diff --git a/Core/AppInfo.cs b/Core/AppInfo.cs index 28368f7..6eb986b 100644 --- a/Core/AppInfo.cs +++ b/Core/AppInfo.cs @@ -9,7 +9,7 @@ public static class AppInfo /// Author of the app. public const string Author = "jbgarcia@uvigo.es"; /// Version of the app. - public const string Version = "1.3 20170214"; + public const string Version = "1.4 20170401"; /// Website for this app. public const string Web = "http://webs.uvigo.es/jbgarcia/prys/csim/"; /// Extension for files created by this app. diff --git a/Core/FunctionLibrary/Time.cs b/Core/FunctionLibrary/Time.cs index 66533e8..4071f0e 100644 --- a/Core/FunctionLibrary/Time.cs +++ b/Core/FunctionLibrary/Time.cs @@ -31,9 +31,8 @@ public override void Execute(RValue[] realParams) var result = new NoPlaceTempVariable( this.Machine.TypeSystem.GetIntType() ); result.LiteralValue = new IntLiteral( this.Machine, - System.Convert.ToInt64( System.Math.Ceiling( - System.DateTime.Now.TimeOfDay.TotalSeconds ) ) ); + System.DateTime.Now.TimeOfDay.TotalSeconds ).ToBigInteger() ); this.Machine.ExecutionStack.Push( result ); } diff --git a/Core/Literals/DoubleLiteral.cs b/Core/Literals/DoubleLiteral.cs index c3dffe4..18f7d32 100644 --- a/Core/Literals/DoubleLiteral.cs +++ b/Core/Literals/DoubleLiteral.cs @@ -63,7 +63,7 @@ public override byte[] GetRawValue() /// The value as . public override BigInteger GetValueAsInteger() { - return System.Convert.ToInt64( this.Value ); + return this.Value.ToBigInteger(); } /// diff --git a/Core/Literals/FloatLiteral.cs b/Core/Literals/FloatLiteral.cs index 53a8c64..1fd7e80 100644 --- a/Core/Literals/FloatLiteral.cs +++ b/Core/Literals/FloatLiteral.cs @@ -64,7 +64,7 @@ public override byte[] GetRawValue() /// The value as . public override BigInteger GetValueAsInteger() { - return System.Convert.ToInt64( this.Value ); + return this.Value.ToBigInteger(); } /// diff --git a/Core/Literals/TypeLiteral.cs b/Core/Literals/TypeLiteral.cs index 17577a4..b166dc6 100644 --- a/Core/Literals/TypeLiteral.cs +++ b/Core/Literals/TypeLiteral.cs @@ -95,7 +95,7 @@ public override byte[] GetRawValue() /// The value as a . public override BigInteger GetValueAsInteger() { - return System.Convert.ToInt64( this.Value.Size ); + return this.Value.Size.ToBigInteger(); } /// diff --git a/Core/Opcodes/AccessOpcode.cs b/Core/Opcodes/AccessOpcode.cs index b2bad54..cafc2cf 100644 --- a/Core/Opcodes/AccessOpcode.cs +++ b/Core/Opcodes/AccessOpcode.cs @@ -44,7 +44,7 @@ public override void Execute() // Access the pointed value if ( vbleType != null ) { - BigInteger address = System.Convert.ToInt64( vble.LiteralValue.Value ); + BigInteger address = vble.LiteralValue.Value.ToBigInteger(); vble = new InPlaceTempVariable( vbleType.DerreferencedType ); vble.Address = address; this.Machine.TDS.AddVariableInPlace( vble ); diff --git a/Ui/MainWindow.cs b/Ui/MainWindow.cs index fef390c..e32b7f8 100644 --- a/Ui/MainWindow.cs +++ b/Ui/MainWindow.cs @@ -534,8 +534,11 @@ private void UpdateSymbolTable() ReadOnlyCollection variables = this.machine.TDS.Variables; this.tvSymbolTable.Nodes.Clear(); - foreach(Variable vble in variables) { + if ( vble is TempVariable ) { + continue; + } + string varTypeAddr = vble.Type.Name + " :" + vble.Type.Size + " [" + FromIntToPrettyHex( vble.Address, this.machine.WordSize ) diff --git a/Ui/SchemaDrawer.cs b/Ui/SchemaDrawer.cs index 6636368..fb85bb7 100644 --- a/Ui/SchemaDrawer.cs +++ b/Ui/SchemaDrawer.cs @@ -29,7 +29,7 @@ public class SchemaDrawer { public SchemaDrawer(Machine m) { this.Machine = m; - this.boxes = new Dictionary(); + this.boxes = new Dictionary>(); var normalFont = new Font( FontFamily.GenericMonospace, 12 ); var smallFont = new Font( FontFamily.GenericMonospace, 10 ); @@ -54,10 +54,22 @@ public void InitGraphics(Bitmap bitmap) private void AddVariablesAsBoxes(IEnumerable list) { foreach (Variable v in list) { + if ( v is TempVariable) { + continue; + } + var box = GrphBoxedVariable.Create( v, this.GraphInfo ); foreach(var boxInfo in box.GetInvolvedBoxes()) { - this.boxes.Add( boxInfo.Key, boxInfo.Value ); + List l; + + if ( this.boxes.TryGetValue( boxInfo.Key, out l) ) { + l.Add( boxInfo.Value ); + } else { + l = new List(); + l.Add( boxInfo.Value ); + this.boxes.Add( boxInfo.Key, l ); + } } this.rows.AddBox( box ); @@ -144,15 +156,19 @@ public void Draw(Bitmap surface) this.Cls(); // Draw relationships - foreach(GrphBoxedVariable box in this.boxes.Values) { - if ( box.Variable is PtrVariable ) { - this.DrawRelationship( box ); - } + foreach(IList storedBoxes in this.boxes.Values) { + foreach(GrphBoxedVariable box in storedBoxes) { + if ( box.Variable is PtrVariable ) { + this.DrawRelationship( box ); + } + } } // Draw the boxes themselves - foreach(GrphBoxedVariable box in this.boxes.Values) { - box.Draw(); + foreach(IList storedBoxes in this.boxes.Values) { + foreach(GrphBoxedVariable box in storedBoxes) { + box.Draw(); + } } return; @@ -163,14 +179,16 @@ private void DrawRelationship(GrphBoxedVariable box) var ptrVble = box.Variable as PtrVariable; if ( ptrVble != null ) { - var address = (BigInteger) ptrVble.IntValue.Value; + BigInteger address = ptrVble.IntValue.Value; GrphBoxedVariable pointedBox = null; + List l; if ( address == 0 ) { this.DrawNullPointer( box ); } else - if ( this.boxes.TryGetValue( address, out pointedBox ) ) { + if ( this.boxes.TryGetValue( address, out l ) ) { + pointedBox = l[0]; float delta = 0; if ( !( pointedBox is Drawer.GrphBoxedArray ) ) { @@ -313,7 +331,7 @@ public void UpdateFont(int step) get; set; } - private Dictionary boxes; + private Dictionary> boxes; private Bitmap bmBoard; private Graphics board;