Adding support for forcing tick count to return to zero as the same time than all tasks firing are synchronized
--- a/absyntax_utils/search_type_code.c Mon Sep 21 12:02:14 2009 +0200
+++ b/absyntax_utils/search_type_code.c Mon Sep 21 12:04:15 2009 +0200
@@ -13984,7 +13984,13 @@
if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -14136,7 +14142,13 @@
if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -14226,7 +14238,13 @@
if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -14425,7 +14443,13 @@
if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -14515,7 +14539,13 @@
if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -14574,7 +14604,13 @@
if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -14616,7 +14652,13 @@
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -14905,7 +14947,11 @@
if(IN2_type_symbol == NULL || search_expression_type->is_binary_type(IN2_type_symbol))
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lword_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -14964,7 +15010,11 @@
if(IN2_type_symbol == NULL || search_expression_type->is_binary_type(IN2_type_symbol))
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lword_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -15023,7 +15073,11 @@
if(IN2_type_symbol == NULL || search_expression_type->is_binary_type(IN2_type_symbol))
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lword_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -15135,7 +15189,13 @@
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -15200,7 +15260,13 @@
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -15259,7 +15325,13 @@
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -15417,7 +15489,13 @@
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -26530,7 +26608,13 @@
if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -26672,7 +26756,13 @@
if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -26752,7 +26842,13 @@
if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -26941,7 +27037,13 @@
if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -27021,7 +27123,13 @@
if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -27070,7 +27178,13 @@
if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -27102,7 +27216,13 @@
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -27341,7 +27461,11 @@
if(IN2_type_symbol == NULL || search_expression_type->is_binary_type(IN2_type_symbol))
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lword_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -27390,7 +27514,11 @@
if(IN2_type_symbol == NULL || search_expression_type->is_binary_type(IN2_type_symbol))
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lword_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -27439,7 +27567,11 @@
if(IN2_type_symbol == NULL || search_expression_type->is_binary_type(IN2_type_symbol))
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lword_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -27531,7 +27663,13 @@
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -27586,7 +27724,13 @@
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -27635,7 +27779,13 @@
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
@@ -27773,7 +27923,13 @@
{
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
return return_type_symbol;
}
--- a/stage3/visit_expression_type.cc Mon Sep 21 12:02:14 2009 +0200
+++ b/stage3/visit_expression_type.cc Mon Sep 21 12:04:15 2009 +0200
@@ -50,10 +50,10 @@
(symbol1))
#define STAGE3_ERROR(symbol1, symbol2, msg) { \
- printf("semantic error between (%d:%d) and (%d:%d): %s\n", \
+ /*printf("semantic error between (%d:%d) and (%d:%d): %s\n", \
FIRST_(symbol1,symbol2)->first_line, FIRST_(symbol1,symbol2)->first_column, \
LAST_(symbol1,symbol2) ->last_line, LAST_(symbol1,symbol2) ->last_column, \
- msg); \
+ msg);*/ \
il_error = true; \
}
@@ -64,7 +64,7 @@
void *visit_expression_type_c::visit(program_declaration_c *symbol) {
search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
symbol->var_declarations->accept(*this);
- printf("checking semantics in body of program %s\n", ((token_c *)(symbol->program_type_name))->value);
+ //printf("checking semantics in body of program %s\n", ((token_c *)(symbol->program_type_name))->value);
il_parenthesis_level = 0;
il_error = false;
il_default_variable_type = NULL;
@@ -77,7 +77,7 @@
void *visit_expression_type_c::visit(function_declaration_c *symbol) {
search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
symbol->var_declarations_list->accept(*this);
- printf("checking semantics in body of function %s\n", ((token_c *)(symbol->derived_function_name))->value);
+ //printf("checking semantics in body of function %s\n", ((token_c *)(symbol->derived_function_name))->value);
il_parenthesis_level = 0;
il_error = false;
il_default_variable_type = NULL;
@@ -90,7 +90,7 @@
void *visit_expression_type_c::visit(function_block_declaration_c *symbol) {
search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
symbol->var_declarations->accept(*this);
- printf("checking semantics in body of FB %s\n", ((token_c *)(symbol->fblock_name))->value);
+ //printf("checking semantics in body of FB %s\n", ((token_c *)(symbol->fblock_name))->value);
il_parenthesis_level = 0;
il_error = false;
il_default_variable_type = NULL;
--- a/stage4/generate_c/generate_c.cc Mon Sep 21 12:02:14 2009 +0200
+++ b/stage4/generate_c/generate_c.cc Mon Sep 21 12:04:15 2009 +0200
@@ -165,13 +165,13 @@
/* A helper class that knows how to generate code for both the IL and ST languages... */
class calculate_time_c: public iterator_visitor_c {
private:
- unsigned long time;
+ unsigned long long time;
float current_value;
public:
calculate_time_c(void){time = 0;};
- unsigned long get_time(void) {return time;};
+ unsigned long long get_time(void) {return time;};
void *get_integer_value(token_c *token) {
std::string str = "";
@@ -213,7 +213,7 @@
if (symbol->hours)
symbol->hours->accept(*this);
symbol->days->accept(*this);
- time += (unsigned long)(current_value * 24 * 3600 * SECOND);
+ time += (unsigned long long)(current_value * 24 * 3600 * SECOND);
return NULL;
}
@@ -222,7 +222,7 @@
if (symbol->minutes)
symbol->minutes->accept(*this);
symbol->hours->accept(*this);
- time += (unsigned long)(current_value * 3600 * SECOND);
+ time += (unsigned long long)(current_value * 3600 * SECOND);
return NULL;
}
@@ -231,7 +231,7 @@
if (symbol->seconds)
symbol->seconds->accept(*this);
symbol->minutes->accept(*this);
- time += (unsigned long)(current_value * 60 * SECOND);
+ time += (unsigned long long)(current_value * 60 * SECOND);
return NULL;
}
@@ -240,14 +240,14 @@
if (symbol->milliseconds)
symbol->milliseconds->accept(*this);
symbol->seconds->accept(*this);
- time += (unsigned long)(current_value * SECOND);
+ time += (unsigned long long)(current_value * SECOND);
return NULL;
}
/* SYM_REF2(milliseconds_c, milliseconds, unused) */
void *visit(milliseconds_c *symbol) {
symbol->milliseconds->accept(*this);
- time += (unsigned long)(current_value * MILLISECOND);
+ time += (unsigned long long)(current_value * MILLISECOND);
return NULL;
}
};
@@ -259,37 +259,52 @@
class calculate_common_ticktime_c: public iterator_visitor_c {
private:
- unsigned long common_ticktime;
+ unsigned long long common_ticktime;
+ unsigned long long least_common_ticktime;
public:
- calculate_common_ticktime_c(void){common_ticktime = 0;}
-
- unsigned long euclide(unsigned long a, unsigned long b) {
- unsigned long c = a % b;
+ calculate_common_ticktime_c(void){
+ common_ticktime = 0;
+ least_common_ticktime = 0;
+ }
+
+ unsigned long long euclide(unsigned long long a, unsigned long long b) {
+ unsigned long long c = a % b;
if (c == 0)
return b;
else
return euclide(b, c);
}
- void update_ticktime(unsigned long time) {
+ void update_ticktime(unsigned long long time) {
if (common_ticktime == 0)
common_ticktime = time;
else if (time > common_ticktime)
common_ticktime = euclide(time, common_ticktime);
else
common_ticktime = euclide(common_ticktime, time);
- }
-
- unsigned long get_ticktime(void) {
+ if (least_common_ticktime == 0)
+ least_common_ticktime = time;
+ else
+ least_common_ticktime = (least_common_ticktime * time) / common_ticktime;
+ }
+
+ unsigned long long get_common_ticktime(void) {
return common_ticktime;
}
+ unsigned long get_greatest_tick_count(void) {
+ unsigned long long least_common_tick = least_common_ticktime / common_ticktime;
+ if (least_common_tick >> 32)
+ ERROR;
+ return (unsigned long)(~(((unsigned long)-2) % (unsigned long)least_common_tick) + 1);
+ }
+
/* TASK task_name task_initialization */
//SYM_REF2(task_configuration_c, task_name, task_initialization)
void *visit(task_initialization_c *symbol) {
calculate_time_c calculate_time;
- unsigned long time = 0;
+ unsigned long long time = 0;
if (symbol->interval_data_source != NULL) {
symbol->interval_data_source->accept(calculate_time);
time = calculate_time.get_time();
@@ -1013,7 +1028,7 @@
/* (C.2) Run function name... */
s4o.print(s4o.indent_spaces + "void config");
s4o.print(FB_RUN_SUFFIX);
- s4o.print("(int tick) {\n");
+ s4o.print("(unsigned long tick) {\n");
s4o.indent_right();
/* (C.3) Resources initializations... */
@@ -1037,7 +1052,7 @@
}
else {
s4o.print(FB_RUN_SUFFIX);
- s4o.print("(int tick);\n");
+ s4o.print("(unsigned long tick);\n");
}
}
if (wanted_declaretype == initdeclare_dt || wanted_declaretype == rundeclare_dt) {
@@ -1064,7 +1079,7 @@
}
else {
s4o.print(FB_RUN_SUFFIX);
- s4o.print("(int tick);\n");
+ s4o.print("(unsigned long tick);\n");
}
}
if (wanted_declaretype == initdeclare_dt || wanted_declaretype == rundeclare_dt) {
@@ -1243,7 +1258,7 @@
s4o.print("void ");
current_resource_name->accept(*this);
s4o.print(FB_RUN_SUFFIX);
- s4o.print("(int tick) {\n");
+ s4o.print("(unsigned long tick) {\n");
s4o.indent_right();
wanted_declaretype = run_dt;
@@ -1630,16 +1645,19 @@
calculate_common_ticktime_c calculate_common_ticktime;
symbol->accept(calculate_common_ticktime);
- common_ticktime = calculate_common_ticktime.get_ticktime();
+ common_ticktime = calculate_common_ticktime.get_common_ticktime();
symbol->configuration_name->accept(*this);
stage4out_c config_s4o(current_builddir, current_name, "c");
generate_c_config_c generate_c_config(&config_s4o);
symbol->accept(generate_c_config);
- config_s4o.print("int common_ticktime__ = ");
- config_s4o.print_integer((int)(common_ticktime / 1000000));
- config_s4o.print("; /*ms*/\n");
+ config_s4o.print("unsigned long long common_ticktime__ = ");
+ config_s4o.print_long_long_integer(common_ticktime);
+ config_s4o.print("; /*ns*/\n");
+ config_s4o.print("unsigned long greatest_tick_count__ = ");
+ config_s4o.print_long_integer(calculate_common_ticktime.get_greatest_tick_count());
+ config_s4o.print("; /*tick*/\n");
symbol->resource_declarations->accept(*this);
--- a/stage4/generate_c/generate_c_il.cc Mon Sep 21 12:02:14 2009 +0200
+++ b/stage4/generate_c/generate_c_il.cc Mon Sep 21 12:04:15 2009 +0200
@@ -202,6 +202,9 @@
* The following object is it...
*/
bool_type_name_c bool_type;
+ lint_type_name_c lint_type;
+ lword_type_name_c lword_type;
+ lreal_type_name_c lreal_type;
/* the data type of the IL default variable... */
#define IL_DEFVAR_T VAR_LEADER "IL_DEFVAR_T"
@@ -381,6 +384,38 @@
else {ERROR;}
}
+ void BYTE_operator_result_type(void) {
+ if (search_expression_type->is_literal_integer_type(this->default_variable_name.current_type)) {
+ if (search_expression_type->is_literal_integer_type(this->current_operand_type))
+ this->default_variable_name.current_type = &(this->lword_type);
+ else
+ this->default_variable_name.current_type = this->current_operand_type;
+ }
+ else if (search_expression_type->is_literal_integer_type(this->current_operand_type))
+ this->current_operand_type = this->default_variable_name.current_type;
+ }
+
+ void NUM_operator_result_type(void) {
+ if (search_expression_type->is_literal_real_type(this->default_variable_name.current_type)) {
+ if (search_expression_type->is_literal_integer_type(this->current_operand_type) ||
+ search_expression_type->is_literal_real_type(this->current_operand_type))
+ this->default_variable_name.current_type = &(this->lreal_type);
+ else
+ this->default_variable_name.current_type = this->current_operand_type;
+ }
+ else if (search_expression_type->is_literal_integer_type(this->default_variable_name.current_type)) {
+ if (search_expression_type->is_literal_integer_type(this->current_operand_type))
+ this->default_variable_name.current_type = &(this->lint_type);
+ else if (search_expression_type->is_literal_real_type(this->current_operand_type))
+ this->default_variable_name.current_type = &(this->lreal_type);
+ else
+ this->default_variable_name.current_type = this->current_operand_type;
+ }
+ else if (search_expression_type->is_literal_integer_type(this->current_operand_type) ||
+ search_expression_type->is_literal_real_type(this->current_operand_type))
+ this->current_operand_type = this->default_variable_name.current_type;
+ }
+
public:
void *visit(il_default_variable_c *symbol) {
@@ -1151,14 +1186,23 @@
void *visit(LD_operator_c *symbol) {
/* the data type resulting from this operation... */
+ if (search_expression_type->is_literal_integer_type(this->current_operand_type))
+ this->default_variable_name.current_type = &(this->lint_type);
+ else if (search_expression_type->is_literal_real_type(this->current_operand_type))
+ this->default_variable_name.current_type = &(this->lreal_type);
+ else
+ this->default_variable_name.current_type = this->current_operand_type;
+ XXX_operator(&(this->default_variable_name), " = ", this->current_operand);
this->default_variable_name.current_type = this->current_operand_type;
- XXX_operator(&(this->default_variable_name), " = ", this->current_operand);
return NULL;
}
void *visit(LDN_operator_c *symbol) {
/* the data type resulting from this operation... */
- this->default_variable_name.current_type = this->current_operand_type;
+ if (search_expression_type->is_literal_integer_type(this->current_operand_type))
+ this->default_variable_name.current_type = &(this->lword_type);
+ else
+ this->default_variable_name.current_type = this->current_operand_type;
XXX_operator(&(this->default_variable_name),
search_expression_type->is_bool_type(this->current_operand_type)?" = !":" = ~",
this->current_operand);
@@ -1175,6 +1219,9 @@
operand_type->accept(*this);
s4o.print("(");
}
+ if (search_expression_type->is_literal_integer_type(this->default_variable_name.current_type) ||
+ search_expression_type->is_literal_real_type(this->default_variable_name.current_type))
+ this->default_variable_name.current_type = this->current_operand_type;
this->default_variable_name.accept(*this);
if (search_base_type.type_is_subrange(operand_type))
s4o.print(")");
@@ -1196,6 +1243,8 @@
s4o.print("!");
else
s4o.print("~");
+ if (search_expression_type->is_literal_integer_type(this->default_variable_name.current_type))
+ this->default_variable_name.current_type = this->current_operand_type;
this->default_variable_name.accept(*this);
if (search_base_type.type_is_subrange(operand_type))
s4o.print(")");
@@ -1244,7 +1293,8 @@
void *visit(AND_operator_c *symbol) {
if (search_expression_type->is_binary_type(this->default_variable_name.current_type) &&
search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
- XXX_operator(&(this->default_variable_name), " &= ", this->current_operand);
+ BYTE_operator_result_type();
+ XXX_operator(&(this->default_variable_name), " &= ", this->current_operand);
/* the data type resulting from this operation... */
this->default_variable_name.current_type = this->current_operand_type;
}
@@ -1255,7 +1305,8 @@
void *visit(OR_operator_c *symbol) {
if (search_expression_type->is_binary_type(this->default_variable_name.current_type) &&
search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
- XXX_operator(&(this->default_variable_name), " |= ", this->current_operand);
+ BYTE_operator_result_type();
+ XXX_operator(&(this->default_variable_name), " |= ", this->current_operand);
/* the data type resulting from this operation... */
this->default_variable_name.current_type = this->current_operand_type;
}
@@ -1266,7 +1317,8 @@
void *visit(XOR_operator_c *symbol) {
if (search_expression_type->is_binary_type(this->default_variable_name.current_type) &&
search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
- // '^' is a bit by bit exclusive OR !! Also seems to work with boolean types!
+ BYTE_operator_result_type();
+ // '^' is a bit by bit exclusive OR !! Also seems to work with boolean types!
XXX_operator(&(this->default_variable_name), " ^= ", this->current_operand);
/* the data type resulting from this operation... */
this->default_variable_name.current_type = this->current_operand_type;
@@ -1278,7 +1330,8 @@
void *visit(ANDN_operator_c *symbol) {
if (search_expression_type->is_binary_type(this->default_variable_name.current_type) &&
search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
- XXX_operator(&(this->default_variable_name),
+ BYTE_operator_result_type();
+ XXX_operator(&(this->default_variable_name),
search_expression_type->is_bool_type(this->current_operand_type)?" &= !":" &= ~",
this->current_operand);
/* the data type resulting from this operation... */
@@ -1291,7 +1344,8 @@
void *visit(ORN_operator_c *symbol) {
if (search_expression_type->is_binary_type(this->default_variable_name.current_type) &&
search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
- XXX_operator(&(this->default_variable_name),
+ BYTE_operator_result_type();
+ XXX_operator(&(this->default_variable_name),
search_expression_type->is_bool_type(this->current_operand_type)?" |= !":" |= ~",
this->current_operand);
/* the data type resulting from this operation... */
@@ -1304,7 +1358,8 @@
void *visit(XORN_operator_c *symbol) {
if (search_expression_type->is_binary_type(this->default_variable_name.current_type) &&
search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
- XXX_operator(&(this->default_variable_name),
+ BYTE_operator_result_type();
+ XXX_operator(&(this->default_variable_name),
// bit by bit exclusive OR !! Also seems to work with boolean types!
search_expression_type->is_bool_type(this->current_operand_type)?" ^= !":" ^= ~",
this->current_operand);
@@ -1325,7 +1380,8 @@
}
if (search_expression_type->is_num_type(this->default_variable_name.current_type) &&
search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
- XXX_operator(&(this->default_variable_name), " += ", this->current_operand);
+ NUM_operator_result_type();
+ XXX_operator(&(this->default_variable_name), " += ", this->current_operand);
/* the data type resulting from this operation... */
this->default_variable_name.current_type = this->current_operand_type;
return NULL;
@@ -1344,7 +1400,8 @@
}
if (search_expression_type->is_num_type(this->default_variable_name.current_type) &&
search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
- XXX_operator(&(this->default_variable_name), " -= ", this->current_operand);
+ NUM_operator_result_type();
+ XXX_operator(&(this->default_variable_name), " -= ", this->current_operand);
/* the data type resulting from this operation... */
this->default_variable_name.current_type = this->current_operand_type;
return NULL;
@@ -1362,6 +1419,7 @@
}
if (search_expression_type->is_num_type(this->default_variable_name.current_type) &&
search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
+ NUM_operator_result_type();
XXX_operator(&(this->default_variable_name), " *= ", this->current_operand);
/* the data type resulting from this operation... */
this->default_variable_name.current_type = this->current_operand_type;
@@ -1380,7 +1438,8 @@
}
if (search_expression_type->is_num_type(this->default_variable_name.current_type) &&
search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
- XXX_operator(&(this->default_variable_name), " /= ", this->current_operand);
+ NUM_operator_result_type();
+ XXX_operator(&(this->default_variable_name), " /= ", this->current_operand);
/* the data type resulting from this operation... */
this->default_variable_name.current_type = this->current_operand_type;
}
@@ -1391,7 +1450,8 @@
void *visit(MOD_operator_c *symbol) {
if (search_expression_type->is_num_type(this->default_variable_name.current_type) &&
search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
- XXX_operator(&(this->default_variable_name), " %= ", this->current_operand);
+ NUM_operator_result_type();
+ XXX_operator(&(this->default_variable_name), " %= ", this->current_operand);
/* the data type resulting from this operation... */
this->default_variable_name.current_type = this->current_operand_type;
}
--- a/stage4/generate_c/il_code_gen.c Mon Sep 21 12:02:14 2009 +0200
+++ b/stage4/generate_c/il_code_gen.c Mon Sep 21 12:04:15 2009 +0200
@@ -13819,7 +13819,13 @@
}
}while(param_value != NULL);
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -14030,7 +14036,13 @@
}
}while(param_value != NULL);
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -14132,7 +14144,13 @@
if (IN2_type_symbol == NULL)
IN2_type_symbol = last_type_symbol;
ADD_PARAM_LIST(IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -14388,7 +14406,13 @@
if (IN2_type_symbol == NULL)
IN2_type_symbol = last_type_symbol;
ADD_PARAM_LIST(IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -14490,7 +14514,13 @@
if (IN2_type_symbol == NULL)
IN2_type_symbol = last_type_symbol;
ADD_PARAM_LIST(IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -14552,7 +14582,13 @@
if (IN2_type_symbol == NULL)
IN2_type_symbol = last_type_symbol;
ADD_PARAM_LIST(IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = IN1_type_symbol;
break;
@@ -14593,7 +14629,13 @@
if (IN_type_symbol == NULL)
IN_type_symbol = last_type_symbol;
ADD_PARAM_LIST(IN_param_value, IN_type_symbol, function_param_iterator_c::direction_in)
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -14926,7 +14968,11 @@
}
}while(param_value != NULL);
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lword_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -15017,7 +15063,11 @@
}
}while(param_value != NULL);
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lword_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -15108,7 +15158,11 @@
}
}while(param_value != NULL);
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lword_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -15226,7 +15280,13 @@
if (IN1_type_symbol == NULL)
IN1_type_symbol = last_type_symbol;
ADD_PARAM_LIST(IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = IN0_type_symbol;
break;
@@ -15323,7 +15383,13 @@
}
}while(param_value != NULL);
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -15414,7 +15480,13 @@
}
}while(param_value != NULL);
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -15615,7 +15687,13 @@
}
}while(param_value != NULL);
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
--- a/stage4/generate_c/st_code_gen.c Mon Sep 21 12:02:14 2009 +0200
+++ b/stage4/generate_c/st_code_gen.c Mon Sep 21 12:04:15 2009 +0200
@@ -16528,7 +16528,13 @@
}
}while(param_value != NULL);
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -16746,7 +16752,13 @@
}
}while(param_value != NULL);
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -16855,7 +16867,13 @@
if (IN2_type_symbol == NULL)
IN2_type_symbol = last_type_symbol;
ADD_PARAM_LIST(IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -17118,7 +17136,13 @@
if (IN2_type_symbol == NULL)
IN2_type_symbol = last_type_symbol;
ADD_PARAM_LIST(IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -17227,7 +17251,13 @@
if (IN2_type_symbol == NULL)
IN2_type_symbol = last_type_symbol;
ADD_PARAM_LIST(IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -17296,7 +17326,13 @@
if (IN2_type_symbol == NULL)
IN2_type_symbol = last_type_symbol;
ADD_PARAM_LIST(IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = IN1_type_symbol;
break;
@@ -17344,7 +17380,13 @@
if (IN_type_symbol == NULL)
IN_type_symbol = last_type_symbol;
ADD_PARAM_LIST(IN_param_value, IN_type_symbol, function_param_iterator_c::direction_in)
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -17712,7 +17754,11 @@
}
}while(param_value != NULL);
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lword_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -17810,7 +17856,11 @@
}
}while(param_value != NULL);
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lword_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -17908,7 +17958,11 @@
}
}while(param_value != NULL);
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lword_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -18040,7 +18094,13 @@
if (IN1_type_symbol == NULL)
IN1_type_symbol = last_type_symbol;
ADD_PARAM_LIST(IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = IN0_type_symbol;
break;
@@ -18144,7 +18204,13 @@
}
}while(param_value != NULL);
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -18242,7 +18308,13 @@
}
}while(param_value != NULL);
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
@@ -18457,7 +18529,13 @@
}
}while(param_value != NULL);
- symbol_c * return_type_symbol = last_type_symbol;
+ symbol_c * return_type_symbol;
+ if (search_expression_type->is_literal_integer_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lint_type_name;
+ else if (search_expression_type->is_literal_real_type(last_type_symbol))
+ return_type_symbol = &search_constant_type_c::lreal_type_name;
+ else
+ return_type_symbol = last_type_symbol;
function_type_suffix = return_type_symbol;
break;
--- a/stage4/stage4.cc Mon Sep 21 12:02:14 2009 +0200
+++ b/stage4/stage4.cc Mon Sep 21 12:04:15 2009 +0200
@@ -107,6 +107,16 @@
return NULL;
}
+void *stage4out_c::print_long_integer(unsigned long l_integer) {
+ *out << l_integer << "UL";
+ return NULL;
+}
+
+void *stage4out_c::print_long_long_integer(unsigned long long ll_integer) {
+ *out << ll_integer << "ULL";
+ return NULL;
+}
+
void *stage4out_c::printupper(const char *str) {
for (int i = 0; str[i] != '\0'; i++)
*out << (unsigned char)toupper(str[i]);
--- a/stage4/stage4.hh Mon Sep 21 12:02:14 2009 +0200
+++ b/stage4/stage4.hh Mon Sep 21 12:04:15 2009 +0200
@@ -48,6 +48,8 @@
void *print(std::string str);
void *print_integer(int integer);
+ void *print_long_integer(unsigned long l_integer);
+ void *print_long_long_integer(unsigned long long ll_integer);
void *printupper(const char *str);
void *printupper(std::string str);