# HG changeset patch # User Mario de Sousa # Date 1310374047 -3600 # Node ID ba80c3ceb6fbcafca2aa0459e3cf5845cb8aabc8 # Parent 27a56785e9cddbc995bef5495f77c974e798f7ef# Parent 229eb3e29216fa50a2f92d702de47156f12d7d7b commiting merge with Laurent's repository diff -r 27a56785e9cd -r ba80c3ceb6fb absyntax_utils/search_expression_type.cc --- a/absyntax_utils/search_expression_type.cc Sat Jul 09 14:48:31 2011 +0100 +++ b/absyntax_utils/search_expression_type.cc Mon Jul 11 09:47:27 2011 +0100 @@ -191,6 +191,16 @@ return NULL; } +symbol_c *search_expression_type_c::default_literal_type(symbol_c* symbol) { + if (is_literal_integer_type(symbol)) { + return (symbol_c *)&search_constant_type_c::lint_type_name; + } + else if (is_literal_real_type(symbol)) { + return (symbol_c *)&search_constant_type_c::lreal_type_name; + } + return symbol; +} + integer_c search_expression_type_c::integer("1"); // what default value should we use here ??? #include "search_type_code.c" diff -r 27a56785e9cd -r ba80c3ceb6fb absyntax_utils/search_expression_type.hh --- a/absyntax_utils/search_expression_type.hh Sat Jul 09 14:48:31 2011 +0100 +++ b/absyntax_utils/search_expression_type.hh Mon Jul 11 09:47:27 2011 +0100 @@ -64,6 +64,7 @@ bool is_same_type(symbol_c *first_type, symbol_c *second_type); symbol_c* common_type(symbol_c *first_type, symbol_c *second_type); + symbol_c* default_literal_type(symbol_c *symbol); /* #include "search_type_code.c" diff -r 27a56785e9cd -r ba80c3ceb6fb stage4/generate_c/generate_c_il.cc --- a/stage4/generate_c/generate_c_il.cc Sat Jul 09 14:48:31 2011 +0100 +++ b/stage4/generate_c/generate_c_il.cc Mon Jul 11 09:47:27 2011 +0100 @@ -893,9 +893,12 @@ if (function_type_prefix != NULL) { s4o.print("("); - function_type_prefix->accept(*this); + search_expression_type->default_literal_type(function_type_prefix)->accept(*this); s4o.print(")"); } + if (function_type_suffix != NULL) { + function_type_suffix = search_expression_type->default_literal_type(function_type_prefix); + } if (has_output_params) { fcall_number++; s4o.print("__"); @@ -1258,9 +1261,12 @@ if (function_type_prefix != NULL) { s4o.print("("); - function_type_prefix->accept(*this); + search_expression_type->default_literal_type(function_type_prefix)->accept(*this); s4o.print(")"); } + if (function_type_suffix != NULL) { + function_type_suffix = search_expression_type->default_literal_type(function_type_prefix); + } if (has_output_params) { fcall_number++; s4o.print("__"); diff -r 27a56785e9cd -r ba80c3ceb6fb stage4/generate_c/generate_c_inlinefcall.cc --- a/stage4/generate_c/generate_c_inlinefcall.cc Sat Jul 09 14:48:31 2011 +0100 +++ b/stage4/generate_c/generate_c_inlinefcall.cc Mon Jul 11 09:47:27 2011 +0100 @@ -91,11 +91,9 @@ std::list::iterator pt; fcall_number++; - if (search_expression_type->is_literal_integer_type(function_type_prefix)) { - function_type_prefix = (symbol_c *)&search_constant_type_c::lint_type_name; - } - else if (search_expression_type->is_literal_real_type(function_type_prefix)) { - function_type_prefix = (symbol_c *)&search_constant_type_c::lreal_type_name; + function_type_prefix = search_expression_type->default_literal_type(function_type_prefix); + if (function_type_suffix) { + function_type_suffix = search_expression_type->default_literal_type(function_type_suffix); } s4o.print(s4o.indent_spaces); @@ -105,23 +103,16 @@ fbname->accept(*this); s4o.print("_"); function_name->accept(*this); - if (function_type_suffix) - function_type_suffix->accept(*this); + if (function_type_suffix) { + function_type_suffix->accept(*this); + } s4o.print_integer(fcall_number); s4o.print("("); s4o.indent_right(); PARAM_LIST_ITERATOR() { if (PARAM_DIRECTION == function_param_iterator_c::direction_in) { - if (search_expression_type->is_literal_integer_type(PARAM_TYPE)) { - ((symbol_c *)&search_constant_type_c::lint_type_name)->accept(*this); - } - else if (search_expression_type->is_literal_real_type(PARAM_TYPE)) { - ((symbol_c *)&search_constant_type_c::lreal_type_name)->accept(*this); - } - else { - PARAM_TYPE->accept(*this); - } + search_expression_type->default_literal_type(PARAM_TYPE)->accept(*this); s4o.print(" "); PARAM_NAME->accept(*this); s4o.print(",\n" + s4o.indent_spaces); diff -r 27a56785e9cd -r ba80c3ceb6fb stage4/generate_c/generate_c_st.cc --- a/stage4/generate_c/generate_c_st.cc Sat Jul 09 14:48:31 2011 +0100 +++ b/stage4/generate_c/generate_c_st.cc Mon Jul 11 09:47:27 2011 +0100 @@ -698,9 +698,12 @@ if (function_type_prefix != NULL) { s4o.print("("); - function_type_prefix->accept(*this); + search_expression_type->default_literal_type(function_type_prefix)->accept(*this); s4o.print(")"); } + if (function_type_suffix != NULL) { + function_type_suffix = search_expression_type->default_literal_type(function_type_prefix); + } if (has_output_params) { fcall_number++; s4o.print("__");