[pypy-svn] r6018 - in pypy/branch/pypy-genc/translator: . tool/pygame
rxe at codespeak.net
rxe at codespeak.net
Wed Aug 18 01:20:50 CEST 2004
Author: rxe
Date: Wed Aug 18 01:20:50 2004
New Revision: 6018
Modified:
pypy/branch/pypy-genc/translator/tool/pygame/graphdisplay.py
pypy/branch/pypy-genc/translator/translator.py
Log:
Some minor tweaks for translator.py for new modules
graphdisplay and genc.
Added escape key to graphdisplay.
Modified: pypy/branch/pypy-genc/translator/tool/pygame/graphdisplay.py
==============================================================================
--- pypy/branch/pypy-genc/translator/tool/pygame/graphdisplay.py (original)
+++ pypy/branch/pypy-genc/translator/tool/pygame/graphdisplay.py Wed Aug 18 01:20:50 2004
@@ -212,6 +212,8 @@
if event.type == KEYDOWN:
if event.key in [K_p, K_LEFT, K_BACKSPACE]:
self.layout_back()
+ if event.key == K_ESCAPE:
+ break
if event.type == VIDEORESIZE:
# short-circuit if there are more resize events pending
if pygame.event.peek([VIDEORESIZE]):
Modified: pypy/branch/pypy-genc/translator/translator.py
==============================================================================
--- pypy/branch/pypy-genc/translator/translator.py (original)
+++ pypy/branch/pypy-genc/translator/translator.py Wed Aug 18 01:20:50 2004
@@ -29,7 +29,7 @@
Try dir(test) for list of current snippets.
"""
-import autopath
+import test.autopath
from pypy.objspace.flow.model import *
from pypy.annotation.model import *
@@ -37,6 +37,7 @@
from pypy.translator.simplify import simplify_graph
from pypy.translator.genpyrex import GenPyrex
from pypy.translator.gencl import GenCL
+from pypy.translator.genc import GenC
from pypy.translator.tool.buildpyxmodule import make_module_from_pyxstring
from pypy.objspace.flow import FlowObjSpace
@@ -103,8 +104,9 @@
def view(self, *functions):
"""Shows the control flow graph with annotations if computed.
Requires 'dot' and pygame."""
- from pypy.translator.tool.pygame.graphviewer import GraphDisplay
- GraphDisplay(self, functions).run()
+ from pypy.translator.tool.pygame.graphdisplay import GraphDisplay
+ from pypy.translator.tool.pygame.flowviewer import FlowGraphLayout
+ GraphDisplay(FlowGraphLayout(self)).run()
def simplify(self, func=None):
"""Simplifies the control flow graph (default: for all functions)."""
@@ -155,6 +157,18 @@
"""
return self.generatecode(GenCL, input_arg_types, func)
+ def c(self, input_arg_types=None, func=None):
+ """c(self[, input_arg_types][, func]) -> C (CPython) translation
+
+ Returns C (CPython) translation. If input_arg_types is provided,
+ returns type annotated translation. Subsequent calls are
+ not affected by this.
+ """
+ from StringIO import StringIO
+ out = StringIO()
+ genc = GenC(out, self)
+ return out.getvalue()
+
def generatecode(self, gencls, input_arg_types, func):
if input_arg_types is None:
ann = self.annotator
More information about the Pypy-commit
mailing list