[pypy-svn] r26291 - pypy/dist/pypy/translator/cl
sanxiyn at codespeak.net
sanxiyn at codespeak.net
Tue Apr 25 08:26:14 CEST 2006
Author: sanxiyn
Date: Tue Apr 25 08:26:10 2006
New Revision: 26291
Modified:
pypy/dist/pypy/translator/cl/gencl.py
Log:
Add emitfile() to gencl that writes the code to the file and returns
the file name
Modified: pypy/dist/pypy/translator/cl/gencl.py
==============================================================================
--- pypy/dist/pypy/translator/cl/gencl.py (original)
+++ pypy/dist/pypy/translator/cl/gencl.py Tue Apr 25 08:26:10 2006
@@ -1,5 +1,6 @@
import types
+from pypy.tool.udir import udir
from pypy.translator.translator import graphof
from pypy.rpython.ootypesystem.ootype import Instance, List, _static_meth, _meth
from pypy.translator.cl.clrepr import repr_arg, repr_var, repr_const, repr_fun_name, repr_class_name
@@ -134,9 +135,17 @@
def __init__(self, context, funobj):
self.context = context
+ self.entry_point = funobj
self.pendinggraphs = [funobj]
self.declarations = []
+ def emitfile(self):
+ name = self.entry_point.func_name
+ path = udir.join("%s.lisp" % (name,))
+ code = self.emitcode()
+ path.write(code)
+ return str(path)
+
def emitcode(self):
lines = list(self.emit())
declarations = "\n".join(self.declarations)
More information about the Pypy-commit
mailing list