File: test.ngc

package info (click to toggle)
linuxcnc 1%3A2.9.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 285,604 kB
  • sloc: python: 202,568; ansic: 109,036; cpp: 99,239; tcl: 16,054; xml: 10,631; sh: 10,303; makefile: 1,255; javascript: 138; sql: 72; asm: 15
file content (62 lines) | stat: -rw-r--r-- 1,415 bytes parent folder | download | duplicates (3)
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