621 s4o.print(s4o.indent_spaces +"TIME elapsed_time, current_time;\n\n"); |
622 s4o.print(s4o.indent_spaces +"TIME elapsed_time, current_time;\n\n"); |
622 |
623 |
623 /* generate elapsed_time initialisations */ |
624 /* generate elapsed_time initialisations */ |
624 s4o.print(s4o.indent_spaces + "// Calculate elapsed_time\n"); |
625 s4o.print(s4o.indent_spaces + "// Calculate elapsed_time\n"); |
625 s4o.print(s4o.indent_spaces +"current_time = __CURRENT_TIME;\n"); |
626 s4o.print(s4o.indent_spaces +"current_time = __CURRENT_TIME;\n"); |
626 s4o.print(s4o.indent_spaces +"elapsed_time = __time_sub(current_time, "); |
627 s4o.print(s4o.indent_spaces +"elapsed_time = __time_sub(__BOOL_LITERAL(TRUE), NULL, current_time, "); |
627 print_variable_prefix(); |
628 print_variable_prefix(); |
628 s4o.print("__lasttick_time);\n"); |
629 s4o.print("__lasttick_time);\n"); |
629 s4o.print(s4o.indent_spaces); |
630 s4o.print(s4o.indent_spaces); |
630 print_variable_prefix(); |
631 print_variable_prefix(); |
631 s4o.print("__lasttick_time = current_time;\n"); |
632 s4o.print("__lasttick_time = current_time;\n"); |
645 print_variable_prefix(); |
646 print_variable_prefix(); |
646 s4o.print("__step_list[i].state) {\n"); |
647 s4o.print("__step_list[i].state) {\n"); |
647 s4o.indent_right(); |
648 s4o.indent_right(); |
648 s4o.print(s4o.indent_spaces); |
649 s4o.print(s4o.indent_spaces); |
649 print_variable_prefix(); |
650 print_variable_prefix(); |
650 s4o.print("__step_list[i].elapsed_time = __time_add("); |
651 s4o.print("__step_list[i].elapsed_time = __time_add(__BOOL_LITERAL(TRUE), NULL, "); |
651 print_variable_prefix(); |
652 print_variable_prefix(); |
652 s4o.print("__step_list[i].elapsed_time, elapsed_time);\n"); |
653 s4o.print("__step_list[i].elapsed_time, elapsed_time);\n"); |
653 s4o.indent_left(); |
654 s4o.indent_left(); |
654 s4o.print(s4o.indent_spaces + "}\n"); |
655 s4o.print(s4o.indent_spaces + "}\n"); |
655 s4o.indent_left(); |
656 s4o.indent_left(); |
669 s4o.print("__action_list[i].set = 0;\n"); |
670 s4o.print("__action_list[i].set = 0;\n"); |
670 s4o.print(s4o.indent_spaces); |
671 s4o.print(s4o.indent_spaces); |
671 print_variable_prefix(); |
672 print_variable_prefix(); |
672 s4o.print("__action_list[i].reset = 0;\n"); |
673 s4o.print("__action_list[i].reset = 0;\n"); |
673 s4o.print(s4o.indent_spaces + "if ("); |
674 s4o.print(s4o.indent_spaces + "if ("); |
674 s4o.print("__gt_TIME(2, "); |
675 s4o.print("__TIME_CMP("); |
675 print_variable_prefix(); |
676 print_variable_prefix(); |
676 s4o.print("__action_list[i].set_remaining_time, __time_to_timespec(1, 0, 0, 0, 0, 0))) {\n"); |
677 s4o.print("__action_list[i].set_remaining_time, __time_to_timespec(1, 0, 0, 0, 0, 0)) > 0) {\n"); |
677 s4o.indent_right(); |
678 s4o.indent_right(); |
678 s4o.print(s4o.indent_spaces); |
679 s4o.print(s4o.indent_spaces); |
679 print_variable_prefix(); |
680 print_variable_prefix(); |
680 s4o.print("__action_list[i].set_remaining_time = __time_sub("); |
681 s4o.print("__action_list[i].set_remaining_time = __time_sub(__BOOL_LITERAL(TRUE), NULL, "); |
681 print_variable_prefix(); |
682 print_variable_prefix(); |
682 s4o.print("__action_list[i].set_remaining_time, elapsed_time);\n"); |
683 s4o.print("__action_list[i].set_remaining_time, elapsed_time);\n"); |
683 s4o.print(s4o.indent_spaces + "if ("); |
684 s4o.print(s4o.indent_spaces + "if ("); |
684 s4o.print("__le_TIME(2, "); |
685 s4o.print("__TIME_CMP("); |
685 print_variable_prefix(); |
686 print_variable_prefix(); |
686 s4o.print("__action_list[i].set_remaining_time, __time_to_timespec(1, 0, 0, 0, 0, 0))) {\n"); |
687 s4o.print("__action_list[i].set_remaining_time, __time_to_timespec(1, 0, 0, 0, 0, 0)) <= 0) {\n"); |
687 s4o.indent_right(); |
688 s4o.indent_right(); |
688 s4o.print(s4o.indent_spaces); |
689 s4o.print(s4o.indent_spaces); |
689 print_variable_prefix(); |
690 print_variable_prefix(); |
690 s4o.print("__action_list[i].set_remaining_time = __time_to_timespec(1, 0, 0, 0, 0, 0);\n"); |
691 s4o.print("__action_list[i].set_remaining_time = __time_to_timespec(1, 0, 0, 0, 0, 0);\n"); |
691 s4o.print(s4o.indent_spaces); |
692 s4o.print(s4o.indent_spaces); |
694 s4o.indent_left(); |
695 s4o.indent_left(); |
695 s4o.print(s4o.indent_spaces + "}\n"); |
696 s4o.print(s4o.indent_spaces + "}\n"); |
696 s4o.indent_left(); |
697 s4o.indent_left(); |
697 s4o.print(s4o.indent_spaces + "}\n"); |
698 s4o.print(s4o.indent_spaces + "}\n"); |
698 s4o.print(s4o.indent_spaces + "if ("); |
699 s4o.print(s4o.indent_spaces + "if ("); |
699 s4o.print("__gt_TIME(2, "); |
700 s4o.print("__TIME_CMP("); |
700 print_variable_prefix(); |
701 print_variable_prefix(); |
701 s4o.print("__action_list[i].reset_remaining_time, __time_to_timespec(1, 0, 0, 0, 0, 0))) {\n"); |
702 s4o.print("__action_list[i].reset_remaining_time, __time_to_timespec(1, 0, 0, 0, 0, 0)) > 0) {\n"); |
702 s4o.indent_right(); |
703 s4o.indent_right(); |
703 s4o.print(s4o.indent_spaces); |
704 s4o.print(s4o.indent_spaces); |
704 print_variable_prefix(); |
705 print_variable_prefix(); |
705 s4o.print("__action_list[i].reset_remaining_time = __time_sub("); |
706 s4o.print("__action_list[i].reset_remaining_time = __time_sub(__BOOL_LITERAL(TRUE), NULL, "); |
706 print_variable_prefix(); |
707 print_variable_prefix(); |
707 s4o.print("__action_list[i].reset_remaining_time, elapsed_time);\n"); |
708 s4o.print("__action_list[i].reset_remaining_time, elapsed_time);\n"); |
708 s4o.print(s4o.indent_spaces + "if ("); |
709 s4o.print(s4o.indent_spaces + "if ("); |
709 s4o.print("__le_TIME(2, "); |
710 s4o.print("__TIME_CMP("); |
710 print_variable_prefix(); |
711 print_variable_prefix(); |
711 s4o.print("__action_list[i].reset_remaining_time, __time_to_timespec(1, 0, 0, 0, 0, 0))) {\n"); |
712 s4o.print("__action_list[i].reset_remaining_time, __time_to_timespec(1, 0, 0, 0, 0, 0)) <= 0) {\n"); |
712 s4o.indent_right(); |
713 s4o.indent_right(); |
713 s4o.print(s4o.indent_spaces); |
714 s4o.print(s4o.indent_spaces); |
714 print_variable_prefix(); |
715 print_variable_prefix(); |
715 s4o.print("__action_list[i].reset_remaining_time = __time_to_timespec(1, 0, 0, 0, 0, 0);\n"); |
716 s4o.print("__action_list[i].reset_remaining_time = __time_to_timespec(1, 0, 0, 0, 0, 0);\n"); |
716 s4o.print(s4o.indent_spaces); |
717 s4o.print(s4o.indent_spaces); |