[pypy-svn] rev 2631 - pypy/trunk/src/pypy/translator/tool
pedronis at codespeak.net
pedronis at codespeak.net
Sat Dec 20 11:49:15 CET 2003
Author: pedronis
Date: Sat Dec 20 11:49:14 2003
New Revision: 2631
Modified:
pypy/trunk/src/pypy/translator/tool/temptest.py
Log:
made temptest.py a more generally useful tool.
Modified: pypy/trunk/src/pypy/translator/tool/temptest.py
==============================================================================
--- pypy/trunk/src/pypy/translator/tool/temptest.py (original)
+++ pypy/trunk/src/pypy/translator/tool/temptest.py Sat Dec 20 11:49:14 2003
@@ -1,3 +1,18 @@
+"""
+
+- annotate and translate snippet producing tracing of calls
+to AnnotationSet and RPythonAnnotator
+- print bindings and final annotation set
+and pyrex
+
+- display flow graph
+
+call it like:
+
+traceann <snippet-name> <types...> >result.txt 2>trace.txt
+
+"""
+
import sys
import autopath
@@ -9,18 +24,19 @@
tracer.trace(AnnotationSet)
tracer.trace(RPythonAnnotator)
-def h(lst):
- lst += [5]
+try:
+ snippet_name = sys.argv[1]
+except IndexError:
+ snippet_name = "call_five"
-def calling_h():
- a = []
- h(a)
- return a
+argtypes = []
+for argtype in sys.argv[2:]:
+ argtypes.append(eval(argtype))
-t = Translator(calling_h) # test.poor_man_rev_range)
+t = Translator(getattr(test,snippet_name))
t.simplify()
-a = t.annotate([])
+a = t.annotate(argtypes)
lines = []
for key, value in a.bindings.items():
lines.append('%r: %r' % (key, value))
More information about the Pypy-commit
mailing list