stage4/generate_c/generate_c_vardecl.cc
changeset 762 a3d917474ae4
parent 661 f537c3315f83
child 793 268bf4ca5fa1
equal deleted inserted replaced
761:7b52623a2f37 762:a3d917474ae4
   193       identifier_c* type_name;
   193       identifier_c* type_name;
   194       switch (current_mode) {
   194       switch (current_mode) {
   195         case arraysize_am:
   195         case arraysize_am:
   196           symbol->array_subrange_list->accept(*this);
   196           symbol->array_subrange_list->accept(*this);
   197           array_base_type = symbol->non_generic_type_name;
   197           array_base_type = symbol->non_generic_type_name;
   198           array_default_value = (symbol_c *)symbol->non_generic_type_name->accept(*type_initial_value_c::instance());;
   198           array_default_value = type_initial_value_c::get(symbol->non_generic_type_name);
   199           if (array_default_value == NULL) ERROR;
   199           if (array_default_value == NULL) ERROR;
   200           break;
   200           break;
   201         case typedecl_am:
   201         case typedecl_am:
   202           s4o.print("__");
   202           s4o.print("__");
   203           symbol->non_generic_type_name->accept(*this);
   203           symbol->non_generic_type_name->accept(*this);
   616         
   616         
   617         if (element_value == NULL) {
   617         if (element_value == NULL) {
   618           if (current_element_type == NULL) ERROR;
   618           if (current_element_type == NULL) ERROR;
   619           
   619           
   620           /* If not, get the default value of this variable's type */
   620           /* If not, get the default value of this variable's type */
   621           element_value = (symbol_c *)current_element_type->accept(*type_initial_value_c::instance());
   621           element_value = type_initial_value_c::get(current_element_type);
   622         }
   622         }
   623         
   623         
   624         if (element_value == NULL) ERROR;
   624         if (element_value == NULL) ERROR;
   625         
   625         
   626         initialization_analyzer_c initialization_analyzer(element_value);
   626         initialization_analyzer_c initialization_analyzer(element_value);
   876       this->current_var_init_symbol = spec_init_sperator_c::get_init(symbol);
   876       this->current_var_init_symbol = spec_init_sperator_c::get_init(symbol);
   877       if (NULL == this->current_var_type_symbol)
   877       if (NULL == this->current_var_type_symbol)
   878         ERROR;
   878         ERROR;
   879       if (NULL == this->current_var_init_symbol) {
   879       if (NULL == this->current_var_init_symbol) {
   880         /* We try to find the data type's default value... */
   880         /* We try to find the data type's default value... */
   881         this->current_var_init_symbol = (symbol_c *)this->current_var_type_symbol->accept(*type_initial_value_c::instance());
   881         this->current_var_init_symbol = type_initial_value_c::get(this->current_var_type_symbol);
   882       /* Note that Function Block 'data types' do not have a default value, so we cannot abort if no default value is found! */
   882       /* Note that Function Block 'data types' do not have a default value, so we cannot abort if no default value is found! */
   883       /*
   883       /*
   884       if (NULL == this->current_var_init_symbol)
   884       if (NULL == this->current_var_init_symbol)
   885         ERROR;
   885         ERROR;
   886       */
   886       */