103 Commits

Author SHA1 Message Date
83b9511df3 small ui changes 2015-08-19 22:24:37 +02:00
719f026d0f reduce object to list and register to show that list
also remove duplication in registercontroller
ready for events
2015-08-19 00:22:08 +02:00
d7e0cd665f working more with id only 2015-08-19 00:08:28 +02:00
ef321dab26 start to unify and test listeners 2015-08-18 23:08:12 +02:00
f942ed719a try to get object recursion going 2015-08-16 10:01:12 +03:00
a779daf205 flatten object args and test level 2015-08-15 11:50:44 +03:00
9837461a86 pull out a section for an object 2015-08-14 22:57:37 +03:00
08fba7129b second and third levels for register view 2015-08-14 20:27:06 +03:00
5583a7a56c getting the levels right in registers 2015-08-14 20:14:00 +03:00
3d2dadbd62 show variables for classes, small layout fix 2015-08-13 19:54:45 +03:00
c6d5824dff make suckerfish look nice 2015-08-13 19:32:03 +03:00
a1f1d9d6a4 back to suckerfish 2015-08-13 18:49:22 +03:00
2b9f16dad4 another level for try out 2015-08-13 17:49:12 +03:00
33ee57e605 menumatic instead of tooltips 2015-08-12 21:09:46 +03:00
7b82ff31dd more and meaningful tooltips 2015-08-10 22:29:49 +03:00
8ed2a03ea9 better multiline tooltip code 2015-08-09 12:57:32 +03:00
0926f1f85f more info 2015-08-09 12:15:22 +03:00
72a2d22215 add simtip, remove css hint 2015-08-09 12:15:05 +03:00
abb22f524b better register contents view 2015-08-08 17:52:24 +03:00
b91fabdd90 testing addition 2015-08-04 21:45:49 +03:00
878ec9aecc forgot parslet 2015-07-31 21:41:11 +03:00
50367abcbb try 2015-07-31 20:42:25 +03:00
64078cc331 update to http git 2015-07-31 20:36:35 +03:00
65d95de885 block and source views seperated 2015-07-31 19:42:34 +03:00
bdfafd17c8 classes view separated out 2015-07-31 19:35:06 +03:00
ab08fcc7c1 cleaning, upgrade last pre 2015-07-31 19:31:02 +03:00
cfc6f09ec1 move the interpreter to the app
too ugly to drag it around everywhere
2015-07-31 18:32:36 +03:00
1728cc1b25 made status into own view 2015-07-31 14:10:55 +03:00
5bd6b3517d made view component out of register view 2015-07-31 11:42:26 +03:00
69e51a1037 update gemfile to github versions 2015-07-30 20:07:27 +03:00
ba8768e374 moved interpreter in salama 2015-07-30 19:23:25 +03:00
33b0260bfb move interpretr to salama 2015-07-30 16:03:59 +03:00
b81c8e69b7 cleanup 2015-07-30 15:18:19 +03:00
eba80177ae minor fixes 2015-07-30 15:05:57 +03:00
9afaeba302 add sources 2015-07-30 15:05:44 +03:00
4c4d90385f add clock and method name 2015-07-30 15:05:22 +03:00
e8a5a20db1 fix register update 2015-07-30 14:00:49 +03:00
08beaa2d93 formatting 2015-07-30 11:26:48 +03:00
bb24a6cae5 adds button and blocks tick over 2015-07-30 10:27:27 +03:00
d8a3657365 some real models 2015-07-30 10:09:04 +03:00
a2f3daa828 registers back (non updating) 2015-07-29 21:05:02 +03:00
9383f0d75e salaam boots and classes are shown 2015-07-29 20:50:39 +03:00
264a52c184 basic view up with styles 2015-07-29 18:50:03 +03:00
3bad4cc570 first steps (nothing works) 2015-07-29 18:19:26 +03:00
56521fd5ed new versions 2015-07-29 17:34:15 +03:00
a0b37977a9 volt new overlay 2015-07-29 17:26:04 +03:00
9c7a333127 move code here 2015-07-29 17:17:37 +03:00
485f3134dd revieve volt scaffold 2015-07-29 17:13:04 +03:00
79383d89b1 trying to get register view to update 2015-07-29 16:39:15 +03:00
933b64c499 better docs, new pic 2015-07-28 16:36:29 +03:00
62e5761a40 using github gems 2015-07-28 16:35:45 +03:00
07f7945917 move to suzy is done 2015-07-28 16:16:33 +03:00
756ab31a61 add status view and fixes 2015-07-28 16:16:09 +03:00
557c455167 switch to susy
a rewire basically, but much clearer
2015-07-27 21:29:41 +03:00
7e34ae003e integrating the sources to views 2015-07-27 12:09:35 +03:00
e460e0041b finishes the yellow world instructions 2015-07-26 18:27:12 +03:00
87cec0f4bc some read me info 2015-07-26 14:38:07 +03:00
1ae4baf3f7 implement put string and fix set 2015-07-26 13:59:58 +03:00
228b1b5832 slight improvement on the register view
still lagging, but …
2015-07-26 13:24:00 +03:00
add84432b4 removed unused 2015-07-26 12:52:29 +03:00
6ce51c38db better view for registers 2015-07-26 12:51:57 +03:00
6ba3c54690 three more instruction for interpreter 2015-07-26 09:04:57 +03:00
3464e50b2f better block view 2015-07-26 09:04:34 +03:00
515e1b106b better register an instruction view 2015-07-25 21:04:20 +03:00
b693f55a29 showing active instruction with bg 2015-07-25 15:28:59 +03:00
2f66bd9f08 Slot instructions and tests 2015-07-24 21:15:47 +03:00
93ac945dd2 first mini test, remove spec 2015-07-24 18:38:37 +03:00
1526656dfe fix register (sym/ref) 2015-07-24 17:21:13 +03:00
959cb628fa implements fetching of next instruction 2015-07-24 15:48:12 +03:00
5d42da9d03 next instruction working
but no clock yet
2015-07-24 13:56:31 +03:00
f5ece67233 first interpreted instruction, with gui change 2015-07-24 10:15:58 +03:00
246bb5ee4f debug off is faster 2015-07-24 10:15:27 +03:00
0cdd5fdf13 registering events with objects not procs
to make unregistering easier
2015-07-24 10:01:01 +03:00
8183dfd6b1 simple events and triggers in interpreter 2015-07-23 20:09:19 +03:00
950c77b127 react update 2015-07-23 20:08:50 +03:00
a896702880 passing the interpreter around 2015-07-23 20:08:40 +03:00
53d576ef90 showing actual block and actual instruction
time to ponder a little more
2015-07-23 17:26:48 +03:00
1f19a28906 trying to find exception 2015-07-23 16:23:10 +03:00
03c0041255 create separate main
figuring load order
2015-07-23 14:59:29 +03:00
736bff02a5 trying to find .name error 2015-07-23 14:59:15 +03:00
2645f54d5b move registers to hash 2015-07-23 13:20:53 +03:00
aa2303ddaa add lib and interpreter skeleton 2015-07-23 13:15:44 +03:00
f4dfbb5845 move to haml style class names 2015-07-23 13:15:26 +03:00
398d364c02 got vm to boot and classes to show 2015-07-22 23:08:36 +03:00
3d96d59371 sort of noop of version is working 2015-07-22 22:05:31 +03:00
a0721a0cde move to opal from sinatra
also external index
2015-07-22 17:10:50 +03:00
d021816726 move sources to app directory 2015-07-22 16:26:46 +03:00
e8d9000a74 file per class 2015-07-22 16:22:54 +03:00
db7fa423bb a noon start, copied from examples 2015-07-22 16:17:25 +03:00
bd882b7d2e remove volt 2015-07-21 20:25:57 +03:00
5c2f423f58 reinstantiating lib dir 2015-07-18 11:25:11 +03:00
19a0b7f9fe get vm source on screen 2015-07-18 11:22:42 +03:00
4305ddaf1d copied salama in for reload
but have to rethink approach
2015-07-17 22:44:20 +03:00
b5b0630060 rename 2015-07-17 19:27:46 +03:00
c22a4a95d3 add block inspect, status: up to first jump 2015-07-17 15:14:41 +03:00
69414a11f9 fix eval by including parser 2015-07-17 11:42:21 +03:00
40d97dcf87 remove double boot 2015-07-17 11:41:59 +03:00
acd66f66f3 add hint.css for tooltips 2015-07-17 11:37:02 +03:00
f2af076c8e small view change 2015-07-16 17:35:19 +03:00
1efce561d7 basic html skeleton, classes and registers 2015-07-16 10:43:49 +03:00
1d005862ac remove pixi, going back to html 2015-07-15 19:26:11 +03:00
e51d6cb3fa remove hardcoded size and move point code to pixie 2015-07-14 19:59:21 +03:00
d47d8a9e2a still playing luke, has the direction wrong 2015-07-14 16:57:44 +03:00
52 changed files with 631 additions and 27962 deletions

