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 <Python xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="py_ext_xsd.xsd"> |
2 <Python xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="py_ext_xsd.xsd"> |
3 <![CDATA[import time,sys |
3 <![CDATA[import time,sys,ctypes |
|
4 Python_to_C_Call = PLCBinary.Python_to_C_Call |
|
5 Python_to_C_Call.restype = ctypes.c_int |
|
6 Python_to_C_Call.argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)] |
4 |
7 |
5 def MyPythonFunc(arg): |
8 def MyPythonFunc(arg): |
6 print arg |
9 i = ctypes.c_int() |
7 PLCBinary.Python_to_C_Call(arg) |
10 if(Python_to_C_Call(arg, i)): |
|
11 res = i.value |
|
12 print "toC:", arg, "from C:", res |
|
13 else: |
|
14 print "Failed Python_to_C_Call failed" |
|
15 res = None |
8 sys.stdout.flush() |
16 sys.stdout.flush() |
9 return arg |
17 return res |
10 ]]> |
18 ]]> |
11 </Python> |
19 </Python> |