First working IEC std lib test, actually test from string and to_string functions.
authoretisserant
Fri, 13 Jul 2007 19:20:26 +0200
changeset 41 8998c8b24b60
parent 40 873a5b60a7ea
child 42 b45c7f34dec1
First working IEC std lib test, actually test from string and to_string functions.
lib/iec_std_lib.h
lib/test_iec_std_lib.c
stage1_2/iec.y
stage4/generate_cc/generate_cc.cc
stage4/generate_cc/generate_cc_base.cc
stage4/generate_cc/generate_cc_il.cc
stage4/generate_cc/generate_cc_sfc.cc
stage4/generate_cc/generate_cc_st.cc
stage4/generate_cc/generate_cc_vardecl.cc
stage4/generate_cc/generate_location_list.cc
stage4/generate_cc/il_code_gen.c
stage4/generate_cc/search_var_instance_decl.cc
stage4/generate_cc/st_code_gen.c
stage4/generate_cc/test_iec_std_lib.c
stage4/stage4.cc
tests/.cvsignore
tests/STD_TEST.xml
tests/build.sh
tests/main.c
--- a/lib/iec_std_lib.h	Thu Jul 12 11:24:32 2007 +0200
+++ b/lib/iec_std_lib.h	Fri Jul 13 19:20:26 2007 +0200
@@ -8,6 +8,7 @@
 #include <time.h>
 #include <sys/types.h>
 
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdarg.h>
@@ -47,6 +48,7 @@
 typedef struct timespec TOD;
 
 #define __TIME_CMP(t1, t2) (t2.tv_sec == t1.tv_sec ? t2.tv_nsec - t1.tv_nsec : t1.tv_sec - t2.tv_sec) 
+extern TIME __CURRENT_TIME;
 
 #define STR_MAX_LEN 40
 typedef int8_t __strlen_t;
@@ -57,7 +59,6 @@
 
 #define __STR_CMP(str1, str2) memcmp((char*)&str1.body,(char*)&str2.body, str1.len < str2.len ? str1.len : str2.len)
 
-
 /* TODO
 typedef struct {
     __strlen_t len;
@@ -65,6 +66,28 @@
 } WSTRING;
 */
 
