Show equivalence classes in html output
This commit is contained in:
parent
2a6936a5da
commit
24a68dbba2
2 changed files with 45 additions and 3 deletions
|
@ -28,6 +28,7 @@ let render_prog_box annotated_prog = Jingoo.Jg_types.(Renderer.AnnotAsm.(
|
||||||
("bound", box_string @@ render_addr bound);
|
("bound", box_string @@ render_addr bound);
|
||||||
("data", box_string @@ Format.sprintf "[%d] File %d, %d:%d"
|
("data", box_string @@ Format.sprintf "[%d] File %d, %d:%d"
|
||||||
data.box_class_id data.box_file data.box_line data.box_col);
|
data.box_class_id data.box_file data.box_line data.box_col);
|
||||||
|
("box_eq", box_int data.box_class_id);
|
||||||
|
|
||||||
] |> box_obj)
|
] |> box_obj)
|
||||||
row.instr_annot.Renderer.events)
|
row.instr_annot.Renderer.events)
|
||||||
|
@ -49,6 +50,19 @@ let render_progs_box annotated_progs = Jingoo.Jg_types.(
|
||||||
|> box_list
|
|> box_list
|
||||||
)
|
)
|
||||||
|
|
||||||
|
module IntSet = Set.Make(struct type t = int let compare = compare end)
|
||||||
|
|
||||||
|
let prog_box_classes render_data = Jingoo.Jg_types.(
|
||||||
|
List.fold_left (fun accu prog ->
|
||||||
|
List.fold_left (fun accu (Renderer.TaggedRange(_, _, box)) ->
|
||||||
|
IntSet.add box.box_class_id accu)
|
||||||
|
accu prog.Renderer.render_boxes)
|
||||||
|
IntSet.empty render_data
|
||||||
|
|> IntSet.elements
|
||||||
|
|> List.map box_int
|
||||||
|
|> box_list
|
||||||
|
)
|
||||||
|
|
||||||
(** [render multi_render_data] renders the given [render_data] to a string. *)
|
(** [render multi_render_data] renders the given [render_data] to a string. *)
|
||||||
let render multi_render_data = Jingoo.(
|
let render multi_render_data = Jingoo.(
|
||||||
let annotated_progs = List.map (fun render_data ->
|
let annotated_progs = List.map (fun render_data ->
|
||||||
|
@ -56,6 +70,7 @@ let render multi_render_data = Jingoo.(
|
||||||
Renderer.render_data_to_annotated_asm render_data) multi_render_data in
|
Renderer.render_data_to_annotated_asm render_data) multi_render_data in
|
||||||
let models = [
|
let models = [
|
||||||
("progs", render_progs_box annotated_progs);
|
("progs", render_progs_box annotated_progs);
|
||||||
|
("box_classes", prog_box_classes multi_render_data);
|
||||||
] in
|
] in
|
||||||
Jg_template.from_file "src/render_html.jingoo" ~models:models
|
Jg_template.from_file "src/render_html.jingoo" ~models:models
|
||||||
)
|
)
|
||||||
|
|
|
@ -50,6 +50,26 @@
|
||||||
background-color: #ffffb4;
|
background-color: #ffffb4;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function hoverByClass(classname){
|
||||||
|
var colorover = "orange";
|
||||||
|
var colorout = "#ffffb4";
|
||||||
|
var elms=document.getElementsByClassName(classname);
|
||||||
|
for(var i=0;i<elms.length;i++){
|
||||||
|
elms[i].onmouseover = function(){
|
||||||
|
for(var k=0;k<elms.length;k++){
|
||||||
|
elms[k].style.backgroundColor=colorover;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
elms[i].onmouseout = function(){
|
||||||
|
for(var k=0;k<elms.length;k++){
|
||||||
|
elms[k].style.backgroundColor=colorout;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="prog_container">
|
<div class="prog_container">
|
||||||
|
@ -67,9 +87,10 @@
|
||||||
{% for row in subroutine.sub_asm %}
|
{% for row in subroutine.sub_asm %}
|
||||||
{% for event in row.instr_events %}
|
{% for event in row.instr_events %}
|
||||||
{% if event.typ == "start" %}
|
{% if event.typ == "start" %}
|
||||||
<div class="instr_box" id="instr_box_{{ event.id }}"
|
<div class="instr_box box_eq_{{ event.box_eq }}"
|
||||||
title="{{ event.data }}"
|
id="instr_box_{{ event.id }}"
|
||||||
>
|
title="{{ event.data }}"
|
||||||
|
>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<div class="sub_instr">
|
<div class="sub_instr">
|
||||||
|
@ -89,5 +110,11 @@
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
{% for class in box_classes %}
|
||||||
|
hoverByClass("box_eq_{{ class }}");
|
||||||
|
{% endfor %}
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue