adjust to rubyx layers

no global machine and positions
also small layout changes
This commit is contained in:
Torsten Ruger 2018-07-03 19:16:12 +03:00
parent 24961e2e10
commit 11cdb5872a
6 changed files with 10 additions and 16 deletions

View File

@ -24,7 +24,8 @@ body
.mom_view
width: 16%
margin-left: 1%
overflow-x: hidden
.risc_view
width: 34%
margin-left: 1%

View File

@ -40,8 +40,9 @@ class MainView < ListView
include AST::Sexp
def initialize
Risc.machine.boot
@interpreter = Risc::Interpreter.new
input = "class Space;def main(arg); return 1; end; end"
linker = RubyX::RubyXCompiler.new(input).ruby_to_binary(:interpreter)
@interpreter = Risc::Interpreter.new(linker)
super( [LeftView.new(@interpreter) ,
VoolView.new(@interpreter) ,
MomView.new(@interpreter) ,

View File

@ -57,13 +57,11 @@ class SelectView < ElementView
def select( code )
puts "selecting #{code}"
Risc.machine.boot
@interpreter.set_state :stopped
@element.at_css(".selected").text = code
ruby = get_codes[code]
Risc.machine.boot
Vool::VoolCompiler.ruby_to_binary( as_main(ruby) , :interpreter )
@interpreter.start_machine
linker = RubyX::RubyXCompiler.new(as_main(ruby)).ruby_to_binary(:interpreter)
@interpreter.start_program(linker)
end
def as_main(statements)
"class Space ;def main(arg) ; #{statements}; end; end"

View File

@ -40,8 +40,7 @@ class ObjectView < ListView
end
def class_header
pos = Risc::Position.set?(@object)
str = pos ? pos.to_s : @object.object_id.to_s(16)
str = Risc::Position.set?(@object).to_s
clazz = @object.class.name.split("::").last
[clazz, str].join " : "
end

View File

@ -58,11 +58,7 @@ class RefView < ListView
if is_string?
str = @value
elsif is_object?
var = @value
str = var.class.name.split("::").last[0,2]
pos = Risc::Position.set?(@value)
str += pos ? pos.to_s : @value.object_id.to_s(16)
str + " : #{@value.object_id.to_s(16)}"
str = Risc::Position.get(@value).to_s
elsif is_label?
str = "Label"
else

View File

@ -19,9 +19,8 @@ class VoolView < ElementView
return "" unless i
if i.is_a?(Risc::FunctionReturn)
link = @interpreter.get_register( i.register )
puts "Link #{link}:#{link.source}"
puts "Link #{link}:#{link.class}"
raise "No link method" unless link
i = link
end
method = nil
case i.source