2015-07-31 10:42:26 +02:00
|
|
|
module Main
|
|
|
|
class RegistersController < Volt::ModelController
|
|
|
|
|
2015-07-31 17:32:36 +02:00
|
|
|
def initialize *args
|
|
|
|
super(*args)
|
2015-07-31 10:42:26 +02:00
|
|
|
self.model = []
|
2015-07-31 17:32:36 +02:00
|
|
|
init_registers
|
2015-07-31 10:42:26 +02:00
|
|
|
end
|
|
|
|
|
2015-07-31 17:32:36 +02:00
|
|
|
|
|
|
|
def init_registers
|
|
|
|
@volt_app.interpreter.registers.each do |reg , val|
|
2015-07-31 10:42:26 +02:00
|
|
|
r = RegisterModel.new( :name => reg , :value => val)
|
|
|
|
self.model << r
|
2015-07-31 17:32:36 +02:00
|
|
|
@volt_app.interpreter.register_event(:register_changed, r)
|
|
|
|
@volt_app.interpreter.register_event(:object_changed, r)
|
|
|
|
r.register_changed( reg , nil , @volt_app.interpreter.registers[reg])
|
2015-07-31 10:42:26 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def marker var
|
2015-08-08 16:52:24 +02:00
|
|
|
return "Wo" if var.is_a? String
|
|
|
|
var.class.name.split("::").last[0,2]
|
2015-07-31 10:42:26 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|