85 case sfcdecl_sd: |
85 case sfcdecl_sd: |
86 for(int i = 0; i < symbol->n; i++) |
86 for(int i = 0; i < symbol->n; i++) |
87 symbol->elements[i]->accept(*this); |
87 symbol->elements[i]->accept(*this); |
88 |
88 |
89 /* steps table declaration */ |
89 /* steps table declaration */ |
90 s4o.print(s4o.indent_spaces + "STEP step_list["); |
90 s4o.print(s4o.indent_spaces + "STEP __step_list["); |
91 s4o.print_integer(step_number); |
91 s4o.print_integer(step_number); |
92 s4o.print("];\n"); |
92 s4o.print("];\n"); |
93 s4o.print(s4o.indent_spaces + "UINT nb_steps;\n"); |
93 s4o.print(s4o.indent_spaces + "UINT __nb_steps;\n"); |
94 |
94 |
95 /* actions table declaration */ |
95 /* actions table declaration */ |
96 s4o.print(s4o.indent_spaces + "ACTION action_list["); |
96 s4o.print(s4o.indent_spaces + "ACTION __action_list["); |
97 s4o.print_integer(action_number); |
97 s4o.print_integer(action_number); |
98 s4o.print("];\n"); |
98 s4o.print("];\n"); |
99 s4o.print(s4o.indent_spaces + "UINT nb_actions;\n"); |
99 s4o.print(s4o.indent_spaces + "UINT __nb_actions;\n"); |
100 |
100 |
101 /* transitions table declaration */ |
101 /* transitions table declaration */ |
102 s4o.print(s4o.indent_spaces + "BOOL transition_list["); |
102 s4o.print(s4o.indent_spaces + "BOOL __transition_list["); |
103 s4o.print_integer(transition_number); |
103 s4o.print_integer(transition_number); |
104 s4o.print("];\n"); |
104 s4o.print("];\n"); |
105 |
105 |
|
106 /* transitions debug table declaration */ |
|
107 s4o.print(s4o.indent_spaces + "BOOL __debug_transition_list["); |
|
108 s4o.print_integer(transition_number); |
|
109 s4o.print("];\n"); |
|
110 |
106 /* last_ticktime declaration */ |
111 /* last_ticktime declaration */ |
107 s4o.print(s4o.indent_spaces + "TIME lasttick_time;\n"); |
112 s4o.print(s4o.indent_spaces + "TIME __lasttick_time;\n"); |
108 break; |
113 break; |
109 case sfcinit_sd: |
114 case sfcinit_sd: |
110 s4o.print(s4o.indent_spaces); |
115 s4o.print(s4o.indent_spaces); |
111 s4o.print("UINT i;\n"); |
116 s4o.print("UINT i;\n"); |
112 |
117 |
114 wanted_sfcdeclaration = stepcount_sd; |
119 wanted_sfcdeclaration = stepcount_sd; |
115 for(int i = 0; i < symbol->n; i++) |
120 for(int i = 0; i < symbol->n; i++) |
116 symbol->elements[i]->accept(*this); |
121 symbol->elements[i]->accept(*this); |
117 s4o.print(s4o.indent_spaces); |
122 s4o.print(s4o.indent_spaces); |
118 print_variable_prefix(); |
123 print_variable_prefix(); |
119 s4o.print("nb_steps = "); |
124 s4o.print("__nb_steps = "); |
120 s4o.print_integer(step_number); |
125 s4o.print_integer(step_number); |
121 s4o.print(";\n"); |
126 s4o.print(";\n"); |
122 step_number = 0; |
127 step_number = 0; |
123 wanted_sfcdeclaration = sfcinit_sd; |
128 wanted_sfcdeclaration = sfcinit_sd; |
124 |
129 |
125 /* steps table initialisation */ |
130 /* steps table initialisation */ |
126 s4o.print(s4o.indent_spaces + "STEP temp_step = {0, 0, 0};\n"); |
131 s4o.print(s4o.indent_spaces + "STEP temp_step = {0, 0, 0};\n"); |
127 s4o.print(s4o.indent_spaces + "for(i = 0; i < "); |
132 s4o.print(s4o.indent_spaces + "for(i = 0; i < "); |
128 print_variable_prefix(); |
133 print_variable_prefix(); |
129 s4o.print("nb_steps; i++) {\n"); |
134 s4o.print("__nb_steps; i++) {\n"); |
130 s4o.indent_right(); |
135 s4o.indent_right(); |
131 s4o.print(s4o.indent_spaces); |
136 s4o.print(s4o.indent_spaces); |
132 print_variable_prefix(); |
137 print_variable_prefix(); |
133 s4o.print("step_list[i] = temp_step;\n"); |
138 s4o.print("__step_list[i] = temp_step;\n"); |
134 s4o.indent_left(); |
139 s4o.indent_left(); |
135 s4o.print(s4o.indent_spaces + "}\n"); |
140 s4o.print(s4o.indent_spaces + "}\n"); |
136 for(int i = 0; i < symbol->n; i++) |
141 for(int i = 0; i < symbol->n; i++) |
137 symbol->elements[i]->accept(*this); |
142 symbol->elements[i]->accept(*this); |
138 |
143 |
140 wanted_sfcdeclaration = actioncount_sd; |
145 wanted_sfcdeclaration = actioncount_sd; |
141 for(int i = 0; i < symbol->n; i++) |
146 for(int i = 0; i < symbol->n; i++) |
142 symbol->elements[i]->accept(*this); |
147 symbol->elements[i]->accept(*this); |
143 s4o.print(s4o.indent_spaces); |
148 s4o.print(s4o.indent_spaces); |
144 print_variable_prefix(); |
149 print_variable_prefix(); |
145 s4o.print("nb_actions = "); |
150 s4o.print("__nb_actions = "); |
146 s4o.print_integer(action_number); |
151 s4o.print_integer(action_number); |
147 s4o.print(";\n"); |
152 s4o.print(";\n"); |
148 action_number = 0; |
153 action_number = 0; |
149 wanted_sfcdeclaration = sfcinit_sd; |
154 wanted_sfcdeclaration = sfcinit_sd; |
150 |
155 |
151 /* actions table initialisation */ |
156 /* actions table initialisation */ |
152 s4o.print(s4o.indent_spaces + "ACTION temp_action = {0, 0, 0, 0, 0, 0};\n"); |
157 s4o.print(s4o.indent_spaces + "ACTION temp_action = {0, 0, 0, 0, 0, 0};\n"); |
153 s4o.print(s4o.indent_spaces + "for(i = 0; i < "); |
158 s4o.print(s4o.indent_spaces + "for(i = 0; i < "); |
154 print_variable_prefix(); |
159 print_variable_prefix(); |
155 s4o.print("nb_actions; i++) {\n"); |
160 s4o.print("__nb_actions; i++) {\n"); |
156 s4o.indent_right(); |
161 s4o.indent_right(); |
157 s4o.print(s4o.indent_spaces); |
162 s4o.print(s4o.indent_spaces); |
158 print_variable_prefix(); |
163 print_variable_prefix(); |
159 s4o.print("action_list[i] = temp_action;\n"); |
164 s4o.print("__action_list[i] = temp_action;\n"); |
160 s4o.indent_left(); |
165 s4o.indent_left(); |
161 s4o.print(s4o.indent_spaces + "}\n"); |
166 s4o.print(s4o.indent_spaces + "}\n"); |
162 |
167 |
163 /* last_ticktime initialisation */ |
168 /* last_ticktime initialisation */ |
164 print_variable_prefix(); |
169 print_variable_prefix(); |
165 s4o.print("lasttick_time = __CURRENT_TIME;\n"); |
170 s4o.print("__lasttick_time = __CURRENT_TIME;\n"); |
166 break; |
171 break; |
167 case stepdef_sd: |
172 case stepdef_sd: |
168 s4o.print("// Steps definitions\n"); |
173 s4o.print("// Steps definitions\n"); |
169 for(int i = 0; i < symbol->n; i++) |
174 for(int i = 0; i < symbol->n; i++) |
170 symbol->elements[i]->accept(*this); |
175 symbol->elements[i]->accept(*this); |