Merged with modifications from Edouard
authorlaurent
Sat, 12 Mar 2011 18:43:02 +0100
changeset 249 d58a45824531
parent 248 9cb18ec14fa2 (diff)
parent 246 e8b5b163804d (current diff)
child 250 5d2927300e2c
Merged with modifications from Edouard
--- 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;
 }
--- 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");