[pypy-svn] r32684 - pypy/dist/pypy/rpython
pedronis at codespeak.net
pedronis at codespeak.net
Wed Sep 27 22:03:08 CEST 2006
Author: pedronis
Date: Wed Sep 27 22:03:06 2006
New Revision: 32684
Modified:
pypy/dist/pypy/rpython/llinterp.py
Log:
automatically upon opening show the trace of the last call chain in the llinterp html logging files.
Modified: pypy/dist/pypy/rpython/llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/llinterp.py (original)
+++ pypy/dist/pypy/rpython/llinterp.py Wed Sep 27 22:03:06 2006
@@ -903,22 +903,33 @@
HEADER = """<html><head>
<script language=javascript type='text/javascript'>
- function togglestate(name) {
- item = document.getElementById(name)
+ function togglestate(n) {
+ var item = document.getElementById('div'+n)
if (item.style.display == 'none')
item.style.display = 'block';
else
item.style.display = 'none';
}
+
+ function toggleall(lst) {
+ for (var i = 0; i<lst.length; i++) {
+ togglestate(lst[i]);
+ }
+ }
</script>
</head>
<body><pre>
"""
- FOOTER = """</pre></body></html>"""
+ FOOTER = """</pre>
+ <script language=javascript type='text/javascript'>
+ toggleall(%r);
+ </script>
+
+ </body></html>"""
- ENTER = ('''\n\t<a href="javascript:togglestate('div%d')">%s</a>'''
+ ENTER = ('''\n\t<a href="javascript:togglestate(%d)">%s</a>'''
'''\n<div id="div%d" style="display: %s">\t''')
LEAVE = '''\n</div>\t'''
@@ -951,17 +962,22 @@
self.count = 0
self.indentation = ''
+ self.depth = 0
+ self.latest_call_chain = []
def stop(self):
# end of a dump file
if self.file:
- print >> self.file, self.FOOTER
+ print >> self.file, self.FOOTER % (self.latest_call_chain[1:])
self.file.close()
self.file = None
def enter(self, graph):
# enter evaluation of a graph
if self.file:
+ del self.latest_call_chain[self.depth:]
+ self.depth += 1
+ self.latest_call_chain.append(self.count)
s = self.htmlquote(str(graph))
i = s.rfind(')')
s = s[:i+1] + '<b>' + s[i+1:] + '</b>'
@@ -979,6 +995,7 @@
if self.file:
self.indentation = self.indentation[:-4]
self.file.write(self.LEAVE.replace('\t', self.indentation))
+ self.depth -= 1
def dump(self, text, bold=False):
if self.file:
More information about the Pypy-commit
mailing list