Update __SET_VAR() macros to reflect changes made to matiec
authormjsousa
Mon, 26 May 2014 14:44:03 +0100
changeset 1469 86797748c2a2
parent 1406 82db84fe88ea
child 1470 f65ab5ff91d1
Update __SET_VAR() macros to reflect changes made to matiec
plcopen/Additional_Function_Blocks.xml
plcopen/Standard_Function_Blocks.xml
py_ext/plc_python.c
--- a/plcopen/Additional_Function_Blocks.xml	Tue May 13 00:43:06 2014 +0200
+++ b/plcopen/Additional_Function_Blocks.xml	Mon May 26 14:44:03 2014 +0100
@@ -81,7 +81,7 @@
         </interface>
         <body>
           <ST>
-            <xhtml:p><![CDATA[{__SET_VAR(data__->,CURRENT_TIME,__CURRENT_TIME)}
+            <xhtml:p><![CDATA[{__SET_VAR(data__->,CURRENT_TIME,,__CURRENT_TIME)}
 
  IF IN
  THEN
--- a/plcopen/Standard_Function_Blocks.xml	Tue May 13 00:43:06 2014 +0200
+++ b/plcopen/Standard_Function_Blocks.xml	Mon May 26 14:44:03 2014 +0100
@@ -1194,7 +1194,7 @@
         </interface>
         <body>
           <ST>
-            <xhtml:p><![CDATA[{__SET_VAR(data__->,CURRENT_TIME,__CURRENT_TIME)}
+            <xhtml:p><![CDATA[{__SET_VAR(data__->,CURRENT_TIME,,__CURRENT_TIME)}
 
 IF ((STATE = 0) AND NOT(PREV_IN) AND IN)   (* found rising edge on IN *)
 THEN
@@ -1307,7 +1307,7 @@
         </interface>
         <body>
           <ST>
-            <xhtml:p><![CDATA[{__SET_VAR(data__->,CURRENT_TIME,__CURRENT_TIME)}
+            <xhtml:p><![CDATA[{__SET_VAR(data__->,CURRENT_TIME,,__CURRENT_TIME)}
 
 IF ((STATE = 0) AND NOT(PREV_IN) AND IN)   (* found rising edge on IN *)
 THEN
@@ -1424,7 +1424,7 @@
         </interface>
         <body>
           <ST>
-            <xhtml:p><![CDATA[{__SET_VAR(data__->,CURRENT_TIME,__CURRENT_TIME)}
+            <xhtml:p><![CDATA[{__SET_VAR(data__->,CURRENT_TIME,,__CURRENT_TIME)}
 
 IF ((STATE = 0) AND PREV_IN AND NOT(IN))   (* found falling edge on IN *)
 THEN
--- a/py_ext/plc_python.c	Tue May 13 00:43:06 2014 +0200
+++ b/py_ext/plc_python.c	Mon May 26 14:44:03 2014 +0100
@@ -96,30 +96,30 @@
 	    /* trig only if not already trigged */
 	    __GET_VAR(data__->TRIGGED) == 0){
 		/* mark as trigged */
-	    __SET_VAR(data__->, TRIGGED, 1);
+	    __SET_VAR(data__->, TRIGGED,, 1);
 		/* make a safe copy of the code */
-		__SET_VAR(data__->, PREBUFFER, __GET_VAR(data__->CODE));
+		__SET_VAR(data__->, PREBUFFER,, __GET_VAR(data__->CODE));
 	}
 	/* retain value for next rising edge detection */
-	__SET_VAR(data__->, TRIGM1, __GET_VAR(data__->TRIG));
+	__SET_VAR(data__->, TRIGM1,, __GET_VAR(data__->TRIG));
 
 	/* python thread is not in ? */
 	if( PythonState & PYTHON_LOCKED_BY_PLC){
 		/* if some answer are waiting, publish*/
 		if(__GET_VAR(data__->STATE) == PYTHON_FB_ANSWERED){
 			/* Copy buffer content into result*/
-			__SET_VAR(data__->, RESULT, __GET_VAR(data__->BUFFER));
+			__SET_VAR(data__->, RESULT,, __GET_VAR(data__->BUFFER));
 			/* signal result presece to PLC*/
-			__SET_VAR(data__->, ACK, 1);
+			__SET_VAR(data__->, ACK,, 1);
 			/* Mark as free */
-			__SET_VAR(data__->, STATE, PYTHON_FB_FREE);
+			__SET_VAR(data__->, STATE,, PYTHON_FB_FREE);
 			/* mark as not trigged */
 			if(!poll)
-			    __SET_VAR(data__->, TRIGGED, 0);
+			    __SET_VAR(data__->, TRIGGED,, 0);
 			/*printf("__PythonEvalFB pop %%d - %%*s\n",Current_PLC_EvalFB, data__->BUFFER.len, data__->BUFFER.body);*/
 		}else if(poll){
 			/* when in polling, no answer == ack down */
-		    __SET_VAR(data__->, ACK, 0);
+		    __SET_VAR(data__->, ACK., 0);
 		}
 		/* got the order to act ?*/
 		if(__GET_VAR(data__->TRIGGED) == 1 &&
@@ -132,17 +132,17 @@
 			 * be requested twice */
 			EvalFBs[Current_PLC_EvalFB] = data__;
 			/* copy into BUFFER local*/
-			__SET_VAR(data__->, BUFFER, __GET_VAR(data__->PREBUFFER));
+			__SET_VAR(data__->, BUFFER,, __GET_VAR(data__->PREBUFFER));
 			/* Set ACK pin to low so that we can set a rising edge on result */
 			if(!poll){
 				/* when not polling, a new answer imply reseting ack*/
-			    __SET_VAR(data__->, ACK, 0);
+			    __SET_VAR(data__->, ACK,, 0);
 			}else{
 				/* when in polling, acting reset trigger */
-			    __SET_VAR(data__->, TRIGGED, 0);
+			    __SET_VAR(data__->, TRIGGED,, 0);
 			}
 			/* Mark FB busy */
-			__SET_VAR(data__->, STATE, PYTHON_FB_REQUESTED);
+			__SET_VAR(data__->, STATE,, PYTHON_FB_REQUESTED);
 			/* Have to wakeup python thread in case he was asleep */
 			PythonState |= PYTHON_MUSTWAKEUP;
 			/*printf("__PythonEvalFB push %%d - %%*s\n",Current_PLC_EvalFB, data__->BUFFER.len, data__->BUFFER.body);*/
@@ -168,22 +168,22 @@
 	   	/* If result not None */
 	   	if(result){
 			/* Get results len */
-	   	    __SET_VAR(data__->, BUFFER, strlen(result), .len);
+	   	    __SET_VAR(data__->, BUFFER, .len, strlen(result));
 			/* prevent results overrun */
 			if(__GET_VAR(data__->BUFFER, .len) > STR_MAX_LEN)
 			{
-			    __SET_VAR(data__->, BUFFER, STR_MAX_LEN, .len );
+			    __SET_VAR(data__->, BUFFER, .len, STR_MAX_LEN);
 				/* TODO : signal error */
 			}
 			/* Copy results to buffer */
 			strncpy((char*)__GET_VAR(data__->BUFFER, .body), result, __GET_VAR(data__->BUFFER,.len));
 	   	}else{
-	   	    __SET_VAR(data__->, BUFFER, 0, .len);
+	   	    __SET_VAR(data__->, BUFFER, .len, 0);
 	   	}
 		/* remove block from fifo*/
 		EvalFBs[Current_Python_EvalFB] = NULL;
 		/* Mark block as answered */
-		__SET_VAR(data__->, STATE, PYTHON_FB_ANSWERED);
+		__SET_VAR(data__->, STATE,, PYTHON_FB_ANSWERED);
 		/* Get a new line */
 		Current_Python_EvalFB = (Current_Python_EvalFB + 1) %% %(python_eval_fb_count)d;
 		//printf("PythonIterator ++ Current_Python_EvalFB %%d\n", Current_Python_EvalFB);
@@ -202,10 +202,10 @@
 		LockPython();
 	}
 	/* Mark block as processing */
-	__SET_VAR(data__->, STATE, PYTHON_FB_PROCESSING);
+	__SET_VAR(data__->, STATE,, PYTHON_FB_PROCESSING);
 	//printf("PythonIterator\n");
 	/* make BUFFER a null terminated string */
-	__SET_VAR(data__->, BUFFER, 0, .body[__GET_VAR(data__->BUFFER, .len)]);
+	__SET_VAR(data__->, BUFFER, .body[__GET_VAR(data__->BUFFER, .len)], 0);
 	/* next command is BUFFER */
 	next_command = (char*)__GET_VAR(data__->BUFFER, .body);
 	*id=data__;