stage4/generate_c/generate_c_il.cc
changeset 693 51a2fa6441b9
parent 690 6156ee2b4e32
child 721 5dc33058e041
equal deleted inserted replaced
692:c3287ffaee8c 693:51a2fa6441b9
   254 
   254 
   255   private:
   255   private:
   256     /* a small helper function */
   256     /* a small helper function */
   257     symbol_c *default_literal_type(symbol_c *symbol) {
   257     symbol_c *default_literal_type(symbol_c *symbol) {
   258       if (get_datatype_info_c::is_ANY_INT_literal(symbol)) {
   258       if (get_datatype_info_c::is_ANY_INT_literal(symbol)) {
   259         return &search_constant_type_c::lint_type_name;
   259         return &get_datatype_info_c::lint_type_name;
   260       }
   260       }
   261       else if (get_datatype_info_c::is_ANY_REAL_literal(symbol)) {
   261       else if (get_datatype_info_c::is_ANY_REAL_literal(symbol)) {
   262         return &search_constant_type_c::lreal_type_name;
   262         return &get_datatype_info_c::lreal_type_name;
   263       }
   263       }
   264       return symbol;
   264       return symbol;
   265     }
   265     }
   266 
   266 
   267     /* A helper function... */
   267     /* A helper function... */
   906           param_value = (symbol_c *)current_param_type->accept(*type_initial_value_c::instance());
   906           param_value = (symbol_c *)current_param_type->accept(*type_initial_value_c::instance());
   907         }
   907         }
   908         if (param_value == NULL) ERROR;
   908         if (param_value == NULL) ERROR;
   909         s4o.print("(");
   909         s4o.print("(");
   910         if (get_datatype_info_c::is_ANY_INT_literal(current_param_type))
   910         if (get_datatype_info_c::is_ANY_INT_literal(current_param_type))
   911           search_constant_type_c::lint_type_name.accept(*this);
   911           get_datatype_info_c::lint_type_name.accept(*this);
   912         else if (get_datatype_info_c::is_ANY_REAL_literal(current_param_type))
   912         else if (get_datatype_info_c::is_ANY_REAL_literal(current_param_type))
   913           search_constant_type_c::lreal_type_name.accept(*this);
   913           get_datatype_info_c::lreal_type_name.accept(*this);
   914         else
   914         else
   915           current_param_type->accept(*this);
   915           current_param_type->accept(*this);
   916         s4o.print(")");
   916         s4o.print(")");
   917         print_check_function(current_param_type, param_value);
   917         print_check_function(current_param_type, param_value);
   918         nb_param++;
   918         nb_param++;
  1294           /* If not, get the default value of this variable's type */
  1294           /* If not, get the default value of this variable's type */
  1295           param_value = (symbol_c *)current_param_type->accept(*type_initial_value_c::instance());
  1295           param_value = (symbol_c *)current_param_type->accept(*type_initial_value_c::instance());
  1296         }
  1296         }
  1297         if (param_value == NULL) ERROR;
  1297         if (param_value == NULL) ERROR;
  1298         s4o.print("(");
  1298         s4o.print("(");
  1299         if (get_datatype_info_c::is_ANY_INT_literal(current_param_type))
  1299         if      (get_datatype_info_c::is_ANY_INT_literal(current_param_type))
  1300           search_constant_type_c::lint_type_name.accept(*this);
  1300                  get_datatype_info_c::lint_type_name.accept(*this);
  1301         else if (get_datatype_info_c::is_ANY_REAL_literal(current_param_type))
  1301         else if (get_datatype_info_c::is_ANY_REAL_literal(current_param_type))
  1302           search_constant_type_c::lreal_type_name.accept(*this);
  1302                  get_datatype_info_c::lreal_type_name.accept(*this);
  1303         else
  1303         else
  1304           current_param_type->accept(*this);
  1304           current_param_type->accept(*this);
  1305         s4o.print(")");
  1305         s4o.print(")");
  1306         print_check_function(current_param_type, param_value);
  1306         print_check_function(current_param_type, param_value);
  1307         nb_param++;
  1307         nb_param++;