83 action_number = 0; |
83 action_number = 0; |
84 transition_number = 0; |
84 transition_number = 0; |
85 switch (wanted_sfcdeclaration) { |
85 switch (wanted_sfcdeclaration) { |
86 case sfcdecl_sd: |
86 case sfcdecl_sd: |
87 for(int i = 0; i < symbol->n; i++) |
87 for(int i = 0; i < symbol->n; i++) |
88 symbol->elements[i]->accept(*this); |
88 symbol->get_element(i)->accept(*this); |
89 |
89 |
90 /* steps table declaration */ |
90 /* steps table declaration */ |
91 s4o.print(s4o.indent_spaces + "STEP __step_list["); |
91 s4o.print(s4o.indent_spaces + "STEP __step_list["); |
92 s4o.print(step_number); |
92 s4o.print(step_number); |
93 s4o.print("];\n"); |
93 s4o.print("];\n"); |
118 s4o.print("UINT i;\n"); |
118 s4o.print("UINT i;\n"); |
119 |
119 |
120 /* steps table count */ |
120 /* steps table count */ |
121 wanted_sfcdeclaration = stepcount_sd; |
121 wanted_sfcdeclaration = stepcount_sd; |
122 for(int i = 0; i < symbol->n; i++) |
122 for(int i = 0; i < symbol->n; i++) |
123 symbol->elements[i]->accept(*this); |
123 symbol->get_element(i)->accept(*this); |
124 s4o.print(s4o.indent_spaces); |
124 s4o.print(s4o.indent_spaces); |
125 print_variable_prefix(); |
125 print_variable_prefix(); |
126 s4o.print("__nb_steps = "); |
126 s4o.print("__nb_steps = "); |
127 s4o.print(step_number); |
127 s4o.print(step_number); |
128 s4o.print(";\n"); |
128 s4o.print(";\n"); |
139 print_variable_prefix(); |
139 print_variable_prefix(); |
140 s4o.print("__step_list[i] = temp_step;\n"); |
140 s4o.print("__step_list[i] = temp_step;\n"); |
141 s4o.indent_left(); |
141 s4o.indent_left(); |
142 s4o.print(s4o.indent_spaces + "}\n"); |
142 s4o.print(s4o.indent_spaces + "}\n"); |
143 for(int i = 0; i < symbol->n; i++) |
143 for(int i = 0; i < symbol->n; i++) |
144 symbol->elements[i]->accept(*this); |
144 symbol->get_element(i)->accept(*this); |
145 |
145 |
146 /* actions table count */ |
146 /* actions table count */ |
147 wanted_sfcdeclaration = actioncount_sd; |
147 wanted_sfcdeclaration = actioncount_sd; |
148 for(int i = 0; i < symbol->n; i++) |
148 for(int i = 0; i < symbol->n; i++) |
149 symbol->elements[i]->accept(*this); |
149 symbol->get_element(i)->accept(*this); |
150 s4o.print(s4o.indent_spaces); |
150 s4o.print(s4o.indent_spaces); |
151 print_variable_prefix(); |
151 print_variable_prefix(); |
152 s4o.print("__nb_actions = "); |
152 s4o.print("__nb_actions = "); |
153 s4o.print(action_number); |
153 s4o.print(action_number); |
154 s4o.print(";\n"); |
154 s4o.print(";\n"); |
168 s4o.print(s4o.indent_spaces + "}\n"); |
168 s4o.print(s4o.indent_spaces + "}\n"); |
169 |
169 |
170 /* transitions table count */ |
170 /* transitions table count */ |
171 wanted_sfcdeclaration = transitioncount_sd; |
171 wanted_sfcdeclaration = transitioncount_sd; |
172 for(int i = 0; i < symbol->n; i++) |
172 for(int i = 0; i < symbol->n; i++) |
173 symbol->elements[i]->accept(*this); |
173 symbol->get_element(i)->accept(*this); |
174 s4o.print(s4o.indent_spaces); |
174 s4o.print(s4o.indent_spaces); |
175 print_variable_prefix(); |
175 print_variable_prefix(); |
176 s4o.print("__nb_transitions = "); |
176 s4o.print("__nb_transitions = "); |
177 s4o.print(transition_number); |
177 s4o.print(transition_number); |
178 s4o.print(";\n"); |
178 s4o.print(";\n"); |
185 s4o.print("__lasttick_time = __CURRENT_TIME;\n"); |
185 s4o.print("__lasttick_time = __CURRENT_TIME;\n"); |
186 break; |
186 break; |
187 case stepdef_sd: |
187 case stepdef_sd: |
188 s4o.print("// Steps definitions\n"); |
188 s4o.print("// Steps definitions\n"); |
189 for(int i = 0; i < symbol->n; i++) |
189 for(int i = 0; i < symbol->n; i++) |
190 symbol->elements[i]->accept(*this); |
190 symbol->get_element(i)->accept(*this); |
191 s4o.print("\n"); |
191 s4o.print("\n"); |
192 break; |
192 break; |
193 case actiondef_sd: |
193 case actiondef_sd: |
194 s4o.print("// Actions definitions\n"); |
194 s4o.print("// Actions definitions\n"); |
195 { |
195 { |
196 // first fill up the this->variable_list variable! |
196 // first fill up the this->variable_list variable! |
197 wanted_sfcdeclaration = actioncount_sd; |
197 wanted_sfcdeclaration = actioncount_sd; |
198 for(int i = 0; i < symbol->n; i++) |
198 for(int i = 0; i < symbol->n; i++) |
199 symbol->elements[i]->accept(*this); |
199 symbol->get_element(i)->accept(*this); |
200 action_number = 0; // reset the counter! |
200 action_number = 0; // reset the counter! |
201 wanted_sfcdeclaration = actiondef_sd; |
201 wanted_sfcdeclaration = actiondef_sd; |
202 // Now do the defines for actions! |
202 // Now do the defines for actions! |
203 for(int i = 0; i < symbol->n; i++) |
203 for(int i = 0; i < symbol->n; i++) |
204 symbol->elements[i]->accept(*this); |
204 symbol->get_element(i)->accept(*this); |
205 // Now do the defines for actions that reference a variable instead of an action block! |
205 // Now do the defines for actions that reference a variable instead of an action block! |
206 std::list<VARIABLE>::iterator pt; |
206 std::list<VARIABLE>::iterator pt; |
207 for(pt = variable_list.begin(); pt != variable_list.end(); pt++) { |
207 for(pt = variable_list.begin(); pt != variable_list.end(); pt++) { |
208 s4o.print("#define "); |
208 s4o.print("#define "); |
209 s4o.print(SFC_STEP_ACTION_PREFIX); |
209 s4o.print(SFC_STEP_ACTION_PREFIX); |
217 s4o.print("\n"); |
217 s4o.print("\n"); |
218 break; |
218 break; |
219 case stepundef_sd: |
219 case stepundef_sd: |
220 s4o.print("// Steps undefinitions\n"); |
220 s4o.print("// Steps undefinitions\n"); |
221 for(int i = 0; i < symbol->n; i++) |
221 for(int i = 0; i < symbol->n; i++) |
222 symbol->elements[i]->accept(*this); |
222 symbol->get_element(i)->accept(*this); |
223 s4o.print("\n"); |
223 s4o.print("\n"); |
224 break; |
224 break; |
225 case actionundef_sd: |
225 case actionundef_sd: |
226 s4o.print("// Actions undefinitions\n"); |
226 s4o.print("// Actions undefinitions\n"); |
227 for(int i = 0; i < symbol->n; i++) |
227 for(int i = 0; i < symbol->n; i++) |
228 symbol->elements[i]->accept(*this); |
228 symbol->get_element(i)->accept(*this); |
229 { |
229 { |
230 // first fill up the this->variable_list variable! |
230 // first fill up the this->variable_list variable! |
231 wanted_sfcdeclaration = actioncount_sd; |
231 wanted_sfcdeclaration = actioncount_sd; |
232 for(int i = 0; i < symbol->n; i++) |
232 for(int i = 0; i < symbol->n; i++) |
233 symbol->elements[i]->accept(*this); |
233 symbol->get_element(i)->accept(*this); |
234 wanted_sfcdeclaration = actionundef_sd; |
234 wanted_sfcdeclaration = actionundef_sd; |
235 std::list<VARIABLE>::iterator pt; |
235 std::list<VARIABLE>::iterator pt; |
236 for(pt = variable_list.begin(); pt != variable_list.end(); pt++) { |
236 for(pt = variable_list.begin(); pt != variable_list.end(); pt++) { |
237 s4o.print("#undef "); |
237 s4o.print("#undef "); |
238 s4o.print(SFC_STEP_ACTION_PREFIX); |
238 s4o.print(SFC_STEP_ACTION_PREFIX); |