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.
|
- 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 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
|
- last section, current block with current Register Instruction highlighted
|
||||||
- step (next) button for single stepping
|
- step (next) button for single stepping
|
||||||
- state: starting , running , exited
|
- state: starting , running , exited
|
||||||
|
@ -19,15 +19,15 @@ require "views/file_view"
|
|||||||
require "views/blocks_view"
|
require "views/blocks_view"
|
||||||
require "views/instruction_view"
|
require "views/instruction_view"
|
||||||
require "views/registers_view"
|
require "views/registers_view"
|
||||||
require "code"
|
|
||||||
|
|
||||||
class MainView < ListView
|
class MainView < ListView
|
||||||
|
include AST::Sexp
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
machine = Virtual.machine.boot
|
machine = Register.machine.boot
|
||||||
code = s(:statements, s(:class, :Foo, s(:derives, nil),
|
code = s(:statements, s(:class, :Foo, s(:derives, nil),
|
||||||
s(:statements, s(:class_field, :Integer, :x))))
|
s(:statements, s(:class_field, :Integer, :x))))
|
||||||
Phisol::Compiler.compile( code )
|
Soml::Compiler.compile( code )
|
||||||
machine.collect
|
machine.collect
|
||||||
@interpreter = Interpreter::Interpreter.new
|
@interpreter = Interpreter::Interpreter.new
|
||||||
super( [SwitchView.new(@interpreter) ,
|
super( [SwitchView.new(@interpreter) ,
|
||||||
|
@ -4,7 +4,7 @@ class ClassesView < ListView
|
|||||||
def initialize interpreter
|
def initialize interpreter
|
||||||
@interpreter = interpreter
|
@interpreter = interpreter
|
||||||
classes = []
|
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
|
next if [:Kernel,:Module,:MetaClass,:BinaryCode].index name
|
||||||
classes << claz
|
classes << claz
|
||||||
end
|
end
|
||||||
@ -28,7 +28,7 @@ class ClassView < ElementView
|
|||||||
|
|
||||||
def draw
|
def draw
|
||||||
@element = div("li") << div( "a" , @clazz.name ) << (ul = div("ul"))
|
@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 ))
|
ul << (div("li") << div("a", name ))
|
||||||
end
|
end
|
||||||
@element.style["z-index"] = 20
|
@element.style["z-index"] = 20
|
||||||
|
@ -24,7 +24,7 @@ class InstructionView < ListView
|
|||||||
def draw
|
def draw
|
||||||
super()
|
super()
|
||||||
wrap_node_with @elements.first , div
|
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
|
@element
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class ObjectView < ListView
|
|||||||
for_object = @interpreter.get_register( reg )
|
for_object = @interpreter.get_register( reg )
|
||||||
return unless for_object == @object_id
|
return unless for_object == @object_id
|
||||||
#puts "Object changed #{for_object} , at #{at}"
|
#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)
|
raise "error #{@object_id} , #{at}" unless object and ! object.is_a?(String)
|
||||||
variable = object.get_instance_variables.get(at)
|
variable = object.get_instance_variables.get(at)
|
||||||
if(variable)
|
if(variable)
|
||||||
@ -45,13 +45,13 @@ class ObjectView < ListView
|
|||||||
end
|
end
|
||||||
|
|
||||||
def class_header(id)
|
def class_header(id)
|
||||||
object = Virtual.machine.objects[id]
|
object = Register.machine.objects[id]
|
||||||
clazz = object.class.name.split("::").last
|
clazz = object.class.name.split("::").last
|
||||||
[clazz, id].join " : "
|
[clazz, id].join " : "
|
||||||
end
|
end
|
||||||
|
|
||||||
def content_elements
|
def content_elements
|
||||||
object = Virtual.machine.objects[@object_id]
|
object = Register.machine.objects[@object_id]
|
||||||
fields = []
|
fields = []
|
||||||
if object and ! object.is_a?(String)
|
if object and ! object.is_a?(String)
|
||||||
fields << RefView.new( "layout" , object.get_layout.object_id , @z )
|
fields << RefView.new( "layout" , object.get_layout.object_id , @z )
|
||||||
|
@ -27,15 +27,15 @@ class RefView < ListView
|
|||||||
end
|
end
|
||||||
|
|
||||||
def is_object?( )
|
def is_object?( )
|
||||||
Virtual.machine.objects[@value] != nil
|
Register.machine.objects[@value] != nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_string?()
|
def is_string?()
|
||||||
Virtual.machine.objects[@value].is_a? String
|
Register.machine.objects[@value].is_a? String
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_nil?()
|
def is_nil?()
|
||||||
Virtual.machine.objects[@value].nil?
|
Register.machine.objects[@value].nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
def hover
|
def hover
|
||||||
@ -50,7 +50,7 @@ class RefView < ListView
|
|||||||
elsif is_nil?
|
elsif is_nil?
|
||||||
str = "nil"
|
str = "nil"
|
||||||
else
|
else
|
||||||
var = Virtual.machine.objects[id]
|
var = Register.machine.objects[id]
|
||||||
str = var.class.name.split("::").last[0,2]
|
str = var.class.name.split("::").last[0,2]
|
||||||
str + " : #{id.to_s}"
|
str + " : #{id.to_s}"
|
||||||
end
|
end
|
||||||
|
@ -34,7 +34,7 @@ class RegistersView < ListView
|
|||||||
end
|
end
|
||||||
|
|
||||||
def is_object?( id )
|
def is_object?( id )
|
||||||
Virtual.machine.objects[id] != nil
|
Register.machine.objects[id] != nil
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user