equal
deleted
inserted
replaced
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
2 <CodeFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="codefile.xsd"> |
2 <PyFile> |
3 <includes> |
|
4 <![CDATA[]]> |
|
5 </includes> |
|
6 <variables> |
3 <variables> |
7 <variable name="Test_Python_Var" type="INT" initial="0"/> |
4 <variable name="Test_Python_Var" type="INT" initial="0"/> |
8 </variables> |
5 </variables> |
9 <globals> |
6 <globals> |
10 <![CDATA[import time,sys,ctypes |
7 <![CDATA[ |
|
8 import time,sys,ctypes |
11 Python_to_C_Call = PLCBinary.Python_to_C_Call |
9 Python_to_C_Call = PLCBinary.Python_to_C_Call |
12 Python_to_C_Call.restype = ctypes.c_int |
10 Python_to_C_Call.restype = ctypes.c_int |
13 Python_to_C_Call.argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)] |
11 Python_to_C_Call.argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)] |
14 |
12 |
15 def MyPythonFunc(arg): |
13 def MyPythonFunc(arg): |
38 b = Timer(6, badaboomwx) |
36 b = Timer(6, badaboomwx) |
39 b.start() |
37 b.start() |
40 """ |
38 """ |
41 ]]> |
39 ]]> |
42 </globals> |
40 </globals> |
43 <initFunction> |
41 <init> |
44 <![CDATA[]]> |
42 <![CDATA[ |
45 </initFunction> |
43 global x, y |
46 <cleanUpFunction> |
44 x = 2 |
47 <![CDATA[]]> |
45 y = 5 |
48 </cleanUpFunction> |
46 print "py_runtime init:", x, ",", y |
49 <retrieveFunction> |
47 ]]> |
50 <![CDATA[]]> |
48 </init> |
51 </retrieveFunction> |
49 <cleanup> |
52 <publishFunction> |
50 <![CDATA[ |
53 <![CDATA[]]> |
51 print "py_runtime cleanup" |
54 </publishFunction> |
52 ]]> |
55 </CodeFile> |
53 </cleanup> |
|
54 <start> |
|
55 <![CDATA[ |
|
56 global x, y |
|
57 print "py_runtime start", x * x + y * y |
|
58 ]]> |
|
59 </start> |
|
60 <stop> |
|
61 <![CDATA[ |
|
62 print "py_runtime stop" |
|
63 ]]> |
|
64 </stop> |
|
65 </PyFile> |