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,6 +24,7 @@ body
.mom_view .mom_view
width: 16% width: 16%
margin-left: 1% margin-left: 1%
overflow-x: hidden
.risc_view .risc_view
width: 34% width: 34%

View File

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

View File

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

View File

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

View File

@ -58,11 +58,7 @@ class RefView < ListView
if is_string? if is_string?
str = @value str = @value
elsif is_object? elsif is_object?
var = @value str = Risc::Position.get(@value).to_s
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)}"
elsif is_label? elsif is_label?
str = "Label" str = "Label"
else else

View File

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