--- a/stage4/generate_c/generate_c.cc Fri Apr 11 10:53:38 2008 +0200
+++ b/stage4/generate_c/generate_c.cc Wed Apr 16 09:49:28 2008 +0200
@@ -1196,7 +1196,9 @@
/* (A.1) resource name in comment */
s4o.print("// RESOURCE ");
current_resource_name->accept(*this);
- s4o.print("\n");
+ s4o.print("\n\n");
+
+ s4o.print("extern int common_ticktime__;\n\n");
/* (A.2) Global variables... */
if (current_global_vars != NULL) {
@@ -1205,8 +1207,8 @@
generate_c_vardecl_c::global_vt);
vardecl->print(current_global_vars);
delete vardecl;
+ s4o.print("\n");
}
- s4o.print("\n");
/* (A.3) POUs inclusion */
s4o.print("#include \"POUS.c\"\n\n");
--- a/stage4/generate_c/generate_c_sfc.cc Fri Apr 11 10:53:38 2008 +0200
+++ b/stage4/generate_c/generate_c_sfc.cc Wed Apr 16 09:49:28 2008 +0200
@@ -469,15 +469,16 @@
s4o.print("activated");
}
if (strcmp(qualifier, "D") == 0 || strcmp(qualifier, "L") == 0) {
- s4o.print("active && ");
+ s4o.print("active && __TIME_CMP(");
print_step_argument(current_step, "elapsed_time");
+ s4o.print(", ");
+ symbol->action_time->accept(*this);
if (strcmp(qualifier, "D") == 0) {
- s4o.print(" >= ");
+ s4o.print(") >= 0");
}
else {
- s4o.print(" < ");
+ s4o.print(") < 0");
}
- symbol->action_time->accept(*this);
}
s4o.print(") {\n");
s4o.indent_right();
--- a/stage4/generate_c/generate_c_sfcdecl.cc Fri Apr 11 10:53:38 2008 +0200
+++ b/stage4/generate_c/generate_c_sfcdecl.cc Wed Apr 16 09:49:28 2008 +0200
@@ -161,7 +161,7 @@
/* period initialisation */
s4o.print(s4o.indent_spaces);
print_variable_prefix();
- s4o.print("period = __time_to_timespec(1, 0, 0, 0, 0, 0);\n");
+ s4o.print("period = __time_to_timespec(1, common_ticktime__, 0, 0, 0, 0);\n");
s4o.indent_left();
s4o.print(s4o.indent_spaces + "}\n");