47
.gitignore vendored
View File

@ -1,42 +1,9 @@
# database
db
# rdoc generated
rdoc
# yard generated
doc
.yardoc
# bundler
.bundle
*.gem
# jeweler generated
pkg
#
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
#
# For MacOS:
#
.config
.yardoc
tmp
.idea
.yardoc
.sass-cache
.DS_Store
# For TextMate
#*.tmproj
#tmtags
# For emacs:
#*~
#\#*
#.\#*
# For vim:
#*.swp
# Object files
*.o
log
tmp/
compiled

23
Gemfile
View File

@ -1,30 +1,27 @@
source 'https://rubygems.org'
gem 'volt', :path => "../volt"
gem 'volt', '0.9.5.pre4'
# volt uses mongo as the default data store.
gem 'volt-mongo', '~> 0.1.0'
# The following gem's are optional for themeing
# Twitter bootstrap
gem 'volt-bootstrap', '~> 0.0.10'
gem "parslet" , git: "https://github.com/salama/parslet.git"
#gem "salama" , git: "https://github.com/salama/salama.git"
gem "salama" , path: "../salama"
gem "salama-reader" , git: "https://github.com/salama/salama-reader.git"
gem "salama-arm" , git: "https://github.com/salama/salama-arm.git"
gem "salama-object-file" , git: "https://github.com/salama/salama-object-file.git"
gem "susy" , "2.2.5"
# Asset compilation gems, they will be required when needed.
gem 'csso-rails', '~> 0.3.4', require: false
gem 'uglifier', '>= 2.4.0', require: false
gem 'opal-pixi' , :path => "../opal-pixi"
#gem "salama" , "0.2" , :path => "../salama"
gem "parslet" , path: "../parslet"
gem "salama" , path: "../salama"
gem "salama-reader" , path: "../salama-reader"
gem "salama-object-file" , path: "../salama-object-file"
#gem "foundation" , :github => "zurb/foundation"
group :test do
# Testing dependencies
gem "minitest"
gem 'rspec', '~> 3.2.0'
gem 'opal-rspec', '~> 0.4.2'
gem 'capybara', '~> 2.4.2'