+#define __INIT_REAL 0
+#define __INIT_LREAL 0
+#define __INIT_SINT 0
+#define __INIT_INT 0
+#define __INIT_DINT 0
+#define __INIT_LINT 0
+#define __INIT_USINT 0
+#define __INIT_UINT 0
+#define __INIT_UDINT 0
+#define __INIT_ULINT 0
+#define __INIT_TIME (TIME){0,0}
+#define __INIT_BOOL 0
+#define __INIT_BYTE 0
+#define __INIT_WORD 0
+#define __INIT_DWORD 0
+#define __INIT_LWORD 0
+#define __INIT_STRING (STRING){0,""}
+//#define __INIT_WSTRING
+#define __INIT_DATE (DATE){0,0}
+#define __INIT_TOD (TOD){0,0}
+#define __INIT_DT (DT){0,0}
+
 typedef union __IL_DEFVAR_T {
     BOOL    BOOLvar;
 
@@ -100,7 +123,7 @@
 /*****************/
 
 /* function that generates an IEC runtime error */
-void IEC_error(void) {
+static inline void IEC_error(void) {
   /* TODO... */
   fprintf(stderr, "IEC 61131-3 runtime error.\n");
   /*exit(1);*/
@@ -193,25 +216,25 @@
 /***************/
 /*   Time ops  */
 /***************/
-inline TIME __date_and_time_to_time_of_day(TIME IN){
+static inline TIME __date_and_time_to_time_of_day(TIME IN){
   return (TIME){IN.tv_sec % 86400, IN.tv_nsec};
 }
-inline TIME __date_and_time_to_date(TIME IN){
+static inline TIME __date_and_time_to_date(TIME IN){
   return (TIME){IN.tv_sec - (IN.tv_sec % (24*60*60)), 0};
 }
-inline TIME __time_add(TIME IN1, TIME IN2){
+static inline TIME __time_add(TIME IN1, TIME IN2){
   TIME res ={IN1.tv_sec + IN2.tv_sec,
              IN1.tv_nsec + IN2.tv_nsec };
   __normalize_timespec(&res);
   return res;
 }
-inline TIME __time_sub(TIME IN1, TIME IN2){
+static inline TIME __time_sub(TIME IN1, TIME IN2){
   TIME res ={IN1.tv_sec - IN2.tv_sec,
              IN1.tv_nsec - IN2.tv_nsec };
   __normalize_timespec(&res);
   return res;
 }
-inline TIME __time_mul(TIME IN1, LREAL IN2){
+static inline TIME __time_mul(TIME IN1, LREAL IN2){
   LREAL s_f = IN1.tv_sec * IN2;
   time_t s = s_f;
   div_t ns = div((LREAL)IN1.tv_nsec * IN2, 1000000000);
@@ -220,7 +243,7 @@
   __normalize_timespec(&res);
   return res;
 }
-inline TIME __time_div(TIME IN1, LREAL IN2){
+static inline TIME __time_div(TIME IN1, LREAL IN2){
   LREAL s_f = IN1.tv_sec / IN2;
   time_t s = s_f;
   TIME res = {s,
@@ -232,36 +255,38 @@
 /***************/
 /* String ops  */
 /***************/
-inline UINT __len(STRING IN){
+static inline UINT __len(STRING IN){
     return IN.len;
 }
-inline STRING __left(STRING IN, SINT L){
-    STRING res = {0,};
-    memcpy(&res.body, &IN.body, L < res.len ? L : res.len);
-    return res;
-}
-inline STRING __right(STRING IN, SINT L){
-    STRING res = {0,};
+static inline STRING __left(STRING IN, SINT L){
+    STRING res = __INIT_STRING;
     L = L < IN.len ? L : IN.len;
-    memcpy(&res, &IN.body[IN.len - L], L);
+    memcpy(&res.body, &IN.body, L);
     res.len = L;
     return res;
 }
-inline STRING __mid(STRING IN, SINT L, SINT P){
-    STRING res = {0,};
+static inline STRING __right(STRING IN, SINT L){
+    STRING res = __INIT_STRING;
+    L = L < IN.len ? L : IN.len;
+    memcpy(&res.body, &IN.body[IN.len - L], L);
+    res.len = L;
+    return res;
+}
+static inline STRING __mid(STRING IN, SINT L, SINT P){
+    STRING res = __INIT_STRING;
     if(P <= IN.len){
 	    P -= 1; /* now can be used as [index]*/
 	    L = L + P <= IN.len ? L : IN.len - P;
-	    memcpy(&res, &IN.body[P] , L);
+	    memcpy(&res.body, &IN.body[P] , L);
         res.len = L;
     }
     return res;
 }
-inline STRING __concat(SINT param_count, ...){
+static inline STRING __concat(SINT param_count, ...){
   va_list ap;
   UINT i;
   __strlen_t charcount = 0;
-  STRING res = {0,};
+  STRING res = __INIT_STRING;
 
   va_start (ap, param_count);         /* Initialize the argument list.  */
 
@@ -279,11 +304,11 @@
   va_end (ap);                  /* Clean up.  */
   return res;
 }
-inline STRING __insert(STRING IN1, STRING IN2, SINT P){
-    STRING res = {0,};
+static inline STRING __insert(STRING IN1, STRING IN2, SINT P){
+    STRING res = __INIT_STRING;
     __strlen_t to_copy;
     
-    to_copy = P > IN1.len ? IN1.len : P;
+    to_copy = P > IN1.len ? IN1.len : P - 1;
     memcpy(&res.body, &IN1.body , to_copy);
     P = res.len = to_copy;
     
@@ -297,44 +322,54 @@
 
     return res;
 }
-inline STRING __delete(STRING IN, SINT L_value, SINT P){
-    STRING res = {0,};
+static inline STRING __delete(STRING IN, SINT L, SINT P){
+    STRING res = __INIT_STRING;
     __strlen_t to_copy;
     
-    to_copy = P > IN.len ? IN.len : P;
+    to_copy = P > IN.len ? IN.len : P-1;
     memcpy(&res.body, &IN.body , to_copy);
     P = res.len = to_copy;
 
-    to_copy = IN.len - P;
-    memcpy(&res.body[res.len], &IN.body[P] , to_copy);
-    res.len += to_copy;
-
-    return res;
-}
-inline STRING __replace(STRING IN1, STRING IN2, SINT L, SINT P){
-    STRING res = {0,};
+    if( IN.len > P + L ){
+        to_copy = IN.len - P - L;
+        memcpy(&res.body[res.len], &IN.body[P + L], to_copy);
+        res.len += to_copy;
+    }
+
+    return res;
+}
+static inline STRING __replace(STRING IN1, STRING IN2, SINT L, SINT P){
+    STRING res = __INIT_STRING;
     __strlen_t to_copy;
     
-    to_copy = P > IN1.len ? IN1.len : P;
+    to_copy = P > IN1.len ? IN1.len : P-1;
     memcpy(&res.body, &IN1.body , to_copy);
     P = res.len = to_copy;
     
-    to_copy = IN2.len + res.len > STR_MAX_LEN ? STR_MAX_LEN - res.len : IN2.len;
+    to_copy = IN2.len < L ? IN2.len : L;
+
+    if( to_copy + res.len > STR_MAX_LEN ) 
+       to_copy = STR_MAX_LEN - res.len;   
+
     memcpy(&res.body[res.len], &IN2.body , to_copy);
     res.len += to_copy;
 
-    to_copy = res.len < IN1.len ? IN1.len - res.len : 0;
-    memcpy(&res.body[res.len], &IN1.body[res.len] , to_copy);
-    res.len += to_copy;
-
-    return res;
-}
-
-
-
-inline UINT __pfind(STRING* IN1, STRING* IN2){
-    UINT count1 = 0;
-    UINT count2 = 0;
+    P += L;
+    if( res.len <  STR_MAX_LEN && P < IN1.len)
+    {
+        to_copy = IN1.len - P;
+        memcpy(&res.body[res.len], &IN1.body[P] , to_copy);
+        res.len += to_copy;
+    }
+
+    return res;
+}
+
+
+
+static inline UINT __pfind(STRING* IN1, STRING* IN2){
+    UINT count1 = 0; /* offset of first matching char in IN1 */
+    UINT count2 = 0; /* count of matching char */
     while(count1 + count2 < IN1->len && count2 < IN2->len)
     {
         if(IN1->body[count1 + count2] != IN2->body[count2++]){
@@ -342,9 +377,9 @@
             count2 = 0;
         }        
     }
-    return count2 == IN2->len ? 0 : count1;
-}
-inline UINT __find(STRING IN1, STRING IN2){
+    return count2 == IN2->len -1 ? 0 : count1 + 1;
+}
+static inline UINT __find(STRING IN1, STRING IN2){
     return __pfind(&IN1, &IN2);
 }
 
@@ -354,32 +389,32 @@
     /***************/
     /*  TO_STRING  */
     /***************/
-inline STRING __bool_to_string(BOOL IN)
+static inline STRING __bool_to_string(BOOL IN)
 {
     if(IN)
         return (STRING){4, "TRUE"};
     return (STRING){5,"FALSE"};
 }
-inline STRING __bit_to_string(LWORD IN){
-    STRING res = {0,};
+static inline STRING __bit_to_string(LWORD IN){
+    STRING res = __INIT_STRING;
     res.len = snprintf(res.body, STR_MAX_LEN, "16#%llx", IN);
     if(res.len > STR_MAX_LEN) res.len = STR_MAX_LEN;
     return res;
 }
-inline STRING __real_to_string(LREAL IN){
-    STRING res = {0,};
+static inline STRING __real_to_string(LREAL IN){
+    STRING res = __INIT_STRING;
     res.len = snprintf(res.body, STR_MAX_LEN, "%g", IN);
     if(res.len > STR_MAX_LEN) res.len = STR_MAX_LEN;
     return res;
 }
-inline STRING __sint_to_string(LINT IN){
-    STRING res = {0,};
+static inline STRING __sint_to_string(LINT IN){
+    STRING res = __INIT_STRING;
     res.len = snprintf(res.body, STR_MAX_LEN, "%lld", IN);
     if(res.len > STR_MAX_LEN) res.len = STR_MAX_LEN;
     return res;
 }
-inline STRING __uint_to_string(ULINT IN){
-    STRING res = {0,};
+static inline STRING __uint_to_string(ULINT IN){
+    STRING res = __INIT_STRING;
     res.len = snprintf(res.body, STR_MAX_LEN, "16#%llu", IN);
     if(res.len > STR_MAX_LEN) res.len = STR_MAX_LEN;
     return res;
@@ -387,11 +422,11 @@
     /***************/
     /* FROM_STRING */
     /***************/
-inline BOOL __string_to_bool(STRING IN){
+static inline BOOL __string_to_bool(STRING IN){
     return IN.len == 5 ? !memcmp(&IN.body,"TRUE", IN.len) : 0;
 }
 
-inline LINT __pstring_to_sint(STRING* IN){
+static inline LINT __pstring_to_sint(STRING* IN){
     LINT res = 0;
     char tmp[STR_MAX_LEN];
     char tmp2[STR_MAX_LEN];
@@ -444,22 +479,26 @@
                 res += ( c - '0') * fac;
                 fac *= 10;
                 shift += 1;
-            }
+            }else if( c >= '.' ){ /* reset value */
+                res = 0;
+                fac = 1;
+                shift = 0;
+            }            
         }
     }
     return res;
 }
 
-inline LINT __string_to_sint(STRING IN){
+static inline LINT __string_to_sint(STRING IN){
     return (LWORD)__pstring_to_sint(&IN);
 }
-inline LWORD __string_to_bit(STRING IN){
+static inline LWORD __string_to_bit(STRING IN){
     return (LWORD)__pstring_to_sint(&IN);
 }
-inline ULINT __string_to_uint(STRING IN){
+static inline ULINT __string_to_uint(STRING IN){
     return (ULINT)__pstring_to_sint(&IN);
 }
-inline LREAL __string_to_real(STRING IN){
+static inline LREAL __string_to_real(STRING IN){
     /* search the dot */
     __strlen_t l = IN.len;
     while(--l > 0 && IN.body[l] != '.');
@@ -473,14 +512,14 @@
     /***************/
     /*   TO_TIME   */
     /***************/
-inline TIME __int_to_time(LINT IN){
+static inline TIME __int_to_time(LINT IN){
     return (TIME){IN, 0};
 }
 
-inline TIME __real_to_time(LREAL IN){
+static inline TIME __real_to_time(LREAL IN){
     return (TIME){IN, (IN - (LINT)IN) * 1000000000};
 }
-inline TIME __string_to_time(STRING IN){
+static inline TIME __string_to_time(STRING IN){
     /* TODO :
      *
      *  Duration literals without underlines: T#14ms    T#-14ms   T#14.7s   T#14.7m
@@ -516,15 +555,15 @@
     /***************/
     /*  FROM_TIME  */
     /***************/
-inline LREAL __time_to_real(TIME IN){
+static inline LREAL __time_to_real(TIME IN){
     return (LREAL)IN.tv_sec + ((LREAL)IN.tv_nsec/1000000000);
 }
-inline LINT __time_to_int(TIME IN){
+static inline LINT __time_to_int(TIME IN){
     return IN.tv_sec;
 }
-inline STRING __time_to_string(TIME IN){
+static inline STRING __time_to_string(TIME IN){
     /*t#5d14h12m18s3.5ms*/
-    STRING res = {0,};
+    STRING res = __INIT_STRING;
     div_t days = div(IN.tv_sec ,86400);
     if(!days.rem && IN.tv_nsec == 0){
         res.len = snprintf((char*)&res.body, STR_MAX_LEN, "T#%dd", days.quot);
@@ -548,9 +587,9 @@
     if(res.len > STR_MAX_LEN) res.len = STR_MAX_LEN;
     return res;
 }
-inline STRING __date_to_string(DATE IN){
+static inline STRING __date_to_string(DATE IN){
     /* D#1984-06-25 */
-    STRING res = {0,};
+    STRING res = __INIT_STRING;
     struct tm broken_down_time;
     time_t seconds = IN.tv_sec;
     if (NULL == gmtime_r(&seconds, &broken_down_time)){ /* get the UTC (GMT) broken down time */
@@ -561,9 +600,9 @@
     if(res.len > STR_MAX_LEN) res.len = STR_MAX_LEN;
     return res;
 }
-inline STRING __tod_to_string(TOD IN){
+static inline STRING __tod_to_string(TOD IN){
     /* TOD#15:36:55.36 */
-    STRING res = {0,};
+    STRING res = __INIT_STRING;
     struct tm broken_down_time;
     time_t seconds = IN.tv_sec;
     if (NULL == gmtime_r(&seconds, &broken_down_time)){ /* get the UTC (GMT) broken down time */
@@ -578,7 +617,7 @@
     if(res.len > STR_MAX_LEN) res.len = STR_MAX_LEN;
     return res;
 }
-inline STRING __dt_to_string(DT IN){
+static inline STRING __dt_to_string(DT IN){
     /* DT#1984-06-25-15:36:55.36 */
     STRING res;
     struct tm broken_down_time;
@@ -608,7 +647,7 @@
     return res;
 }
     /* BCD */
-inline ULINT __bcd_to_uint(LWORD IN){
+static inline ULINT __bcd_to_uint(LWORD IN){
     return IN & 0xf +
            ((IN >>= 4) & 0xf) * 10 + 
            ((IN >>= 4) & 0xf) * 100 + 
@@ -626,7 +665,7 @@
            ((IN >>= 4) & 0xf) * 100000000000000 + 
            ((IN >>= 4) & 0xf) * 1000000000000000;
 }
-inline LWORD __uint_to_bcd(ULINT IN){
+static inline LWORD __uint_to_bcd(ULINT IN){
     return (IN - (IN /= 10))|
            (IN - (IN /= 10)) << 4 |
            (IN - (IN /= 10)) << 8 |
@@ -649,7 +688,7 @@
 /* Binary ops */
 /**************/
 #define __ror_(TYPENAME)\
-inline TYPENAME __ror_##TYPENAME( TYPENAME IN, USINT N){\
+static inline TYPENAME __ror_##TYPENAME( TYPENAME IN, USINT N){\
  N %= 8*sizeof(TYPENAME);\
  return (IN >> N) | (IN << 8*sizeof(TYPENAME)-N);\
 }
@@ -657,7 +696,7 @@
 ANY_NBIT(__ror_)
 
 #define __rol_(TYPENAME)\
-inline TYPENAME __rol_##TYPENAME( TYPENAME IN, USINT N){\
+static inline TYPENAME __rol_##TYPENAME( TYPENAME IN, USINT N){\
  N %= 8*sizeof(TYPENAME);\
  return (IN << N) | (IN >> 8*sizeof(TYPENAME)-N);\
 }
@@ -672,7 +711,7 @@
 	/**************/
 
 #define __limit_(TYPENAME)\
-inline TYPENAME __limit_##TYPENAME( TYPENAME MN, TYPENAME IN, TYPENAME MX){\
+static inline TYPENAME __limit_##TYPENAME( TYPENAME MN, TYPENAME IN, TYPENAME MX){\
  return IN > MN ? IN < MX ? IN : MX : MN;\
 }
 
@@ -681,7 +720,7 @@
 ANY_NUM(__limit_)
 
 #define __limit_time(TYPENAME)\
-inline TIME __limit_##TYPENAME( TYPENAME MN, TYPENAME IN, TYPENAME MX){\
+static inline TIME __limit_##TYPENAME( TYPENAME MN, TYPENAME IN, TYPENAME MX){\
     return __TIME_CMP(IN, MN) > 0 ? /* IN>MN ?*/\
            __TIME_CMP(IN, MX) < 0 ? /* IN<MX ?*/\
            IN : MX : MN;\
@@ -691,7 +730,7 @@
 ANY_DATE(__limit_time)
 __limit_time(TIME)
 
-inline STRING __limit_STRING( STRING MN, STRING IN, STRING MX){
+static inline STRING __limit_STRING( STRING MN, STRING IN, STRING MX){
     return __STR_CMP(IN, MN) > 0 ? __STR_CMP(IN, MX) < 0 ? IN : MX : MN;
 }
 
@@ -723,7 +762,7 @@
 #define VA_ARGS_DT DT
 
 #define __extrem_(fname,TYPENAME, COND) \
-inline TYPENAME fname##TYPENAME( UINT param_count, TYPENAME op1, ...){\
+static inline TYPENAME fname##TYPENAME( UINT param_count, TYPENAME op1, ...){\
   va_list ap;\
   UINT i;\
   \
@@ -768,15 +807,16 @@
     /*     MUX    */
     /**************/
 #define __mux_(TYPENAME) \
-inline TYPENAME __mux_##TYPENAME( UINT param_count, UINT K, TYPENAME op1, ...){\
+static inline TYPENAME __mux_##TYPENAME( UINT param_count, UINT K, ...){\
   va_list ap;\
   UINT i;\
+  TYPENAME tmp = __INIT_##TYPENAME;\
   \
-  va_start (ap, op1);         /* Initialize the argument list.  */\
+  va_start (ap, K);         /* Initialize the argument list.  */\
   \
   for (i = 0; i < param_count; i++){\
     if(K == i){\
-        TYPENAME tmp = va_arg (ap, VA_ARGS_##TYPENAME);\
+        tmp = va_arg (ap, VA_ARGS_##TYPENAME);\
         va_end (ap);                  /* Clean up.  */\
         return tmp;\
     }else{\
@@ -785,7 +825,7 @@
   }\
   \
   va_end (ap);                  /* Clean up.  */\
-  return op1;\
+  return tmp;\
 }
 
 ANY(__mux_)
@@ -795,7 +835,7 @@
 /**************/
 
 #define __compare_(fname,TYPENAME, COND) \
-inline BOOL fname##TYPENAME( UINT param_count, TYPENAME op1, ...){\
+static inline BOOL fname##TYPENAME( UINT param_count, TYPENAME op1, ...){\
   va_list ap;\
   UINT i;\
   \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/test_iec_std_lib.c	Fri Jul 13 19:20:26 2007 +0200
@@ -0,0 +1,7 @@
+
+#include "iec_std_lib.h"
+
+int main(int argc,char **argv)
+{
+        return 0;
+}
--- a/stage1_2/iec.y	Thu Jul 12 11:24:32 2007 +0200
+++ b/stage1_2/iec.y	Fri Jul 13 19:20:26 2007 +0200
@@ -70,7 +70,7 @@
  * Printing of debug info must then be activated by setting
  * the variable yydebug to 1.
  */
-#define YYDEBUG 1
+#define YYDEBUG 0
 
 
 /* file with declaration of absyntax classes... */
--- a/stage4/generate_cc/generate_cc.cc	Thu Jul 12 11:24:32 2007 +0200
+++ b/stage4/generate_cc/generate_cc.cc	Fri Jul 13 19:20:26 2007 +0200
@@ -1146,19 +1146,19 @@
       current_resource_name->accept(*this);
       s4o.print("\n");
        
-      /* (A.2) POUs inclusion */
-      s4o.print("#include \"POUS.c\"\n\n");
-      
-      /* (A.3) Global variables... */
+      /* (A.2) Global variables... */
       if (current_global_vars != NULL) {
         vardecl = new generate_cc_vardecl_c(&s4o,
-                      generate_cc_vardecl_c::local_vf,
+                      generate_cc_vardecl_c::localstatic_vf,
                       generate_cc_vardecl_c::global_vt);
         vardecl->print(current_global_vars);
         delete vardecl;
       }
       s4o.print("\n");
       
+      /* (A.3) POUs inclusion */
+      s4o.print("#include \"POUS.c\"\n\n");
+      
       /* (A.4) Resource programs declaration... */
       wanted_declaretype = declare_dt;
       symbol->program_configuration_list->accept(*this);
@@ -1382,6 +1382,7 @@
   protected:
     stage4out_c &s4o;
     stage4out_c pous_s4o;
+    stage4out_c located_variables_s4o;
     generate_cc_pous_c generate_cc_pous;
 
     symbol_c *current_configuration;
@@ -1394,6 +1395,7 @@
     generate_cc_c(stage4out_c *s4o_ptr): 
             s4o(*s4o_ptr),
             pous_s4o("POUS", "c"),
+            located_variables_s4o("LOCATED_VARIABLES","h"),
             generate_cc_pous(&pous_s4o) {
       current_configuration = NULL;
     }
@@ -1404,7 +1406,7 @@
 /* B 0 - Programming Model */
 /***************************/
     void *visit(library_c *symbol) {
-      generate_location_list_c generate_location_list(&s4o);
+      generate_location_list_c generate_location_list(&located_variables_s4o);
       symbol->accept(generate_location_list);
       
       for(int i = 0; i < symbol->n; i++) {
@@ -1468,16 +1470,18 @@
       calculate_common_ticktime_c calculate_common_ticktime;
       symbol->accept(calculate_common_ticktime);
       common_ticktime = calculate_common_ticktime.get_ticktime();
-      s4o.print("common_ticktime : ");
-      s4o.print_integer((int)(common_ticktime / 1000000));
-      s4o.print("ms\n");
       
       symbol->configuration_name->accept(*this);
-    	stage4out_c config_s4o(current_name, "c");
-    	generate_cc_config_c generate_cc_config(&config_s4o);
-    	symbol->accept(generate_cc_config);
+      stage4out_c config_s4o(current_name, "c");
+      generate_cc_config_c generate_cc_config(&config_s4o);
+      symbol->accept(generate_cc_config);
+        
+      config_s4o.print("int common_ticktime__ = ");
+      config_s4o.print_integer((int)(common_ticktime / 1000000));
+      config_s4o.print("; /*ms*/\n");
+      
       symbol->resource_declarations->accept(*this);
-    	
+
       current_configuration = NULL;
       
       return NULL;
--- a/stage4/generate_cc/generate_cc_base.cc	Thu Jul 12 11:24:32 2007 +0200
+++ b/stage4/generate_cc/generate_cc_base.cc	Fri Jul 13 19:20:26 2007 +0200
@@ -194,13 +194,12 @@
    	}
 
     void *print_compare_function(const char *function,
-          const char *compare_sign,
+          symbol_c *compare_type,
           symbol_c *l_exp,
           symbol_c *r_exp) {
       s4o.print(function);
-      s4o.print("(");
-      s4o.print(compare_sign);
-      s4o.print(", ");
+      compare_type->accept(*this);
+      s4o.print("(2, ");
       l_exp->accept(*this);
       s4o.print(", ");
       r_exp->accept(*this);
--- a/stage4/generate_cc/generate_cc_il.cc	Thu Jul 12 11:24:32 2007 +0200
+++ b/stage4/generate_cc/generate_cc_il.cc	Fri Jul 13 19:20:26 2007 +0200
@@ -402,23 +402,15 @@
       this->default_variable_name.accept(*this);
       this->default_variable_name.current_type = backup;
 
-      if (search_expression_type->is_time_type(this->default_variable_name.current_type) &&
-          search_expression_type->is_time_type(this->current_operand_type)) {
-        s4o.print(" = __compare_timespec(");
-        s4o.print(operation);
-        s4o.print(", ");
-        this->default_variable_name.accept(*this);
-        s4o.print(", ");
-        o->accept(*this);
-        s4o.print(")");
-      }
-      else {
-        s4o.print(" = (");
-        this->default_variable_name.accept(*this);
-        s4o.print(operation);
-        o->accept(*this);
-        s4o.print(")");
-      }
+      s4o.print(" = ");
+      s4o.print(operation);
+      this->default_variable_name.current_type->accept(*this);
+      s4o.print("(2, ");
+      this->default_variable_name.accept(*this);
+      s4o.print(", ");
+      o->accept(*this);
+      s4o.print(")");
+
       /* the data type resulting from this operation... */
       this->default_variable_name.current_type = &(this->bool_type);
       return NULL;
@@ -1215,7 +1207,7 @@
 void *visit(ADD_operator_c *symbol)	{
   if (search_expression_type->is_time_type(this->default_variable_name.current_type) &&
       search_expression_type->is_time_type(this->current_operand_type)) {
-    XXX_function("__add_timespec", &(this->default_variable_name), this->current_operand);
+    XXX_function("__time_add", &(this->default_variable_name), this->current_operand);
     /* the data type resulting from this operation... */
     this->default_variable_name.current_type = this->current_operand_type;
     return NULL;
@@ -1234,7 +1226,7 @@
 void *visit(SUB_operator_c *symbol)	{
   if (search_expression_type->is_time_type(this->default_variable_name.current_type) &&
       search_expression_type->is_time_type(this->current_operand_type)) {
-    XXX_function("__sub_timespec", &(this->default_variable_name), this->current_operand);
+    XXX_function("__time_sub", &(this->default_variable_name), this->current_operand);
     /* the data type resulting from this operation... */
     this->default_variable_name.current_type = this->current_operand_type;
     return NULL;
@@ -1253,7 +1245,7 @@
 void *visit(MUL_operator_c *symbol)	{
   if (search_expression_type->is_time_type(this->default_variable_name.current_type) &&
       search_expression_type->is_integer_type(this->current_operand_type)) {
-    XXX_function("__mul_timespec", &(this->default_variable_name), this->current_operand);
+    XXX_function("__time_mul", &(this->default_variable_name), this->current_operand);
     /* the data type resulting from this operation... */
     this->default_variable_name.current_type = this->current_operand_type;
     return NULL;
@@ -1292,27 +1284,27 @@
 }
 
 void *visit(GT_operator_c *symbol)	{
-  return CMP_operator(this->current_operand, " > ");
+  return CMP_operator(this->current_operand, "__gt_");
 }
 
 void *visit(GE_operator_c *symbol)	{
-  return CMP_operator(this->current_operand, " >= ");
+  return CMP_operator(this->current_operand, "__ge_");
 }
 
 void *visit(EQ_operator_c *symbol)	{
-  return CMP_operator(this->current_operand, " == ");
+  return CMP_operator(this->current_operand, "__eq_");
 }
 
 void *visit(LT_operator_c *symbol)	{
-  return CMP_operator(this->current_operand, " < ");
+  return CMP_operator(this->current_operand, "__lt_");
 }
 
 void *visit(LE_operator_c *symbol)	{
-  return CMP_operator(this->current_operand, " <= ");
+  return CMP_operator(this->current_operand, "__le_");
 }
 
 void *visit(NE_operator_c *symbol)	{
-  return CMP_operator(this->current_operand, " != ");
+  return CMP_operator(this->current_operand, "__ne_");
 }
 
 
--- a/stage4/generate_cc/generate_cc_sfc.cc	Thu Jul 12 11:24:32 2007 +0200
+++ b/stage4/generate_cc/generate_cc_sfc.cc	Fri Jul 13 19:20:26 2007 +0200
@@ -783,7 +783,7 @@
       s4o.indent_right();
       s4o.print(s4o.indent_spaces);
       print_variable_prefix();
-      s4o.print("step_list[i].elapsed_time = __add_timespec(");
+      s4o.print("step_list[i].elapsed_time = __time_add(");
       print_variable_prefix();
       s4o.print("step_list[i].elapsed_time, PERIOD);\n");
       s4o.indent_left();
@@ -808,16 +808,16 @@
       s4o.print("action_list[i].reset = 0;\n");
       s4o.print(s4o.indent_spaces + "if (");
       print_variable_prefix();
-      s4o.print("__compare_timespec(>, action_list[i].set_remaining_time, __time_to_timespec(1, 0, 0, 0, 0, 0)) {\n");
-      s4o.indent_right();
-      s4o.print(s4o.indent_spaces);
-      print_variable_prefix();
-      s4o.print("action_list[i].set_remaining_time = __sub_timespec(");
+      s4o.print("__gt_TIME(action_list[i].set_remaining_time, __time_to_timespec(1, 0, 0, 0, 0, 0)) {\n");
+      s4o.indent_right();
+      s4o.print(s4o.indent_spaces);
+      print_variable_prefix();
+      s4o.print("action_list[i].set_remaining_time = __time_sub(");
       print_variable_prefix();
       s4o.print("action_list[i].set_remaining_time, PERIOD);\n");
       s4o.print(s4o.indent_spaces + "if (");
       print_variable_prefix();
-      s4o.print("__compare_timespec(<=, action_list[i].set_remaining_time, __time_to_timespec(1, 0, 0, 0, 0, 0)) {\n");
+      s4o.print("__le_TIME(action_list[i].set_remaining_time, __time_to_timespec(1, 0, 0, 0, 0, 0)) {\n");
       s4o.indent_right();
       s4o.print(s4o.indent_spaces);
       print_variable_prefix();
@@ -831,16 +831,16 @@
       s4o.print(s4o.indent_spaces + "}\n");
       s4o.print(s4o.indent_spaces + "if (");
       print_variable_prefix();
-      s4o.print("__compare_timespec(>, action_list[i].reset_remaining_time, __time_to_timespec(1, 0, 0, 0, 0, 0)) {\n");
-      s4o.indent_right();
-      s4o.print(s4o.indent_spaces);
-      print_variable_prefix();
-      s4o.print("action_list[i].reset_remaining_time = __sub_timespec(");
+      s4o.print("__gt_TIME(action_list[i].reset_remaining_time, __time_to_timespec(1, 0, 0, 0, 0, 0)) {\n");
+      s4o.indent_right();
+      s4o.print(s4o.indent_spaces);
+      print_variable_prefix();
+      s4o.print("action_list[i].reset_remaining_time = __time_sub(");
       print_variable_prefix();
       s4o.print("action_list[i].reset_remaining_time, PERIOD);\n");
       s4o.print(s4o.indent_spaces + "if (");
       print_variable_prefix();
-      s4o.print("__compare_timespec(<=, action_list[i].reset_remaining_time, __time_to_timespec(1, 0, 0, 0, 0, 0)) {\n");
+      s4o.print("__le_TIME(action_list[i].reset_remaining_time, __time_to_timespec(1, 0, 0, 0, 0, 0)) {\n");
       s4o.indent_right();
       s4o.print(s4o.indent_spaces);
       print_variable_prefix();
--- a/stage4/generate_cc/generate_cc_st.cc	Thu Jul 12 11:24:32 2007 +0200
+++ b/stage4/generate_cc/generate_cc_st.cc	Fri Jul 13 19:20:26 2007 +0200
@@ -202,7 +202,7 @@
   if (!search_expression_type->is_same_type(left_type, right_type))
       ERROR;
   if (search_expression_type->is_time_type(left_type))
-    return print_compare_function("__compare_timespec", "==", symbol->l_exp, symbol->r_exp);
+    return print_compare_function("__eq_", left_type, symbol->l_exp, symbol->r_exp);
   return print_binary_expression(symbol->l_exp, symbol->r_exp, " == ");
 }
 
@@ -212,7 +212,7 @@
   if (!search_expression_type->is_same_type(left_type, right_type))
       ERROR;
   if (search_expression_type->is_time_type(left_type))
-    return print_compare_function("__compare_timespec", "!=", symbol->l_exp, symbol->r_exp);
+    return print_compare_function("__ne_", left_type, symbol->l_exp, symbol->r_exp);
   return print_binary_expression(symbol->l_exp, symbol->r_exp, " != ");
 }
 
@@ -222,7 +222,7 @@
   if (!search_expression_type->is_same_type(left_type, right_type))
       ERROR;
   if (search_expression_type->is_time_type(left_type))
-    return print_compare_function("__compare_timespec", "<", symbol->l_exp, symbol->r_exp);
+    return print_compare_function("__lt_", left_type, symbol->l_exp, symbol->r_exp);
   return print_binary_expression(symbol->l_exp, symbol->r_exp, " < ");
 }
 
@@ -232,7 +232,7 @@
   if (!search_expression_type->is_same_type(left_type, right_type))
       ERROR;
   if (search_expression_type->is_time_type(left_type))
-    return print_compare_function("__compare_timespec", ">", symbol->l_exp, symbol->r_exp);
+    return print_compare_function("__gt_", left_type, symbol->l_exp, symbol->r_exp);
   return print_binary_expression(symbol->l_exp, symbol->r_exp, " > ");
 }
 
@@ -242,7 +242,7 @@
   if (!search_expression_type->is_same_type(left_type, right_type))
       ERROR;
   if (search_expression_type->is_time_type(left_type))
-    return print_compare_function("__compare_timespec", "<=", symbol->l_exp, symbol->r_exp);
+    return print_compare_function("__le_", left_type, symbol->l_exp, symbol->r_exp);
   return print_binary_expression(symbol->l_exp, symbol->r_exp, " <= ");
 }
 
@@ -252,7 +252,7 @@
   if (!search_expression_type->is_same_type(left_type, right_type))
       ERROR;
   if (search_expression_type->is_time_type(left_type))
-    return print_compare_function("__compare_timespec", ">=", symbol->l_exp, symbol->r_exp);
+    return print_compare_function("__ge_", left_type, symbol->l_exp, symbol->r_exp);
   return print_binary_expression(symbol->l_exp, symbol->r_exp, " >= ");
 }
 
@@ -262,7 +262,7 @@
 	if ((typeid(*left_type) == typeid(time_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) ||
       (typeid(*left_type) == typeid(tod_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) ||
       (typeid(*left_type) == typeid(dt_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)))
-    return print_binary_function("__add_timespec", symbol->l_exp, symbol->r_exp);
+    return print_binary_function("__time_add", symbol->l_exp, symbol->r_exp);
   if (!search_expression_type->is_same_type(left_type, right_type))
       ERROR;
   if (search_expression_type->is_integer_type(left_type) || search_expression_type->is_real_type(left_type))
@@ -280,7 +280,7 @@
       (typeid(*left_type) == typeid(tod_type_name_c) && typeid(*right_type) == typeid(tod_type_name_c)) ||
       (typeid(*left_type) == typeid(dt_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) ||
       (typeid(*left_type) == typeid(dt_type_name_c) && typeid(*right_type) == typeid(dt_type_name_c)))
-    return print_binary_function("__sub_timespec", symbol->l_exp, symbol->r_exp);
+    return print_binary_function("__time_sub", symbol->l_exp, symbol->r_exp);
   if (!search_expression_type->is_same_type(left_type, right_type))
       ERROR;
   if (search_expression_type->is_integer_type(left_type) || search_expression_type->is_real_type(left_type))
@@ -294,7 +294,7 @@
   symbol_c *right_type = search_expression_type->get_type(symbol->r_exp);
   if ((typeid(*left_type) == typeid(time_type_name_c) && search_expression_type->is_integer_type(right_type)) ||
       (typeid(*left_type) == typeid(time_type_name_c) && search_expression_type->is_real_type(right_type)))
-    return print_binary_function("__mul_timespec", symbol->l_exp, symbol->r_exp);
+    return print_binary_function("__time_mul", symbol->l_exp, symbol->r_exp);
   if (!search_expression_type->is_same_type(left_type, right_type))
       ERROR;
   if (search_expression_type->is_integer_type(left_type) || search_expression_type->is_real_type(left_type))
@@ -386,7 +386,7 @@
         case function_add:
           if (search_expression_type->is_time_type(function_return_type)) {
             if (current_param == 0) {
-              s4o.print("__add_timespec(");
+              s4o.print("__time_add(");
               param_value->accept(*this);
             }
             else if (current_param == 1) {
@@ -409,7 +409,7 @@
         case function_sub:
           if (search_expression_type->is_time_type(function_return_type)) {
             if (current_param == 0) {
-              s4o.print("__sub_timespec(");
+              s4o.print("__time_sub(");
               param_value->accept(*this);
             }
             else if (current_param == 1) {
@@ -595,7 +595,7 @@
   /* now call the function... */
   function_block_type_name->accept(*this);
   s4o.print(FB_FUNCTION_SUFFIX);
-  s4o.print("(");
+  s4o.print("(&");
   print_variable_prefix();
   symbol->fb_name->accept(*this);
   s4o.print(")");
--- a/stage4/generate_cc/generate_cc_vardecl.cc	Thu Jul 12 11:24:32 2007 +0200
+++ b/stage4/generate_cc/generate_cc_vardecl.cc	Fri Jul 13 19:20:26 2007 +0200
@@ -200,6 +200,7 @@
      */
     typedef enum {finterface_vf,
                     local_vf,
+                    localstatic_vf,
 		    localinit_vf,
 		    init_vf,
 		    constructorinit_vf,
@@ -327,7 +328,7 @@
             s4o.print(nv->get());
             this->current_var_type_symbol->accept(*this);
             s4o.print(FB_INIT_SUFFIX);
-            s4o.print("(");
+            s4o.print("(&");
             this->print_variable_prefix();
             list->elements[i]->accept(*this);
             s4o.print(");");
@@ -861,7 +862,7 @@
       s4o.print(nv->get());
       s4o.print("{extern ");
       this->current_var_type_symbol->accept(*this);
-      s4o.print(" ");
+      s4o.print(" *");
       symbol->global_var_name->accept(*this);
       s4o.print("; ");
       print_variable_prefix();
@@ -962,6 +963,7 @@
   /* now to produce the c equivalent... */
   switch(wanted_varformat) {
     case local_vf:
+    case localstatic_vf:
       /* NOTE: located variables must be declared static, as the connection to the
        * MatPLC point must be initialised at program startup, and not whenever
        * a new function block is instantiated!
@@ -972,17 +974,19 @@
        */
       s4o.print(s4o.indent_spaces);
       if (symbol->global_var_name != NULL) {
-        s4o.print("{extern ");
+        s4o.print("extern ");
         this->current_var_type_symbol->accept(*this);
         s4o.print(" ");
         symbol->location->accept(*this);
-        s4o.print("; ");
+        s4o.print(";\n");
+        if (wanted_varformat == localstatic_vf)
+          s4o.print("static ");
         this->current_var_type_symbol->accept(*this);
         s4o.print(" *");
         symbol->global_var_name->accept(*this);
         s4o.print(" = &");
         symbol->location->accept(*this);
-        s4o.print(";}\n");
+        s4o.print(";\n");
       }
       break;
 
--- a/stage4/generate_cc/generate_location_list.cc	Thu Jul 12 11:24:32 2007 +0200
+++ b/stage4/generate_cc/generate_location_list.cc	Fri Jul 13 19:20:26 2007 +0200
@@ -118,11 +118,12 @@
 /********************************************/
 
     void *visit(direct_variable_c *symbol) {
+      s4o.print("__LOCATED_VAR(");
       current_var_type_symbol->accept(*generate_cc_base);
-      s4o.print(" ");
+      s4o.print(",");
       /* Do not use print_token() as it will change everything into uppercase */
       s4o.printlocation((symbol->value)+1);
-      s4o.print("\n");
+      s4o.print(")\n");
       return NULL;
     }
 
--- a/stage4/generate_cc/il_code_gen.c	Thu Jul 12 11:24:32 2007 +0200
+++ b/stage4/generate_cc/il_code_gen.c	Fri Jul 13 19:20:26 2007 +0200
@@ -15019,7 +15019,7 @@
                         s4o.print_integer(nb_param);
                         s4o.print(",");
                         IN1_param_value->accept(*this);
-                        s4o.print(",&");
+                        s4o.print(",");
                         IN2_param_value->accept(*this);
                         
                         int base_num = 3;
@@ -15040,7 +15040,7 @@
                                 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(current_type_symbol, last_type_symbol) ? search_expression_type->common_type(current_type_symbol, last_type_symbol) : current_type_symbol ;
                             
                                 /*Function specific CODE */
-                                s4o.print(",&");
+                                s4o.print(",");
                                 param_value->accept(*this);
                                 
                             }
--- a/stage4/generate_cc/search_var_instance_decl.cc	Thu Jul 12 11:24:32 2007 +0200
+++ b/stage4/generate_cc/search_var_instance_decl.cc	Fri Jul 13 19:20:26 2007 +0200
@@ -316,11 +316,11 @@
       return NULL;
     }
 
-/*  AT direct_variable */
-//SYM_REF2(location_c, direct_variable, unused)
-    void *visit(location_c *symbol) {
-      if (compare_identifiers(symbol->direct_variable, search_name) == 0) {
-        current_vartype = located_vt;
+/*  [variable_name] location ':' located_var_spec_init */
+/* variable_name -> may be NULL ! */
+//SYM_REF4(located_var_decl_c, variable_name, location, located_var_spec_init, unused)
+    void *visit(located_var_decl_c *symbol) {
+      if (symbol->variable_name != NULL && compare_identifiers(symbol->variable_name, search_name) == 0) {
         return current_type_decl;
       }
       else
--- a/stage4/generate_cc/st_code_gen.c	Thu Jul 12 11:24:32 2007 +0200
+++ b/stage4/generate_cc/st_code_gen.c	Fri Jul 13 19:20:26 2007 +0200
@@ -16703,7 +16703,7 @@
                         s4o.print_integer(nb_param);
                         s4o.print(",");
                         IN1_param_value->accept(*this);
-                        s4o.print(",&");
+                        s4o.print(",");
                         IN2_param_value->accept(*this);
                         
                         int base_num = 3;
@@ -16724,7 +16724,7 @@
                                 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(current_type_symbol, last_type_symbol) ? search_expression_type->common_type(current_type_symbol, last_type_symbol) : current_type_symbol ;
                             
                                 /*Function specific CODE */
-                                s4o.print(",&");
+                                s4o.print(",");
                                 param_value->accept(*this);
                                 
                             }
--- a/stage4/generate_cc/test_iec_std_lib.c	Thu Jul 12 11:24:32 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#include "stdio.h"
-
-#include "iec_std_lib.h"
-
-int main(int argc,char **argv)
-{
-        return 0;
-}
--- a/stage4/stage4.cc	Thu Jul 12 11:24:32 2007 +0200
+++ b/stage4/stage4.cc	Fri Jul 13 19:20:26 2007 +0200
@@ -58,6 +58,12 @@
   filename += ".";
   filename += extension;
   std::fstream *file = new std::fstream(filename.c_str(), std::fstream::out);
+  if(file->fail()){
+    std::cerr << "Cannot open " << filename << " for write access \n";
+    exit(EXIT_FAILURE);
+  }else{
+    std::cout << filename << "\n";
+  }
   out = file;
   m_file = file;
   this->indent_level = indent_level;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/.cvsignore	Fri Jul 13 19:20:26 2007 +0200
@@ -0,0 +1,6 @@
+STD_TEST.st
+STD_RESSOURCE.c
+LOCATED_VARIABLES.h
+POUS.c
+test
+STD_CONF.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/STD_TEST.xml	Fri Jul 13 19:20:26 2007 +0200
@@ -0,0 +1,1914 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xmlns="http://www.plcopen.org/xml/tc6.xsd"
+         xmlns:xhtml="http://www.w3.org/1999/xhtml"
+         xsi:schemaLocation="http://www.plcopen.org/xml/tc6.xsd http://www.plcopen.org/xml/tc6.xsd">
+  <fileHeader contentDescription="This tests as most as possible IEC standard library"
+              companyName="LOLITECH"
+              companyURL="www.lolitech.com"
+              productName="BREMIZ"
+              productRelease="1"
+              productVersion="1"
+              creationDateTime="2007-07-07 11:58:26"/>
+  <contentHeader name="STD_TEST">
+    <coordinateInfo>
+      <fbd>
+        <scaling y="0" x="0"/>
+      </fbd>
+      <ld>
+        <scaling y="0" x="0"/>
+      </ld>
+      <sfc>
+        <scaling y="0" x="0"/>
+      </sfc>
+    </coordinateInfo>
+  </contentHeader>
+  <types>
+    <dataTypes/>
+    <pous>
+      <pou name="TEST_FROM_STRINGS" pouType="functionBlock">
+        <interface>
+          <inputVars>
+            <variable name="IN1">
+              <type>
+                <STRING/>
+              </type>
+            </variable>
+            <variable name="IN2">
+              <type>
+                <STRING/>
+              </type>
+            </variable>
+            <variable name="TESTNR">
+              <type>
+                <INT/>
+              </type>
+            </variable>
+          </inputVars>
+          <outputVars>
+            <variable name="INTRES">
+              <type>
+                <INT/>
+              </type>
+            </variable>
+            <variable name="NEXT_TEST">
+              <type>
+                <INT/>
+              </type>
+            </variable>
+            <variable name="TEST_NAME">
+              <type>
+                <STRING/>
+              </type>
+            </variable>
+          </outputVars>
+        </interface>
+        <body>
+          <FBD>
+            <inVariable localId="6" width="59" height="27">
+              <position y="243" x="272"/>
+              <connectionPointOut>
+                <relPosition y="13" x="59"/>
+              </connectionPointOut>
+              <expression>TESTNR</expression>
+            </inVariable>
+            <block localId="7" height="88" width="135" instanceName="" typeName="STRING_TO_INT">
+              <position y="510" x="629"/>
+              <inputVariables>
+                <variable formalParameter="IN">
+                  <connectionPointIn>
+                    <relPosition y="54" x="0"/>
+                    <connection refLocalId="25" formalParameter="IN">
+                      <position y="564" x="629"/>
+                      <position y="564" x="611"/>
+                      <position y="563" x="611"/>
+                      <position y="563" x="594"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition y="54" x="135"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <outVariable localId="8" width="92" height="47">
+              <position y="325" x="1064"/>
+              <connectionPointIn>
+                <relPosition y="23" x="0"/>
+                <connection refLocalId="16">
+                  <position y="348" x="1064"/>
+                  <position y="348" x="1047"/>
+                  <position y="355" x="1047"/>
+                  <position y="355" x="1030"/>
+                </connection>
+              </connectionPointIn>
+              <expression>INTRES</expression>
+            </outVariable>
+            <block localId="9" height="99" width="120" instanceName="" typeName="STRING_TO_REAL">
+              <position y="399" x="403"/>
+              <inputVariables>
+                <variable formalParameter="IN">
+                  <connectionPointIn>
+                    <relPosition y="59" x="0"/>
+                    <connection refLocalId="23" formalParameter="IN">
+                      <position y="458" x="403"/>
+                      <position y="458" x="377"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition y="59" x="120"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <block localId="11" height="114" width="115" instanceName="" typeName="LEN">
+              <position y="316" x="563"/>
+              <inputVariables>
+                <variable formalParameter="IN">
+                  <connectionPointIn>
+                    <relPosition y="67" x="0"/>
+                    <connection refLocalId="24" formalParameter="IN">
+                      <position y="383" x="563"/>
+                      <position y="383" x="542"/>
+                      <position y="371" x="542"/>
+                      <position y="371" x="521"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition y="67" x="115"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <block localId="16" height="240" width="107" instanceName="" typeName="MUX">
+              <position y="313" x="923"/>
+              <inputVariables>
+                <variable formalParameter="K">
+                  <connectionPointIn>
+                    <relPosition y="42" x="0"/>
+                    <connection refLocalId="60" formalParameter="K">
+                      <position y="355" x="923"/>
+                      <position y="355" x="880"/>
+                      <position y="293" x="880"/>
+                      <position y="293" x="852"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN0">
+                  <connectionPointIn>
+                    <relPosition y="86" x="0"/>
+                    <connection refLocalId="11" formalParameter="IN0">
+                      <position y="399" x="923"/>
+                      <position y="399" x="800"/>
+                      <position y="383" x="800"/>
+                      <position y="383" x="678"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN1">
+                  <connectionPointIn>
+                    <relPosition y="130" x="0"/>
+                    <connection refLocalId="19" formalParameter="IN1">
+                      <position y="443" x="923"/>
+                      <position y="443" x="856"/>
+                      <position y="460" x="856"/>
+                      <position y="460" x="789"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN2">
+                  <connectionPointIn>
+                    <relPosition y="174" x="0"/>
+                    <connection refLocalId="7" formalParameter="IN2">
+                      <position y="487" x="923"/>
+                      <position y="487" x="843"/>
+                      <position y="564" x="843"/>
+                      <position y="564" x="764"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN3">
+                  <connectionPointIn>
+                    <relPosition y="218" x="0"/>
+                    <connection refLocalId="57" formalParameter="IN3">
+                      <position y="531" x="923"/>
+                      <position y="531" x="870"/>
+                      <position y="643" x="870"/>
+                      <position y="643" x="710"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition y="42" x="107"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <block localId="17" height="60" width="100" instanceName="" typeName="MUL">
+              <position y="438" x="558"/>
+              <inputVariables>
+                <variable formalParameter="IN1">
+                  <connectionPointIn>
+                    <relPosition y="30" x="0"/>
+                    <connection refLocalId="9" formalParameter="IN1">
+                      <position y="468" x="558"/>
+                      <position y="468" x="535"/>
+                      <position y="458" x="535"/>
+                      <position y="458" x="523"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN2">
+                  <connectionPointIn>
+                    <relPosition y="50" x="0"/>
+                    <connection refLocalId="64">
+                      <position y="488" x="558"/>
+                      <position y="488" x="536"/>
+                      <position y="520" x="536"/>
+                      <position y="520" x="491"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition y="30" x="100"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <block localId="19" height="43" width="97" instanceName="" typeName="REAL_TO_INT">
+              <position y="429" x="692"/>
+              <inputVariables>
+                <variable formalParameter="IN">
+                  <connectionPointIn>
+                    <relPosition y="31" x="0"/>
+                    <connection refLocalId="17" formalParameter="IN">
+                      <position y="460" x="692"/>
+                      <position y="460" x="675"/>
+                      <position y="468" x="675"/>
+                      <position y="468" x="658"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition y="31" x="97"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <inVariable localId="23" width="89" height="30">
+              <position y="443" x="288"/>
+              <connectionPointOut>
+                <relPosition y="15" x="89"/>
+              </connectionPointOut>
+              <expression>IN1</expression>
+            </inVariable>
+            <inVariable localId="24" width="75" height="33">
+              <position y="355" x="446"/>
+              <connectionPointOut>
+                <relPosition y="16" x="75"/>
+              </connectionPointOut>
+              <expression>IN1</expression>
+            </inVariable>
+            <inVariable localId="25" width="71" height="29">
+              <position y="549" x="523"/>
+              <connectionPointOut>
+                <relPosition y="14" x="71"/>
+              </connectionPointOut>
+              <expression>IN2</expression>
+            </inVariable>
+            <block localId="57" height="60" width="63" instanceName="" typeName="FIND">
+              <position y="613" x="647"/>
+              <inputVariables>
+                <variable formalParameter="IN1">
+                  <connectionPointIn>
+                    <relPosition y="30" x="0"/>
+                    <connection refLocalId="58" formalParameter="IN1">
+                      <position y="643" x="647"/>
+                      <position y="643" x="633"/>
+                      <position y="631" x="633"/>
+                      <position y="631" x="609"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN2">
+                  <connectionPointIn>
+                    <relPosition y="50" x="0"/>
+                    <connection refLocalId="59" formalParameter="IN2">
+                      <position y="663" x="647"/>
+                      <position y="663" x="633"/>
+                      <position y="666" x="633"/>
+                      <position y="666" x="610"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition y="30" x="63"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <inVariable localId="58" width="31" height="27">
+              <position y="618" x="578"/>
+              <connectionPointOut>
+                <relPosition y="13" x="31"/>
+              </connectionPointOut>
+              <expression>IN1</expression>
+            </inVariable>
+            <inVariable localId="59" width="31" height="27">
+              <position y="653" x="579"/>
+              <connectionPointOut>
+                <relPosition y="13" x="31"/>
+              </connectionPointOut>
+              <expression>IN2</expression>
+            </inVariable>
+            <block localId="60" height="80" width="63" instanceName="" typeName="LIMIT">
+              <position y="263" x="789"/>
+              <inputVariables>
+                <variable formalParameter="MN">
+                  <connectionPointIn>
+                    <relPosition y="30" x="0"/>
+                    <connection refLocalId="65" formalParameter="MN">
+                      <position y="293" x="789"/>
+                      <position y="293" x="761"/>
+                      <position y="276" x="761"/>
+                      <position y="276" x="734"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN">
+                  <connectionPointIn>
+                    <relPosition y="50" x="0"/>
+                    <connection refLocalId="6" formalParameter="IN">
+                      <position y="313" x="789"/>
+                      <position y="313" x="700"/>
+                      <position y="256" x="700"/>
+                      <position y="256" x="331"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="MX">
+                  <connectionPointIn>
+                    <relPosition y="70" x="0"/>
+                    <connection refLocalId="62" formalParameter="MX">
+                      <position y="333" x="789"/>
+                      <position y="333" x="770"/>
+                      <position y="345" x="770"/>
+                      <position y="345" x="751"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition y="30" x="63"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <inVariable localId="62" width="38" height="27">
+              <position y="332" x="713"/>
+              <connectionPointOut>
+                <relPosition y="13" x="38"/>
+              </connectionPointOut>
+              <expression>3</expression>
+            </inVariable>
+            <comment localId="63" height="87" width="243">
+              <position y="32" x="34"/>
+              <content>The FROM STRING test machine</content>
+            </comment>
+            <inVariable localId="64" width="54" height="27">
+              <position y="507" x="453"/>
+              <connectionPointOut>
+                <relPosition y="13" x="54"/>
+              </connectionPointOut>
+              <expression>1000.0</expression>
+            </inVariable>
+            <inVariable localId="65" width="18" height="27">
+              <position y="263" x="716"/>
+              <connectionPointOut>
+                <relPosition y="13" x="18"/>
+              </connectionPointOut>
+              <expression>0</expression>
+            </inVariable>
+            <outVariable localId="66" width="83" height="27">
+              <position y="147" x="549"/>
+              <connectionPointIn>
+                <relPosition y="13" x="0"/>
+                <connection refLocalId="67" formalParameter="OUT">
+                  <position y="160" x="549"/>
+                  <position y="160" x="530"/>
+                  <position y="161" x="530"/>
+                  <position y="161" x="499"/>
+                </connection>
+              </connectionPointIn>
+              <expression>NEXT_TEST</expression>
+            </outVariable>
+            <block localId="67" height="60" width="63" typeName="ADD">
+              <position y="131" x="436"/>
+              <inputVariables>
+                <variable formalParameter="IN1">
+                  <connectionPointIn>
+                    <relPosition y="30" x="0"/>
+                    <connection refLocalId="68">
+                      <position y="161" x="436"/>
+                      <position y="161" x="398"/>
+                      <position y="150" x="398"/>
+                      <position y="150" x="348"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN2">
+                  <connectionPointIn>
+                    <relPosition y="50" x="0"/>
+                    <connection refLocalId="6">
+                      <position y="181" x="436"/>
+                      <position y="181" x="389"/>
+                      <position y="256" x="389"/>
+                      <position y="256" x="331"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition y="30" x="63"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <inVariable localId="68" width="18" height="27">
+              <position y="137" x="330"/>
+              <connectionPointOut>
+                <relPosition y="13" x="18"/>
+              </connectionPointOut>
+              <expression>1</expression>
+            </inVariable>
+            <inVariable localId="69" width="41" height="27">
+              <position y="463" x="1123"/>
+              <connectionPointOut>
+                <relPosition y="13" x="41"/>
+              </connectionPointOut>
+              <expression>'LEN'</expression>
+            </inVariable>
+            <inVariable localId="70" width="169" height="27">
+              <position y="510" x="1121"/>
+              <connectionPointOut>
+                <relPosition y="13" x="169"/>
+              </connectionPointOut>
+              <expression>'STRING_TO_REAL *1000'</expression>
+            </inVariable>
+            <inVariable localId="71" width="114" height="27">
+              <position y="554" x="1125"/>
+              <connectionPointOut>
+                <relPosition y="13" x="114"/>
+              </connectionPointOut>
+              <expression>'STRING_TO_INT'</expression>
+            </inVariable>
+            <inVariable localId="72" width="46" height="27">
+              <position y="608" x="1130"/>
+              <connectionPointOut>
+                <relPosition y="13" x="46"/>
+              </connectionPointOut>
+              <expression>'FIND'</expression>
+            </inVariable>
+            <block localId="73" height="274" width="69" instanceName="" typeName="MUX">
+              <position y="379" x="1303"/>
+              <inputVariables>
+                <variable formalParameter="K">
+                  <connectionPointIn>
+                    <relPosition y="45" x="0"/>
+                    <connection refLocalId="6">
+                      <position y="424" x="1303"/>
+                      <position y="424" x="1220"/>
+                      <position y="256" x="1220"/>
+                      <position y="256" x="331"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN0">
+                  <connectionPointIn>
+                    <relPosition y="95" x="0"/>
+                    <connection refLocalId="69">
+                      <position y="474" x="1303"/>
+                      <position y="474" x="1232"/>
+                      <position y="476" x="1232"/>
+                      <position y="476" x="1164"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN1">
+                  <connectionPointIn>
+                    <relPosition y="145" x="0"/>
+                    <connection refLocalId="70" formalParameter="IN1">
+                      <position y="524" x="1303"/>
+                      <position y="524" x="1274"/>
+                      <position y="523" x="1274"/>
+                      <position y="523" x="1247"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN2">
+                  <connectionPointIn>
+                    <relPosition y="195" x="0"/>
+                    <connection refLocalId="71">
+                      <position y="574" x="1303"/>
+                      <position y="574" x="1270"/>
+                      <position y="567" x="1270"/>
+                      <position y="567" x="1239"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN3">
+                  <connectionPointIn>
+                    <relPosition y="245" x="0"/>
+                    <connection refLocalId="72">
+                      <position y="624" x="1303"/>
+                      <position y="624" x="1238"/>
+                      <position y="621" x="1238"/>
+                      <position y="621" x="1176"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition y="45" x="69"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <outVariable localId="74" width="86" height="27">
+              <position y="411" x="1395"/>
+              <connectionPointIn>
+                <relPosition y="13" x="0"/>
+                <connection refLocalId="73" formalParameter="OUT">
+                  <position y="424" x="1395"/>
+                  <position y="424" x="1372"/>
+                </connection>
+              </connectionPointIn>
+              <expression>TEST_NAME</expression>
+            </outVariable>
+          </FBD>
+        </body>
+      </pou>
+      <pou name="TEST_TO_STRINGS" pouType="functionBlock">
+        <interface>
+          <inputVars>
+            <variable name="IN1">
+              <type>
+                <STRING/>
+              </type>
+            </variable>
+            <variable name="IN2">
+              <type>
+                <STRING/>
+              </type>
+            </variable>
+            <variable name="IN3">
+              <type>
+                <STRING/>
+              </type>
+            </variable>
+            <variable name="TESTNR">
+              <type>
+                <INT/>
+              </type>
+            </variable>
+            <variable name="K">
+              <type>
+                <INT/>
+              </type>
+            </variable>
+            <variable name="P">
+              <type>
+                <INT/>
+              </type>
+            </variable>
+            <variable name="L">
+              <type>
+                <INT/>
+              </type>
+            </variable>
+          </inputVars>
+          <outputVars>
+            <variable name="STRRES">
+              <type>
+                <STRING/>
+              </type>
+            </variable>
+            <variable name="NEXT_TEST">
+              <type>
+                <INT/>
+              </type>
+            </variable>
+            <variable name="TEST_NAME">
+              <type>
+                <STRING/>
+              </type>
+            </variable>
+          </outputVars>
+        </interface>
+        <body>
+          <FBD>
+            <block localId="1" height="242" width="93" instanceName="" typeName="MUX">
+              <position y="240" x="696"/>
+              <inputVariables>
+                <variable formalParameter="K">
+                  <connectionPointIn>
+                    <relPosition y="30" x="0"/>
+                    <connection refLocalId="6" formalParameter="K">
+                      <position y="270" x="696"/>
+                      <position y="270" x="455"/>
+                      <position y="216" x="455"/>
+                      <position y="216" x="287"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN0">
+                  <connectionPointIn>
+                    <relPosition y="50" x="0"/>
+                    <connection refLocalId="20" formalParameter="IN0">
+                      <position y="290" x="696"/>
+                      <position y="290" x="444"/>
+                      <position y="300" x="444"/>
+                      <position y="300" x="258"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN1">
+                  <connectionPointIn>
+                    <relPosition y="70" x="0"/>
+                    <connection refLocalId="21" formalParameter="IN1">
+                      <position y="310" x="696"/>
+                      <position y="310" x="467"/>
+                      <position y="331" x="467"/>
+                      <position y="331" x="257"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN2">
+                  <connectionPointIn>
+                    <relPosition y="90" x="0"/>
+                    <connection refLocalId="22" formalParameter="IN2">
+                      <position y="330" x="696"/>
+                      <position y="330" x="492"/>
+                      <position y="368" x="492"/>
+                      <position y="368" x="208"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN3">
+                  <connectionPointIn>
+                    <relPosition y="110" x="0"/>
+                    <connection refLocalId="27" formalParameter="IN3">
+                      <position y="350" x="696"/>
+                      <position y="350" x="510"/>
+                      <position y="415" x="510"/>
+                      <position y="415" x="360"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN4">
+                  <connectionPointIn>
+                    <relPosition y="130" x="0"/>
+                    <connection refLocalId="31" formalParameter="IN4">
+                      <position y="370" x="696"/>
+                      <position y="370" x="528"/>
+                      <position y="504" x="528"/>
+                      <position y="504" x="341"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN5">
+                  <connectionPointIn>
+                    <relPosition y="150" x="0"/>
+                    <connection refLocalId="34" formalParameter="IN5">
+                      <position y="390" x="696"/>
+                      <position y="390" x="543"/>
+                      <position y="580" x="543"/>
+                      <position y="580" x="338"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN6">
+                  <connectionPointIn>
+                    <relPosition y="170" x="0"/>
+                    <connection refLocalId="39" formalParameter="IN6">
+                      <position y="410" x="696"/>
+                      <position y="410" x="562"/>
+                      <position y="690" x="562"/>
+                      <position y="690" x="352"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN7">
+                  <connectionPointIn>
+                    <relPosition y="190" x="0"/>
+                    <connection refLocalId="46" formalParameter="IN7">
+                      <position y="430" x="696"/>
+                      <position y="430" x="587"/>
+                      <position y="789" x="587"/>
+                      <position y="789" x="319"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN8">
+                  <connectionPointIn>
+                    <relPosition y="210" x="0"/>
+                    <connection refLocalId="48" formalParameter="IN8">
+                      <position y="450" x="696"/>
+                      <position y="450" x="605"/>
+                      <position y="885" x="605"/>
+                      <position y="885" x="309"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN9">
+                  <connectionPointIn>
+                    <relPosition y="230" x="0"/>
+                    <connection refLocalId="52" formalParameter="IN9">
+                      <position y="470" x="696"/>
+                      <position y="470" x="625"/>
+                      <position y="1040" x="625"/>
+                      <position y="1040" x="318"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition y="30" x="93"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <outVariable localId="2" width="66" height="28">
+              <position y="242" x="839"/>
+              <connectionPointIn>
+                <relPosition y="14" x="0"/>
+                <connection refLocalId="1">
+                  <position y="256" x="839"/>
+                  <position y="256" x="807"/>
+                  <position y="270" x="807"/>
+                  <position y="270" x="789"/>
+                </connection>
+              </connectionPointIn>
+              <expression>STRRES</expression>
+            </outVariable>
+            <inVariable localId="6" width="59" height="27">
+              <position y="203" x="228"/>
+              <connectionPointOut>
+                <relPosition y="13" x="59"/>
+              </connectionPointOut>
+              <expression>TESTNR</expression>
+            </inVariable>
+            <inVariable localId="20" width="31" height="27">
+              <position y="287" x="227"/>
+              <connectionPointOut>
+                <relPosition y="13" x="31"/>
+              </connectionPointOut>
+              <expression>IN1</expression>
+            </inVariable>
+            <inVariable localId="21" width="32" height="29">
+              <position y="317" x="225"/>
+              <connectionPointOut>
+                <relPosition y="14" x="32"/>
+              </connectionPointOut>
+              <expression>IN2</expression>
+            </inVariable>
+            <inVariable localId="22" width="48" height="29">
+              <position y="354" x="160"/>
+              <connectionPointOut>
+                <relPosition y="14" x="48"/>
+              </connectionPointOut>
+              <expression>IN3</expression>
+            </inVariable>
+            <block localId="27" height="61" width="75" typeName="LEFT">
+              <position y="385" x="285"/>
+              <inputVariables>
+                <variable formalParameter="IN">
+                  <connectionPointIn>
+                    <relPosition y="30" x="0"/>
+                    <connection refLocalId="28" formalParameter="IN">
+                      <position y="415" x="285"/>
+                      <position y="415" x="264"/>
+                      <position y="407" x="264"/>
+                      <position y="407" x="193"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="L">
+                  <connectionPointIn>
+                    <relPosition y="50" x="0"/>
+                    <connection refLocalId="29" formalParameter="L">
+                      <position y="435" x="285"/>
+                      <position y="435" x="265"/>
+                      <position y="445" x="265"/>
+                      <position y="445" x="181"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition y="30" x="75"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <inVariable localId="28" width="35" height="30">
+              <position y="392" x="158"/>
+              <connectionPointOut>
+                <relPosition y="15" x="35"/>
+              </connectionPointOut>
+              <expression>IN1</expression>
+            </inVariable>
+            <inVariable localId="29" width="21" height="27">
+              <position y="432" x="160"/>
+              <connectionPointOut>
+                <relPosition y="13" x="21"/>
+              </connectionPointOut>
+              <expression>L</expression>
+            </inVariable>
+            <block localId="31" height="60" width="55" typeName="RIGHT">
+              <position y="474" x="286"/>
+              <inputVariables>
+                <variable formalParameter="IN">
+                  <connectionPointIn>
+                    <relPosition y="30" x="0"/>
+                    <connection refLocalId="32" formalParameter="IN">
+                      <position y="504" x="286"/>
+                      <position y="504" x="261"/>
+                      <position y="489" x="261"/>
+                      <position y="489" x="237"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="L">
+                  <connectionPointIn>
+                    <relPosition y="50" x="0"/>
+                    <connection refLocalId="33" formalParameter="L">
+                      <position y="524" x="286"/>
+                      <position y="524" x="250"/>
+                      <position y="537" x="250"/>
+                      <position y="537" x="215"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition y="30" x="55"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <inVariable localId="32" width="31" height="28">
+              <position y="475" x="206"/>
+              <connectionPointOut>
+                <relPosition y="14" x="31"/>
+              </connectionPointOut>
+              <expression>IN1</expression>
+            </inVariable>
+            <inVariable localId="33" width="17" height="27">
+              <position y="524" x="198"/>
+              <connectionPointOut>
+                <relPosition y="13" x="17"/>
+              </connectionPointOut>
+              <expression>L</expression>
+            </inVariable>
+            <block localId="34" height="80" width="55" typeName="MID">
+              <position y="550" x="283"/>
+              <inputVariables>
+                <variable formalParameter="IN">
+                  <connectionPointIn>
+                    <relPosition y="30" x="0"/>
+                    <connection refLocalId="35" formalParameter="IN">
+                      <position y="580" x="283"/>
+                      <position y="580" x="258"/>
+                      <position y="576" x="258"/>
+                      <position y="576" x="234"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="L">
+                  <connectionPointIn>
+                    <relPosition y="50" x="0"/>
+                    <connection refLocalId="38" formalParameter="L">
+                      <position y="600" x="283"/>
+                      <position y="600" x="232"/>
+                      <position y="594" x="232"/>
+                      <position y="594" x="182"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="P">
+                  <connectionPointIn>
+                    <relPosition y="70" x="0"/>
+                    <connection refLocalId="37" formalParameter="P">
+                      <position y="620" x="283"/>
+                      <position y="620" x="255"/>
+                      <position y="616" x="255"/>
+                      <position y="616" x="227"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition y="30" x="55"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <inVariable localId="35" width="31" height="27">
+              <position y="563" x="203"/>
+              <connectionPointOut>
+                <relPosition y="13" x="31"/>
+              </connectionPointOut>
+              <expression>IN1</expression>
+            </inVariable>
+            <inVariable localId="37" width="18" height="27">
+              <position y="603" x="209"/>
+              <connectionPointOut>
+                <relPosition y="13" x="18"/>
+              </connectionPointOut>
+              <expression>P</expression>
+            </inVariable>
+            <inVariable localId="38" width="17" height="27">
+              <position y="581" x="165"/>
+              <connectionPointOut>
+                <relPosition y="13" x="17"/>
+              </connectionPointOut>
+              <expression>L</expression>
+            </inVariable>
+            <block localId="39" height="83" width="67" typeName="CONCAT">
+              <position y="660" x="285"/>
+              <inputVariables>
+                <variable formalParameter="IN1">
+                  <connectionPointIn>
+                    <relPosition y="30" x="0"/>
+                    <connection refLocalId="40" formalParameter="IN1">
+                      <position y="690" x="285"/>
+                      <position y="690" x="252"/>
+                      <position y="664" x="252"/>
+                      <position y="664" x="219"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN2">
+                  <connectionPointIn>
+                    <relPosition y="51" x="0"/>
+                    <connection refLocalId="41" formalParameter="IN2">
+                      <position y="711" x="285"/>
+                      <position y="711" x="252"/>
+                      <position y="702" x="252"/>
+                      <position y="702" x="220"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN3">
+                  <connectionPointIn>
+                    <relPosition y="72" x="0"/>
+                    <connection refLocalId="42" formalParameter="IN3">
+                      <position y="732" x="285"/>
+                      <position y="732" x="252"/>
+                      <position y="737" x="252"/>
+                      <position y="737" x="219"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition y="30" x="67"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <inVariable localId="40" width="31" height="27">
+              <position y="651" x="188"/>
+              <connectionPointOut>
+                <relPosition y="13" x="31"/>
+              </connectionPointOut>
+              <expression>IN1</expression>
+            </inVariable>
+            <inVariable localId="41" width="31" height="27">
+              <position y="689" x="189"/>
+              <connectionPointOut>
+                <relPosition y="13" x="31"/>
+              </connectionPointOut>
+              <expression>IN2</expression>
+            </inVariable>
+            <inVariable localId="42" width="31" height="27">
+              <position y="724" x="188"/>
+              <connectionPointOut>
+                <relPosition y="13" x="31"/>
+              </connectionPointOut>
+              <expression>IN3</expression>
+            </inVariable>
+            <inVariable localId="44" width="31" height="27">
+              <position y="773" x="182"/>
+              <connectionPointOut>
+                <relPosition y="13" x="31"/>
+              </connectionPointOut>
+              <expression>IN1</expression>
+            </inVariable>
+            <inVariable localId="45" width="31" height="27">
+              <position y="802" x="178"/>
+              <connectionPointOut>
+                <relPosition y="13" x="31"/>
+              </connectionPointOut>
+              <expression>IN2</expression>
+            </inVariable>
+            <block localId="46" height="80" width="63" typeName="INSERT">
+              <position y="759" x="256"/>
+              <inputVariables>
+                <variable formalParameter="IN1">
+                  <connectionPointIn>
+                    <relPosition y="30" x="0"/>
+                    <connection refLocalId="44" formalParameter="IN1">
+                      <position y="789" x="256"/>
+                      <position y="789" x="234"/>
+                      <position y="786" x="234"/>
+                      <position y="786" x="213"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN2">
+                  <connectionPointIn>
+                    <relPosition y="50" x="0"/>
+                    <connection refLocalId="45" formalParameter="IN2">
+                      <position y="809" x="256"/>
+                      <position y="809" x="232"/>
+                      <position y="815" x="232"/>
+                      <position y="815" x="209"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="P">
+                  <connectionPointIn>
+                    <relPosition y="70" x="0"/>
+                    <connection refLocalId="47" formalParameter="P">
+                      <position y="829" x="256"/>
+                      <position y="829" x="228"/>
+                      <position y="852" x="228"/>
+                      <position y="852" x="200"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition y="30" x="63"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <inVariable localId="47" width="18" height="27">
+              <position y="839" x="182"/>
+              <connectionPointOut>
+                <relPosition y="13" x="18"/>
+              </connectionPointOut>
+              <expression>P</expression>
+            </inVariable>
+            <block localId="48" height="80" width="58" typeName="DELETE">
+              <position y="855" x="251"/>
+              <inputVariables>
+                <variable formalParameter="IN">
+                  <connectionPointIn>
+                    <relPosition y="30" x="0"/>
+                    <connection refLocalId="49" formalParameter="IN">
+                      <position y="885" x="251"/>
+                      <position y="885" x="228"/>
+                      <position y="892" x="228"/>
+                      <position y="892" x="205"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="L">
+                  <connectionPointIn>
+                    <relPosition y="50" x="0"/>
+                    <connection refLocalId="50" formalParameter="L">
+                      <position y="905" x="251"/>
+                      <position y="905" x="226"/>
+                      <position y="927" x="226"/>
+                      <position y="927" x="202"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="P">
+                  <connectionPointIn>
+                    <relPosition y="70" x="0"/>
+                    <connection refLocalId="51" formalParameter="P">
+                      <position y="925" x="251"/>
+                      <position y="925" x="233"/>
+                      <position y="968" x="233"/>
+                      <position y="968" x="216"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition y="30" x="58"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <inVariable localId="49" width="31" height="27">
+              <position y="879" x="174"/>
+              <connectionPointOut>
+                <relPosition y="13" x="31"/>
+              </connectionPointOut>
+              <expression>IN1</expression>
+            </inVariable>
+            <inVariable localId="50" width="17" height="27">
+              <position y="914" x="185"/>
+              <connectionPointOut>
+                <relPosition y="13" x="17"/>
+              </connectionPointOut>
+              <expression>L</expression>
+            </inVariable>
+            <inVariable localId="51" width="18" height="27">
+              <position y="955" x="198"/>
+              <connectionPointOut>
+                <relPosition y="13" x="18"/>
+              </connectionPointOut>
+              <expression>P</expression>
+            </inVariable>
+            <block localId="52" height="100" width="67" typeName="REPLACE">
+              <position y="1010" x="251"/>
+              <inputVariables>
+                <variable formalParameter="IN1">
+                  <connectionPointIn>
+                    <relPosition y="30" x="0"/>
+                    <connection refLocalId="53" formalParameter="IN1">
+                      <position y="1040" x="251"/>
+                      <position y="1040" x="227"/>
+                      <position y="1025" x="227"/>
+                      <position y="1025" x="203"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN2">
+                  <connectionPointIn>
+                    <relPosition y="50" x="0"/>
+                    <connection refLocalId="54" formalParameter="IN2">
+                      <position y="1060" x="251"/>
+                      <position y="1060" x="220"/>
+                      <position y="1055" x="220"/>
+                      <position y="1055" x="190"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="L">
+                  <connectionPointIn>
+                    <relPosition y="70" x="0"/>
+                    <connection refLocalId="55">
+                      <position y="1080" x="251"/>
+                      <position y="1080" x="224"/>
+                      <position y="1096" x="224"/>
+                      <position y="1096" x="197"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="P">
+                  <connectionPointIn>
+                    <relPosition y="90" x="0"/>
+                    <connection refLocalId="56" formalParameter="P">
+                      <position y="1100" x="251"/>
+                      <position y="1100" x="219"/>
+                      <position y="1134" x="219"/>
+                      <position y="1134" x="187"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition y="30" x="67"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <inVariable localId="53" width="31" height="27">
+              <position y="1012" x="172"/>
+              <connectionPointOut>
+                <relPosition y="13" x="31"/>
+              </connectionPointOut>
+              <expression>IN1</expression>
+            </inVariable>
+            <inVariable localId="54" width="31" height="27">
+              <position y="1042" x="159"/>
+              <connectionPointOut>
+                <relPosition y="13" x="31"/>
+              </connectionPointOut>
+              <expression>IN2</expression>
+            </inVariable>
+            <inVariable localId="55" width="31" height="27">
+              <position y="1083" x="166"/>
+              <connectionPointOut>
+                <relPosition y="13" x="31"/>
+              </connectionPointOut>
+              <expression>L</expression>
+            </inVariable>
+            <inVariable localId="56" width="18" height="27">
+              <position y="1121" x="169"/>
+              <connectionPointOut>
+                <relPosition y="13" x="18"/>
+              </connectionPointOut>
+              <expression>P</expression>
+            </inVariable>
+            <comment localId="63" height="87" width="209">
+              <position y="32" x="34"/>
+              <content>The TO STRING test machine</content>
+            </comment>
+            <outVariable localId="66" width="83" height="27">
+              <position y="147" x="549"/>
+              <connectionPointIn>
+                <relPosition y="13" x="0"/>
+                <connection refLocalId="67" formalParameter="OUT">
+                  <position y="160" x="549"/>
+                  <position y="160" x="530"/>
+                  <position y="161" x="530"/>
+                  <position y="161" x="499"/>
+                </connection>
+              </connectionPointIn>
+              <expression>NEXT_TEST</expression>
+            </outVariable>
+            <block localId="67" height="60" width="63" instanceName="" typeName="ADD">
+              <position y="131" x="436"/>
+              <inputVariables>
+                <variable formalParameter="IN1">
+                  <connectionPointIn>
+                    <relPosition y="30" x="0"/>
+                    <connection refLocalId="68" formalParameter="IN1">
+                      <position y="161" x="436"/>
+                      <position y="161" x="398"/>
+                      <position y="150" x="398"/>
+                      <position y="150" x="348"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN2">
+                  <connectionPointIn>
+                    <relPosition y="50" x="0"/>
+                    <connection refLocalId="6" formalParameter="IN2">
+                      <position y="181" x="436"/>
+                      <position y="181" x="389"/>
+                      <position y="216" x="389"/>
+                      <position y="216" x="287"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition y="30" x="63"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <inVariable localId="68" width="18" height="27">
+              <position y="137" x="330"/>
+              <connectionPointOut>
+                <relPosition y="13" x="18"/>
+              </connectionPointOut>
+              <expression>1</expression>
+            </inVariable>
+            <inVariable localId="69" width="37" height="27">
+              <position y="320" x="831"/>
+              <connectionPointOut>
+                <relPosition y="13" x="37"/>
+              </connectionPointOut>
+              <expression>'IN1'</expression>
+            </inVariable>
+            <inVariable localId="70" width="37" height="27">
+              <position y="349" x="835"/>
+              <connectionPointOut>
+                <relPosition y="13" x="37"/>
+              </connectionPointOut>
+              <expression>'IN2'</expression>
+            </inVariable>
+            <inVariable localId="71" width="37" height="27">
+              <position y="383" x="835"/>
+              <connectionPointOut>
+                <relPosition y="13" x="37"/>
+              </connectionPointOut>
+              <expression>'IN3'</expression>
+            </inVariable>
+            <inVariable localId="72" width="45" height="27">
+              <position y="445" x="843"/>
+              <connectionPointOut>
+                <relPosition y="13" x="45"/>
+              </connectionPointOut>
+              <expression>'LEFT'</expression>
+            </inVariable>
+            <inVariable localId="73" width="54" height="27">
+              <position y="506" x="858"/>
+              <connectionPointOut>
+                <relPosition y="13" x="54"/>
+              </connectionPointOut>
+              <expression>'RIGHT'</expression>
+            </inVariable>
+            <inVariable localId="74" width="40" height="27">
+              <position y="575" x="860"/>
+              <connectionPointOut>
+                <relPosition y="13" x="40"/>
+              </connectionPointOut>
+              <expression>'MID'</expression>
+            </inVariable>
+            <inVariable localId="75" width="69" height="27">
+              <position y="667" x="865"/>
+              <connectionPointOut>
+                <relPosition y="13" x="69"/>
+              </connectionPointOut>
+              <expression>'CONCAT'</expression>
+            </inVariable>
+            <inVariable localId="76" width="61" height="27">
+              <position y="755" x="875"/>
+              <connectionPointOut>
+                <relPosition y="13" x="61"/>
+              </connectionPointOut>
+              <expression>'INSERT'</expression>
+            </inVariable>
+            <inVariable localId="77" width="64" height="27">
+              <position y="877" x="878"/>
+              <connectionPointOut>
+                <relPosition y="13" x="64"/>
+              </connectionPointOut>
+              <expression>'DELETE'</expression>
+            </inVariable>
+            <inVariable localId="78" width="73" height="27">
+              <position y="1008" x="875"/>
+              <connectionPointOut>
+                <relPosition y="13" x="73"/>
+              </connectionPointOut>
+              <expression>'REPLACE'</expression>
+            </inVariable>
+            <block localId="79" height="240" width="63" instanceName="" typeName="MUX">
+              <position y="241" x="1130"/>
+              <inputVariables>
+                <variable formalParameter="K">
+                  <connectionPointIn>
+                    <relPosition y="30" x="0"/>
+                    <connection refLocalId="6">
+                      <position y="271" x="1130"/>
+                      <position y="271" x="988"/>
+                      <position y="216" x="988"/>
+                      <position y="216" x="287"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN0">
+                  <connectionPointIn>
+                    <relPosition y="50" x="0"/>
+                    <connection refLocalId="69">
+                      <position y="291" x="1130"/>
+                      <position y="291" x="890"/>
+                      <position y="333" x="890"/>
+                      <position y="333" x="868"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN1">
+                  <connectionPointIn>
+                    <relPosition y="70" x="0"/>
+                    <connection refLocalId="70">
+                      <position y="311" x="1130"/>
+                      <position y="311" x="911"/>
+                      <position y="362" x="911"/>
+                      <position y="362" x="872"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN2">
+                  <connectionPointIn>
+                    <relPosition y="90" x="0"/>
+                    <connection refLocalId="71">
+                      <position y="331" x="1130"/>
+                      <position y="331" x="929"/>
+                      <position y="396" x="929"/>
+                      <position y="396" x="872"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN3">
+                  <connectionPointIn>
+                    <relPosition y="110" x="0"/>
+                    <connection refLocalId="72">
+                      <position y="351" x="1130"/>
+                      <position y="351" x="955"/>
+                      <position y="458" x="955"/>
+                      <position y="458" x="888"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN4">
+                  <connectionPointIn>
+                    <relPosition y="130" x="0"/>
+                    <connection refLocalId="73">
+                      <position y="371" x="1130"/>
+                      <position y="371" x="977"/>
+                      <position y="519" x="977"/>
+                      <position y="519" x="912"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN5">
+                  <connectionPointIn>
+                    <relPosition y="150" x="0"/>
+                    <connection refLocalId="74">
+                      <position y="391" x="1130"/>
+                      <position y="391" x="999"/>
+                      <position y="588" x="999"/>
+                      <position y="588" x="900"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN6">
+                  <connectionPointIn>
+                    <relPosition y="170" x="0"/>
+                    <connection refLocalId="75">
+                      <position y="411" x="1130"/>
+                      <position y="411" x="1020"/>
+                      <position y="680" x="1020"/>
+                      <position y="680" x="934"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN7">
+                  <connectionPointIn>
+                    <relPosition y="190" x="0"/>
+                    <connection refLocalId="76">
+                      <position y="431" x="1130"/>
+                      <position y="431" x="1041"/>
+                      <position y="768" x="1041"/>
+                      <position y="768" x="936"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN8">
+                  <connectionPointIn>
+                    <relPosition y="210" x="0"/>
+                    <connection refLocalId="77">
+                      <position y="451" x="1130"/>
+                      <position y="451" x="1058"/>
+                      <position y="890" x="1058"/>
+                      <position y="890" x="942"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN9">
+                  <connectionPointIn>
+                    <relPosition y="230" x="0"/>
+                    <connection refLocalId="78">
+                      <position y="471" x="1130"/>
+                      <position y="471" x="1081"/>
+                      <position y="1021" x="1081"/>
+                      <position y="1021" x="948"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition y="30" x="63"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <outVariable localId="80" width="86" height="27">
+              <position y="307" x="1255"/>
+              <connectionPointIn>
+                <relPosition y="13" x="0"/>
+                <connection refLocalId="79" formalParameter="OUT">
+                  <position y="320" x="1255"/>
+                  <position y="320" x="1224"/>
+                  <position y="271" x="1224"/>
+                  <position y="271" x="1193"/>
+                </connection>
+              </connectionPointIn>
+              <expression>TEST_NAME</expression>
+            </outVariable>
+          </FBD>
+        </body>
+      </pou>
+      <pou name="MAIN_TEST" pouType="program">
+        <interface>
+          <localVars>
+            <variable name="STR1">
+              <type>
+                <STRING/>
+              </type>
+              <initialValue>
+                <simpleValue value="3.456789"/>
+              </initialValue>
+            </variable>
+            <variable name="INT1">
+              <type>
+                <INT/>
+              </type>
+              <initialValue>
+                <simpleValue value="1"/>
+              </initialValue>
+            </variable>
+          </localVars>
+          <localVars>
+            <variable name="RES_STR" address="%QB0">
+              <type>
+                <STRING/>
+              </type>
+            </variable>
+            <variable name="RES_INT" address="%QW1">
+              <type>
+                <INT/>
+              </type>
+            </variable>
+            <variable name="TEST_NB" address="%IW0">
+              <type>
+                <INT/>
+              </type>
+              <initialValue>
+                <simpleValue value="0"/>
+              </initialValue>
+            </variable>
+          </localVars>
+          <externalVars>
+            <variable name="TO_STR_TEST_NAME">
+              <type>
+                <STRING/>
+              </type>
+            </variable>
+            <variable name="FROM_STR_TEST_NAME">
+              <type>
+                <STRING/>
+              </type>
+            </variable>
+          </externalVars>
+        </interface>
+        <body>
+          <FBD>
+            <inVariable localId="2" width="42" height="27">
+              <position y="171" x="55"/>
+              <connectionPointOut>
+                <relPosition y="13" x="42"/>
+              </connectionPointOut>
+              <expression>STR1</expression>
+            </inVariable>
+            <inVariable localId="3" width="60" height="27">
+              <position y="202" x="55"/>
+              <connectionPointOut>
+                <relPosition y="13" x="60"/>
+              </connectionPointOut>
+              <expression>'456'</expression>
+            </inVariable>
+            <inVariable localId="4" width="75" height="27">
+              <position y="256" x="225"/>
+              <connectionPointOut>
+                <relPosition y="13" x="75"/>
+              </connectionPointOut>
+              <expression>'abcdefgh'</expression>
+            </inVariable>
+            <inVariable localId="5" width="38" height="27">
+              <position y="328" x="261"/>
+              <connectionPointOut>
+                <relPosition y="13" x="38"/>
+              </connectionPointOut>
+              <expression>INT1</expression>
+            </inVariable>
+            <inVariable localId="6" width="38" height="27">
+              <position y="360" x="257"/>
+              <connectionPointOut>
+                <relPosition y="13" x="38"/>
+              </connectionPointOut>
+              <expression>2</expression>
+            </inVariable>
+            <inVariable localId="7" width="38" height="27">
+              <position y="393" x="257"/>
+              <connectionPointOut>
+                <relPosition y="13" x="38"/>
+              </connectionPointOut>
+              <expression>3</expression>
+            </inVariable>
+            <outVariable localId="13" width="66" height="27">
+              <position y="188" x="567"/>
+              <connectionPointIn>
+                <relPosition y="13" x="0"/>
+                <connection refLocalId="19" formalParameter="STRRES">
+                  <position y="201" x="567"/>
+                  <position y="201" x="526"/>
+                  <position y="208" x="526"/>
+                  <position y="208" x="485"/>
+                </connection>
+              </connectionPointIn>
+              <expression>RES_STR</expression>
+            </outVariable>
+            <outVariable localId="14" width="62" height="27">
+              <position y="540" x="538"/>
+              <connectionPointIn>
+                <relPosition y="13" x="0"/>
+                <connection refLocalId="21">
+                  <position y="553" x="538"/>
+                  <position y="553" x="522"/>
+                  <position y="556" x="522"/>
+                  <position y="556" x="491"/>
+                </connection>
+              </connectionPointIn>
+              <expression>RES_INT</expression>
+            </outVariable>
+            <inVariable localId="17" width="67" height="27">
+              <position y="286" x="51"/>
+              <connectionPointOut>
+                <relPosition y="13" x="67"/>
+              </connectionPointOut>
+              <expression>TEST_NB</expression>
+            </inVariable>
+            <outVariable localId="18" width="67" height="27">
+              <position y="230" x="568"/>
+              <connectionPointIn>
+                <relPosition y="13" x="0"/>
+                <connection refLocalId="19" formalParameter="NEXT_TEST">
+                  <position y="243" x="568"/>
+                  <position y="243" x="523"/>
+                  <position y="240" x="523"/>
+                  <position y="240" x="485"/>
+                </connection>
+              </connectionPointIn>
+              <expression>TEST_NB</expression>
+            </outVariable>
+            <block localId="19" height="248" width="140" instanceName="my_to_str_test" typeName="TEST_TO_STRINGS">
+              <position y="172" x="345"/>
+              <inputVariables>
+                <variable formalParameter="IN1">
+                  <connectionPointIn>
+                    <relPosition y="36" x="0"/>
+                    <connection refLocalId="2">
+                      <position y="208" x="345"/>
+                      <position y="208" x="243"/>
+                      <position y="184" x="243"/>
+                      <position y="184" x="97"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN2">
+                  <connectionPointIn>
+                    <relPosition y="68" x="0"/>
+                    <connection refLocalId="3">
+                      <position y="240" x="345"/>
+                      <position y="240" x="243"/>
+                      <position y="215" x="243"/>
+                      <position y="215" x="115"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN3">
+                  <connectionPointIn>
+                    <relPosition y="100" x="0"/>
+                    <connection refLocalId="4">
+                      <position y="272" x="345"/>
+                      <position y="272" x="335"/>
+                      <position y="269" x="335"/>
+                      <position y="269" x="300"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="TESTNR">
+                  <connectionPointIn>
+                    <relPosition y="132" x="0"/>
+                    <connection refLocalId="17">
+                      <position y="304" x="345"/>
+                      <position y="304" x="231"/>
+                      <position y="299" x="231"/>
+                      <position y="299" x="118"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="K">
+                  <connectionPointIn>
+                    <relPosition y="164" x="0"/>
+                    <connection refLocalId="5">
+                      <position y="336" x="345"/>
+                      <position y="336" x="309"/>
+                      <position y="341" x="309"/>
+                      <position y="341" x="299"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="P">
+                  <connectionPointIn>
+                    <relPosition y="196" x="0"/>
+                    <connection refLocalId="6">
+                      <position y="368" x="345"/>
+                      <position y="368" x="305"/>
+                      <position y="373" x="305"/>
+                      <position y="373" x="295"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="L">
+                  <connectionPointIn>
+                    <relPosition y="228" x="0"/>
+                    <connection refLocalId="7">
+                      <position y="400" x="345"/>
+                      <position y="400" x="305"/>
+                      <position y="406" x="305"/>
+                      <position y="406" x="295"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="STRRES">
+                  <connectionPointOut>
+                    <relPosition y="36" x="140"/>
+                  </connectionPointOut>
+                </variable>
+                <variable formalParameter="NEXT_TEST">
+                  <connectionPointOut>
+                    <relPosition y="68" x="140"/>
+                  </connectionPointOut>
+                </variable>
+                <variable formalParameter="TEST_NAME">
+                  <connectionPointOut>
+                    <relPosition y="100" x="140"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <block localId="21" height="154" width="147" instanceName="my_from_str_test" typeName="TEST_FROM_STRINGS">
+              <position y="514" x="344"/>
+              <inputVariables>
+                <variable formalParameter="IN1">
+                  <connectionPointIn>
+                    <relPosition y="42" x="0"/>
+                    <connection refLocalId="2">
+                      <position y="556" x="344"/>
+                      <position y="556" x="180"/>
+                      <position y="184" x="180"/>
+                      <position y="184" x="97"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN2">
+                  <connectionPointIn>
+                    <relPosition y="86" x="0"/>
+                    <connection refLocalId="3">
+                      <position y="600" x="344"/>
+                      <position y="600" x="156"/>
+                      <position y="215" x="156"/>
+                      <position y="215" x="97"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="TESTNR">
+                  <connectionPointIn>
+                    <relPosition y="130" x="0"/>
+                    <connection refLocalId="17">
+                      <position y="644" x="344"/>
+                      <position y="644" x="137"/>
+                      <position y="299" x="137"/>
+                      <position y="299" x="118"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="INTRES">
+                  <connectionPointOut>
+                    <relPosition y="42" x="147"/>
+                  </connectionPointOut>
+                </variable>
+                <variable formalParameter="NEXT_TEST">
+                  <connectionPointOut>
+                    <relPosition y="86" x="147"/>
+                  </connectionPointOut>
+                </variable>
+                <variable formalParameter="TEST_NAME">
+                  <connectionPointOut>
+                    <relPosition y="130" x="147"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <outVariable localId="22" width="141" height="27">
+              <position y="279" x="601"/>
+              <connectionPointIn>
+                <relPosition y="13" x="0"/>
+                <connection refLocalId="19" formalParameter="TEST_NAME">
+                  <position y="292" x="601"/>
+                  <position y="292" x="543"/>
+                  <position y="272" x="543"/>
+                  <position y="272" x="485"/>
+                </connection>
+              </connectionPointIn>
+              <expression>TO_STR_TEST_NAME</expression>
+            </outVariable>
+            <outVariable localId="24" width="160" height="27">
+              <position y="631" x="534"/>
+              <connectionPointIn>
+                <relPosition y="13" x="0"/>
+                <connection refLocalId="21" formalParameter="TEST_NAME">
+                  <position y="644" x="534"/>
+                  <position y="644" x="491"/>
+                </connection>
+              </connectionPointIn>
+              <expression>FROM_STR_TEST_NAME</expression>
+            </outVariable>
+            <comment localId="25" height="37" width="111">
+              <position y="580" x="529"/>
+              <content>Unused</content>
+            </comment>
+          </FBD>
+        </body>
+      </pou>
+    </pous>
+  </types>
+  <instances>
+    <configurations>
+      <configuration name="STD_CONF">
+        <resource name="STD_RESSOURCE">
+          <task interval="00:00:00.100000" name="STD_TASK" priority="0"/>
+          <globalVars>
+            <variable name="FROM_STR_TEST_NAME" address="%QB10">
+              <type>
+                <STRING/>
+              </type>
+            </variable>
+          </globalVars>
+          <pouInstance type="MAIN_TEST" name="MAIN_INSTANCE"/>
+        </resource>
+        <globalVars>
+          <variable name="TO_STR_TEST_NAME" address="%QB4">
+            <type>
+              <STRING/>
+            </type>
+            <initialValue>
+              <simpleValue value="str test name"/>
+            </initialValue>
+          </variable>
+        </globalVars>
+      </configuration>
+    </configurations>
+  </instances>
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/build.sh	Fri Jul 13 19:20:26 2007 +0200
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+../iec2cc STD_TEST.st -I ../lib
+
+gcc -I ../lib -c -g STD_RESSOURCE.c
+
+gcc -I ../lib -c  -g STD_CONF.c
+
+gcc -I ../lib main.c STD_CONF.o STD_RESSOURCE.o -g -l rt -o test
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/main.c	Fri Jul 13 19:20:26 2007 +0200
@@ -0,0 +1,97 @@
+#include <time.h>
+#include <signal.h>
+
+#include "iec_std_lib.h"
+
+/*
+ * Functions and variables provied by generated C softPLC
+ **/ 
+void config_run__(int tick);
+void config_init__(void);
+extern int common_ticktime__;
+
+/*
+ *  Functions and variables to export to generated C softPLC
+ **/
+ 
+TIME __CURRENT_TIME;
+
+#define __LOCATED_VAR(type, name) type name;
+#include "LOCATED_VARIABLES.h"
+#undef __LOCATED_VAR
+
+#define print_BOOL(name) printf("  %s = (BOOL) %s\n",#name, name?"TRUE":"FALSE");
+#define print_SINT(name) printf("  %s = (SINT) %d\n",#name, name);
+#define print_INT(name) printf("  %s = (INT) %d\n",#name, name);
+#define print_DINT(name) printf("  %s = (DINT) %d\n",#name, name);
+#define print_LINT(name) printf("  %s = (LINT) %d\n",#name, name);
+#define print_USINT(name) printf("  %s = (USINT) %u\n",#name, name);
+#define print_UINT(name) printf("  %s = (UINT) %u\n",#name, name);
+#define print_UDINT(name) printf("  %s = (UDINT) %u\n",#name, name);
+#define print_ULINT(name) printf("  %s = (ULINT) %lu\n",#name, name);
+#define print_REAL(name) printf("  %s = (REAL) %f\n",#name, (double)name);
+#define print_LREAL(name) printf("  %s = (LREAL) %f\n",#name, (double)name);
+#define print_TIME(name) {tmp STRING = __time_to_string(name);tmp.body[tmp.len] = 0; printf("  %s = (TIME) %s*s\n",#name, tmp.len, &tmp.body);}
+#define print_DATE(name) {tmp STRING = __date_to_string(name);tmp.body[tmp.len] = 0; printf("  %s = (TIME) %*s\n",#name, tmp.len, &tmp.body);}
+#define print_TOD(name) {tmp STRING = __tod_to_string(name);tmp.body[tmp.len] = 0; printf("  %s = (TIME) %*s\n",#name, tmp.len, &tmp.body);}
+#define print_DT(name) {tmp STRING = __dt_to_string(name);tmp.body[tmp.len] = 0; printf("  %s = (TIME) %*s\n",#name, tmp.len, &tmp.body);}
+#define print_STRING(name) printf("  %s = (STRING) {%d, \"%*s\"}\n",#name, name.len, name.len, &name.body);
+#define print_BYTE(name) printf("  %s = (BYTE) 0x%2.2x\n",#name, name);
+#define print_WORD(name) printf("  %s = (WORD) 0x%d4.4\n",#name, name);
+#define print_DWORD(name) printf("  %s = (DWORD) 0x%d8.8\n",#name, name);
+#define print_LWORD(name) printf("  %s = (LWORD) 0x%d16.16\n",#name, name);
+
+static int tick = 0;
+void timer_notify(sigval_t val)
+{
+    clock_gettime(CLOCK_REALTIME, &__CURRENT_TIME);
+    printf("Tick %d\n",tick);
+    config_run__(tick++);
+    printf("  Located variables : \n");
+#define __LOCATED_VAR(type, name) print_##type(name);
+#include "LOCATED_VARIABLES.h"
+#undef __LOCATED_VAR
+}
+
+void catch_signal(int sig)
+{
+  signal(SIGTERM, catch_signal);
+  signal(SIGINT, catch_signal);
+  printf("Got Signal %d\n",sig);
+}
+
+#define maxval(a,b) ((a>b)?a:b)
+int main(int argc,char **argv)
+{
+    timer_t timer;
+    struct sigevent sigev;
+    long tv_nsec = 1000000 * (maxval(common_ticktime__,1)%1000);
+    time_t tv_sec = common_ticktime__/1000;
+    struct itimerspec timerValues;
+    
+    memset (&sigev, 0, sizeof (struct sigevent));
+    memset (&timerValues, 0, sizeof (struct itimerspec));
+    sigev.sigev_value.sival_int = 0;
+    sigev.sigev_notify = SIGEV_THREAD;
+    sigev.sigev_notify_attributes = NULL;
+    sigev.sigev_notify_function = timer_notify;
+    timerValues.it_value.tv_sec = tv_sec;
+    timerValues.it_value.tv_nsec = tv_nsec;
+    timerValues.it_interval.tv_sec = tv_sec;
+    timerValues.it_interval.tv_nsec = tv_nsec;
+
+    config_init__();
+
+    timer_create (CLOCK_REALTIME, &sigev, &timer);
+    timer_settime (timer, 0, &timerValues, NULL);
+    
+    /* install signal handler for manual break */
+    signal(SIGTERM, catch_signal);
+    signal(SIGINT, catch_signal);
+    
+    pause();
+    
+    timer_delete (timer);
+    
+    return 0;
+}