trying to get register view to update

This commit is contained in:
Torsten Ruger 2015-07-29 16:39:15 +03:00
parent 933b64c499
commit 79383d89b1
3 changed files with 17 additions and 4 deletions

View File

@ -10,15 +10,24 @@ class RegisterView
before_mount do
interpreter.register_event(:register_changed, self)
interpreter.register_event(:object_changed, self)
register_changed( register , nil , interpreter.registers[register])
end
def register_changed reg , old , value
reg = reg.symbol unless reg.is_a? Symbol
return unless reg == register
objects_id! value
calc_fields
end
def object_changed reg
reg = reg.symbol unless reg.is_a? Symbol
return unless reg == register
puts "Object changed in #{reg}"
calc_fields
end
def calc_fields
#puts "My id #{objects_id} , #{objects_id.class}"
object = Virtual.machine.objects[objects_id]
@ -49,6 +58,7 @@ class RegisterView
end
def marker var
return "W" if var.is_a? String
var.class.name.split("::").last[0]
end
end

View File

@ -10,7 +10,7 @@ $susy: (
.classes { @include span(3); }
.file-view {
@include span(4);
@include span(4);
margin: span(1);
}
@ -31,7 +31,8 @@ $susy: (
}
.register-view {
@include gallery(2);
@include gallery(3);
margin-top: 10px;
}
.bright {

View File

@ -26,8 +26,8 @@ class Interpreter
@state = "runnnig"
@stdout = ""
@registers = {}
(0...12).each do |r|
set_register "r#{r}".to_sym , "undefined"
(0...16).each do |r|
set_register "r#{r}".to_sym , "r#{r}:unknown"
end
end
@ -114,6 +114,7 @@ class Interpreter
value = object_for( @instruction.register )
object = object_for( @instruction.array )
object.internal_object_set( @instruction.index , value )
trigger(:object_changed, @instruction.register )
true
end
@ -133,6 +134,7 @@ class Interpreter
def execute_SaveReturn
object = object_for @instruction.register
raise "save return has nothing to save" unless @link
trigger(:object_changed, @instruction.register )
object.internal_object_set @instruction.index , @link
true
end