View File

@ -1,14 +1,28 @@
PATH
remote: ../opal-pixi
specs:
opal-pixi (0.1.0)
opal (~> 0.7.0)
PATH
remote: ../parslet
GIT
remote: https://github.com/salama/parslet.git
revision: beeb9b441a9ade1504f7f0e848d805e36a02c544
specs:
parslet (1.7.0)
GIT
remote: https://github.com/salama/salama-arm.git
revision: 0bd5091e3f284ecf040e0086a41d2449cd5afb7a
specs:
salama-arm (0.0.1)
GIT
remote: https://github.com/salama/salama-object-file.git
revision: fbae6a02764dbe97e01e4833f9ffffe09879b100
specs:
salama-object-file (0.2.0)
GIT
remote: https://github.com/salama/salama-reader.git
revision: 841592c667acea1e796f950851262e6938b231bc
specs:
salama-reader (0.2.0)
parslet (~> 1.7.0)
PATH
remote: ../salama
specs:
@ -16,34 +30,6 @@ PATH
salama-object-file (~> 0.2)
salama-reader (~> 0.2)
PATH
remote: ../salama-object-file
specs:
salama-object-file (0.2.0)
PATH
remote: ../salama-reader
specs:
salama-reader (0.2.0)
parslet (~> 1.7.0)
PATH
remote: ../volt
specs:
volt (0.9.4)
bcrypt (~> 3.1.9)
bundler (>= 1.5)
concurrent-ruby (= 0.8.0)
configurations (~> 2.0.0.pre)
faye-websocket (~> 0.9.2)
listen (~> 3.0.1)
opal (~> 0.7.2)
pry (~> 0.10.1)
rack (~> 1.5.0)
sass (~> 3.2.5)
sprockets-sass (~> 1.0.0)
thor (~> 0.19.0)
GEM
remote: https://rubygems.org/
specs:
@ -72,30 +58,31 @@ GEM
execjs (>= 1)
daemons (1.2.3)
diff-lcs (1.2.5)
eventmachine (1.0.7)
eventmachine (1.0.8)
execjs (2.5.2)
faye-websocket (0.9.2)
faye-websocket (0.10.0)
eventmachine (>= 0.12.0)
websocket-driver (>= 0.5.1)
ffi (1.9.10)
hike (1.2.3)
json (1.8.3)
listen (3.0.2)
listen (3.0.3)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
method_source (0.8.2)
mime-types (2.6.1)
mini_portile (0.6.2)
minitest (5.8.0)
mongo (1.9.2)
bson (~> 1.9.2)
multi_json (1.11.2)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
opal (0.7.2)
opal (0.8.0)
hike (~> 1.2)
sourcemap (~> 0.1.0)
sprockets (>= 2.2.3, < 3.0.0)
tilt (~> 1.4)
sprockets (~> 3.1)
tilt (>= 1.4)
opal-rspec (0.4.3)
opal (>= 0.7.0, < 0.9)
poltergeist (1.5.1)
@ -128,7 +115,7 @@ GEM
rspec-support (~> 3.2.0)
rspec-support (3.2.2)
rubyzip (1.1.7)
sass (3.2.19)
sass (3.4.16)
selenium-webdriver (2.43.0)
childprocess (~> 0.5)
multi_json (~> 1.0)
@ -136,28 +123,35 @@ GEM
websocket (~> 1.0)
slop (3.6.0)
sourcemap (0.1.1)
sprockets (2.12.4)
hike (~> 1.2)
multi_json (~> 1.0)
sprockets (3.2.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-sass (1.0.3)
sprockets (~> 2.0)
tilt (~> 1.1)
susy (2.2.5)
sass (>= 3.3.0, < 3.5)
thin (1.6.3)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0)
rack (~> 1.0)
thor (0.19.1)
tilt (1.4.1)
tilt (2.0.1)
uglifier (2.7.1)
execjs (>= 0.3.0)
json (>= 1.8.0)
volt-bootstrap (0.0.10)
volt (0.9.5.pre4)
bcrypt (~> 3.1.9)
bundler (>= 1.5)
concurrent-ruby (= 0.8.0)
configurations (~> 2.0.0.pre)
faye-websocket (~> 0.10.0)
listen (~> 3.0.1)
opal (~> 0.8.0)
pry (~> 0.10.1)
rack (~> 1.5.0)
sass (~> 3.4.15)
thor (~> 0.19.0)
volt-mongo (0.1.1)
mongo (~> 1.9.0)
websocket (1.2.2)
websocket-driver (0.5.4)
websocket-driver (0.6.2)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
xpath (2.0.0)
@ -172,17 +166,21 @@ DEPENDENCIES
chromedriver2-helper (~> 0.0.8)
concurrent-ruby-ext (~> 0.8.0)
csso-rails (~> 0.3.4)
opal-pixi!
minitest
opal-rspec (~> 0.4.2)
parslet!
poltergeist (~> 1.5.0)
rspec (~> 3.2.0)
salama!
salama-arm!
salama-object-file!
salama-reader!
selenium-webdriver (~> 2.43.0)
susy (= 2.2.5)
thin (~> 1.6.0)
uglifier (>= 2.4.0)
volt!
volt-bootstrap (~> 0.0.10)
volt (= 0.9.5.pre4)
volt-mongo (~> 0.1.0)
BUNDLED WITH
1.10.5

