[pypy-svn] rev 2068 - pypy/trunk/src/pypy/translator/tool

hpk at codespeak.net hpk at codespeak.net
Sat Oct 25 22:55:15 CEST 2003


Author: hpk
Date: Sat Oct 25 22:55:15 2003
New Revision: 2068

Modified:
   pypy/trunk/src/pypy/translator/tool/make_dot.py
Log:
and some more tweaks to coloring, forms and such



Modified: pypy/trunk/src/pypy/translator/tool/make_dot.py
==============================================================================
--- pypy/trunk/src/pypy/translator/tool/make_dot.py	(original)
+++ pypy/trunk/src/pypy/translator/tool/make_dot.py	Sat Oct 25 22:55:15 2003
@@ -43,6 +43,7 @@
                   color="black", 
                   dir="forward",
                   decorateP="",
+                  weight="5",
                   ):
         d = locals()
         attrs = [('%s="%s"' % (x, d[x])) for x in d if isinstance(x, str)]
@@ -53,6 +54,8 @@
                   shape="diamond", 
                   label="", 
                   color="black",
+                  fillcolor="white", 
+                  style="filled",
                   ):
         d = locals()
         attrs = [('%s="%s"' % (x, d[x])) for x in d if isinstance(x, str)]
@@ -65,8 +68,14 @@
     def visit_FunctionGraph(self, funcgraph):
         name = funcgraph.name
         data = name
-        self.emit('%(name)s [shape=circle, label="%(data)s"];' % locals())
+        if hasattr(funcgraph, 'source'):
+            source = funcgraph.source.replace('"', "'")
+            data += "\\n" + "\\l".join(source.split('\n'))
+            
+        self.emit_node(name, label=data, shape="box", fillcolor="green", style="filled")
+        #('%(name)s [fillcolor="green", shape=box, label="%(data)s"];' % locals())
         self.emit_edge(name, self.blockname(funcgraph.startblock), 'startblock')
+        self.emit_edge(name, self.blockname(funcgraph.returnblock), 'returnblock', style="dashed")
 
     def visit_Block(self, block):
         # do the block itself
@@ -75,8 +84,10 @@
         lines.append("")
         numblocks = len(block.exits)
         color = "black"
+        fillcolor = "white"
         if not numblocks:
-           shape = "circle"
+           shape = "box"
+           fillcolor="green"
         elif numblocks == 1:
             shape = "box"
         else:
@@ -88,7 +99,7 @@
         data = "%s(%s)\\ninputargs: %s\\n\\n" % (name, block.__class__.__name__, iargs)
         data = data + "\l".join(lines)
 
-        self.emit_node(name, label=data, shape=shape, color=color)
+        self.emit_node(name, label=data, shape=shape, color=color, style="filled", fillcolor=fillcolor)
 
         # do links/exits
         if numblocks == 1:


More information about the Pypy-commit mailing list