switch to susy
a rewire basically, but much clearer
This commit is contained in:
parent
7e34ae003e
commit
557c455167
1
Gemfile
1
Gemfile
@ -9,6 +9,7 @@ gem "salama" , path: "../salama"
|
|||||||
gem "salama-reader" , path: "../salama-reader"
|
gem "salama-reader" , path: "../salama-reader"
|
||||||
gem "salama-arm" , path: "../salama-arm"
|
gem "salama-arm" , path: "../salama-arm"
|
||||||
gem "salama-object-file" , path: "../salama-object-file"
|
gem "salama-object-file" , path: "../salama-object-file"
|
||||||
|
gem "susy"
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
gem "minitest"
|
gem "minitest"
|
||||||
|
@ -50,9 +50,12 @@ GEM
|
|||||||
rack (1.6.4)
|
rack (1.6.4)
|
||||||
react-source (0.13.3)
|
react-source (0.13.3)
|
||||||
rubygems-tasks (0.2.4)
|
rubygems-tasks (0.2.4)
|
||||||
|
sass (3.4.16)
|
||||||
sourcemap (0.1.1)
|
sourcemap (0.1.1)
|
||||||
sprockets (3.2.0)
|
sprockets (3.2.0)
|
||||||
rack (~> 1.0)
|
rack (~> 1.0)
|
||||||
|
susy (2.2.5)
|
||||||
|
sass (>= 3.3.0, < 3.5)
|
||||||
tilt (2.0.1)
|
tilt (2.0.1)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
@ -69,6 +72,7 @@ DEPENDENCIES
|
|||||||
salama-arm!
|
salama-arm!
|
||||||
salama-object-file!
|
salama-object-file!
|
||||||
salama-reader!
|
salama-reader!
|
||||||
|
susy
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.10.5
|
1.10.5
|
||||||
|
@ -30,19 +30,14 @@ class BlockView
|
|||||||
|
|
||||||
def render
|
def render
|
||||||
return unless block
|
return unless block
|
||||||
div.row do
|
div.block_view do
|
||||||
div.col_md_5 do
|
div do
|
||||||
SourceView :source => interpreter.instruction.source
|
h4 {"Block: #{block_name}"}
|
||||||
end
|
|
||||||
div.col_md_5 do
|
|
||||||
h6 { "Block: #{block_name}"}
|
|
||||||
block.each do |code|
|
|
||||||
InstructionView :interpreter => interpreter , :instruction => code
|
|
||||||
end
|
|
||||||
end
|
|
||||||
div.col_md_2 do
|
|
||||||
button.btn.btn_default { "next" }.on(:click) { interpreter.tick }
|
button.btn.btn_default { "next" }.on(:click) { interpreter.tick }
|
||||||
end
|
end
|
||||||
|
block.each do |code|
|
||||||
|
InstructionView :interpreter => interpreter , :instruction => code
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -4,9 +4,10 @@ class ClassView
|
|||||||
required_param :classes, type: {}
|
required_param :classes, type: {}
|
||||||
|
|
||||||
def render
|
def render
|
||||||
div.row do
|
div.classes do
|
||||||
|
h4 { "Classes" }
|
||||||
classes.each do |name , clas|
|
classes.each do |name , clas|
|
||||||
div.row do
|
div.one_class do
|
||||||
clas.name
|
clas.name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -17,27 +17,16 @@ class Debugger
|
|||||||
interpreter.start machine.init
|
interpreter.start machine.init
|
||||||
end
|
end
|
||||||
def render
|
def render
|
||||||
div.container do
|
div.debugger_view do
|
||||||
div.row do
|
ClassView classes: machine.space.classes
|
||||||
div.col_md_1 do
|
div.file_view do
|
||||||
ClassView classes: machine.space.classes
|
"Future Source code view"
|
||||||
end
|
end
|
||||||
div.col_md_11 do
|
SourceView :interpreter => interpreter
|
||||||
div.row do
|
BlockView :interpreter => interpreter
|
||||||
div.col_md_4 do
|
div.registers_view do
|
||||||
"Future one"
|
interpreter.registers.each do |r , oid|
|
||||||
end
|
RegisterView interpreter: interpreter , register: r
|
||||||
div.col_md_8 do
|
|
||||||
BlockView interpreter: interpreter
|
|
||||||
end
|
|
||||||
end
|
|
||||||
div.row do
|
|
||||||
interpreter.registers.each do |r , oid|
|
|
||||||
div.col_md_1 do
|
|
||||||
RegisterView interpreter: interpreter , register: r
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -13,7 +13,7 @@ class InstructionView
|
|||||||
end
|
end
|
||||||
|
|
||||||
def check_active i
|
def check_active i
|
||||||
active! instruction == i ? "active" : ""
|
active! instruction == i ? "bright" : ""
|
||||||
|
|
||||||
end
|
end
|
||||||
def instruction_changed old , ins
|
def instruction_changed old , ins
|
||||||
@ -21,9 +21,8 @@ class InstructionView
|
|||||||
end
|
end
|
||||||
|
|
||||||
def render
|
def render
|
||||||
return unless instruction
|
|
||||||
div :class => active do
|
div :class => active do
|
||||||
instruction.to_s
|
instruction.to_s if instruction
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -20,12 +20,12 @@ class RegisterView
|
|||||||
end
|
end
|
||||||
|
|
||||||
def calc_fields
|
def calc_fields
|
||||||
puts "My id #{objects_id} , #{objects_id.class}"
|
#puts "My id #{objects_id} , #{objects_id.class}"
|
||||||
object = Virtual.machine.objects[objects_id]
|
object = Virtual.machine.objects[objects_id]
|
||||||
if object and ! object.is_a?(String)
|
if object and ! object.is_a?(String)
|
||||||
has_fields = []
|
has_fields = []
|
||||||
clazz = object.class.name.split("::").last
|
clazz = object.class.name.split("::").last
|
||||||
puts "found #{clazz}"
|
#puts "found #{clazz}"
|
||||||
has_fields << clazz
|
has_fields << clazz
|
||||||
object.get_instance_variables.each do |variable|
|
object.get_instance_variables.each do |variable|
|
||||||
f = object.get_instance_variable(variable)
|
f = object.get_instance_variable(variable)
|
||||||
@ -36,8 +36,8 @@ class RegisterView
|
|||||||
end
|
end
|
||||||
|
|
||||||
def render
|
def render
|
||||||
div.row do
|
div.register_view do
|
||||||
div.col_md_12 do
|
div do
|
||||||
objects_id.to_s
|
objects_id.to_s
|
||||||
end
|
end
|
||||||
fields.each do |attribute|
|
fields.each do |attribute|
|
||||||
|
@ -2,26 +2,33 @@ class SourceView
|
|||||||
|
|
||||||
include React::Component
|
include React::Component
|
||||||
|
|
||||||
required_param :source
|
required_param :interpreter
|
||||||
|
|
||||||
define_state :sources => []
|
define_state :sources => []
|
||||||
|
|
||||||
before_update do
|
before_mount do
|
||||||
text = source_text(source)
|
interpreter.register_event(:instruction_changed, self)
|
||||||
|
instruction_changed nil , interpreter.instruction
|
||||||
|
end
|
||||||
|
|
||||||
|
def instruction_changed old , ins
|
||||||
|
text = source_text(ins.source)
|
||||||
return if sources.last == text
|
return if sources.last == text
|
||||||
sources << text
|
sources << text
|
||||||
sources.shift if sources.length > 5
|
sources.shift if sources.length > 5
|
||||||
|
sources! sources
|
||||||
end
|
end
|
||||||
|
|
||||||
def render
|
def render
|
||||||
div.row do
|
div.source_view do
|
||||||
"Virtual Machine Instruction".br
|
h4 {"Virtual Machine Instruction"}
|
||||||
sources.each do |s|
|
sources.each do |s|
|
||||||
s.br
|
s.br
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def source_text
|
def source_text source
|
||||||
if source.is_a? Virtual::Instruction
|
if source.is_a? Virtual::Instruction
|
||||||
return source.class.name
|
return source.class.name
|
||||||
else
|
else
|
||||||
|
30
app/styles.scss
Normal file
30
app/styles.scss
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
@import "susy";
|
||||||
|
|
||||||
|
.debugger-view { @include container(80em); }
|
||||||
|
|
||||||
|
.classes { @include span(2 of 12); }
|
||||||
|
|
||||||
|
.file-view { @include span(3 of 12); }
|
||||||
|
|
||||||
|
.source-view { @include span(3 of 12); }
|
||||||
|
|
||||||
|
.block-view {
|
||||||
|
@include span(4 of 12 at 9);
|
||||||
|
height: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.registers-view {
|
||||||
|
@include span(10 of 12 at 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.register-view {
|
||||||
|
@include span(1 of 13);
|
||||||
|
}
|
||||||
|
|
||||||
|
.half {
|
||||||
|
@include span(5 of 12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bright {
|
||||||
|
background-color: orange ;
|
||||||
|
}
|
@ -6,6 +6,7 @@ Opal.use_gem "salama"
|
|||||||
Opal.use_gem "salama-arm"
|
Opal.use_gem "salama-arm"
|
||||||
|
|
||||||
require "tilt/erb"
|
require "tilt/erb"
|
||||||
|
require "susy"
|
||||||
require "json"
|
require "json"
|
||||||
require "react/source"
|
require "react/source"
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Salama Debugger</title>
|
<title>Salama Debugger</title>
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
|
<link rel="stylesheet" href="/assets/styles.css">
|
||||||
<link rel="stylesheet" href="/static/main.css">
|
|
||||||
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
|
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
|
||||||
<script src="/assets/react-with-addons.js"></script>
|
<script src="/assets/react-with-addons.js"></script>
|
||||||
<%= javascript_include_tag 'main' %>
|
<%= javascript_include_tag 'main' %>
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
.active {
|
|
||||||
background-color: orange ;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user