tests/python/python@py_ext/pyfile.xml
changeset 1099 d9c28879e55b
child 1125 1b1472e76f07
equal deleted inserted replaced
1098:0ead830daf26 1099:d9c28879e55b
       
     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">
       
     3   <includes>
       
     4 <![CDATA[]]>
       
     5   </includes>
       
     6   <variables>
       
     7     <variable name="Test_Python_Var" type="INT" initial="0"/>
       
     8   </variables>
       
     9   <globals>
       
    10 <![CDATA[import time,sys,ctypes
       
    11 Python_to_C_Call = PLCBinary.Python_to_C_Call
       
    12 Python_to_C_Call.restype = ctypes.c_int
       
    13 Python_to_C_Call.argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)]
       
    14 
       
    15 def MyPythonFunc(arg):
       
    16     i = ctypes.c_int()
       
    17     if(Python_to_C_Call(arg, i)):
       
    18         res = i.value
       
    19         print "toC:", arg, "from C:", res, "FBID:", FBID
       
    20     else:
       
    21         print "Failed Python_to_C_Call failed"
       
    22         res = None
       
    23     sys.stdout.flush()
       
    24     return res
       
    25 
       
    26 async_error_test_code = """
       
    27 def badaboom():
       
    28     tuple()[0]
       
    29 
       
    30 import wx
       
    31 def badaboomwx():
       
    32     wx.CallAfter(badaboom)
       
    33 
       
    34 from threading import Timer
       
    35 a = Timer(3, badaboom)
       
    36 a.start()
       
    37 
       
    38 b = Timer(6, badaboomwx)
       
    39 b.start()
       
    40 """
       
    41 ]]>
       
    42   </globals>
       
    43   <initFunction>
       
    44 <![CDATA[]]>
       
    45   </initFunction>
       
    46   <cleanUpFunction>
       
    47 <![CDATA[]]>
       
    48   </cleanUpFunction>
       
    49   <retrieveFunction>
       
    50 <![CDATA[]]>
       
    51   </retrieveFunction>
       
    52   <publishFunction>
       
    53 <![CDATA[]]>
       
    54   </publishFunction>
       
    55 </CodeFile>