stage4/generate_c/generate_var_list.cc
changeset 409 8d876ad522f4
parent 377 60b012b7793f
child 626 9f2cefb98e60
equal deleted inserted replaced
408:34a5571c859c 409:8d876ad522f4
   472        * current_var_init_symbol private variables...
   472        * current_var_init_symbol private variables...
   473        */
   473        */
   474       update_var_type_symbol(symbol->array_spec_init);
   474       update_var_type_symbol(symbol->array_spec_init);
   475       
   475       
   476       declare_variables(symbol->var1_list);
   476       declare_variables(symbol->var1_list);
   477     
   477 
   478       /* Values no longer in scope, and therefore no longer used.
   478       /* Values no longer in scope, and therefore no longer used.
   479        * Make an effort to keep them set to NULL when not in use
   479        * Make an effort to keep them set to NULL when not in use
   480        * in order to catch bugs as soon as possible...
   480        * in order to catch bugs as soon as possible...
   481        */
   481        */
   482       reset_var_type_symbol();
   482       reset_var_type_symbol();
   483     
   483     
   484       return NULL;
   484       return NULL;
       
   485     }
       
   486 
       
   487     /*  var1_list ':' array_specification */
       
   488     //SYM_REF2(array_var_declaration_c, var1_list, array_specification)
       
   489     void *visit(array_var_declaration_c *symbol) {
       
   490        TRACE("array_var_declaration_c");
       
   491        /* Start off by setting the current_var_type_symbol and
       
   492         * current_var_init_symbol private variables...
       
   493         */
       
   494        update_var_type_symbol(symbol->array_specification);
       
   495 
       
   496        declare_variables(symbol->var1_list);
       
   497 
       
   498        /* Values no longer in scope, and therefore no longer used.
       
   499         * Make an effort to keep them set to NULL when not in use
       
   500         * in order to catch bugs as soon as possible...
       
   501         */
       
   502        reset_var_type_symbol();
       
   503 
       
   504        return NULL;
   485     }
   505     }
   486 
   506 
   487     /*  var1_list ':' initialized_structure */
   507     /*  var1_list ':' initialized_structure */
   488     // SYM_REF2(structured_var_init_decl_c, var1_list, initialized_structure)
   508     // SYM_REF2(structured_var_init_decl_c, var1_list, initialized_structure)
   489     void *visit(structured_var_init_decl_c *symbol) {
   509     void *visit(structured_var_init_decl_c *symbol) {
   507       reset_var_type_symbol();
   527       reset_var_type_symbol();
   508     
   528     
   509       return NULL;
   529       return NULL;
   510     }
   530     }
   511     
   531     
       
   532     /*  var1_list ':' structure_type_name */
       
   533     //SYM_REF2(structured_var_declaration_c, var1_list, structure_type_name)
       
   534     void *visit(structured_var_declaration_c *symbol) {
       
   535       TRACE("structured_var_declaration_c");
       
   536       /* Please read the comments inside the var1_init_decl_c
       
   537        * visitor, as they apply here too.
       
   538        */
       
   539 
       
   540       /* Start off by setting the current_var_type_symbol and
       
   541        * current_var_init_symbol private variables...
       
   542        */
       
   543       update_var_type_symbol(symbol->structure_type_name);
       
   544 
       
   545       /* now to produce the c equivalent... */
       
   546       declare_variables(symbol->var1_list);
       
   547 
       
   548       /* Values no longer in scope, and therefore no longer used.
       
   549        * Make an effort to keep them set to NULL when not in use
       
   550        * in order to catch bugs as soon as possible...
       
   551        */
       
   552       reset_var_type_symbol();
       
   553 
       
   554       return NULL;
       
   555     }
       
   556 
   512     /* fb_name_list ':' function_block_type_name ASSIGN structure_initialization */
   557     /* fb_name_list ':' function_block_type_name ASSIGN structure_initialization */
   513     /* structure_initialization -> may be NULL ! */
   558     /* structure_initialization -> may be NULL ! */
   514     void *visit(fb_name_decl_c *symbol) {
   559     void *visit(fb_name_decl_c *symbol) {
   515       TRACE("fb_name_decl_c");
   560       TRACE("fb_name_decl_c");
   516       /* Please read the comments inside the var1_init_decl_c
   561       /* Please read the comments inside the var1_init_decl_c