stage4/generate_c/generate_c_sfc.cc
changeset 229 ca7bc1324540
parent 221 c6aed7e5f070
child 244 3a478229db8b
equal deleted inserted replaced
228:43831b683764 229:ca7bc1324540
   659       
   659       
   660       s4o.print(s4o.indent_spaces +"INT i;\n");
   660       s4o.print(s4o.indent_spaces +"INT i;\n");
   661       s4o.print(s4o.indent_spaces +"BOOL transition;\n");
   661       s4o.print(s4o.indent_spaces +"BOOL transition;\n");
   662       s4o.print(s4o.indent_spaces +"TIME elapsed_time, current_time;\n\n");
   662       s4o.print(s4o.indent_spaces +"TIME elapsed_time, current_time;\n\n");
   663       
   663       
   664       /* generate elapsed_time initialisations */
   664       /* generate elapsed_time initializations */
   665       s4o.print(s4o.indent_spaces + "// Calculate elapsed_time\n");
   665       s4o.print(s4o.indent_spaces + "// Calculate elapsed_time\n");
   666       s4o.print(s4o.indent_spaces +"current_time = __CURRENT_TIME;\n");
   666       s4o.print(s4o.indent_spaces +"current_time = __CURRENT_TIME;\n");
   667       s4o.print(s4o.indent_spaces +"elapsed_time = __time_sub(__BOOL_LITERAL(TRUE), NULL, current_time, ");
   667       s4o.print(s4o.indent_spaces +"elapsed_time = __time_sub(__BOOL_LITERAL(TRUE), NULL, current_time, ");
   668       print_variable_prefix();
   668       print_variable_prefix();
   669       s4o.print("__lasttick_time);\n");
   669       s4o.print("__lasttick_time);\n");
   670       s4o.print(s4o.indent_spaces);
   670       s4o.print(s4o.indent_spaces);
   671       print_variable_prefix();
   671       print_variable_prefix();
   672       s4o.print("__lasttick_time = current_time;\n");
   672       s4o.print("__lasttick_time = current_time;\n");
   673       
   673       
   674       /* generate step initialisations */
   674       /* generate transition initializations */
   675       s4o.print(s4o.indent_spaces + "// Steps initialisation\n");
   675       s4o.print(s4o.indent_spaces + "// Transitions initialization\n");
       
   676       s4o.print(s4o.indent_spaces + "if (__DEBUG) {\n");
       
   677       s4o.indent_right();
       
   678       s4o.print(s4o.indent_spaces + "for (i = 0; i < ");
       
   679       print_variable_prefix();
       
   680       s4o.print("__nb_transitions; i++) {\n");
       
   681       s4o.indent_right();
       
   682       s4o.print(s4o.indent_spaces);
       
   683       print_variable_prefix();
       
   684       s4o.print("__transition_list[i] = ");
       
   685       print_variable_prefix();
       
   686       s4o.print("__debug_transition_list[i];\n");
       
   687       s4o.indent_left();
       
   688       s4o.print(s4o.indent_spaces + "}\n");
       
   689       s4o.indent_left();
       
   690       s4o.print(s4o.indent_spaces + "}\n");
       
   691 
       
   692       /* generate step initializations */
       
   693       s4o.print(s4o.indent_spaces + "// Steps initialization\n");
   676       s4o.print(s4o.indent_spaces + "for (i = 0; i < ");
   694       s4o.print(s4o.indent_spaces + "for (i = 0; i < ");
   677       print_variable_prefix();
   695       print_variable_prefix();
   678       s4o.print("__nb_steps; i++) {\n");
   696       s4o.print("__nb_steps; i++) {\n");
   679       s4o.indent_right();
   697       s4o.indent_right();
   680       s4o.print(s4o.indent_spaces);
   698       s4o.print(s4o.indent_spaces);
   698       s4o.indent_left();
   716       s4o.indent_left();
   699       s4o.print(s4o.indent_spaces + "}\n");
   717       s4o.print(s4o.indent_spaces + "}\n");
   700       s4o.indent_left();
   718       s4o.indent_left();
   701       s4o.print(s4o.indent_spaces + "}\n");
   719       s4o.print(s4o.indent_spaces + "}\n");
   702 
   720 
   703       /* generate action initilizations */
   721       /* generate action initializations */
   704       s4o.print(s4o.indent_spaces + "// Actions initialisation\n");
   722       s4o.print(s4o.indent_spaces + "// Actions initialization\n");
   705       s4o.print(s4o.indent_spaces + "for (i = 0; i < ");
   723       s4o.print(s4o.indent_spaces + "for (i = 0; i < ");
   706       print_variable_prefix();
   724       print_variable_prefix();
   707       s4o.print("__nb_actions; i++) {\n");
   725       s4o.print("__nb_actions; i++) {\n");
   708       s4o.indent_right();
   726       s4o.indent_right();
   709       s4o.print(s4o.indent_spaces);
   727       s4o.print(s4o.indent_spaces);