# HG changeset patch # User laurent # Date 1299951782 -3600 # Node ID d58a4582453195b6144b3f0d429252cd38000349 # Parent 9cb18ec14fa23e2d3390084856cf3af6f909c51f# Parent e8b5b163804d2d3c9b2e213aa8084c45f4b4d22c Merged with modifications from Edouard diff -r e8b5b163804d -r d58a45824531 absyntax_utils/function_call_param_iterator.cc --- a/absyntax_utils/function_call_param_iterator.cc Tue Feb 22 15:19:41 2011 +0100 +++ b/absyntax_utils/function_call_param_iterator.cc Sat Mar 12 18:43:02 2011 +0100 @@ -495,8 +495,10 @@ /* If the syntax parser is working correctly, exactly one of the * following two symbols will be NULL, while the other is != NULL. */ - if (symbol-> formal_param_list != NULL) return symbol-> formal_param_list->accept(*this); - if (symbol->nonformal_param_list != NULL) return symbol->nonformal_param_list->accept(*this); + if (symbol == (function_invocation_c *)f_call) { + if (symbol-> formal_param_list != NULL) return symbol-> formal_param_list->accept(*this); + if (symbol->nonformal_param_list != NULL) return symbol->nonformal_param_list->accept(*this); + } return NULL; } diff -r e8b5b163804d -r d58a45824531 stage4/generate_c/generate_c.cc --- a/stage4/generate_c/generate_c.cc Tue Feb 22 15:19:41 2011 +0100 +++ b/stage4/generate_c/generate_c.cc Sat Mar 12 18:43:02 2011 +0100 @@ -1485,31 +1485,37 @@ s4o.print(FB_INIT_SUFFIX); s4o.print("(&"); current_task_name->accept(*this); - s4o.print("_R_TRIG);\n"); + s4o.print("_R_TRIG, retain);\n"); } break; case run_dt: if (symbol->single_data_source != NULL) { symbol_c *config_var_decl = NULL; symbol_c *res_var_decl = NULL; + unsigned int vartype; symbol_c *current_var_reference = ((global_var_reference_c *)(symbol->single_data_source))->global_var_name; res_var_decl = search_resource_instance->get_decl(current_var_reference); if (res_var_decl == NULL) { config_var_decl = search_config_instance->get_decl(current_var_reference); if (config_var_decl == NULL) ERROR; + vartype = search_config_instance->get_vartype(); s4o.print(s4o.indent_spaces + "{extern "); config_var_decl->accept(*this); s4o.print(" *"); symbol->single_data_source->accept(*this); s4o.print("; "); } - else + else { + vartype = search_resource_instance->get_vartype(); s4o.print(s4o.indent_spaces); + } + s4o.print(SET_VAR); + s4o.print("("); current_task_name->accept(*this); - s4o.print("_R_TRIG.CLK = *"); + s4o.print("_R_TRIG.CLK, *__GET_GLOBAL_"); symbol->single_data_source->accept(*this); - s4o.print(";"); + s4o.print("());"); if (config_var_decl != NULL) s4o.print("}"); s4o.print("\n"); @@ -1521,8 +1527,10 @@ s4o.print(s4o.indent_spaces); current_task_name->accept(*this); s4o.print(" = "); + s4o.print(GET_VAR); + s4o.print("("); current_task_name->accept(*this); - s4o.print("_R_TRIG.Q"); + s4o.print("_R_TRIG.Q)"); } else { s4o.print(s4o.indent_spaces); @@ -1745,6 +1753,10 @@ calculate_common_ticktime_c calculate_common_ticktime; symbol->accept(calculate_common_ticktime); common_ticktime = calculate_common_ticktime.get_common_ticktime(); + if (common_ticktime == 0) { + fprintf(stderr, "\nYou must at least define a periodic task to set cycle period!"); + ERROR; + } symbol->configuration_name->accept(*this); stage4out_c config_s4o(current_builddir, current_name, "c");