[pypy-svn] r64053 - in pypy/branch/pyjitpl5-simplify: dotviewer pypy/translator pypy/translator/tool

arigo at codespeak.net arigo at codespeak.net
Tue Apr 14 13:47:39 CEST 2009


Author: arigo
Date: Tue Apr 14 13:47:39 2009
New Revision: 64053

Modified:
   pypy/branch/pyjitpl5-simplify/dotviewer/graphpage.py
   pypy/branch/pyjitpl5-simplify/pypy/translator/tool/graphpage.py
   pypy/branch/pyjitpl5-simplify/pypy/translator/translator.py
Log:
Support translator.viewcg() with an argument now:
the graph to display at the start.


Modified: pypy/branch/pyjitpl5-simplify/dotviewer/graphpage.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/dotviewer/graphpage.py	(original)
+++ pypy/branch/pyjitpl5-simplify/dotviewer/graphpage.py	Tue Apr 14 13:47:39 2009
@@ -5,8 +5,9 @@
     """
     save_tmp_file = None
 
-    def __init__(self, *args):
+    def __init__(self, *args, **kwds):
         self.args = args
+        self.kwds = kwds
 
     def content(self):
         """Compute the content of the page.
@@ -18,7 +19,7 @@
             new = self.__class__()
             new.source = ''  # '''dot source'''
             new.links  = {}  # {'word': 'statusbar text'}
-            new.compute(*self.args)   # defined in subclasses
+            new.compute(*self.args, **self.kwds)   # defined in subclasses
             return new
 
     def followlink(self, word):

Modified: pypy/branch/pyjitpl5-simplify/pypy/translator/tool/graphpage.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/translator/tool/graphpage.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/translator/tool/graphpage.py	Tue Apr 14 13:47:39 2009
@@ -313,7 +313,7 @@
     def graph_name(self, huge=0):
         return 'translator'
 
-    def do_compute(self, dotgen, huge=100):
+    def do_compute(self, dotgen, huge=100, center_graph=None):
         translator = self.translator
 
         # show the call graph
@@ -322,7 +322,8 @@
 
         if len(graphs) > huge:
             assert graphs, "no graph to show!"
-            LocalizedCallGraphPage.do_compute.im_func(self, dotgen, [graphs[0]])
+            graphs = [center_graph or graphs[0]]
+            LocalizedCallGraphPage.do_compute.im_func(self, dotgen, graphs)
             return
 
         blocked_graphs = self.get_blocked_graphs(graphs)

Modified: pypy/branch/pyjitpl5-simplify/pypy/translator/translator.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/translator/translator.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/translator/translator.py	Tue Apr 14 13:47:39 2009
@@ -150,11 +150,11 @@
         from pypy.translator.tool.graphpage import FlowGraphPage
         FlowGraphPage(self).display()
 
-    def viewcg(self):
+    def viewcg(self, center_graph=None):
         """Shows the whole call graph and the class hierarchy, based on
         the computed annotations."""
         from pypy.translator.tool.graphpage import TranslatorPage
-        TranslatorPage(self).display()
+        TranslatorPage(self, center_graph).display()
 
 
 



More information about the Pypy-commit mailing list