virtual - register update
This commit is contained in:
parent
8cde7011ef
commit
9cb4a787b2
@ -6,7 +6,7 @@ After some tryouts it ended up being an Opal application. That is ruby as javasc
|
||||
|
||||
- On the left are the classes of the system. Next idea is to have hover info about them.
|
||||
- Next a source code view (not implemented)
|
||||
- next a view of the Virtual Instructions
|
||||
- next a view of the Register Instructions
|
||||
- last section, current block with current Register Instruction highlighted
|
||||
- step (next) button for single stepping
|
||||
- state: starting , running , exited
|
||||
|
@ -19,15 +19,15 @@ require "views/file_view"
|
||||
require "views/blocks_view"
|
||||
require "views/instruction_view"
|
||||
require "views/registers_view"
|
||||
require "code"
|
||||
|
||||
class MainView < ListView
|
||||
include AST::Sexp
|
||||
|
||||
def initialize
|
||||
machine = Virtual.machine.boot
|
||||
machine = Register.machine.boot
|
||||
code = s(:statements, s(:class, :Foo, s(:derives, nil),
|
||||
s(:statements, s(:class_field, :Integer, :x))))
|
||||
Phisol::Compiler.compile( code )
|
||||
Soml::Compiler.compile( code )
|
||||
machine.collect
|
||||
@interpreter = Interpreter::Interpreter.new
|
||||
super( [SwitchView.new(@interpreter) ,
|
||||
|
@ -4,7 +4,7 @@ class ClassesView < ListView
|
||||
def initialize interpreter
|
||||
@interpreter = interpreter
|
||||
classes = []
|
||||
Virtual.machine.space.classes.each do |name , claz|
|
||||
Register.machine.space.classes.each do |name , claz|
|
||||
next if [:Kernel,:Module,:MetaClass,:BinaryCode].index name
|
||||
classes << claz
|
||||
end
|
||||
@ -28,7 +28,7 @@ class ClassView < ElementView
|
||||
|
||||
def draw
|
||||
@element = div("li") << div( "a" , @clazz.name ) << (ul = div("ul"))
|
||||
@clazz.object_layout.object_instance_names.each do |name|
|
||||
@clazz.object_layout.instance_names.each do |name|
|
||||
ul << (div("li") << div("a", name ))
|
||||
end
|
||||
@element.style["z-index"] = 20
|
||||
|
@ -24,7 +24,7 @@ class InstructionView < ListView
|
||||
def draw
|
||||
super()
|
||||
wrap_node_with @elements.first , div
|
||||
wrap_element div(".source_view") << div("h4" ,"Virtual Machine Instruction")
|
||||
wrap_element div(".source_view") << div("h4" ,"Register Machine Instruction")
|
||||
@element
|
||||
end
|
||||
|
||||
|
@ -25,7 +25,7 @@ class ObjectView < ListView
|
||||
for_object = @interpreter.get_register( reg )
|
||||
return unless for_object == @object_id
|
||||
#puts "Object changed #{for_object} , at #{at}"
|
||||
object = Virtual.machine.objects[@object_id]
|
||||
object = Register.machine.objects[@object_id]
|
||||
raise "error #{@object_id} , #{at}" unless object and ! object.is_a?(String)
|
||||
variable = object.get_instance_variables.get(at)
|
||||
if(variable)
|
||||
@ -45,13 +45,13 @@ class ObjectView < ListView
|
||||
end
|
||||
|
||||
def class_header(id)
|
||||
object = Virtual.machine.objects[id]
|
||||
object = Register.machine.objects[id]
|
||||
clazz = object.class.name.split("::").last
|
||||
[clazz, id].join " : "
|
||||
end
|
||||
|
||||
def content_elements
|
||||
object = Virtual.machine.objects[@object_id]
|
||||
object = Register.machine.objects[@object_id]
|
||||
fields = []
|
||||
if object and ! object.is_a?(String)
|
||||
fields << RefView.new( "layout" , object.get_layout.object_id , @z )
|
||||
|
@ -27,15 +27,15 @@ class RefView < ListView
|
||||
end
|
||||
|
||||
def is_object?( )
|
||||
Virtual.machine.objects[@value] != nil
|
||||
Register.machine.objects[@value] != nil
|
||||
end
|
||||
|
||||
def is_string?()
|
||||
Virtual.machine.objects[@value].is_a? String
|
||||
Register.machine.objects[@value].is_a? String
|
||||
end
|
||||
|
||||
def is_nil?()
|
||||
Virtual.machine.objects[@value].nil?
|
||||
Register.machine.objects[@value].nil?
|
||||
end
|
||||
|
||||
def hover
|
||||
@ -50,7 +50,7 @@ class RefView < ListView
|
||||
elsif is_nil?
|
||||
str = "nil"
|
||||
else
|
||||
var = Virtual.machine.objects[id]
|
||||
var = Register.machine.objects[id]
|
||||
str = var.class.name.split("::").last[0,2]
|
||||
str + " : #{id.to_s}"
|
||||
end
|
||||
|
@ -34,7 +34,7 @@ class RegistersView < ListView
|
||||
end
|
||||
|
||||
def is_object?( id )
|
||||
Virtual.machine.objects[id] != nil
|
||||
Register.machine.objects[id] != nil
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user