Merge
authorMario de Sousa <msousa@fe.up.pt>
Thu, 04 Oct 2012 15:10:45 +0100
changeset 667 bd1360f29f15
parent 666 8ba9ec4bae50 (current diff)
parent 633 73b56dc69e61 (diff)
child 668 90b6eb7f1775
Merge
absyntax_utils/search_base_type.cc
configure
stage1_2/iec_bison.yy
stage3/array_range_check.cc
stage3/constant_folding.cc
stage3/constant_folding.hh
stage4/generate_c/generate_c.cc
stage4/generate_c/generate_c_il.cc
stage4/generate_c/generate_c_inlinefcall.cc
stage4/generate_c/generate_c_st.cc
stage4/generate_c/generate_var_list.cc
--- a/absyntax_utils/search_base_type.cc	Thu Oct 04 14:30:51 2012 +0100
+++ b/absyntax_utils/search_base_type.cc	Thu Oct 04 15:10:45 2012 +0100
@@ -295,6 +295,11 @@
   return symbol->structure_specification->accept(*this);
 }
 
+/*  var1_list ':' structure_type_name */
+void *search_base_type_c::visit(structured_var_declaration_c *symbol) {
+	return symbol;
+}
+
 /* structure_type_name ASSIGN structure_initialization */
 /* structure_initialization may be NULL ! */
 void *search_base_type_c::visit(initialized_structure_c *symbol)	{
--- a/absyntax_utils/search_base_type.hh	Thu Oct 04 14:30:51 2012 +0100
+++ b/absyntax_utils/search_base_type.hh	Thu Oct 04 15:10:45 2012 +0100
@@ -203,6 +203,8 @@
        *       structure_element_declaration_list_c
        */
     void *visit(structure_type_declaration_c *symbol);
+  /*  var1_list ':' structure_type_name */
+    void *visit(structured_var_declaration_c *symbol);
   /* structure_type_name ASSIGN structure_initialization */
   /* structure_initialization may be NULL ! */
     void *visit(initialized_structure_c *symbol);
--- a/lib/iec_std_lib.h	Thu Oct 04 14:30:51 2012 +0100
+++ b/lib/iec_std_lib.h	Thu Oct 04 15:10:45 2012 +0100
@@ -100,7 +100,7 @@
 #define __DATE_LITERAL(value) __literal(DATE,value)
 #define __TOD_LITERAL(value) __literal(TOD,value)
 #define __DT_LITERAL(value) __literal(DT,value)
-#define __STRING_LITERAL(count,value) {count,value}
+#define __STRING_LITERAL(count,value) (STRING){count,value}
 #define __BYTE_LITERAL(value) __literal(BYTE,value)
 #define __WORD_LITERAL(value) __literal(WORD,value)
 #define __DWORD_LITERAL(value) __literal(DWORD,value,__32b_sufix)
--- a/lib/iec_types_all.h	Thu Oct 04 14:30:51 2012 +0100
+++ b/lib/iec_types_all.h	Thu Oct 04 15:10:45 2012 +0100
@@ -131,7 +131,7 @@
 
 typedef struct {
   BOOL stored;  // action storing state. 0 : not stored, 1: stored
-  BOOL state; // current action state. 0 : inative, 1: active
+  __IEC_BOOL_t state; // current action state. 0 : inative, 1: active
   BOOL set;   // set have been requested (reset each time the body is evaluated)
   BOOL reset; // reset have been requested (reset each time the body is evaluated)
   TIME set_remaining_time;    // time before set will be requested
--- a/stage1_2/iec_bison.yy	Thu Oct 04 14:30:51 2012 +0100
+++ b/stage1_2/iec_bison.yy	Thu Oct 04 15:10:45 2012 +0100
@@ -1020,6 +1020,8 @@
 
 %token N
 %token P
+%token P0
+%token P1
 /* NOTE: the following two clash with the R and S IL operators.
  * It will have to be handled when we include parsing of SFC...
  */
@@ -5243,6 +5245,8 @@
 | R		{$$ = new qualifier_c(strdup("R"), locloc(@$));}
 | S		{$$ = new qualifier_c(strdup("S"), locloc(@$));}
 | P		{$$ = new qualifier_c(strdup("P"), locloc(@$));}
+| P0	{$$ = new qualifier_c(strdup("P0"), locloc(@$));}
+| P1	{$$ = new qualifier_c(strdup("P1"), locloc(@$));}
 ;
 
 timed_qualifier:
--- a/stage1_2/iec_flex.ll	Thu Oct 04 14:30:51 2012 +0100
+++ b/stage1_2/iec_flex.ll	Thu Oct 04 15:10:45 2012 +0100
@@ -1387,6 +1387,8 @@
 SL		return SL;
 N		return N;
 P		return P;
+P0		return P0;
+P1		return P1;
 R		return R;
 S		return S;
 }
--- a/stage3/constant_folding.cc	Thu Oct 04 14:30:51 2012 +0100
+++ b/stage3/constant_folding.cc	Thu Oct 04 15:10:45 2012 +0100
@@ -332,12 +332,19 @@
 real64_t extract_real_value(symbol_c *sym, bool *overflow) {
   std::string str = "";
   real_c *real_sym;
+  fixed_point_c *fixed_point_sym;
   char   *endptr;
   real64_t ret;
 
-  if ((real_sym = dynamic_cast<real_c *>(sym)) == NULL) ERROR;
-  for(unsigned int i = 0; i < strlen(real_sym->value); i++)
-    if (real_sym->value[i] != '_') str += real_sym->value[i];
+  if ((real_sym = dynamic_cast<real_c *>(sym)) != NULL) {
+	for(unsigned int i = 0; i < strlen(real_sym->value); i++)
+      if (real_sym->value[i] != '_') str += real_sym->value[i];
+  }
+  else if ((fixed_point_sym = dynamic_cast<fixed_point_c *>(sym)) != NULL) {
+    for(unsigned int i = 0; i < strlen(fixed_point_sym->value); i++)
+      if (fixed_point_sym->value[i] != '_') str += fixed_point_sym->value[i];
+  }
+  else ERROR;
     
   errno = 0; // since strtoXX() may legally return 0, we must set errno to 0 to detect errors correctly!
   #if    (real64_t  == float)
@@ -899,7 +906,15 @@
 	return NULL;
 }
 
-
+/************************/
+/* B 1.2.3.1 - Duration */
+/********* **************/
+void *constant_folding_c::visit(fixed_point_c *symbol) {
+	bool overflow;
+	SET_CVALUE(real64, symbol, extract_real_value(symbol, &overflow));
+	if (overflow) SET_OVFLOW(real64, symbol);
+	return NULL;
+}
 
 
 
@@ -1158,4 +1173,4 @@
 void *constant_folding_c::visit(   not_expression_c *symbol) {symbol->  exp->accept(*this); return handle_not(symbol, symbol->exp);}
 
 /* TODO: handle function invocations... */
-// void *fill_candidate_datatypes_c::visit(function_invocation_c *symbol) {}
\ No newline at end of file
+// void *fill_candidate_datatypes_c::visit(function_invocation_c *symbol) {}
--- a/stage3/constant_folding.hh	Thu Oct 04 14:30:51 2012 +0100
+++ b/stage3/constant_folding.hh	Thu Oct 04 15:10:45 2012 +0100
@@ -81,6 +81,11 @@
     void *visit(boolean_true_c *symbol);
     void *visit(boolean_false_c *symbol);
 
+    /************************/
+    /* B 1.2.3.1 - Duration */
+    /********* **************/
+    void *visit(fixed_point_c *symbol);
+
     /****************************************/
     /* B.2 - Language IL (Instruction List) */
     /****************************************/
--- a/stage4/generate_c/generate_c.cc	Thu Oct 04 14:30:51 2012 +0100
+++ b/stage4/generate_c/generate_c.cc	Thu Oct 04 15:10:45 2012 +0100
@@ -352,12 +352,13 @@
   interval_c *interval = dynamic_cast<interval_c *>(symbol);
   duration_c *duration = dynamic_cast<duration_c *>(symbol);
   
-  if ((NULL == interval) && (NULL == duration)) ERROR;
+  if ((NULL == interval) && (NULL == duration))
+  	  {STAGE4_ERROR(symbol, symbol, "This type of interval value is not currently supported"); ERROR;}
 
   if (NULL != duration) {
     /* SYM_REF2(duration_c, neg, interval) */
     if (duration->neg != NULL)
-      {STAGE4_ERROR(duration, duration, "Negative TIME literals are not currently supported"); ERROR;}
+      {STAGE4_ERROR(duration, duration, "Negative TIME literals for interval are not currently supported"); ERROR;}
     return calculate_time(duration->interval);
   }
 
--- a/stage4/generate_c/generate_c_il.cc	Thu Oct 04 14:30:51 2012 +0100
+++ b/stage4/generate_c/generate_c_il.cc	Thu Oct 04 15:10:45 2012 +0100
@@ -647,17 +647,28 @@
 // SYM_REF2(structured_variable_c, record_variable, field_selector)
 void *visit(structured_variable_c *symbol) {
   TRACE("structured_variable_c");
+  bool type_is_complex = search_var_instance_decl->type_is_complex(symbol->record_variable);
   switch (wanted_variablegeneration) {
     case complextype_base_vg:
     case complextype_base_assignment_vg:
       symbol->record_variable->accept(*this);
+      if (!type_is_complex) {
+        s4o.print(".");
+        symbol->field_selector->accept(*this);
+      }
       break;
     case complextype_suffix_vg:
-    case assignment_vg:
-      symbol->record_variable->accept(*this);
-      s4o.print(".");
-      symbol->field_selector->accept(*this);
-      break;
+	  symbol->record_variable->accept(*this);
+	  if (type_is_complex) {
+		s4o.print(".");
+		symbol->field_selector->accept(*this);
+	  }
+	  break;
+	case assignment_vg:
+	  symbol->record_variable->accept(*this);
+	  s4o.print(".");
+	  symbol->field_selector->accept(*this);
+	  break;
     default:
       if (this->is_variable_prefix_null()) {
     	symbol->record_variable->accept(*this);
--- a/stage4/generate_c/generate_c_inlinefcall.cc	Thu Oct 04 14:30:51 2012 +0100
+++ b/stage4/generate_c/generate_c_inlinefcall.cc	Thu Oct 04 15:10:45 2012 +0100
@@ -401,15 +401,22 @@
     // SYM_REF2(structured_variable_c, record_variable, field_selector)
     void *visit(structured_variable_c *symbol) {
       TRACE("structured_variable_c");
+      bool type_is_complex = search_var_instance_decl->type_is_complex(symbol->record_variable);
       if (generating_inlinefunction) {
         switch (wanted_variablegeneration) {
           case complextype_base_vg:
             symbol->record_variable->accept(*this);
+            if (!type_is_complex) {
+          	  s4o.print(".");
+          	  symbol->field_selector->accept(*this);
+            }
             break;
           case complextype_suffix_vg:
             symbol->record_variable->accept(*this);
-            s4o.print(".");
-            symbol->field_selector->accept(*this);
+            if (type_is_complex) {
+              s4o.print(".");
+              symbol->field_selector->accept(*this);
+            }
             break;
           default:
             print_getter(symbol);
--- a/stage4/generate_c/generate_c_sfc.cc	Thu Oct 04 14:30:51 2012 +0100
+++ b/stage4/generate_c/generate_c_sfc.cc	Thu Oct 04 15:10:45 2012 +0100
@@ -51,6 +51,7 @@
     generate_c_il_c *generate_c_il;
     generate_c_st_c *generate_c_st;
     generate_c_SFC_IL_ST_c *generate_c_code;
+    search_var_instance_decl_c *search_var_instance_decl;
     
     int transition_number;
     std::list<TRANSITION> transition_list;
@@ -66,6 +67,7 @@
       generate_c_il = new generate_c_il_c(s4o_ptr, name, scope, variable_prefix);
       generate_c_st = new generate_c_st_c(s4o_ptr, name, scope, variable_prefix);
       generate_c_code = new generate_c_SFC_IL_ST_c(s4o_ptr, name, scope, variable_prefix);
+      search_var_instance_decl = new search_var_instance_decl_c(scope);
       this->set_variable_prefix(variable_prefix);
     }
     
@@ -74,7 +76,16 @@
       delete generate_c_il;
       delete generate_c_st;
       delete generate_c_code;
-    }
+      delete search_var_instance_decl;
+    }
+
+
+	bool is_variable(symbol_c *symbol) {
+	  /* we try to find the variable instance declaration, to determine if symbol is variable... */
+	  symbol_c *var_decl = search_var_instance_decl->get_decl(symbol);
+
+	  return var_decl != NULL;
+	}
 
     void reset_transition_number(void) {transition_number = 0;}
 
@@ -398,11 +409,13 @@
       switch (wanted_sfcgeneration) {
         case actionbody_sg:
           s4o.print(s4o.indent_spaces + "if(");
+          s4o.print(GET_VAR);
+          s4o.print("(");
           print_variable_prefix();
           s4o.print("__action_list[");
           s4o.print(SFC_STEP_ACTION_PREFIX);
           symbol->action_name->accept(*this);
-          s4o.print("].state) {\n");
+          s4o.print("].state)) {\n");
           s4o.indent_right();
           
           // generate action code
@@ -421,8 +434,8 @@
       if (symbol->step_name != NULL) {
         switch (wanted_sfcgeneration) {
           case transitiontest_sg:
-        	s4o.print(GET_VAR);
-        	s4o.print("(");
+            s4o.print(GET_VAR);
+            s4o.print("(");
             print_step_argument(symbol->step_name, "state");
             s4o.print(")");
             break;
@@ -446,8 +459,8 @@
       switch (wanted_sfcgeneration) {
         case transitiontest_sg:
           for(int i = 0; i < symbol->n; i++) {
-        	s4o.print(GET_VAR);
-        	s4o.print("(");
+            s4o.print(GET_VAR);
+            s4o.print("(");
             print_step_argument(symbol->elements[i], "state");
             s4o.print(")");
             if (i < symbol->n - 1) {
@@ -497,8 +510,10 @@
             s4o.print(")) {\n");
             s4o.indent_right();
             s4o.print(s4o.indent_spaces);
-            print_action_argument(symbol->action_name, "state");
-            s4o.print(" = 1;\n");
+            s4o.print(SET_VAR);
+            s4o.print("(");
+            print_action_argument(symbol->action_name, "state", true);
+            s4o.print(",1);\n");
             s4o.indent_left();
             s4o.print(s4o.indent_spaces + "}");
           }
@@ -519,11 +534,15 @@
                 strcmp(qualifier, "R") == 0) {
               s4o.print("active");
             }
-            if (strcmp(qualifier, "P") == 0 || strcmp(qualifier, "SD") == 0 || 
-                strcmp(qualifier, "DS") == 0 || strcmp(qualifier, "SL") == 0) {
+            else if (strcmp(qualifier, "P") == 0 || strcmp(qualifier, "SD") == 0 ||
+                     strcmp(qualifier, "DS") == 0 || strcmp(qualifier, "SL") == 0 ||
+                     strcmp(qualifier, "P0") == 0) {
               s4o.print("activated");
             }
-            if (strcmp(qualifier, "D") == 0 || strcmp(qualifier, "L") == 0) {
+            else if (strcmp(qualifier, "P1") == 0) {
+              s4o.print("desactivated");
+            }
+            else if (strcmp(qualifier, "D") == 0 || strcmp(qualifier, "L") == 0) {
               s4o.print("active && __time_cmp(");
               print_step_argument(current_step, "elapsed_time");
               s4o.print(", ");
@@ -539,11 +558,48 @@
             s4o.indent_right();
             s4o.print(s4o.indent_spaces);
             if (strcmp(qualifier, "N") == 0 || strcmp(qualifier, "P") == 0 ||
-                strcmp(qualifier, "D") == 0 || strcmp(qualifier, "L") == 0) {
-              print_action_argument(current_action, "state");
-              s4o.print(" = 1;\n");  
-            }
-            if (strcmp(qualifier, "S") == 0) {
+                strcmp(qualifier, "D") == 0 || strcmp(qualifier, "L") == 0 ||
+                strcmp(qualifier, "P0") == 0 || strcmp(qualifier, "P1") == 0) {
+
+              if (is_variable(current_action)) {
+                unsigned int vartype = search_var_instance_decl->get_vartype(current_action);
+
+                if (vartype == search_var_instance_decl_c::external_vt)
+                  s4o.print(SET_EXTERNAL);
+                else if (vartype == search_var_instance_decl_c::located_vt)
+                  s4o.print(SET_LOCATED);
+                else
+                  s4o.print(SET_VAR);
+                s4o.print("(");
+                print_variable_prefix();
+                s4o.print(",");
+                current_action->accept(*this);
+                s4o.print(",1);\n");
+                s4o.indent_left();
+                s4o.print("}\n");
+                s4o.print(s4o.indent_spaces + "else if (active) {\n");
+                s4o.indent_right();
+                if (vartype == search_var_instance_decl_c::external_vt)
+                  s4o.print(SET_EXTERNAL);
+                else if (vartype == search_var_instance_decl_c::located_vt)
+                  s4o.print(SET_LOCATED);
+                else
+                  s4o.print(SET_VAR);
+                s4o.print("(");
+                print_variable_prefix();
+                s4o.print(",");
+                current_action->accept(*this);
+                s4o.print(",0);\n");
+              }
+
+              else {
+                s4o.print(SET_VAR);
+                s4o.print("(");
+                print_action_argument(current_action, "state", true);
+                s4o.print(",1);\n");
+              }
+            }
+            if (strcmp(qualifier, "S") == 0 || strcmp(qualifier, "SL") == 0) {
               print_action_argument(current_action, "set");
               s4o.print(" = 1;\n");
             }
@@ -714,8 +770,10 @@
       s4o.print("__nb_actions; i++) {\n");
       s4o.indent_right();
       s4o.print(s4o.indent_spaces);
-      print_variable_prefix();
-      s4o.print("__action_list[i].state = 0;\n");
+      s4o.print(SET_VAR);
+      s4o.print("(");
+      print_variable_prefix();
+      s4o.print(",__action_list[i].state,0);\n");
       s4o.print(s4o.indent_spaces);
       print_variable_prefix();
       s4o.print("__action_list[i].set = 0;\n");
@@ -834,10 +892,16 @@
       s4o.print("__action_list[i].stored = 0;\n");
       s4o.indent_left();
       s4o.print(s4o.indent_spaces + "}\n" + s4o.indent_spaces);
-      print_variable_prefix();
-      s4o.print("__action_list[i].state |= ");
-      print_variable_prefix();
-      s4o.print("__action_list[i].stored;\n");
+      s4o.print(SET_VAR);
+      s4o.print("(");
+      print_variable_prefix();
+      s4o.print(",__action_list[i].state,");
+      s4o.print(GET_VAR);
+      s4o.print("(");
+      print_variable_prefix();
+      s4o.print("__action_list[i].state) | ");
+      print_variable_prefix();
+      s4o.print("__action_list[i].stored);\n");
       s4o.indent_left();
       s4o.print(s4o.indent_spaces + "}\n\n");
       
@@ -846,27 +910,52 @@
       {
         std::list<VARIABLE>::iterator pt;
         for(pt = variable_list.begin(); pt != variable_list.end(); pt++) {
-          symbol_c *var_decl = search_var_instance_decl->get_decl(pt->symbol);
-          if (var_decl != NULL) {
+
+          if (is_variable(pt->symbol)) {
             unsigned int vartype = search_var_instance_decl->get_vartype(pt->symbol);
 
-            s4o.print(s4o.indent_spaces);
-            if (vartype == search_var_instance_decl_c::external_vt)
-          	  s4o.print(SET_EXTERNAL);
-          	else if (vartype == search_var_instance_decl_c::located_vt)
-          	  s4o.print(SET_LOCATED);
-          	else
-          	  s4o.print(SET_VAR);
-            s4o.print("(");
-          	print_variable_prefix();
-          	s4o.print(",");
-          	pt->symbol->accept(*this);
-            s4o.print(",");
+            s4o.print(s4o.indent_spaces + "if (");
             print_variable_prefix();
             s4o.print("__action_list[");
             s4o.print(SFC_STEP_ACTION_PREFIX);
             pt->symbol->accept(*this);
-            s4o.print("].state);\n");
+            s4o.print("].reset) {\n");
+            s4o.indent_right();
+            s4o.print(s4o.indent_spaces);
+            if (vartype == search_var_instance_decl_c::external_vt)
+              s4o.print(SET_EXTERNAL);
+            else if (vartype == search_var_instance_decl_c::located_vt)
+              s4o.print(SET_LOCATED);
+            else
+              s4o.print(SET_VAR);
+            s4o.print("(");
+            print_variable_prefix();
+            s4o.print(",");
+            pt->symbol->accept(*this);
+            s4o.print(",0);\n");
+            s4o.indent_left();
+            s4o.print(s4o.indent_spaces + "}\n");
+            s4o.print(s4o.indent_spaces + "else if (");
+            print_variable_prefix();
+            s4o.print("__action_list[");
+            s4o.print(SFC_STEP_ACTION_PREFIX);
+            pt->symbol->accept(*this);
+            s4o.print("].set) {\n");
+            s4o.indent_right();
+            s4o.print(s4o.indent_spaces);
+            if (vartype == search_var_instance_decl_c::external_vt)
+              s4o.print(SET_EXTERNAL);
+            else if (vartype == search_var_instance_decl_c::located_vt)
+              s4o.print(SET_LOCATED);
+            else
+              s4o.print(SET_VAR);
+            s4o.print("(");
+            print_variable_prefix();
+            s4o.print(",");
+            pt->symbol->accept(*this);
+            s4o.print(",1);\n");
+            s4o.indent_left();
+            s4o.print(s4o.indent_spaces + "}\n");
           }
         }
       }
@@ -889,9 +978,7 @@
     }
 
     void *visit(action_association_c *symbol) {
-      symbol_c *var_decl = search_var_instance_decl->get_decl(symbol->action_name);
-
-      if (var_decl != NULL) {
+      if (is_variable(symbol->action_name)) {
         std::list<VARIABLE>::iterator pt;
         for(pt = variable_list.begin(); pt != variable_list.end(); pt++) {
           if (!compare_identifiers(pt->symbol, symbol->action_name))
--- a/stage4/generate_c/generate_c_sfcdecl.cc	Thu Oct 04 14:30:51 2012 +0100
+++ b/stage4/generate_c/generate_c_sfcdecl.cc	Thu Oct 04 15:10:45 2012 +0100
@@ -156,7 +156,7 @@
           wanted_sfcdeclaration = sfcinit_sd;
           
           /* actions table initialisation */
-          s4o.print(s4o.indent_spaces + "static const ACTION temp_action = {0, 0, 0, 0, {0, 0}, {0, 0}};\n");
+          s4o.print(s4o.indent_spaces + "static const ACTION temp_action = {0, {0, 0}, 0, 0, {0, 0}, {0, 0}};\n");
           s4o.print(s4o.indent_spaces + "for(i = 0; i < ");
           print_variable_prefix();
           s4o.print("__nb_actions; i++) {\n");
@@ -192,6 +192,8 @@
           break;
         case actiondef_sd:
           s4o.print("// Actions definitions\n");
+          for(int i = 0; i < symbol->n; i++)
+             symbol->elements[i]->accept(*this);
           {
             std::list<VARIABLE>::iterator pt;
             for(pt = variable_list.begin(); pt != variable_list.end(); pt++) {
@@ -204,8 +206,6 @@
               action_number++;
             }
           }
-          for(int i = 0; i < symbol->n; i++)
-            symbol->elements[i]->accept(*this);
           s4o.print("\n");
           break;
         case stepundef_sd:
--- a/stage4/generate_c/generate_c_st.cc	Thu Oct 04 14:30:51 2012 +0100
+++ b/stage4/generate_c/generate_c_st.cc	Thu Oct 04 15:10:45 2012 +0100
@@ -319,12 +319,23 @@
 // SYM_REF2(structured_variable_c, record_variable, field_selector)
 void *visit(structured_variable_c *symbol) {
   TRACE("structured_variable_c");
+  bool type_is_complex = search_var_instance_decl->type_is_complex(symbol->record_variable);
   switch (wanted_variablegeneration) {
     case complextype_base_vg:
     case complextype_base_assignment_vg:
       symbol->record_variable->accept(*this);
+      if (!type_is_complex) {
+    	s4o.print(".");
+    	symbol->field_selector->accept(*this);
+      }
       break;
     case complextype_suffix_vg:
+      symbol->record_variable->accept(*this);
+      if (type_is_complex) {
+        s4o.print(".");
+        symbol->field_selector->accept(*this);
+      }
+      break;
     case assignment_vg:
       symbol->record_variable->accept(*this);
       s4o.print(".");
--- a/stage4/generate_c/generate_var_list.cc	Thu Oct 04 14:30:51 2012 +0100
+++ b/stage4/generate_c/generate_var_list.cc	Thu Oct 04 15:10:45 2012 +0100
@@ -349,7 +349,7 @@
           break;
       }
     }
-    
+
     void print_var_number(void) {
       char str[10];
       sprintf(str, "%d", current_var_number);
@@ -477,7 +477,7 @@
       update_var_type_symbol(symbol->array_spec_init);
       
       declare_variables(symbol->var1_list);
-    
+
       /* Values no longer in scope, and therefore no longer used.
        * Make an effort to keep them set to NULL when not in use
        * in order to catch bugs as soon as possible...
@@ -487,6 +487,26 @@
       return NULL;
     }
 
+    /*  var1_list ':' array_specification */
+    //SYM_REF2(array_var_declaration_c, var1_list, array_specification)
+    void *visit(array_var_declaration_c *symbol) {
+       TRACE("array_var_declaration_c");
+       /* Start off by setting the current_var_type_symbol and
+        * current_var_init_symbol private variables...
+        */
+       update_var_type_symbol(symbol->array_specification);
+
+       declare_variables(symbol->var1_list);
+
+       /* Values no longer in scope, and therefore no longer used.
+        * Make an effort to keep them set to NULL when not in use
+        * in order to catch bugs as soon as possible...
+        */
+       reset_var_type_symbol();
+
+       return NULL;
+    }
+
     /*  var1_list ':' initialized_structure */
     // SYM_REF2(structured_var_init_decl_c, var1_list, initialized_structure)
     void *visit(structured_var_init_decl_c *symbol) {
@@ -512,6 +532,37 @@
       return NULL;
     }
     
+    /*  var1_list ':' structure_type_name */
+    //SYM_REF2(structured_var_declaration_c, var1_list, structure_type_name)
+    void *visit(structured_var_declaration_c *symbol) {
+      TRACE("structured_var_declaration_c");
+      /* Please read the comments inside the var1_init_decl_c
+       * visitor, as they apply here too.
+       */
+
+      /* Start off by setting the current_var_type_symbol and
+       * current_var_init_symbol private variables...
+       */
+      update_var_type_symbol(symbol->structure_type_name);
+
+      /* now to produce the c equivalent... */
+      declare_variables(symbol->var1_list);
+
+      /* Values no longer in scope, and therefore no longer used.
+       * Make an effort to keep them set to NULL when not in use
+       * in order to catch bugs as soon as possible...
+       */
+      reset_var_type_symbol();
+
+      return NULL;
+    }
+
+    /* enumerated_value_list ',' enumerated_value */
+    void *visit(enumerated_value_list_c *symbol) {
+      this->current_var_type_name->accept(*this);
+      return NULL;
+    }
+    
     /* fb_name_list ':' function_block_type_name ASSIGN structure_initialization */
     /* structure_initialization -> may be NULL ! */
     void *visit(fb_name_decl_c *symbol) {