salaam boots and classes are shown
This commit is contained in:
parent
264a52c184
commit
9383f0d75e
@ -1,5 +1,5 @@
|
||||
|
||||
require "eventable"
|
||||
require_relative "eventable"
|
||||
|
||||
class Interpreter
|
||||
# fire events for changed pc and register contents
|
@ -1,11 +1,12 @@
|
||||
# By default Volt generates this controller for your Main component
|
||||
require "salama"
|
||||
require_relative "interpreter"
|
||||
|
||||
module Main
|
||||
class MainController < Volt::ModelController
|
||||
def index
|
||||
# code = Ast::ExpressionList.new( [Ast::CallSiteExpression.new(:putstring, [] ,Ast::StringExpression.new("Hello again"))])
|
||||
# Virtual::Compiler.compile( code , machine.space.get_main )
|
||||
# machine.run_before "Register::CallImplementation"
|
||||
# interpreter.start machine.init
|
||||
init_machine
|
||||
init_classes
|
||||
end
|
||||
|
||||
def about
|
||||
@ -13,7 +14,22 @@ module Main
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def init_machine
|
||||
machine = Virtual.machine.boot
|
||||
machine.run_before "Register::CallImplementation"
|
||||
code = Ast::ExpressionList.new( [Ast::CallSiteExpression.new(:putstring, [] ,Ast::StringExpression.new("Hello again"))])
|
||||
Virtual::Compiler.compile( code , machine.space.get_main )
|
||||
@interpreter = Interpreter.new
|
||||
@interpreter.start machine.init
|
||||
end
|
||||
def init_classes
|
||||
page._classes!.clear
|
||||
Virtual.machine.space.classes.each do |name , claz|
|
||||
next if [:Kernel,:Module,:MetaClass,:BinaryCode].index name
|
||||
c = Volt::Model.new :name => name
|
||||
page._classes << c
|
||||
end
|
||||
end
|
||||
# The main template contains a #template binding that shows another
|
||||
# template. This is the path to that template. It may change based
|
||||
# on the params._component, params._controller, and params._action values.
|
||||
|
@ -2,8 +2,15 @@
|
||||
Home
|
||||
|
||||
<:Body>
|
||||
<div class="classes">
|
||||
<h4> Classes </h4>
|
||||
{{page._classes!.each do |clas| }}
|
||||
<div class="one-class">
|
||||
{{ clas._name }}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
ClassView classes: machine.space.classes
|
||||
<div class="file-view">
|
||||
"Future Source code view"
|
||||
</div>
|
||||
|
2
config/initializers/server/salama.rb
Normal file
2
config/initializers/server/salama.rb
Normal file
@ -0,0 +1,2 @@
|
||||
Opal.use_gem "salama"
|
||||
Opal.use_gem "salama-arm"
|
Loading…
Reference in New Issue
Block a user