Add support for the stepname.T syntax.
--- a/lib/iec_types_all.h Sun Jun 01 08:59:02 2014 +0100
+++ b/lib/iec_types_all.h Sun Jun 01 08:59:57 2014 +0100
@@ -127,8 +127,8 @@
typedef struct {
__IEC_BOOL_t X; // state; --> current step state. 0 : inative, 1: active. We name it 'X' as it may be accessed from IEC 61131.3 code using stepname.X syntax!!
- BOOL prev_state; // previous step state. 0 : inative, 1: active
- TIME elapsed_time; // T; // elapsed_time; --> time since step is active. We name it 'T' as it may be accessed from IEC 61131.3 code using stepname.T syntax!!
+ BOOL prev_state; // previous step state. 0 : inative, 1: active
+ __IEC_TIME_t T; // elapsed_time; --> time since step is active. We name it 'T' as it may be accessed from IEC 61131.3 code using stepname.T syntax!!
} STEP;
--- a/stage4/generate_c/generate_c_sfc.cc Sun Jun 01 08:59:02 2014 +0100
+++ b/stage4/generate_c/generate_c_sfc.cc Sun Jun 01 08:59:57 2014 +0100
@@ -143,7 +143,7 @@
s4o.print("(");
print_step_argument(step_name, "X", true);
s4o.print(",,1);\n" + s4o.indent_spaces);
- print_step_argument(step_name, "elapsed_time");
+ print_step_argument(step_name, "T.value");
s4o.print(" = __time_to_timespec(1, 0, 0, 0, 0, 0);\n");
}
@@ -543,7 +543,7 @@
}
else if (strcmp(qualifier, "D") == 0 || strcmp(qualifier, "L") == 0) {
s4o.print("active && __time_cmp(");
- print_step_argument(current_step, "elapsed_time");
+ print_step_argument(current_step, "T.value");
s4o.print(", ");
symbol->action_time->accept(*this);
if (strcmp(qualifier, "D") == 0) {
@@ -753,9 +753,9 @@
print_variable_prefix();
// s4o.print("__step_list[i].elapsed_time = __time_add(__BOOL_LITERAL(TRUE), NULL, ");
// s4o.print("__step_list[i].elapsed_time = ADD_TIME(__BOOL_LITERAL(TRUE), NULL, ");
- s4o.print("__step_list[i].elapsed_time = __time_add(");
- print_variable_prefix();
- s4o.print("__step_list[i].elapsed_time, elapsed_time);\n");
+ s4o.print("__step_list[i].T.value = __time_add(");
+ print_variable_prefix();
+ s4o.print("__step_list[i].T.value, elapsed_time);\n");
s4o.indent_left();
s4o.print(s4o.indent_spaces + "}\n");
s4o.indent_left();