diff -r 242907849850 -r 76175defb87b stage4/generate_c/generate_c_st.cc --- a/stage4/generate_c/generate_c_st.cc Sat May 07 21:17:49 2016 +0100 +++ b/stage4/generate_c/generate_c_st.cc Sun May 08 20:01:15 2016 +0100 @@ -623,7 +623,7 @@ if (get_datatype_info_c::is_TIME_compatible (symbol->l_exp->datatype) || get_datatype_info_c::is_ANY_DATE_compatible (symbol->l_exp->datatype) || get_datatype_info_c::is_ANY_STRING_compatible(symbol->l_exp->datatype)) - return print_compare_function("EQ_", symbol->l_exp->datatype, symbol->l_exp, symbol->r_exp); + return print_compare_function("EQ", symbol->l_exp->datatype, symbol->l_exp, symbol->r_exp); return print_binary_expression(symbol->l_exp, symbol->r_exp, " == "); } @@ -631,7 +631,7 @@ if (get_datatype_info_c::is_TIME_compatible (symbol->l_exp->datatype) || get_datatype_info_c::is_ANY_DATE_compatible (symbol->l_exp->datatype) || get_datatype_info_c::is_ANY_STRING_compatible(symbol->l_exp->datatype)) - return print_compare_function("NE_", symbol->l_exp->datatype, symbol->l_exp, symbol->r_exp); + return print_compare_function("NE", symbol->l_exp->datatype, symbol->l_exp, symbol->r_exp); return print_binary_expression(symbol->l_exp, symbol->r_exp, " != "); } @@ -639,7 +639,7 @@ if (get_datatype_info_c::is_TIME_compatible (symbol->l_exp->datatype) || get_datatype_info_c::is_ANY_DATE_compatible (symbol->l_exp->datatype) || get_datatype_info_c::is_ANY_STRING_compatible(symbol->l_exp->datatype)) - return print_compare_function("LT_", symbol->l_exp->datatype, symbol->l_exp, symbol->r_exp); + return print_compare_function("LT", symbol->l_exp->datatype, symbol->l_exp, symbol->r_exp); return print_binary_expression(symbol->l_exp, symbol->r_exp, " < "); } @@ -647,7 +647,7 @@ if (get_datatype_info_c::is_TIME_compatible (symbol->l_exp->datatype) || get_datatype_info_c::is_ANY_DATE_compatible (symbol->l_exp->datatype) || get_datatype_info_c::is_ANY_STRING_compatible(symbol->l_exp->datatype)) - return print_compare_function("GT_", symbol->l_exp->datatype, symbol->l_exp, symbol->r_exp); + return print_compare_function("GT", symbol->l_exp->datatype, symbol->l_exp, symbol->r_exp); return print_binary_expression(symbol->l_exp, symbol->r_exp, " > "); } @@ -655,7 +655,7 @@ if (get_datatype_info_c::is_TIME_compatible (symbol->l_exp->datatype) || get_datatype_info_c::is_ANY_DATE_compatible (symbol->l_exp->datatype) || get_datatype_info_c::is_ANY_STRING_compatible(symbol->l_exp->datatype)) - return print_compare_function("LE_", symbol->l_exp->datatype, symbol->l_exp, symbol->r_exp); + return print_compare_function("LE", symbol->l_exp->datatype, symbol->l_exp, symbol->r_exp); return print_binary_expression(symbol->l_exp, symbol->r_exp, " <= "); } @@ -663,19 +663,11 @@ if (get_datatype_info_c::is_TIME_compatible (symbol->l_exp->datatype) || get_datatype_info_c::is_ANY_DATE_compatible (symbol->l_exp->datatype) || get_datatype_info_c::is_ANY_STRING_compatible(symbol->l_exp->datatype)) - return print_compare_function("GE_", symbol->l_exp->datatype, symbol->l_exp, symbol->r_exp); + return print_compare_function("GE", symbol->l_exp->datatype, symbol->l_exp, symbol->r_exp); return print_binary_expression(symbol->l_exp, symbol->r_exp, " >= "); } void *visit(add_expression_c *symbol) { -/* - symbol_c *left_type = symbol->l_exp->datatype; - symbol_c *right_type = symbol->r_exp->datatype; - if ((typeid(*left_type) == typeid(time_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) || - (typeid(*left_type) == typeid(tod_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) || - (typeid(*left_type) == typeid(dt_type_name_c) && typeid(*right_type) == typeid(time_type_name_c))) - return print_binary_function("__time_add", symbol->l_exp, symbol->r_exp); -*/ if (get_datatype_info_c::is_TIME_compatible (symbol->datatype) || get_datatype_info_c::is_ANY_DATE_compatible (symbol->datatype)) return print_binary_function("__time_add", symbol->l_exp, symbol->r_exp); @@ -683,17 +675,6 @@ } void *visit(sub_expression_c *symbol) { -/* - symbol_c *left_type = symbol->l_exp->datatype; - symbol_c *right_type = symbol->r_exp->datatype; - if ((typeid(*left_type) == typeid(time_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) || - (typeid(*left_type) == typeid(date_type_name_c) && typeid(*right_type) == typeid(date_type_name_c)) || - (typeid(*left_type) == typeid(tod_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) || - (typeid(*left_type) == typeid(tod_type_name_c) && typeid(*right_type) == typeid(tod_type_name_c)) || - (typeid(*left_type) == typeid(dt_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) || - (typeid(*left_type) == typeid(dt_type_name_c) && typeid(*right_type) == typeid(dt_type_name_c))) - return print_binary_function("__time_sub", symbol->l_exp, symbol->r_exp); -*/ if (get_datatype_info_c::is_TIME_compatible (symbol->datatype) || get_datatype_info_c::is_ANY_DATE_compatible (symbol->datatype)) return print_binary_function("__time_sub", symbol->l_exp, symbol->r_exp); @@ -701,26 +682,12 @@ } void *visit(mul_expression_c *symbol) { -/* - symbol_c *left_type = symbol->l_exp->datatype; - symbol_c *right_type = symbol->r_exp->datatype; - if ((typeid(*left_type) == typeid(time_type_name_c) && get_datatype_info_c::is_ANY_INT_compatible (right_type)) || - (typeid(*left_type) == typeid(time_type_name_c) && get_datatype_info_c::is_ANY_REAL_compatible(right_type))) - return print_binary_function("__time_mul", symbol->l_exp, symbol->r_exp); -*/ if (get_datatype_info_c::is_TIME_compatible (symbol->datatype)) return print_binary_function("__time_mul", symbol->l_exp, symbol->r_exp); return print_binary_expression(symbol->l_exp, symbol->r_exp, " * "); } void *visit(div_expression_c *symbol) { -/* - symbol_c *left_type = symbol->l_exp->datatype; - symbol_c *right_type = symbol->r_exp->datatype; - if ((typeid(*left_type) == typeid(time_type_name_c) && get_datatype_info_c::is_ANY_INT_compatible (right_type)) || - (typeid(*left_type) == typeid(time_type_name_c) && get_datatype_info_c::is_ANY_REAL_compatible(right_type))) - return print_binary_function("__time_div", symbol->l_exp, symbol->r_exp); -*/ if (get_datatype_info_c::is_TIME_compatible (symbol->datatype)) return print_binary_function("__time_div", symbol->l_exp, symbol->r_exp); return print_binary_expression(symbol->l_exp, symbol->r_exp, " / "); @@ -736,13 +703,9 @@ } void *visit(power_expression_c *symbol) { - s4o.print("EXPT__LREAL__LREAL__LREAL((BOOL)__BOOL_LITERAL(TRUE),\n"); - s4o.indent_right(); - s4o.print(s4o.indent_spaces + "NULL,\n"); - s4o.print(s4o.indent_spaces + "(LREAL)("); + s4o.print("__expt((LREAL)("); symbol->l_exp->accept(*this); - s4o.print("),\n"); - s4o.print(s4o.indent_spaces + "(LREAL)("); + s4o.print("), (LREAL)("); symbol->r_exp->accept(*this); s4o.print("))"); return NULL; @@ -895,6 +858,7 @@ } s4o.print("("); s4o.indent_right(); + s4o.print("\n"+s4o.indent_spaces); int nb_param = 0; PARAM_LIST_ITERATOR() {