stage4/generate_c/generate_c_sfc.cc
changeset 1011 76175defb87b
parent 992 aa642302fa60
child 1030 9aba95daf81a
equal deleted inserted replaced
1010:242907849850 1011:76175defb87b
   718       s4o.print(s4o.indent_spaces +"TIME elapsed_time, current_time;\n\n");
   718       s4o.print(s4o.indent_spaces +"TIME elapsed_time, current_time;\n\n");
   719       
   719       
   720       /* generate elapsed_time initializations */
   720       /* generate elapsed_time initializations */
   721       s4o.print(s4o.indent_spaces + "// Calculate elapsed_time\n");
   721       s4o.print(s4o.indent_spaces + "// Calculate elapsed_time\n");
   722       s4o.print(s4o.indent_spaces +"current_time = __CURRENT_TIME;\n");
   722       s4o.print(s4o.indent_spaces +"current_time = __CURRENT_TIME;\n");
   723 //       s4o.print(s4o.indent_spaces +"elapsed_time = __time_sub(__BOOL_LITERAL(TRUE), NULL, current_time, ");
       
   724 //       s4o.print(s4o.indent_spaces +"elapsed_time = SUB_TIME(__BOOL_LITERAL(TRUE), NULL, current_time, ");
       
   725       s4o.print(s4o.indent_spaces +"elapsed_time = __time_sub(current_time, ");
   723       s4o.print(s4o.indent_spaces +"elapsed_time = __time_sub(current_time, ");
   726       print_variable_prefix();
   724       print_variable_prefix();
   727       s4o.print("__lasttick_time);\n");
   725       s4o.print("__lasttick_time);\n");
   728       s4o.print(s4o.indent_spaces);
   726       s4o.print(s4o.indent_spaces);
   729       print_variable_prefix();
   727       print_variable_prefix();
   766       print_variable_prefix();
   764       print_variable_prefix();
   767       s4o.print("__step_list[i].X)) {\n");
   765       s4o.print("__step_list[i].X)) {\n");
   768       s4o.indent_right();
   766       s4o.indent_right();
   769       s4o.print(s4o.indent_spaces);
   767       s4o.print(s4o.indent_spaces);
   770       print_variable_prefix();
   768       print_variable_prefix();
   771 //      s4o.print("__step_list[i].elapsed_time = __time_add(__BOOL_LITERAL(TRUE), NULL, ");
       
   772 //      s4o.print("__step_list[i].elapsed_time = ADD_TIME(__BOOL_LITERAL(TRUE), NULL, ");
       
   773       s4o.print("__step_list[i].T.value = __time_add(");
   769       s4o.print("__step_list[i].T.value = __time_add(");
   774       print_variable_prefix();
   770       print_variable_prefix();
   775       s4o.print("__step_list[i].T.value, elapsed_time);\n");
   771       s4o.print("__step_list[i].T.value, elapsed_time);\n");
   776       s4o.indent_left();
   772       s4o.indent_left();
   777       s4o.print(s4o.indent_spaces + "}\n");
   773       s4o.print(s4o.indent_spaces + "}\n");
   800       print_variable_prefix();
   796       print_variable_prefix();
   801       s4o.print("__action_list[i].set_remaining_time, __time_to_timespec(1, 0, 0, 0, 0, 0)) > 0) {\n");
   797       s4o.print("__action_list[i].set_remaining_time, __time_to_timespec(1, 0, 0, 0, 0, 0)) > 0) {\n");
   802       s4o.indent_right();
   798       s4o.indent_right();
   803       s4o.print(s4o.indent_spaces);
   799       s4o.print(s4o.indent_spaces);
   804       print_variable_prefix();
   800       print_variable_prefix();
   805 //       s4o.print("__action_list[i].set_remaining_time = __time_sub(__BOOL_LITERAL(TRUE), NULL, ");
       
   806 //       s4o.print("__action_list[i].set_remaining_time = SUB_TIME(__BOOL_LITERAL(TRUE), NULL, ");
       
   807       s4o.print("__action_list[i].set_remaining_time = __time_sub(");
   801       s4o.print("__action_list[i].set_remaining_time = __time_sub(");
   808       print_variable_prefix();
   802       print_variable_prefix();
   809       s4o.print("__action_list[i].set_remaining_time, elapsed_time);\n");
   803       s4o.print("__action_list[i].set_remaining_time, elapsed_time);\n");
   810       s4o.print(s4o.indent_spaces + "if (");
   804       s4o.print(s4o.indent_spaces + "if (");
   811       s4o.print("__time_cmp(");
   805       s4o.print("__time_cmp(");
   827       print_variable_prefix();
   821       print_variable_prefix();
   828       s4o.print("__action_list[i].reset_remaining_time, __time_to_timespec(1, 0, 0, 0, 0, 0)) > 0) {\n");
   822       s4o.print("__action_list[i].reset_remaining_time, __time_to_timespec(1, 0, 0, 0, 0, 0)) > 0) {\n");
   829       s4o.indent_right();
   823       s4o.indent_right();
   830       s4o.print(s4o.indent_spaces);
   824       s4o.print(s4o.indent_spaces);
   831       print_variable_prefix();
   825       print_variable_prefix();
   832 //       s4o.print("__action_list[i].reset_remaining_time = __time_sub(__BOOL_LITERAL(TRUE), NULL, ");
       
   833 //       s4o.print("__action_list[i].reset_remaining_time = SUB_TIME(__BOOL_LITERAL(TRUE), NULL, ");
       
   834       s4o.print("__action_list[i].reset_remaining_time = __time_sub(");
   826       s4o.print("__action_list[i].reset_remaining_time = __time_sub(");
   835       print_variable_prefix();
   827       print_variable_prefix();
   836       s4o.print("__action_list[i].reset_remaining_time, elapsed_time);\n");
   828       s4o.print("__action_list[i].reset_remaining_time, elapsed_time);\n");
   837       s4o.print(s4o.indent_spaces + "if (");
   829       s4o.print(s4o.indent_spaces + "if (");
   838       s4o.print("__time_cmp(");
   830       s4o.print("__time_cmp(");