rubyx-debugger/lib/debugger.js.rb

56 lines
1.2 KiB
Ruby
Raw Normal View History

2015-07-14 13:08:28 +02:00
require "opal"
2015-07-14 15:03:06 +02:00
require "opal-parser"
require 'opal/compiler'
2015-08-24 01:49:41 +02:00
require "logger"
2015-08-24 01:49:41 +02:00
require 'browser'
require 'browser/http'
2015-08-24 01:49:41 +02:00
require 'native'
require "rubyx"
2015-10-02 19:25:54 +02:00
require "ast"
2018-04-03 17:24:57 +02:00
require "util/eventable"
require "risc/interpreter"
2015-10-07 11:24:02 +02:00
# the base, our own litle framework, allows for child and parent views and handles updates
2015-08-24 01:49:41 +02:00
require "base/list_view"
2015-10-07 11:24:02 +02:00
# each seperate view is in it's own class.
require "views/switch_view"
2015-10-19 18:56:35 +02:00
require "views/status_view"
2015-10-29 15:49:14 +01:00
require "views/source_view"
2015-10-19 18:56:35 +02:00
require "views/instruction_view"
require "views/registers_view"
class Bignum
end
class String
def codepoints
arr = []
one = nil
self.each_byte do |c|
if( one )
arr << (one + c * 256)
one = nil
else
one = c
end
end
arr
end
end
2015-08-24 01:49:41 +02:00
class MainView < ListView
2015-10-27 11:44:02 +01:00
include AST::Sexp
2015-08-24 01:49:41 +02:00
def initialize
Risc.machine.boot
@interpreter = Risc::Interpreter.new
super( [SwitchView.new(@interpreter) ,
2015-10-29 15:49:14 +01:00
SourceView.new(@interpreter) ,
2015-08-24 01:49:41 +02:00
InstructionView.new(@interpreter) ,
StatusView.new(@interpreter) ,
RegistersView.new(@interpreter) ] )
end
end
2015-07-14 13:08:28 +02:00
2015-08-20 19:40:47 +02:00
view = MainView.new()
view.draw.append_to($document.body)