86 |
88 |
87 /* steps table declaration */ |
89 /* steps table declaration */ |
88 s4o.print(s4o.indent_spaces + "STEP step_list["); |
90 s4o.print(s4o.indent_spaces + "STEP step_list["); |
89 s4o.print_integer(step_number); |
91 s4o.print_integer(step_number); |
90 s4o.print("];\n"); |
92 s4o.print("];\n"); |
91 s4o.print(s4o.indent_spaces + "UINT nb_steps = "); |
93 s4o.print(s4o.indent_spaces + "UINT nb_steps;\n"); |
92 s4o.print_integer(step_number); |
|
93 s4o.print(";\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 = "); |
99 s4o.print(s4o.indent_spaces + "UINT nb_actions;\n"); |
100 s4o.print_integer(action_number); |
|
101 s4o.print(";\n"); |
|
102 |
100 |
103 /* transitions table declaration */ |
101 /* transitions table declaration */ |
104 s4o.print(s4o.indent_spaces + "USINT transition_list["); |
102 s4o.print(s4o.indent_spaces + "USINT transition_list["); |
105 s4o.print_integer(transition_number); |
103 s4o.print_integer(transition_number); |
106 s4o.print("];\n"); |
104 s4o.print("];\n"); |
|
105 |
|
106 /* period declaration */ |
|
107 s4o.print(s4o.indent_spaces + "TIME period;\n"); |
107 break; |
108 break; |
108 case sfcinit_sd: |
109 case sfcinit_sd: |
|
110 s4o.print(s4o.indent_spaces); |
|
111 s4o.print("UINT i;\n"); |
|
112 |
|
113 /* steps table count */ |
|
114 wanted_sfcdeclaration = stepcount_sd; |
|
115 for(int i = 0; i < symbol->n; i++) |
|
116 symbol->elements[i]->accept(*this); |
|
117 s4o.print(s4o.indent_spaces); |
|
118 print_variable_prefix(); |
|
119 s4o.print("nb_steps = "); |
|
120 s4o.print_integer(step_number); |
|
121 s4o.print(";\n"); |
|
122 step_number = 0; |
|
123 wanted_sfcdeclaration = sfcinit_sd; |
|
124 |
109 /* steps table initialisation */ |
125 /* steps table initialisation */ |
110 s4o.print(s4o.indent_spaces + "STEP temp_step = {0, 0, 0};\n"); |
126 s4o.print(s4o.indent_spaces + "STEP temp_step = {0, 0, 0};\n"); |
111 s4o.print(s4o.indent_spaces + "for(UINT i = 0; i < "); |
127 s4o.print(s4o.indent_spaces + "for(i = 0; i < "); |
112 print_variable_prefix(); |
128 print_variable_prefix(); |
113 s4o.print("nb_steps; i++) {\n"); |
129 s4o.print("nb_steps; i++) {\n"); |
114 s4o.indent_right(); |
130 s4o.indent_right(); |
115 s4o.print(s4o.indent_spaces); |
131 s4o.print(s4o.indent_spaces); |
116 print_variable_prefix(); |
132 print_variable_prefix(); |
118 s4o.indent_left(); |
134 s4o.indent_left(); |
119 s4o.print(s4o.indent_spaces + "}\n"); |
135 s4o.print(s4o.indent_spaces + "}\n"); |
120 for(int i = 0; i < symbol->n; i++) |
136 for(int i = 0; i < symbol->n; i++) |
121 symbol->elements[i]->accept(*this); |
137 symbol->elements[i]->accept(*this); |
122 |
138 |
|
139 /* steps table count */ |
|
140 wanted_sfcdeclaration = actioncount_sd; |
|
141 for(int i = 0; i < symbol->n; i++) |
|
142 symbol->elements[i]->accept(*this); |
|
143 s4o.print(s4o.indent_spaces); |
|
144 print_variable_prefix(); |
|
145 s4o.print("nb_actions = "); |
|
146 s4o.print_integer(action_number); |
|
147 s4o.print(";\n"); |
|
148 action_number = 0; |
|
149 wanted_sfcdeclaration = sfcinit_sd; |
|
150 |
123 /* actions table initialisation */ |
151 /* actions table initialisation */ |
124 s4o.print(s4o.indent_spaces + "ACTION temp_action = {0, 0, 0, 0, 0, 0};\n"); |
152 s4o.print(s4o.indent_spaces + "ACTION temp_action = {0, 0, 0, 0, 0, 0};\n"); |
125 s4o.print(s4o.indent_spaces + "for(UINT i = 0; i < "); |
153 s4o.print(s4o.indent_spaces + "for(i = 0; i < "); |
126 print_variable_prefix(); |
154 print_variable_prefix(); |
127 s4o.print("nb_actions; i++) {\n"); |
155 s4o.print("nb_actions; i++) {\n"); |
128 s4o.indent_right(); |
156 s4o.indent_right(); |
129 s4o.print(s4o.indent_spaces); |
157 s4o.print(s4o.indent_spaces); |
130 print_variable_prefix(); |
158 print_variable_prefix(); |
131 s4o.print("action_list[i] = temp_action;\n"); |
159 s4o.print("action_list[i] = temp_action;\n"); |
|
160 |
|
161 /* period initialisation */ |
|
162 s4o.print(s4o.indent_spaces); |
|
163 print_variable_prefix(); |
|
164 s4o.print("period = __time_to_timespec(1, 0, 0, 0, 0, 0);\n"); |
|
165 |
132 s4o.indent_left(); |
166 s4o.indent_left(); |
133 s4o.print(s4o.indent_spaces + "}\n"); |
167 s4o.print(s4o.indent_spaces + "}\n"); |
134 break; |
168 break; |
135 case stepdef_sd: |
169 case stepdef_sd: |
136 s4o.print("// Steps definitions\n"); |
170 s4o.print("// Steps definitions\n"); |
154 s4o.print("// Actions undefinitions\n"); |
188 s4o.print("// Actions undefinitions\n"); |
155 for(int i = 0; i < symbol->n; i++) |
189 for(int i = 0; i < symbol->n; i++) |
156 symbol->elements[i]->accept(*this); |
190 symbol->elements[i]->accept(*this); |
157 s4o.print("\n"); |
191 s4o.print("\n"); |
158 break; |
192 break; |
|
193 default: |
|
194 break; |
159 } |
195 } |
160 return NULL; |
196 return NULL; |
161 } |
197 } |
162 |
198 |
163 void *visit(initial_step_c *symbol) { |
199 void *visit(initial_step_c *symbol) { |
164 switch (wanted_sfcdeclaration) { |
200 switch (wanted_sfcdeclaration) { |
|
201 case stepcount_sd: |
165 case sfcdecl_sd: |
202 case sfcdecl_sd: |
166 step_number++; |
203 step_number++; |
167 break; |
204 break; |
168 case sfcinit_sd: |
205 case sfcinit_sd: |
169 s4o.print(s4o.indent_spaces); |
206 s4o.print(s4o.indent_spaces); |
170 print_variable_prefix(); |
207 print_variable_prefix(); |
171 s4o.print("action_list["); |
208 s4o.print("step_list["); |
172 s4o.print_integer(step_number); |
209 s4o.print_integer(step_number); |
173 s4o.print("].state = 1;\n"); |
210 s4o.print("].state = 1;\n"); |
174 step_number++; |
211 step_number++; |
175 break; |
212 break; |
176 case stepdef_sd: |
213 case stepdef_sd: |