Debian Codegraph @

rpython/translator/goal/targetpushpop.py

raw symbols SCIP
1 """
2 A simple standalone target.
3
4 The target below specifies None as the argument types list.
5 This is a case treated specially in driver.py . If the list
6 of input types is empty, it is meant to be a list of strings,
7 actually implementing argv of the executable.
8 """
9
10 # __________ Entry point __________
11
12 class A(object):
13 pass
14
15 class B(object):
16 pass
17
18 def f(x):
19 if x == 0:
20 return f(x - 1)
21 b = B()
22 b.x = x
23 return b
24
25 global_a = A()
26
27 def entry_point(argv):
28 a1 = A()
29 a2 = A()
30 a3 = A()
31 a4 = A()
32 global_a.next = a1
33 a1.x = 1
34 a2.x = 2
35 a3.x = 3
36 a4.x = 4
37 a1.next = a2
38 a2.next = a3
39 a3.next = a4
40 a4.next = None
41 # push stuff
42 global_a.b = f(len(argv))
43 global_a.b.x = len(argv)
44 # pop stuff
45 return a1.x + a2.x + a3.x + a4.x + global_a.b.x
46
47 # _____ Define and setup target ___
48
49 def target(*args):
50 return entry_point, None