Fix bug with complex type inout variables while generating variable list
authorLaurent Bessard
Fri, 27 Jul 2012 15:40:44 +0200
changeset 409 8d876ad522f4
parent 408 34a5571c859c
child 410 c6486bd97392
Fix bug with complex type inout variables while generating variable list
stage4/generate_c/generate_var_list.cc
--- 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) {