stage4/generate_c/generate_var_list.cc
changeset 667 bd1360f29f15
parent 661 f537c3315f83
parent 626 9f2cefb98e60
child 718 a9f8cc778444
--- 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) {