equal
deleted
inserted
replaced
9 import time,sys,ctypes |
9 import time,sys,ctypes |
10 Python_to_C_Call = PLCBinary.Python_to_C_Call |
10 Python_to_C_Call = PLCBinary.Python_to_C_Call |
11 Python_to_C_Call.restype = ctypes.c_int |
11 Python_to_C_Call.restype = ctypes.c_int |
12 Python_to_C_Call.argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)] |
12 Python_to_C_Call.argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)] |
13 |
13 |
|
14 |
|
15 def MyPrintFunction(msg): |
|
16 if sys.stdout: |
|
17 sys.stdout.write(msg) |
|
18 sys.stdout.flush() |
|
19 else: |
|
20 PLCObject.LogMessage(msg) |
|
21 |
14 def MyPythonFunc(arg): |
22 def MyPythonFunc(arg): |
15 i = ctypes.c_int() |
23 i = ctypes.c_int() |
16 if(Python_to_C_Call(arg, i)): |
24 if(Python_to_C_Call(arg, i)): |
17 res = i.value |
25 res = i.value |
18 print("toC:", arg, "from C:", res, "FBID:", FBID) |
26 print("toC:", arg, "from C:", res, "FBID:", FBID) |
20 print("Failed Python_to_C_Call failed") |
28 print("Failed Python_to_C_Call failed") |
21 res = None |
29 res = None |
22 print("Python read PLC global :",PLCGlobals.Test_Python_Var) |
30 print("Python read PLC global :",PLCGlobals.Test_Python_Var) |
23 print("Python read PLC global Grumpf :",PLCGlobals.Grumpf) |
31 print("Python read PLC global Grumpf :",PLCGlobals.Grumpf) |
24 PLCGlobals.Second_Python_Var = 789 |
32 PLCGlobals.Second_Python_Var = 789 |
25 sys.stdout.flush() |
33 |
|
34 if sys.stdout: |
|
35 sys.stdout.flush() |
26 return res |
36 return res |
27 |
37 |
28 async_error_test_code = """ |
38 async_error_test_code = """ |
29 def badaboom(): |
39 def badaboom(): |
30 tuple()[0] |
40 tuple()[0] |