--- a/tests/python/plc.xml Thu Oct 18 20:40:12 2012 +0200
+++ b/tests/python/plc.xml Fri Oct 19 12:14:24 2012 +0200
@@ -8,7 +8,7 @@
creationDateTime="2008-12-14T16:21:19"/>
<contentHeader name="Beremiz Python Support Tests"
- modificationDateTime="2012-10-18T20:37:52">
+ modificationDateTime="2012-10-19T11:54:13"> <pageSize x="1024" y="1024"/>
@@ -23,7 +23,24 @@
+ <dataType name="CPLX_TYPE"> + <variable name="FIRSTBYTE"> + <variable name="SECONDBYTE"> <pou name="main_pytest" pouType="program">
@@ -588,15 +605,62 @@
+ <variable name="COORDS"> + <dimension lower="0" upper="5"/> + <simpleValue value="54"/> + <simpleValue value="55"/> + <simpleValue value="56"/> + <simpleValue value="57"/> + <simpleValue value="58"/> + <simpleValue value="59"/> + <variable name="SMURF"> + <derived name="CPLX_TYPE"/> <![CDATA[(* hereafter is a C pragma accessing FB interface in a clean way *)
- int fromPLC = __GET_VAR(data__->IN);
- if(PLC_C_Call(fromPLC, &toPLC))__SET_VAR(data__->,OUT,toPLC);
+ char fromPLC = GetFbVar(IN); + if(PLC_C_Call(fromPLC, &toPLC)){ + /* that code demonstrate C access to complex types */ + char somebyte = GetFbVar(COORDS, .table[3]); + SetFbVar(SMURF, somebyte, .FIRSTBYTE); + SetFbVar(COORDS, somebyte, .table[4]); (* If you do not use __GET_VAR and _SET_VAR macro, expect unexpected *)