Skip to content
Snippets Groups Projects
Commit f0ab3550 authored by charguer's avatar charguer Committed by Thomas Wood
Browse files

ctx

parent 74590aa5
No related branches found
No related tags found
No related merge requests found
...@@ -482,8 +482,6 @@ function jsvalue_of_value(jsheap, v) { ...@@ -482,8 +482,6 @@ function jsvalue_of_value(jsheap, v) {
return jsheap[v.loc]; return jsheap[v.loc];
case "val_abs": case "val_abs":
return "<closure>"; return "<closure>";
// case "val_constr":
// case "val_record":
default: default:
stuck("unrecognized value"); stuck("unrecognized value");
} }
......
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
border-bottom: 1px solid black; border-bottom: 1px solid black;
} }
.heap_link {
color: black;
}
#file_list { #file_list {
height: 1em; height: 1em;
margin-top: 8px; margin-top: 8px;
...@@ -90,11 +94,17 @@ Reach condition: ...@@ -90,11 +94,17 @@ Reach condition:
<div id='file_list'></div> <div id='file_list'></div>
<div class='source_div'> <div class='source_div'>
<table id='main_table'> <table id='main_table'><tr>
<tr> <td>
<td><textarea id='interpreter_code' class='source' rows='20' cols='60'></textarea></td> <textarea id='interpreter_code' class='source' rows='20' cols='60'></textarea>
<td width='600'><div id='infos'>infos here</div> </td>
<td width='600'>
<div id='disp_infos' style="height:1em">infos here</div>
<div id='disp_context'>ctx here</div>
</td> </td>
</tr></table>
</div> </div>
......
...@@ -3,7 +3,7 @@ tracer_items = datalog; ...@@ -3,7 +3,7 @@ tracer_items = datalog;
var h = null var h = null
var tracer_length = tracer_items.length; var tracer_length = tracer_items.length;
var tracer_pos = 0; var tracer_pos = 29;
$("#navigation_total").html(tracer_length); $("#navigation_total").html(tracer_length);
...@@ -129,6 +129,52 @@ function updateFileList() { ...@@ -129,6 +129,52 @@ function updateFileList() {
$('#file_list').html(s); $('#file_list').html(s);
} }
function text_of_cst(c) {
switch (c.tag) {
case "cst_bool":
return c.bool + "";
case "cst_number":
return c.number + "";
default:
return "unrecognized cst";
}
}
var next_fresh_id = 0;
function fresh_id() {
return "fresh_id_" + (next_fresh_id++);
}
var handlers = [];
function text_of_value(heap, v, target) {
switch (v.tag) {
case "val_cst":
return text_of_cst(v.cst);
case "val_loc":
handlers[target] = function() {
};
return "<span class='heap_link'><a onclick=\"handlers['" + target + "']()\">&lt;Location&gt;(" + v.loc + ")</a></span>";
case "val_abs":
return "&lt;Closure&gt;";
default:
return "<pre style='margin:0; padding: 0; margin-left:1em'>" + JSON.stringify(v, null, 2) + "</pre>";
}
}
function updateContext(heap, env) { // env here is the ctx
$("#disp_context").html("");
// TODO: une fonction de conversion de env vers array
while (env.tag === "env_cons") {
var target = fresh_id();
$("#disp_context").append("<div id='" + target + "'></div>");
$("#" + target).html(env.name + ": " + text_of_value(heap, env.val, target));
env = env.env;
}
}
function updateSelection() { function updateSelection() {
var item = tracer_items[tracer_pos]; var item = tracer_items[tracer_pos];
h = jsheap_of_heap(item.heap); // export for client h = jsheap_of_heap(item.heap); // export for client
...@@ -140,9 +186,10 @@ function updateSelection() { ...@@ -140,9 +186,10 @@ function updateSelection() {
$('.CodeMirror-focused .CodeMirror-selected').css({ background: color }); $('.CodeMirror-focused .CodeMirror-selected').css({ background: color });
if (item.line === undefined) if (item.line === undefined)
alert("missing line in log event"); alert("missing line in log event");
$("#infos").html("type = " + item.type); $("#disp_infos").html("type = " + item.type);
updateContext(item.heap, item.ctx);
$("#navigation_step").val(tracer_pos); $("#navigation_step").val(tracer_pos);
console.log(item); // console.log(item);
var anchor = {line: item.start_line-1 , ch: item.start_col }; var anchor = {line: item.start_line-1 , ch: item.start_col };
var head = {line: item.end_line-1, ch: item.end_col }; var head = {line: item.end_line-1, ch: item.end_col };
editor.setSelection(anchor, head); editor.setSelection(anchor, head);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment