root/trunk/infrastructure/pyd/generators/iterate.py

Revision 38, 0.6 kB (checked in by KirkMcDonald, 2 years ago)

More opApply wrapping, docs

Line 
1 import sys
2 old_stdout = sys.stdout
3 sys.stdout = file('iterate.txt', 'w')
4
5 template = """\
6         } else static if (ARGS == %s) {
7             foreach (%s; t) {
8                 temp = _make_pytuple(%s);
9                 if (temp is null) StackContext.throwYield(new DPyYield(null));
10                 StackContext.throwYield(new DPyYield(temp));
11             }"""
12
13 def args(i):
14     return ['a%s' % i for i in range(0, i)]
15
16 def pyargs(i):
17     return ['_py(%s)' % p for p in args(i)]
18
19 for i in range(2, 11):
20     print template % (i, ', '.join(args(i)), ', '.join(pyargs(i)))
21 print '        }'
22
23 sys.stdout = old_stdout
Note: See TracBrowser for help on using the browser.