stage4/generate_c/generate_var_list.cc
changeset 409 8d876ad522f4
parent 377 60b012b7793f
child 626 9f2cefb98e60
--- a/stage4/generate_c/generate_var_list.cc	Thu Mar 22 00:22:48 2012 +0100
+++ b/stage4/generate_c/generate_var_list.cc	Fri Jul 27 15:40:44 2012 +0200
@@ -474,7 +474,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...
@@ -484,6 +484,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) {
@@ -509,6 +529,31 @@
       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;
+    }
+
     /* fb_name_list ':' function_block_type_name ASSIGN structure_initialization */
     /* structure_initialization -> may be NULL ! */
     void *visit(fb_name_decl_c *symbol) {