[pypy-svn] r70022 - pypy/branch/sepcomp/pypy/translator/goal
xoraxax at codespeak.net
xoraxax at codespeak.net
Wed Dec 9 13:13:43 CET 2009
Author: xoraxax
Date: Wed Dec 9 13:13:42 2009
New Revision: 70022
Added:
pypy/branch/sepcomp/pypy/translator/goal/md5module.py
pypy/branch/sepcomp/pypy/translator/goal/target_md5demo.py
Log:
Add demo module for sepcomp.
Added: pypy/branch/sepcomp/pypy/translator/goal/md5module.py
==============================================================================
--- (empty file)
+++ pypy/branch/sepcomp/pypy/translator/goal/md5module.py Wed Dec 9 13:13:42 2009
@@ -0,0 +1,22 @@
+from pypy.translator.sepcomp import scimport, export, ImportExportComponent
+from pypy.module.md5demo.interface import MD5Interface
+
+
+class MD5Inherited(MD5Interface):
+ def __init__(self):
+ self.argument_cache = []
+
+ def update(self, x):
+ # keeps all strings that were fed into this hash object
+ self.argument_cache.append(x)
+ return MD5Interface.update(self, x)
+
+ def digest(self):
+ return MD5Interface.digest(self) + "POSTF3"
+
+
+ at export(ret=MD5Interface, force_name="module_init")
+def module_init():
+ return MD5Inherited()
+
+ImportExportComponent("md5module", locals())
Added: pypy/branch/sepcomp/pypy/translator/goal/target_md5demo.py
==============================================================================
--- (empty file)
+++ pypy/branch/sepcomp/pypy/translator/goal/target_md5demo.py Wed Dec 9 13:13:42 2009
@@ -0,0 +1,5 @@
+from pypy.translator.goal import md5module
+
+def target(*args):
+ return lambda:None, ()
+
More information about the Pypy-commit
mailing list