1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
; return a value via endsub
o<function1> sub
o<function1> endsub [4711]
; return a value via return
o<function2> sub
o100 return [4712]
o<function2> endsub
; a procedure without return value
o<proc> sub
o<proc> endsub
;py,from interpreter import *
;;;py,print this.return_value
;;;py,print this.value_returned
;py,assert equal(this.return_value,0.0)
;py,assert this.value_returned == 0
o<function1> call
; make sure they are properly set
;py,assert equal(this.return_value,4711.0)
;py,assert this.value_returned == 1
o<proc> call
; make sure they are cleared
;py,assert equal(this.return_value,0.0)
;py,assert this.value_returned == 0
o<function2> call
; make sure they are properly set again
;py,assert equal(this.return_value,4712.0)
;py,assert this.value_returned == 1
o<proc> call
; make sure they are cleared again
;py,assert equal(this.return_value,0.0)
;py,assert this.value_returned == 0
; now the same for Python oword subs
o<returns4711> call
;py,assert equal(this.return_value,4711.0)
;py,assert this.value_returned == 1
o<nonereturned> call
; make sure they are cleared again
;;py,assert equal(this.return_value,0.0)
;;py,assert this.value_returned == 0
o<returns4711> call
;py,assert equal(this.return_value,4711.0)
;py,assert this.value_returned == 1
o<endswithpass> call
; make sure they are cleared again
;py,assert equal(this.return_value,0.0)
;py,assert this.value_returned == 0
m2
|