@@ -232,8 +232,27 @@ function updateOutput() {
232232 $ ( "#pyStdout" ) . scrollTop ( $ ( "#pyStdout" ) . attr ( 'scrollHeight' ) ) ;
233233
234234
235+ // finally, render all the data structures!!!
236+ renderDataStructures ( curEntry , "#dataViz" ) ;
237+ }
238+
239+ // Renders the current trace entry (curEntry) into the div named by vizDiv
240+ function renderDataStructures ( curEntry , vizDiv ) {
241+ renderDataStructuresVersion1 ( curEntry , vizDiv ) ;
242+
243+ // Version 2.0 forthcoming!
244+ //renderDataStructuresVersion2(curEntry, vizDiv);
245+ }
246+
247+
248+ // The ORIGINAL "1.0" version of renderDataStructures, which renders
249+ // variables and values INLINE within each stack frame without any
250+ // explicit representation of data structure aliasing.
251+ //
252+ // This version was originally created in January 2010
253+ function renderDataStructuresVersion1 ( curEntry , vizDiv ) {
235254 // render data structures:
236- $ ( "#dataViz" ) . html ( '' ) ; // CLEAR IT!
255+ $ ( vizDiv ) . html ( '' ) ; // CLEAR IT!
237256
238257
239258 // render locals on stack:
@@ -242,7 +261,7 @@ function updateOutput() {
242261 var funcName = htmlspecialchars ( frame [ 0 ] ) ; // might contain '<' or '>' for weird names like <genexpr>
243262 var localVars = frame [ 1 ] ;
244263
245- $ ( "#dataViz" ) . append ( '<div class="vizFrame">Local variables for <span style="font-family: Andale mono, monospace;">' + funcName + '</span>:</div>' ) ;
264+ $ ( vizDiv ) . append ( '<div class="vizFrame">Local variables for <span style="font-family: Andale mono, monospace;">' + funcName + '</span>:</div>' ) ;
246265
247266 // render locals in alphabetical order for tidiness:
248267 var orderedVarnames = [ ] ;
@@ -255,7 +274,7 @@ function updateOutput() {
255274 orderedVarnames . sort ( ) ;
256275
257276 if ( orderedVarnames . length > 0 ) {
258- $ ( "#dataViz .vizFrame:last") . append ( '<br/><table class="frameDataViz"></table>' ) ;
277+ $ ( vizDiv + " .vizFrame:last") . append ( '<br/><table class="frameDataViz"></table>' ) ;
259278 var tbl = $ ( "#pyOutputPane table:last" ) ;
260279 $ . each ( orderedVarnames , function ( i , varname ) {
261280 var val = localVars [ varname ] ;
@@ -274,15 +293,15 @@ function updateOutput() {
274293 tbl . find ( "tr:last" ) . find ( "td.val" ) . css ( 'border-bottom' , '0px' ) ;
275294 }
276295 else {
277- $ ( "#dataViz .vizFrame:last") . append ( ' <i>none</i>' ) ;
296+ $ ( vizDiv + " .vizFrame:last") . append ( ' <i>none</i>' ) ;
278297 }
279298 } ) ;
280299 }
281300
282301
283302 // render globals LAST:
284303
285- $ ( "#dataViz" ) . append ( '<div class="vizFrame">Global variables:</div>' ) ;
304+ $ ( vizDiv ) . append ( '<div class="vizFrame">Global variables:</div>' ) ;
286305
287306 var nonEmptyGlobals = false ;
288307 var curGlobalFields = { } ;
@@ -296,7 +315,7 @@ function updateOutput() {
296315 }
297316
298317 if ( nonEmptyGlobals ) {
299- $ ( "#dataViz .vizFrame:last") . append ( '<br/><table class="frameDataViz"></table>' ) ;
318+ $ ( vizDiv + " .vizFrame:last") . append ( '<br/><table class="frameDataViz"></table>' ) ;
300319
301320 // render all global variables IN THE ORDER they were created by the program,
302321 // in order to ensure continuity:
@@ -349,11 +368,21 @@ function updateOutput() {
349368 tbl . find ( "tr:last" ) . find ( "td.val" ) . css ( 'border-bottom' , '0px' ) ;
350369 }
351370 else {
352- $ ( "#dataViz .vizFrame:last") . append ( ' <i>none</i>' ) ;
371+ $ ( vizDiv + " .vizFrame:last") . append ( ' <i>none</i>' ) ;
353372 }
354373
355374}
356375
376+
377+ // The "2.0" version of renderDataStructures, which renders variables in
378+ // a stack and values in a separate heap, with data structure aliasing
379+ // explicitly represented via line connectors.
380+ //
381+ // This version was originally created in September 2011
382+ function renderDataStructuresVersion2 ( curEntry , vizDiv ) {
383+
384+ }
385+
357386// render the JS data object obj inside of jDomElt,
358387// which is a jQuery wrapped DOM object
359388// (obj is in a format encoded by cgi-bin/pg_encoder.py)
0 commit comments