Skip to content

Commit 11ddd4f

Browse files
author
Philip Guo
committed
something simple that sorta works, maybe patch up lata?
1 parent 3352907 commit 11ddd4f

File tree

1 file changed

+19
-105
lines changed

1 file changed

+19
-105
lines changed

PyTutorGAE/js/pytutor.js

Lines changed: 19 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,50 +1585,9 @@ ExecutionVisualizer.prototype.renderDataStructures = function() {
15851585
//})
15861586
.attr('id', function(d, i) {return d.is_zombie ? myViz.generateID("zombie_stack" + i)
15871587
: myViz.generateID("stack" + i);
1588-
})
1589-
1590-
1591-
1592-
/*
1593-
// I suspect I need to use .order() somewhere, but I can't seem to get it in the right place :(
1594-
stackFrameDiv
1595-
.each(function(frame, i) {
1596-
console.log('UPDATE stackFrameDiv', frame.unique_hash);
1597-
})
1598-
.append('div')
1599-
.attr('class', 'stackFrameHeader')
1600-
.html(function(frame, i) {
1601-
var funcName = htmlspecialchars(frame.func_name); // might contain '<' or '>' for weird names like <genexpr>
1602-
var headerLabel = funcName + '()';
1603-
1604-
var frameID = frame.frame_id; // optional (btw, this isn't a CSS id)
1605-
if (frameID) {
1606-
headerLabel = 'f' + frameID + ': ' + headerLabel;
1607-
}
1608-
1609-
// optional (btw, this isn't a CSS id)
1610-
if (frame.parent_frame_id_list.length > 0) {
1611-
var parentFrameID = frame.parent_frame_id_list[0];
1612-
headerLabel = headerLabel + ' [parent=f' + parentFrameID + ']';
1613-
}
1614-
1615-
return headerLabel;
1616-
})
1617-
*/
1618-
1619-
stackFrameDiv.exit().remove();
1620-
1621-
1622-
/*
1623-
stackFrameDiv
1624-
.append('div')
1625-
.attr('class', 'derrrr')
1626-
1627-
var stackVarTable = stackFrameDiv.select('div.derrrr')
1628-
.each(function(frame, i) {
1629-
console.log('ENTER/UPDATE DIV', (frame.func_name + '_' + String(frame.frame_id) + '_' + String(frame.parent_frame_id_list) + '_' + i));
1630-
})
1631-
.selectAll('li')
1588+
});
1589+
1590+
var stackVarTable = stackFrameDiv.selectAll('li')
16321591
.data(function(frame) {
16331592
// each list element contains a reference to the entire frame object as well as the variable name
16341593
// TODO: look into whether we can use d3 parent nodes to avoid this hack ... http://bost.ocks.org/mike/nest/
@@ -1645,20 +1604,18 @@ ExecutionVisualizer.prototype.renderDataStructures = function() {
16451604
.html(function(d, i) {
16461605
var varname = d[0];
16471606
var frame = d[1];
1648-
return varname + '_' + frame.func_name;
1607+
return varname;
16491608
});
16501609

16511610
stackVarTable.exit().remove();
1652-
*/
1653-
16541611

16551612

16561613
/*
1657-
stackFrame.enter()
1614+
stackFrameDiv.select('div')
1615+
.data(function
16581616
.append('div')
16591617
.attr('class', 'stackFrameHeader')
1660-
.attr('id', function(frame, i) {return frame.is_zombie ? myViz.generateID("zombie_stack_header" + i) : myViz.generateID("stack_header" + i);})
1661-
.html(function(frame, i) {
1618+
.text(function(frame, i) {
16621619
var funcName = htmlspecialchars(frame.func_name); // might contain '<' or '>' for weird names like <genexpr>
16631620
var headerLabel = funcName + '()';
16641621
@@ -1674,66 +1631,21 @@ ExecutionVisualizer.prototype.renderDataStructures = function() {
16741631
}
16751632
16761633
return headerLabel;
1677-
});
1678-
*/
1679-
1680-
1681-
1682-
/*
1683-
// UPDATE:
1684-
var stackFrameTable = stackD3
1685-
.order() // VERY IMPORTANT to put in the order corresponding to data elements
1686-
.append('div')
1687-
.attr('class', 'stackFrameHeader')
1688-
.attr('id', function(frame, i) {return frame.is_zombie ? myViz.generateID("zombie_stack_header" + i) : myViz.generateID("stack_header" + i);})
1689-
.html(function(frame, i) {
1690-
var funcName = htmlspecialchars(frame.func_name); // might contain '<' or '>' for weird names like <genexpr>
1691-
var headerLabel = funcName + '()';
1692-
1693-
var frameID = frame.frame_id; // optional (btw, this isn't a CSS id)
1694-
if (frameID) {
1695-
headerLabel = 'f' + frameID + ': ' + headerLabel;
1696-
}
1697-
1698-
// optional (btw, this isn't a CSS id)
1699-
if (frame.parent_frame_id_list.length > 0) {
1700-
var parentFrameID = frame.parent_frame_id_list[0];
1701-
headerLabel = headerLabel + ' [parent=f' + parentFrameID + ']';
1702-
}
1703-
1704-
return headerLabel;
1705-
});
1634+
})
1635+
.each(function(frame, i) {
1636+
console.log('ENTER stackFrameDiv', frame.unique_hash, i);
1637+
})
17061638
*/
17071639

1708-
/*
1709-
var stackFrameTable = stackD3.order()
1710-
.select('.stackFrameVarTable')
1711-
.selectAll('tr')
1712-
.data(function(frame, i) {
1713-
// each list element contains a reference to the entire frame object as well as the variable name
1714-
// TODO: look into whether we can use d3 parent nodes to avoid this hack ... http://bost.ocks.org/mike/nest/
1715-
return frame.ordered_varnames.map(function(e) {return [e, frame];});
1716-
},
1717-
function(d) {return d[0];} // use variable name as key
1718-
);
1719-
1720-
// ENTER - stack frame variables table
1721-
stackFrameTable.enter()
1722-
.append('tr')
1723-
.append('td')
17241640

1725-
// UPDATE - stack frame variables table
1726-
stackFrameTable
1727-
.html(function(d, i) {
1728-
var varname = d[0];
1729-
var frame = d[1];
1730-
return varname + '_' + frame.func_name;
1641+
// I suspect I need to use .order() somewhere, but I can't seem to get it in the right place :(
1642+
stackFrameDiv
1643+
.each(function(frame, i) {
1644+
console.log('UPDATE stackFrameDiv', frame.unique_hash, i);
17311645
})
17321646

1733-
// EXIT - stack frame variables table
1734-
stackFrameTable.exit()
1735-
.remove
1736-
*/
1647+
stackFrameDiv.exit().remove();
1648+
17371649

17381650

17391651
function renderStackFrame(frame, ind, is_zombie) {
@@ -1872,6 +1784,7 @@ ExecutionVisualizer.prototype.renderDataStructures = function() {
18721784

18731785

18741786
// highlight the top-most non-zombie stack frame or, if not available, globals
1787+
/*
18751788
var frame_already_highlighted = false;
18761789
$.each(curEntry.stack_to_render, function(i, e) {
18771790
if (e.is_highlighted) {
@@ -1883,6 +1796,7 @@ ExecutionVisualizer.prototype.renderDataStructures = function() {
18831796
if (!frame_already_highlighted) {
18841797
highlight_frame(myViz.generateID('globals'));
18851798
}
1799+
*/
18861800

18871801
}
18881802

0 commit comments

Comments
 (0)