[pypy-svn] r25913 - pypy/dist/pypy/translator/goal

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Apr 17 23:25:10 CEST 2006


Author: cfbolz
Date: Mon Apr 17 23:25:08 2006
New Revision: 25913

Added:
   pypy/dist/pypy/translator/goal/targetpushpop.py
Log:
small target that shows a push and a pop for checking the assembly that is
generated for this


Added: pypy/dist/pypy/translator/goal/targetpushpop.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/goal/targetpushpop.py	Mon Apr 17 23:25:08 2006
@@ -0,0 +1,36 @@
+"""
+A simple standalone target.
+
+The target below specifies None as the argument types list.
+This is a case treated specially in driver.py . If the list
+of input types is empty, it is meant to be a list of strings,
+actually implementing argv of the executable.
+"""
+
+import os, sys
+
+# __________  Entry point  __________
+
+class A(object):
+    pass
+
+class B(object):
+    pass
+
+def f(x):
+    b = B()
+    b.x = x
+    return b
+
+global_a = A()
+
+def entry_point(argv):
+    # push argv
+    global_a.b = f(len(argv))
+    # pop argv
+    return global_a.b.x
+
+# _____ Define and setup target ___
+
+def target(*args):
+    return entry_point, None



More information about the Pypy-commit mailing list