getting the levels right in registers

This commit is contained in:
Torsten Ruger 2015-08-14 20:14:00 +03:00
parent 3d2dadbd62
commit 5583a7a56c
2 changed files with 33 additions and 29 deletions

View File

@ -33,15 +33,27 @@ module Main
fields = []
if object and ! object.is_a?(String)
clazz = object.class.name.split("::").last
fields << "#{clazz}:#{object.internal_object_length}"
fields << "--------------------"
fields << ["#{clazz}:#{object.internal_object_length}" , 0]
fields << ["--------------------" , 0 ]
object.get_instance_variables.each do |variable|
f = object.get_instance_variable(variable)
fields << "#{f.class.name.split('::').last} : #{f.object_id}"
fields << ["#{variable} : #{marker(f)} : #{f.object_id}" , f.object_id]
end
end
fields
end
def variables(attribute)
model_name = attribute.class.name.split("::").last
vars = []
cl = Virtual.machine.space.get_class_by_name(model_name)
return vars unless cl
layout = cl.object_layout
layout.object_instance_names.each do |name|
vars.push name
end
vars
end
end
end

View File

@ -5,32 +5,24 @@
<div class="registers-view">
{{ model.each do |reg| }}
<div class="register-view">
<div>
<div class="field">
{{ reg.name }}
</div>
<div class="value">
<span class="value-head">
{{ reg.value }}
</span>
</div>
</div>
{{ reg.fields.each_with_index do |attribute, index| }}
<div>
<div class="field tooltip">
{{index}}{{marker(attribute)}}
<span>
{{variables(attribute).join("\n")}}
</span>
</div>
<div class="value tooltip">
{{attribute.object_id}}
<span>
{{content(attribute.object_id).join("\n")}}
</span>
</div>
</div>
{{end}}
<ul id="nav">
<a href="#">{{reg.name}} : {{reg.value}}</a>
{{ reg.fields.each_with_index do |attribute, index| }}
<li class="field">
<a href="#">
{{index}}{{marker(attribute)}}
{{attribute.object_id}}
</a>
<ul>
{{content(attribute.object_id).each do |con| }}
<li>
<a href="#">{{con[0]}}</a>
</li>
{{end}}
</ul>
</li>
{{end}}
</ul>
</div>
{{end}}
</div>