From c22a4a95d3308386699949faf6e17ce625b2d6b0 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Fri, 17 Jul 2015 15:14:41 +0300 Subject: [PATCH] add block inspect, status: up to first jump --- Gemfile | 2 -- app/main/controllers/main_controller.rb | 9 +++------ app/main/models/block_model.rb | 13 +++++++++++++ app/main/views/main/index.html | 19 +++++++++++++++++-- 4 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 app/main/models/block_model.rb diff --git a/Gemfile b/Gemfile index e53a343..e8072c8 100644 --- a/Gemfile +++ b/Gemfile @@ -13,8 +13,6 @@ gem 'volt-bootstrap', '~> 0.0.10' gem 'csso-rails', '~> 0.3.4', require: false gem 'uglifier', '>= 2.4.0', require: false -#gem "salama" , "0.2" , :path => "../salama" - gem "parslet" , path: "../parslet" gem "salama" , path: "../salama" gem "salama-reader" , path: "../salama-reader" diff --git a/app/main/controllers/main_controller.rb b/app/main/controllers/main_controller.rb index 2106b67..605f56e 100644 --- a/app/main/controllers/main_controller.rb +++ b/app/main/controllers/main_controller.rb @@ -11,7 +11,7 @@ module Main page._registers!.clear page._classes!.clear page._objects!.clear - + page._block = BlockModel.new nil fill_regs parse_and_fill end @@ -26,11 +26,7 @@ module Main ParseTask.parse(1).then do |result| is = Ast::Expression.from_basic(result) Virtual::Compiler.compile( is , Virtual.machine.space.get_main ) - begin - Virtual.machine.run_before Virtual::Machine::FIRST_PASS - rescue => e - puts "FILL #{e}" - end + Virtual.machine.run_before "Register::CallImplementation" fill_classes end.fail do |error| raise "Error: #{error}" @@ -42,6 +38,7 @@ module Main c = Volt::Model.new :name => name page._classes << c end + page._block = BlockModel.new Virtual.machine.init end def fill_regs register_names = (0..8).collect {|i| "r#{i}"} diff --git a/app/main/models/block_model.rb b/app/main/models/block_model.rb new file mode 100644 index 0000000..f61e8bc --- /dev/null +++ b/app/main/models/block_model.rb @@ -0,0 +1,13 @@ + +# represent a block and hold the actual instance (as transient) + +class BlockModel < Volt::Model + field :name + attr_accessor :block + + def initialize(b) + super() + @block = b + self.name = b.nil? ? 'undefined' : b.name + end +end diff --git a/app/main/views/main/index.html b/app/main/views/main/index.html index 76aa464..c47139b 100644 --- a/app/main/views/main/index.html +++ b/app/main/views/main/index.html @@ -10,8 +10,23 @@ {{ end }}
-
- +
+ Messages +
+
+ Source Code +
+
+
+ Current block: {{ page._block._name}} +
+
+ {{ if page._block.block }} + {{ page._block.block.codes.each do |c| }} + {{ c.to_s }} + {{ end }} + {{ end }} +