View File

@ -1,9 +1,22 @@
### statement of intent
just starting and not quite sure, but here is the direction
# Debugger
After some tryouts it ended up being an Opal application. That is ruby as javascript in the browser.
![Debugger](https://raw.githubusercontent.com/salama/salama-debugger/master/static/debugger.png)
- On the left are the classes of the system. Next idea is to have hover info about them.
- Next a source code view (not implemented)
- next a view of the Virtual Instructions
- last section, current block with current Register Instruction highlighted
- step (next) button for single stepping
- status: starting , running , exited
- bottom row are the registers. If the register hold an object the variables are shown.
(also should have hover info) , the first letter indicates the class, the number is the address
So lots to do, but a good start.
I don't want to use gdb anymore, and it would be easier without using the qemu setup, so:
- single step debugging of the register machine level (as close to arm as need be)

View File

@ -1 +1,59 @@
// Place your apps css here
// Place your apps css here
@import "susy";
$susy: (
columns: 24 ,
gutter-position: split ,
);
.debugger-view { @include container(90%); }
.classes {
@include span(3);
}
.one-class {
margin: 10px;
}
.file-view {
@include span(4);
margin: span(1);
}
.source-view { @include span(6); }
.block-view {
@include span(4);
margin-right: span(2);
height: 200px;
}
.status-view {
@include span(2 at 22);
}
.registers-view {
@include span(20 at 3);
}
.register-view {
@include gallery(4);
margin-top: 10px;
}
.field {
@include span(5)
}
.value {
@include span(18)
}
.value-head {
background-color: #C5FFD9;
}
.bright {
background-color: orange ;
}

View File

@ -0,0 +1,59 @@
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;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 B

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,2 @@
# Specify which components you wish to include when
# the "home" component loads.
# bootstrap css framework
component 'bootstrap'
Opal.use_gem("salama")

View File

@ -2,6 +2,7 @@
client '/about', action: 'about'
# The main route, this should be last. It will match any params not
# previously matched.
client '/', {}

View File

@ -0,0 +1,12 @@
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

View File

@ -0,0 +1,28 @@
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

View File

@ -1,25 +1,32 @@
# By default Volt generates this controller for your Main component
require "salama"
require "interpreter/interpreter"
if RUBY_PLATFORM == 'opal'
require "main/lib/main_view"
end
Virtual::Machine.boot
module Main
class MainController < Volt::ModelController
def index
MainView.new()
def initialize *args
super(*args)
@volt_app.class.attr_accessor :interpreter
@volt_app.interpreter = Interpreter::Interpreter.new
end
def about
def index
init_machine
end
private
def init_machine
machine = Virtual.machine.boot
code = Ast::OperatorExpression.new("+", Ast::IntegerExpression.new(2),Ast::IntegerExpression.new(5))
Virtual::Compiler.compile( code , machine.space.get_main )
machine.run_before "Register::CallImplementation"
page._interpreter = { }
@volt_app.interpreter.start machine.init
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.

View File

@ -0,0 +1,55 @@
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

View File

@ -0,0 +1,26 @@
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

View File

@ -0,0 +1,12 @@
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

View File

@ -0,0 +1,31 @@
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

View File

@ -1,46 +0,0 @@
require 'opal/pixi'
require 'native'
require "salama"
require_relative "registers_view"
require_relative "object_view"
require_relative "space_view"
class MainView
def initialize
@container = PIXI::Container.new
height = `window.innerHeight`
width = `window.innerWidth`
renderer = PIXI::WebGLRenderer.new( width - 100 , height - 100, {"backgroundColor" => 0xFFFFFF})
body = Native(`window.document.body`)
# bit of a hack as it assumes index's structure
html_con = body.firstElementChild
html_con.insertBefore renderer.view , html_con.lastElementChild
registers = RegisterView.new(height - 150)
@container.add_child registers
ParseTask.parse(1).then do |result|
is = Ast::Expression.from_basic(result)
Virtual::Compiler.compile( is , Virtual.machine.space.get_main )
Virtual.machine.run_before Virtual::Machine::FIRST_PASS
end.fail do |error|
raise "Error: #{error}"
end
space = SpaceView.new
@container.add_child space
animate = Proc.new do
`requestAnimationFrame(animate)`
registers.draw_me
space.draw_me
renderer.render @container
end
animate.call
end
attr_reader :container
end

View File

@ -1,38 +0,0 @@
class ObjectView
attr_accessor :text , :object , :attributes
def initialize o
super()
self.text = PIXI::Text.new("no")
self.text.position = PIXI::Point.new( rand(1000) , rand(550))
puts "NO O " unless o
self.object = o
self.text.text = short
@attributes = {}
end
def short
object.class.name.split("::").last[0 .. 3]
end
def is_parfait
object.class.name.split("::").first == "Parfait"
end
def set name , val
@attributes[name] = val
self.text.text = short + @attributes.length.to_s
end
def get(name)
@attributes[name]
end
def position
#raise "NONAME" unless self.text
self.text.position
end
def distance to
self.position - to.position
end
end

View File

@ -1,21 +0,0 @@
class RegisterView < PIXI::Container
@@register_names = (0..8).collect {|i| "r#{i}"}
def initialize at_y
super()
@registers = {}
x = 0
@@register_names.each do |name|
reg = PIXI::Text.new( name )
reg.position = PIXI::Point.new x , at_y
x += reg.width + 20
@registers[name] = reg
self.add_child reg
end
def draw_me
end
end
end

View File

@ -1,159 +0,0 @@
require "math"
PIXI::Point.class_eval do
alias_native :y=
def add point
self.x += point.x
self.x = 0 if self.x < 0
self.x = 1100 if self.x > 1100
self.y += point.y
self.y = 0 if self.y < 0
self.y = 550 if self.y > 550
end
def scale_by num
min = 0.001
num = min if num <= min
self.x = self.x / num
self.y = self.y / num
end
end
class SpaceView < PIXI::Graphics
include Sof::Util
def initialize
super()
space = Virtual.machine.space
# just a way to get the space into a list. objects is an id => occurence mapping.
# occurence.object is the object
objects = Sof::Members.new(space).objects
@objects = objects
puts "Objects #{objects.length}"
# create a mapping from id to volt models
@view_objects = {}
@objects.each do |i , o|
next unless o.object
view = ObjectView.new o.object
@view_objects[i] = view
add_child view.text
end
fill_attributes
end
# should almost be called draw by now
def draw_me
update_positions
self.clear
@view_objects.each do |i , view|
self.lineStyle(4, 0xffd900, 2)
puts "v" if view.nil?
view.attributes.each do |n , v |
next if n == :id
next unless v.is_a? ObjectView
next unless v.is_parfait
puts "v2" if view.nil?
puts "0" if v.nil?
self.moveTo( view.position.x , view.position.y )
self.lineTo( v.position.x , v.position.y )
end
end
end
def force from , to
dir_x = from.x - to.x - 100
dir_x2 = dir_x * dir_x
dir_y = from.y - to.y - 100
dir_y2 = dir_y * dir_y
if( dir_x2 < 0.1 and dir_y2 < 0.1 )
puts "Were close"
dir_x = rand(10) - 5
dir_y = rand(10) - 5
end
f = dir_x * dir_x + dir_y * dir_y
f = 0.01 if f < 0.01
f = f / 100
#puts "force #{f}"
PIXI::Point.new( dir_x / f , dir_y / f)
end
def update_positions
@view_objects.each do |i , view|
view.attributes.each do |n , v |
next if n == :id
next unless v.is_a? ObjectView
next unless v.is_parfait
puts "v2" if view.nil?
puts "0" if v.nil?
view.position.add force( view.position , v.position )
end
offset = 0.0
view.position.add force( view.position , PIXI::Point.new(view.position.x , -offset) )
view.position.add force( view.position , PIXI::Point.new(-offset , view.position.y) )
view.position.add force( view.position , PIXI::Point.new(view.position.x , 550 + offset) )
view.position.add force( view.position , PIXI::Point.new(1000 + offset , view.position.y) )
end
end
def fill_attributes
@view_objects.each do |i , view|
ob = view.object
next if is_value?(ob)
case ob.class.name
when "Array" , "Parfait::List"
fill_array view
when "Hash" , "Parfait::Dictionary"
fill_hash view
else
next if ob.class.name.include?("::") and !ob.class.name.include?("Parfait")
next if ob.class.name == "Proc"
next if ob.class.name == "String"
next if ob.class.name == "Numeric"
next if ob.class.name == "Class"
#puts "object #{ob.class.name}"
attributes = attributes_for(ob)
attributes.each do |a|
next if a == "html_safe"
next if a == "constructor"
next if a == "toString"
next if a == "position"
val = get_value( ob , a)
if( @view_objects[val.object_id])
val = @view_objects[val.object_id]
end
#puts "set #{a}"
view.set(a , val )
end
superclasses = [ob.class.superclass.name]
if superclasses.include?( "Array") or superclasses.include?( "Parfait::List")
fill_array view
end
if superclasses.include?( "Hash") or superclasses.include?( "Parfait::Dictionary")
fill_hash view
end
end
end
end
# and hash keys/values
def fill_hash hash
return
hash.each do |a,b|
next_level << a
next_level << b
end
end
# and array values
def fill_array array
return
array.each do |a|
next_level << a
end
end
end

View File

@ -0,0 +1,10 @@
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

View File

@ -0,0 +1,36 @@
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

View File

@ -0,0 +1,23 @@
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

View File

@ -1,12 +0,0 @@
# By default Volt generates this User model which inherits from Volt::User,
# you can rename this if you want.
class User < Volt::User
# login_field is set to :email by default and can be changed to :username
# in config/app.rb
field login_field
field :name
validate login_field, unique: true, length: 8
validate :email, email: true
end

View File

@ -0,0 +1,17 @@
<: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>

View File

@ -0,0 +1,23 @@
<: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>

View File

@ -1,7 +0,0 @@
<:Title>
About
<:Body>
<h1>About</h1>
<p>About page...</p>

View File

@ -2,3 +2,15 @@
Home
<:Body>
<:classes />
<div class="file-view">
</div>
<:sources />
<:blocks />
<:status/>
<:registers/>

View File

@ -2,26 +2,11 @@
{{ view main_path, "title", {controller_group: 'main'} }}
<:Body>
<div class="container">
<div class="header">
<ul class="nav nav-pills pull-right">
<:nav href="/">Home</:nav>
<:nav href="/about">About</:nav>
</ul>
<h3 class="text-muted">Salama Debugger</h3>
</div>
<div class="debugger_view">
<:volt:notices />
{{ view main_path, 'body', {controller_group: 'main'} }}
<div class="footer">
<p> <a href="http://salama-vm.org/" >Salama</a> {{ Time.now.year }}</p>
</div>
</div>
<:Nav>
<li class="{{ if active_tab? }}active{{ end }}">
<a href="{{ attrs.href }}">{{ yield }}</a>
</li>

View File

@ -0,0 +1,15 @@
<:Title>
objects index
<:Body>
<ul sid={{attrs.id}}>
<li>
<span>{{class_header(attrs.id)}}</span>
</li>
<li>&nbsp;&nbsp;-------------------------</li>
{{content(attrs.id).each do |con3| }}
<li>
<a href="#">{{con3[0]}}</a>
</li>
{{end}}
</ul>

View File

@ -0,0 +1,19 @@
<: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>

View File

@ -0,0 +1,14 @@
<: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>

View File

@ -0,0 +1,17 @@
<: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>

View File

@ -1,13 +1,17 @@
# app.rb is used to configure your app. This code is only run on the server,
# then any config options in config.public are passed to the client as well.
#hint_path = Bundler.definition.specs["simptip"].first.full_gem_path
#ENV["SASS_PATH"] = ENV["SASS_PATH"] + File::PATH_SEPARATOR + hint_path
Volt.configure do |config|
# Setup your global app config here.
#######################################
# Basic App Info (stuff you should set)
#######################################
config.domain = 'salama-vm.org'
config.domain = 'salama-debugger.com'
config.app_name = 'Salama-debugger'
config.mailer.from = 'Salama-debugger <no-reply@salama-debugger.com>'
@ -23,7 +27,7 @@ Volt.configure do |config|
#
# config.app_secret = ENV['APP_SECRET']
#
config.app_secret = 'pKDKhKInTaI5EVH9WmyN-cJSYnJt8PmDogwW63Zqr_ieUNqYvh1KybeWJoslylzFgsU'
config.app_secret = 'qwSEmWdixdHgwOgXiLdGJt87b9TxMq009gbJWn0fOTygfIk6fAIlgHO9tAPbA4vaKgY'
###############
# Log Filtering
@ -100,8 +104,8 @@ Volt.configure do |config|
# config.message_bus.bus_name = 'peer_to_peer'
#
# Encrypt message bus - messages on the message bus are encrypted by default
# but this is meant to be used locally by a developer
config.message_bus.disable_encryption = true
# using rbnacl.
# config.message_bus.disable_encryption = true
#
# ## MessageBus Server -- the message bus binds to a port and ip which the
# other volt instances need to be able to connect to. You can customize

View File

@ -6,13 +6,8 @@
<%# language difference. This file handles auto-loading all JS/Opal and CSS. %>
<head>
<meta charset="UTF-8" />
<% javascript_files.each do |javascript_file| %>
<script src="<%= javascript_file %>"></script>
<% end %>
<% css_files.each do |css_file| %>
<link href="<%= css_file %>" media="all" rel="stylesheet" type="text/css" />
<% end %>
<%= javascript_tags %>
<%= css_tags %>
</head>
<body>

6
config/dependencies.rb Normal file
View File

@ -0,0 +1,6 @@
# Specify which components you wish to include when
# the "home" component loads.
Opal.use_gem("salama-reader")
Opal.use_gem("salama-object-file")

View File

@ -0,0 +1,10 @@
# Place any code you want to run when the component is included on the client
# or server.
# To include code only on the client use:
# if RUBY_PLATFORM == 'opal'
#
# To include code only on the server, use:
# unless RUBY_PLATFORM == 'opal'
# ^^ this will not send compile in code in the conditional to the client.
# ^^ this include code required in the conditional.

View File

@ -1,3 +0,0 @@
#require "salama"
Virtual::Machine.boot

View File

@ -0,0 +1,2 @@
Opal.use_gem "salama"
Opal.use_gem "salama-arm"

7
config/routes.rb Normal file
View File

@ -0,0 +1,7 @@
# See https://github.com/voltrb/volt#routes for more info on routes
client '/about', action: 'about'
# The main route, this should be last. It will match any params not
# previously matched.
client '/', {}

View File

@ -1,5 +0,0 @@
require 'spec_helper'
describe 'sample http controller test', type: :http_controller do
# Specs here
end

View File

@ -1,5 +1,5 @@
require 'spec_helper'
describe 'sample model' do
describe '', type: :feature do
# Specs here
end

View File

@ -1,5 +1,5 @@
require 'spec_helper'
describe 'sample task', type: :task do
describe '', type: :feature do
# Specs here
end

View File

@ -0,0 +1,5 @@
require 'spec_helper'
describe '', type: :feature do
# Specs here
end

View File

@ -0,0 +1,5 @@
require 'spec_helper'
describe '', type: :feature do
# Specs here
end

View File

@ -1,11 +0,0 @@
require 'spec_helper'
describe 'sample integration test', type: :feature do
# An example integration spec, this will only be run if ENV['BROWSER'] is
# specified. Current values for ENV['BROWSER'] are 'firefox' and 'phantom'
it 'should load the page' do
visit '/'
expect(page).to have_content('Home')
end
end

View File

@ -0,0 +1,5 @@
require 'spec_helper'
describe '', type: :feature do
# Specs here
end

View File

@ -0,0 +1,5 @@
require 'spec_helper'
describe '', type: :feature do
# Specs here
end

View File

@ -1,14 +0,0 @@
# Volt sets up rspec and capybara for testing.
require 'volt/spec/setup'
Volt.spec_setup
RSpec.configure do |config|
config.run_all_when_everything_filtered = true
config.filter_run :focus
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = 'random'
end

BIN
static/debugger.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB