# HG changeset patch # User lbessard # Date 1191599924 -7200 # Node ID c6d41c1287de7ad116ce3a20be78e0a9b15b3275 # Parent ab704568fa2561ca84b78a80ad458bf4381d3efd Lots of bugs fixed diff -r ab704568fa25 -r c6d41c1287de stage4/generate_cc/function_call_param_iterator.cc --- a/stage4/generate_cc/function_call_param_iterator.cc Fri Oct 05 10:24:39 2007 +0200 +++ b/stage4/generate_cc/function_call_param_iterator.cc Fri Oct 05 17:58:44 2007 +0200 @@ -466,7 +466,7 @@ */ void *visit(function_invocation_c *symbol) { TRACE("function_invocation_c"); - if ((symbol_c *)symbol == f_call) + if ((symbol_c *)symbol == f_call && symbol->parameter_assignment_list != NULL) return symbol->parameter_assignment_list->accept(*this); else return NULL; @@ -498,7 +498,10 @@ // SYM_REF2(fb_invocation_c, fb_name, param_assignment_list) void *visit(fb_invocation_c *symbol) { TRACE("fb_invocation_c"); - return symbol->param_assignment_list->accept(*this); + if (symbol->param_assignment_list != NULL) + return symbol->param_assignment_list->accept(*this); + else + return NULL; } /* helper symbol for fb_invocation */ diff -r ab704568fa25 -r c6d41c1287de stage4/generate_cc/generate_cc.cc --- a/stage4/generate_cc/generate_cc.cc Fri Oct 05 10:24:39 2007 +0200 +++ b/stage4/generate_cc/generate_cc.cc Fri Oct 05 17:58:44 2007 +0200 @@ -1168,7 +1168,7 @@ /* (A.2) Global variables... */ if (current_global_vars != NULL) { vardecl = new generate_cc_vardecl_c(&s4o, - generate_cc_vardecl_c::localstatic_vf, + generate_cc_vardecl_c::local_vf, generate_cc_vardecl_c::global_vt); vardecl->print(current_global_vars); delete vardecl; diff -r ab704568fa25 -r c6d41c1287de stage4/generate_cc/generate_cc_st.cc --- a/stage4/generate_cc/generate_cc_st.cc Fri Oct 05 10:24:39 2007 +0200 +++ b/stage4/generate_cc/generate_cc_st.cc Fri Oct 05 17:58:44 2007 +0200 @@ -349,7 +349,13 @@ /* TODO: power expression... */ void *visit(power_expression_c *symbol) {ERROR; return print_binary_expression(symbol->l_exp, symbol->r_exp, " ** ");} void *visit(neg_expression_c *symbol) {return print_unary_expression(symbol->exp, " -");} -void *visit(not_expression_c *symbol) {return print_unary_expression(symbol->exp, search_expression_type->is_bool_type(symbol->exp)?"!":"~");} + +void *visit(not_expression_c *symbol) { + symbol_c *exp_type = search_expression_type->get_type(symbol->exp); + if (!search_expression_type->is_binary_type(exp_type)) + ERROR; + return print_unary_expression(symbol->exp, search_expression_type->is_bool_type(exp_type)?"!":"~"); +} void *visit(function_invocation_c *symbol) { function_declaration_c *f_decl = function_symtable.find_value(symbol->function_name); diff -r ab704568fa25 -r c6d41c1287de stage4/generate_cc/search_expression_type.cc --- a/stage4/generate_cc/search_expression_type.cc Fri Oct 05 10:24:39 2007 +0200 +++ b/stage4/generate_cc/search_expression_type.cc Fri Oct 05 17:58:44 2007 +0200 @@ -472,9 +472,7 @@ void *visit(not_expression_c *symbol) { symbol_c *exp_type = base_type((symbol_c *)symbol->exp->accept(*this)); - if (typeid(*exp_type) == typeid(bool_type_name_c)) {return (void *)exp_type;} - ERROR; - return NULL; + return compute_boolean_expression(exp_type, exp_type); } void *visit(function_invocation_c *symbol) {