[pypy-svn] r65936 - pypy/branch/pyjitpl5/pypy/jit/tl/spli
fijal at codespeak.net
fijal at codespeak.net
Wed Jun 24 21:49:12 CEST 2009
Author: fijal
Date: Wed Jun 24 21:49:10 2009
New Revision: 65936
Modified:
pypy/branch/pyjitpl5/pypy/jit/tl/spli/examples.py
pypy/branch/pyjitpl5/pypy/jit/tl/spli/targetspli.py
Log:
implement command line args
Modified: pypy/branch/pyjitpl5/pypy/jit/tl/spli/examples.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/tl/spli/examples.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/tl/spli/examples.py Wed Jun 24 21:49:10 2009
@@ -1,3 +1,6 @@
def f():
return 1
+
+def adder(a, b):
+ return a + b
Modified: pypy/branch/pyjitpl5/pypy/jit/tl/spli/targetspli.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/tl/spli/targetspli.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/tl/spli/targetspli.py Wed Jun 24 21:49:10 2009
@@ -8,6 +8,14 @@
space = objects.DumbObjSpace()
+def unwrap_arg(arg):
+ if arg.startswith('s:'):
+ return objects.Str(arg[2:])
+ elif arg.startswith('i:'):
+ return objects.Int(int(arg[2:]))
+ else:
+ raise NotImplementedError
+
def entry_point(argv):
if len(argv) < 2:
print __doc__
@@ -16,6 +24,8 @@
stream = open_file_as_stream(argv[1])
co = serializer.deserialize(stream.readall(), space)
frame = interpreter.SPLIFrame(co)
+ for n in range(len(args)):
+ frame.locals[n] = unwrap_arg(args[n])
res = frame.run()
print res.repr()
return 0
More information about the Pypy-commit
mailing list