remove dead code (no going back anyway)
This commit is contained in:
parent
9cb4a787b2
commit
b6bfddf536
@ -1,59 +0,0 @@
|
||||
body {
|
||||
font-family: arial, helvetica, serif;
|
||||
}
|
||||
|
||||
#nav, #nav ul { /* all lists */
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
float : left;
|
||||
width : 10em;
|
||||
/*border around submenu goes here*/
|
||||
-moz-border-radius: 8px;
|
||||
-webkit-border-radius: 8px;
|
||||
background:#fff;
|
||||
border:1px solid #C3D46A
|
||||
}
|
||||
|
||||
#nav li { /* all list items */
|
||||
position : relative;
|
||||
float : left;
|
||||
line-height : 1.25em;
|
||||
width: 9em;
|
||||
}
|
||||
|
||||
#nav li ul { /* second-level lists */
|
||||
position : absolute;
|
||||
left: -999em;
|
||||
margin-left : 10.05em;
|
||||
margin-top : -1.35em;
|
||||
}
|
||||
|
||||
#nav li ul ul { /* third-and-above-level lists */
|
||||
left: -999em;
|
||||
}
|
||||
|
||||
#nav li a , li span {
|
||||
padding-left: 0.5em;
|
||||
width : 9.5em;
|
||||
display : block;
|
||||
color : black;
|
||||
font-weight : bold;
|
||||
text-decoration : none;
|
||||
background-color : white;
|
||||
-moz-border-radius: 7px;
|
||||
-webkit-border-radius: 7px;
|
||||
}
|
||||
|
||||
#nav li a:hover {
|
||||
color : white;
|
||||
background-color : #F6C739;
|
||||
}
|
||||
|
||||
#nav li:hover ul ul, #nav li:hover ul ul ul {
|
||||
left: -999em;
|
||||
}
|
||||
|
||||
#nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul { /* lists nested under hovered list items */
|
||||
left: auto;
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
module Main
|
||||
class BlocksController < Volt::ModelController
|
||||
|
||||
def initialize *args
|
||||
super(*args)
|
||||
blocks = BlocksModel.new
|
||||
page._blocks = blocks
|
||||
@volt_app.interpreter.register_event(:instruction_changed, blocks)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
@ -1,28 +0,0 @@
|
||||
module Main
|
||||
class ClassesController < Volt::ModelController
|
||||
|
||||
def initialize *args
|
||||
super(*args)
|
||||
|
||||
page._classes!.clear
|
||||
all = []
|
||||
Virtual.machine.space.classes.each do |name , claz|
|
||||
next if [:Kernel,:Module,:MetaClass,:BinaryCode].index name
|
||||
all << name
|
||||
end
|
||||
all.sort.each do |name|
|
||||
c = Volt::Model.new :name => name
|
||||
page._classes << c
|
||||
end
|
||||
end
|
||||
|
||||
def variables(clas_model)
|
||||
layout = Virtual.machine.space.get_class_by_name(clas_model._name).object_layout
|
||||
vars = []
|
||||
layout.object_instance_names.each do |name|
|
||||
vars.push name
|
||||
end
|
||||
vars
|
||||
end
|
||||
end
|
||||
end
|
@ -1,55 +0,0 @@
|
||||
if RUBY_PLATFORM == 'opal'
|
||||
require "native"
|
||||
end
|
||||
|
||||
module Main
|
||||
class ObjectsController < Volt::ModelController
|
||||
|
||||
def index_ready
|
||||
container = Native(self.container).querySelector("ul")
|
||||
all = container.querySelectorAll("a")
|
||||
len = all.length - 1
|
||||
while len >= 0
|
||||
puts "li #{len}" + all.item(len).innerHTML + " lo"
|
||||
len = len - 1
|
||||
end
|
||||
# red = -> (event) { container.style.backgroundColor = "red" }
|
||||
red = -> (event) { puts container.innerHTML }
|
||||
container.addEventListener("mouseenter" , red)
|
||||
end
|
||||
|
||||
def marker id
|
||||
var = Virtual.machine.objects[id]
|
||||
if var.is_a? String
|
||||
str "Wo"
|
||||
else
|
||||
str = var.class.name.split("::").last[0,2]
|
||||
end
|
||||
str + " : #{id.to_s}"
|
||||
end
|
||||
|
||||
def class_header(id)
|
||||
object = Virtual.machine.objects[id]
|
||||
return "" unless object
|
||||
clazz = object.class.name.split("::").last
|
||||
"#{clazz}:#{id}"
|
||||
end
|
||||
|
||||
def content(id)
|
||||
object = Virtual.machine.objects[id]
|
||||
fields = []
|
||||
if object and ! object.is_a?(String)
|
||||
object.get_instance_variables.each do |variable|
|
||||
f = object.get_instance_variable(variable)
|
||||
fields << ["#{variable} : #{marker(f.object_id)}" , f.object_id]
|
||||
end
|
||||
end
|
||||
fields
|
||||
end
|
||||
|
||||
def is_object?( id )
|
||||
Virtual.machine.objects[id] != nil
|
||||
end
|
||||
|
||||
end
|
||||
end
|
@ -1,26 +0,0 @@
|
||||
module Main
|
||||
class RegistersController < Volt::ModelController
|
||||
|
||||
def initialize *args
|
||||
super(*args)
|
||||
self.model = []
|
||||
init_registers
|
||||
end
|
||||
|
||||
|
||||
def init_registers
|
||||
@volt_app.interpreter.registers.each do |reg , val|
|
||||
r = RegisterModel.new( :name => reg , :value => val)
|
||||
self.model << r
|
||||
@volt_app.interpreter.register_event(:register_changed, r)
|
||||
@volt_app.interpreter.register_event(:object_changed, r)
|
||||
r.register_changed( reg , nil , @volt_app.interpreter.registers[reg])
|
||||
end
|
||||
end
|
||||
|
||||
def is_object?( id )
|
||||
Virtual.machine.objects[id] != nil
|
||||
end
|
||||
|
||||
end
|
||||
end
|
@ -1,12 +0,0 @@
|
||||
module Main
|
||||
class SourcesController < Volt::ModelController
|
||||
def initialize *args
|
||||
super(*args)
|
||||
|
||||
sources = SourceModel.new
|
||||
page._sources = sources
|
||||
@volt_app.interpreter.register_event(:instruction_changed, sources)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
@ -1,31 +0,0 @@
|
||||
module Main
|
||||
class StatusController < Volt::ModelController
|
||||
|
||||
def initialize *args
|
||||
super(*args)
|
||||
self.model = Volt::Model.new
|
||||
update_interpreter
|
||||
end
|
||||
|
||||
def tick
|
||||
@volt_app.interpreter.tick
|
||||
update_interpreter
|
||||
end
|
||||
def update_interpreter
|
||||
self._clock = @volt_app.interpreter.clock
|
||||
self._state = @volt_app.interpreter.state
|
||||
self._stdout = @volt_app.interpreter.stdout
|
||||
self._link = @volt_app.interpreter.link.to_s
|
||||
page._method_name = method_name
|
||||
page._block_name = @volt_app.interpreter.block ? @volt_app.interpreter.block.name : " "
|
||||
end
|
||||
|
||||
def method_name
|
||||
bl = @volt_app.interpreter.block
|
||||
return " " unless bl
|
||||
return bl.method if bl.method.is_a? String
|
||||
"#{bl.method.for_class.name}.#{bl.method.name}"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
@ -1,10 +0,0 @@
|
||||
class BlocksModel < Volt::ArrayModel
|
||||
|
||||
def instruction_changed old , ins
|
||||
self.last._class_name = "inactive" if( self.length > 0)
|
||||
self << { :name => ins.to_s , :class_name => "bright" }
|
||||
#puts "block #{self.length}"
|
||||
self.delete_at(0) if( self.length > 5)
|
||||
end
|
||||
|
||||
end
|
@ -1,36 +0,0 @@
|
||||
class RegisterModel < Volt::Model
|
||||
field :name
|
||||
field :value
|
||||
field :fields
|
||||
|
||||
def register_changed reg , old , value
|
||||
reg = reg.symbol unless reg.is_a? Symbol
|
||||
return unless reg == name
|
||||
self.value = value
|
||||
calc_fields
|
||||
end
|
||||
|
||||
def object_changed reg
|
||||
reg = reg.symbol unless reg.is_a? Symbol
|
||||
return unless reg == name
|
||||
#puts "Object changed in #{reg}"
|
||||
calc_fields
|
||||
end
|
||||
|
||||
def calc_fields
|
||||
#puts "My id #{objects_id} , #{objects_id.class}"
|
||||
object = Virtual.machine.objects[value]
|
||||
self.fields.clear
|
||||
if object and ! object.is_a?(String)
|
||||
clazz = object.class.name.split("::").last
|
||||
#puts "found #{clazz}"
|
||||
self.fields << "#{clazz}:#{object.internal_object_length}"
|
||||
self.fields << object.get_layout
|
||||
object.get_instance_variables.each do |variable|
|
||||
f = object.get_instance_variable(variable)
|
||||
self.fields << f
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -1,23 +0,0 @@
|
||||
class SourceModel < Volt::ArrayModel
|
||||
|
||||
def instruction_changed old , ins
|
||||
return unless ins
|
||||
source = source_text ins.source
|
||||
if( self.length > 0)
|
||||
return if self.last._name == source
|
||||
self.last._class_name = "inactive"
|
||||
end
|
||||
self << { :name => source.to_s , :class_name => "bright" }
|
||||
#puts "sources #{self.length}"
|
||||
self.delete_at(0) if( self.length > 5)
|
||||
end
|
||||
|
||||
def source_text source
|
||||
if source.is_a? Virtual::Instruction
|
||||
return source.class.name
|
||||
else
|
||||
return "Method: #{source.name}"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -1,17 +0,0 @@
|
||||
<:Title>
|
||||
blocks index
|
||||
|
||||
<:Body>
|
||||
<div class="block-view">
|
||||
<div>
|
||||
<h4> {{page._method_name}} </h4>
|
||||
<h4> Block: {{page._block_name}} </h4>
|
||||
</div>
|
||||
{{ page._blocks.each do |b| }}
|
||||
<div>
|
||||
<span class="{{b._class_name}}">
|
||||
{{b._name}}
|
||||
</span>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
@ -1,23 +0,0 @@
|
||||
<:Title>
|
||||
classes index
|
||||
|
||||
<:Body>
|
||||
<div class="classes">
|
||||
<h4> Classes </h4>
|
||||
<ul id="nav">
|
||||
{{page._classes.each do |clas| }}
|
||||
<li>
|
||||
<a href="#">{{ clas._name }}</a>
|
||||
{{ unless variables(clas).empty? }}
|
||||
<ul>
|
||||
{{variables(clas).each do |var| }}
|
||||
<li>
|
||||
<a href="#">{{var}}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
</div>
|
@ -1,15 +0,0 @@
|
||||
<:Title>
|
||||
objects index
|
||||
|
||||
<:Body>
|
||||
<ul sid={{attrs.id}}>
|
||||
<li>
|
||||
<span>{{class_header(attrs.id)}}</span>
|
||||
</li>
|
||||
<li> -------------------------</li>
|
||||
{{content(attrs.id).each do |con3| }}
|
||||
<li>
|
||||
<a href="#">{{con3[0]}}</a>
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
@ -1,19 +0,0 @@
|
||||
<:Title>
|
||||
registers index
|
||||
|
||||
<:Body>
|
||||
<div class="registers-view">
|
||||
{{ model.each do |reg| }}
|
||||
<div class="register-view" id="nav">
|
||||
{{ if(is_object?(reg.value) ) }}
|
||||
<:objects id={{reg.value}} />
|
||||
{{else}}
|
||||
<ul>
|
||||
<li>
|
||||
<a href="#">{{reg.value}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
@ -1,14 +0,0 @@
|
||||
<:Title>
|
||||
sources index
|
||||
|
||||
<:Body>
|
||||
<div class="source-view">
|
||||
<h4> Virtual Machine Instruction </h4>
|
||||
{{page._sources.each do |source| }}
|
||||
<div>
|
||||
<span class="{{source._class_name}}">
|
||||
{{source._name}}
|
||||
</span>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
@ -1,17 +0,0 @@
|
||||
<:Title>
|
||||
status index
|
||||
|
||||
<:Body>
|
||||
<div class="status-view">
|
||||
<h4> Interpreter </h4>
|
||||
Instruction {{ _clock}}
|
||||
<button e-click="tick"> Next </button>
|
||||
<br/>
|
||||
<span> State </span>
|
||||
<span> {{_state}} </span>
|
||||
<br/>
|
||||
<span> Link: {{_link}} </span>
|
||||
<br/>
|
||||
Stdout <br/>
|
||||
<span> {{_stdout}} </span>
|
||||
</div>
|
13
lib/code.rb
13
lib/code.rb
@ -1,13 +0,0 @@
|
||||
include AST::Sexp
|
||||
CODE = s(:class, :Object,
|
||||
s(:derives, nil),
|
||||
s(:statements,
|
||||
s(:function, :int,
|
||||
s(:name, :main),
|
||||
s(:parameters),
|
||||
s(:statements,
|
||||
s(:call,
|
||||
s(:name, :putstring),
|
||||
s(:arguments),
|
||||
s(:receiver,
|
||||
s(:string, "Hello again")))))))
|
@ -1,11 +0,0 @@
|
||||
require "salama-reader"
|
||||
|
||||
class ParseTask
|
||||
def parse(num)
|
||||
string_input = '"Hello again".putstring()'
|
||||
parser = Parser::Salama.new
|
||||
out = parser.parse(string_input)
|
||||
parts = Parser::Transform.new.apply(out)
|
||||
parts.to_basic
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user