author | laurent |
Thu, 22 Apr 2010 00:29:30 +0200 | |
changeset 239 | b3063ca418c1 |
parent 226 | 29f8ffc203c1 |
child 265 | 4d222f46f8cc |
permissions | -rwxr-xr-x |
181 | 1 |
/* |
2 |
* (c) 2003 Mario de Sousa |
|
3 |
* |
|
4 |
* Offered to the public under the terms of the GNU General Public License |
|
5 |
* as published by the Free Software Foundation; either version 2 of the |
|
6 |
* License, or (at your option) any later version. |
|
7 |
* |
|
8 |
* This program is distributed in the hope that it will be useful, but |
|
9 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
|
11 |
* Public License for more details. |
|
12 |
* |
|
13 |
* This code is made available on the understanding that it will not be |
|
14 |
* used in safety-critical situations without a full and competent review. |
|
15 |
*/ |
|
16 |
||
17 |
/* |
|
18 |
* An IEC 61131-3 IL and ST compiler. |
|
19 |
* |
|
20 |
* Based on the |
|
21 |
* FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) |
|
22 |
* |
|
23 |
*/ |
|
24 |
||
25 |
/* Determine the data type of a specific variable instance, including |
|
26 |
* function block instances. |
|
27 |
* A reference to the relevant variable declaration is returned. |
|
217
f5dfadf5de54
Adding support for declare, init, get and set macros
laurent
parents:
202
diff
changeset
|
28 |
* The variable instance may NOT be a member of a structure of a member |
181 | 29 |
* of a structure of an element of an array of ... |
30 |
* |
|
31 |
* example: |
|
32 |
* window.points[1].coordinate.x |
|
33 |
* window.points[1].colour |
|
34 |
* etc... ARE NOT ALLOWED! |
|
35 |
* |
|
36 |
* This class must only be passed the name of the variable that will appear |
|
37 |
* in the variable declaration. In the above examples, this would be |
|
38 |
* 'window' !! |
|
39 |
* |
|
40 |
* |
|
41 |
* If you need to pass a complete name of a variable instance (such as |
|
42 |
* 'window.points[1].coordinate.x') use the search_varfb_instance_type_c instead! |
|
43 |
*/ |
|
44 |
||
45 |
/* Note that current_type_decl that this class returns may reference the |
|
46 |
* name of a type, or the type declaration itself! |
|
47 |
* For an example of the first, consider a variable declared as ... |
|
48 |
* x : AAA; |
|
49 |
* where the AAA type is previously declared as whatever. |
|
50 |
* For an example of the second, consider a variable declared as ... |
|
51 |
* x : array of int [10]; ----> is allowed |
|
52 |
* |
|
53 |
* If it is the first, we will return a reference to the name, if the second |
|
54 |
* we return a reference to the declaration!! |
|
55 |
*/ |
|
56 |
#include "absyntax_utils.hh" |
|
57 |
||
58 |
||
59 |
search_var_instance_decl_c::search_var_instance_decl_c(symbol_c *search_scope) { |
|
60 |
this->current_vartype = none_vt; |
|
61 |
this->search_scope = search_scope; |
|
62 |
this->search_name = NULL; |
|
63 |
this->current_type_decl = NULL; |
|
64 |
} |
|
65 |
||
66 |
symbol_c *search_var_instance_decl_c::get_decl(symbol_c *variable_instance_name) { |
|
217
f5dfadf5de54
Adding support for declare, init, get and set macros
laurent
parents:
202
diff
changeset
|
67 |
this->current_vartype = none_vt; |
181 | 68 |
this->search_name = variable_instance_name; |
69 |
return (symbol_c *)search_scope->accept(*this); |
|
70 |
} |
|
71 |
||
226
29f8ffc203c1
Adding support for setter and getter on complex datatype in ST
laurent
parents:
221
diff
changeset
|
72 |
unsigned int search_var_instance_decl_c::get_vartype(void) { |
181 | 73 |
return current_vartype; |
74 |
} |
|
75 |
||
76 |
/***************************/ |
|
77 |
/* B 0 - Programming Model */ |
|
78 |
/***************************/ |
|
79 |
void *search_var_instance_decl_c::visit(library_c *symbol) { |
|
80 |
/* we do not want to search multiple declaration scopes, |
|
217
f5dfadf5de54
Adding support for declare, init, get and set macros
laurent
parents:
202
diff
changeset
|
81 |
* so we do not visit all the functions, function blocks, etc... |
181 | 82 |
*/ |
83 |
return NULL; |
|
84 |
} |
|
85 |
||
86 |
||
87 |
||
88 |
/******************************************/ |
|
217
f5dfadf5de54
Adding support for declare, init, get and set macros
laurent
parents:
202
diff
changeset
|
89 |
/* B 1.4.3 - Declaration & Initialization */ |
181 | 90 |
/******************************************/ |
217
f5dfadf5de54
Adding support for declare, init, get and set macros
laurent
parents:
202
diff
changeset
|
91 |
|
181 | 92 |
/* edge -> The F_EDGE or R_EDGE directive */ |
93 |
// SYM_REF2(edge_declaration_c, edge, var1_list) |
|
94 |
// TODO |
|
95 |
||
96 |
void *search_var_instance_decl_c::visit(input_declarations_c *symbol) { |
|
97 |
current_vartype = input_vt; |
|
98 |
void *res = symbol->input_declaration_list->accept(*this); |
|
99 |
if (res == NULL) { |
|
100 |
current_vartype = none_vt; |
|
101 |
} |
|
102 |
return res; |
|
103 |
} |
|
104 |
||
105 |
/* VAR_OUTPUT [RETAIN | NON_RETAIN] var_init_decl_list END_VAR */ |
|
106 |
/* option -> may be NULL ! */ |
|
107 |
void *search_var_instance_decl_c::visit(output_declarations_c *symbol) { |
|
108 |
current_vartype = output_vt; |
|
109 |
void *res = symbol->var_init_decl_list->accept(*this); |
|
110 |
if (res == NULL) { |
|
111 |
current_vartype = none_vt; |
|
112 |
} |
|
113 |
return res; |
|
114 |
} |
|
115 |
||
116 |
/* VAR_IN_OUT var_declaration_list END_VAR */ |
|
117 |
void *search_var_instance_decl_c::visit(input_output_declarations_c *symbol) { |
|
118 |
current_vartype = inoutput_vt; |
|
119 |
void *res = symbol->var_declaration_list->accept(*this); |
|
120 |
if (res == NULL) { |
|
121 |
current_vartype = none_vt; |
|
122 |
} |
|
123 |
return res; |
|
124 |
} |
|
125 |
||
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
126 |
/* ENO : BOOL */ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
127 |
void *search_var_instance_decl_c::visit(eno_param_declaration_c *symbol) { |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
128 |
if (compare_identifiers(symbol->name, search_name) == 0) |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
129 |
return symbol->type; |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
130 |
return NULL; |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
131 |
} |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
132 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
133 |
|
181 | 134 |
/* VAR [CONSTANT] var_init_decl_list END_VAR */ |
135 |
/* option -> may be NULL ! */ |
|
136 |
/* helper symbol for input_declarations */ |
|
137 |
void *search_var_instance_decl_c::visit(var_declarations_c *symbol) { |
|
138 |
current_vartype = private_vt; |
|
139 |
void *res = symbol->var_init_decl_list->accept(*this); |
|
140 |
if (res == NULL) { |
|
141 |
current_vartype = none_vt; |
|
142 |
} |
|
143 |
return res; |
|
144 |
} |
|
145 |
||
146 |
/* VAR RETAIN var_init_decl_list END_VAR */ |
|
147 |
void *search_var_instance_decl_c::visit(retentive_var_declarations_c *symbol) { |
|
148 |
current_vartype = private_vt; |
|
149 |
void *res = symbol->var_init_decl_list->accept(*this); |
|
150 |
if (res == NULL) { |
|
151 |
current_vartype = none_vt; |
|
152 |
} |
|
153 |
return res; |
|
154 |
} |
|
155 |
||
156 |
/* VAR [CONSTANT|RETAIN|NON_RETAIN] located_var_decl_list END_VAR */ |
|
157 |
/* option -> may be NULL ! */ |
|
158 |
//SYM_REF2(located_var_declarations_c, option, located_var_decl_list) |
|
159 |
void *search_var_instance_decl_c::visit(located_var_declarations_c *symbol) { |
|
160 |
current_vartype = located_vt; |
|
161 |
void *res = symbol->located_var_decl_list->accept(*this); |
|
162 |
if (res == NULL) { |
|
163 |
current_vartype = none_vt; |
|
164 |
} |
|
165 |
return res; |
|
166 |
} |
|
167 |
||
168 |
/*| VAR_EXTERNAL [CONSTANT] external_declaration_list END_VAR */ |
|
169 |
/* option -> may be NULL ! */ |
|
170 |
//SYM_REF2(external_var_declarations_c, option, external_declaration_list) |
|
171 |
void *search_var_instance_decl_c::visit(external_var_declarations_c *symbol) { |
|
172 |
current_vartype = external_vt; |
|
173 |
void *res = symbol->external_declaration_list->accept(*this); |
|
174 |
if (res == NULL) { |
|
175 |
current_vartype = none_vt; |
|
176 |
} |
|
177 |
return res; |
|
178 |
} |
|
179 |
||
180 |
/*| VAR_GLOBAL [CONSTANT|RETAIN] global_var_decl_list END_VAR */ |
|
181 |
/* option -> may be NULL ! */ |
|
182 |
//SYM_REF2(global_var_declarations_c, option, global_var_decl_list) |
|
183 |
void *search_var_instance_decl_c::visit(global_var_declarations_c *symbol) { |
|
184 |
current_vartype = global_vt; |
|
185 |
void *res = symbol->global_var_decl_list->accept(*this); |
|
186 |
if (res == NULL) { |
|
187 |
current_vartype = none_vt; |
|
188 |
} |
|
189 |
return res; |
|
190 |
} |
|
191 |
||
192 |
/* var1_list is one of the following... |
|
193 |
* simple_spec_init_c * |
|
194 |
* subrange_spec_init_c * |
|
195 |
* enumerated_spec_init_c * |
|
196 |
*/ |
|
197 |
// SYM_REF2(var1_init_decl_c, var1_list, spec_init) |
|
198 |
void *search_var_instance_decl_c::visit(var1_init_decl_c *symbol) { |
|
199 |
current_type_decl = symbol->spec_init; |
|
200 |
return symbol->var1_list->accept(*this); |
|
201 |
} |
|
202 |
||
203 |
/* var1_list ',' variable_name */ |
|
204 |
// SYM_LIST(var1_list_c) |
|
205 |
void *search_var_instance_decl_c::visit(var1_list_c *symbol) { |
|
206 |
list_c *list = symbol; |
|
207 |
for(int i = 0; i < list->n; i++) { |
|
208 |
if (compare_identifiers(list->elements[i], search_name) == 0) |
|
209 |
/* by now, current_type_decl should be != NULL */ |
|
210 |
return current_type_decl; |
|
211 |
} |
|
212 |
return NULL; |
|
213 |
} |
|
214 |
||
215 |
/* name_list ':' function_block_type_name ASSIGN structure_initialization */ |
|
216 |
/* structure_initialization -> may be NULL ! */ |
|
217 |
void *search_var_instance_decl_c::visit(fb_name_decl_c *symbol) { |
|
218 |
current_type_decl = symbol->function_block_type_name; |
|
219 |
return symbol->fb_name_list->accept(*this); |
|
220 |
} |
|
221 |
||
222 |
/* name_list ',' fb_name */ |
|
223 |
void *search_var_instance_decl_c::visit(fb_name_list_c *symbol) { |
|
224 |
list_c *list = symbol; |
|
225 |
for(int i = 0; i < list->n; i++) { |
|
226 |
if (compare_identifiers(list->elements[i], search_name) == 0) |
|
227 |
/* by now, current_fb_declaration should be != NULL */ |
|
228 |
return current_type_decl; |
|
229 |
} |
|
230 |
return NULL; |
|
231 |
} |
|
232 |
||
233 |
/* var1_list ':' array_spec_init */ |
|
234 |
// SYM_REF2(array_var_init_decl_c, var1_list, array_spec_init) |
|
235 |
void *search_var_instance_decl_c::visit(array_var_init_decl_c *symbol) { |
|
236 |
current_type_decl = symbol->array_spec_init; |
|
237 |
return symbol->var1_list->accept(*this); |
|
238 |
} |
|
239 |
||
240 |
/* var1_list ':' initialized_structure */ |
|
241 |
// SYM_REF2(structured_var_init_decl_c, var1_list, initialized_structure) |
|
242 |
void *search_var_instance_decl_c::visit(structured_var_init_decl_c *symbol) { |
|
243 |
current_type_decl = symbol->initialized_structure; |
|
244 |
return symbol->var1_list->accept(*this); |
|
245 |
} |
|
246 |
||
247 |
/* var1_list ':' array_specification */ |
|
248 |
// SYM_REF2(array_var_declaration_c, var1_list, array_specification) |
|
249 |
void *search_var_instance_decl_c::visit(array_var_declaration_c *symbol) { |
|
250 |
current_type_decl = symbol->array_specification; |
|
251 |
return symbol->var1_list->accept(*this); |
|
252 |
} |
|
253 |
||
254 |
/* var1_list ':' structure_type_name */ |
|
255 |
// SYM_REF2(structured_var_declaration_c, var1_list, structure_type_name) |
|
256 |
void *search_var_instance_decl_c::visit(structured_var_declaration_c *symbol) { |
|
257 |
current_type_decl = symbol->structure_type_name; |
|
258 |
return symbol->var1_list->accept(*this); |
|
259 |
} |
|
260 |
||
261 |
/* [variable_name] location ':' located_var_spec_init */ |
|
262 |
/* variable_name -> may be NULL ! */ |
|
263 |
// SYM_REF4(located_var_decl_c, variable_name, location, located_var_spec_init, unused) |
|
264 |
// TODO!! |
|
265 |
||
266 |
/* global_var_name ':' (simple_specification|subrange_specification|enumerated_specification|array_specification|prev_declared_structure_type_name|function_block_type_name */ |
|
267 |
// SYM_REF2(external_declaration_c, global_var_name, specification) |
|
268 |
void *search_var_instance_decl_c::visit(external_declaration_c *symbol) { |
|
269 |
if (compare_identifiers(symbol->global_var_name, search_name) == 0) |
|
270 |
return symbol->specification; |
|
271 |
return NULL; |
|
272 |
} |
|
273 |
||
274 |
/*| global_var_spec ':' [located_var_spec_init|function_block_type_name] */ |
|
275 |
/* type_specification ->may be NULL ! */ |
|
276 |
// SYM_REF2(global_var_decl_c, global_var_spec, type_specification) |
|
277 |
void *search_var_instance_decl_c::visit(global_var_decl_c *symbol) { |
|
278 |
if (symbol->type_specification != NULL) { |
|
279 |
current_type_decl = symbol->type_specification; |
|
280 |
return symbol->global_var_spec->accept(*this); |
|
281 |
} |
|
282 |
else |
|
283 |
return NULL; |
|
284 |
} |
|
285 |
||
286 |
/*| global_var_name location */ |
|
287 |
//SYM_REF2(global_var_spec_c, global_var_name, location) |
|
288 |
void *search_var_instance_decl_c::visit(global_var_spec_c *symbol) { |
|
289 |
if (symbol->global_var_name != NULL && compare_identifiers(symbol->global_var_name, search_name) == 0) |
|
290 |
return current_type_decl; |
|
291 |
else |
|
292 |
return symbol->location->accept(*this); |
|
293 |
} |
|
294 |
||
295 |
/*| global_var_list ',' global_var_name */ |
|
296 |
//SYM_LIST(global_var_list_c) |
|
297 |
void *search_var_instance_decl_c::visit(global_var_list_c *symbol) { |
|
298 |
list_c *list = symbol; |
|
299 |
for(int i = 0; i < list->n; i++) { |
|
300 |
if (compare_identifiers(list->elements[i], search_name) == 0) |
|
301 |
/* by now, current_type_decl should be != NULL */ |
|
302 |
return current_type_decl; |
|
303 |
} |
|
304 |
return NULL; |
|
305 |
} |
|
306 |
||
307 |
/* [variable_name] location ':' located_var_spec_init */ |
|
308 |
/* variable_name -> may be NULL ! */ |
|
309 |
//SYM_REF4(located_var_decl_c, variable_name, location, located_var_spec_init, unused) |
|
310 |
void *search_var_instance_decl_c::visit(located_var_decl_c *symbol) { |
|
311 |
if (symbol->variable_name != NULL && compare_identifiers(symbol->variable_name, search_name) == 0) |
|
312 |
return symbol->located_var_spec_init; |
|
313 |
else { |
|
314 |
current_type_decl = symbol->located_var_spec_init; |
|
315 |
return symbol->location->accept(*this); |
|
316 |
} |
|
317 |
} |
|
318 |
||
319 |
/*| global_var_spec ':' [located_var_spec_init|function_block_type_name] */ |
|
320 |
/* type_specification ->may be NULL ! */ |
|
321 |
// SYM_REF2(global_var_decl_c, global_var_spec, type_specification) |
|
322 |
// TODO!! |
|
323 |
||
324 |
/* AT direct_variable */ |
|
325 |
// SYM_REF2(location_c, direct_variable, unused) |
|
326 |
void *search_var_instance_decl_c::visit(location_c *symbol) { |
|
327 |
if (compare_identifiers(symbol->direct_variable, search_name) == 0) |
|
328 |
return current_type_decl; |
|
329 |
else |
|
330 |
return NULL; |
|
331 |
} |
|
332 |
||
333 |
/*| global_var_list ',' global_var_name */ |
|
334 |
// SYM_LIST(global_var_list_c) |
|
335 |
// TODO!! |
|
336 |
||
337 |
/* var1_list ':' single_byte_string_spec */ |
|
338 |
// SYM_REF2(single_byte_string_var_declaration_c, var1_list, single_byte_string_spec) |
|
339 |
void *search_var_instance_decl_c::visit(single_byte_string_var_declaration_c *symbol) { |
|
340 |
current_type_decl = symbol->single_byte_string_spec; |
|
341 |
return symbol->var1_list->accept(*this); |
|
342 |
} |
|
343 |
||
344 |
/* STRING ['[' integer ']'] [ASSIGN single_byte_character_string] */ |
|
345 |
/* integer ->may be NULL ! */ |
|
346 |
/* single_byte_character_string ->may be NULL ! */ |
|
347 |
// SYM_REF2(single_byte_string_spec_c, integer, single_byte_character_string) |
|
348 |
// TODO!! |
|
349 |
||
350 |
/* var1_list ':' double_byte_string_spec */ |
|
351 |
// SYM_REF2(double_byte_string_var_declaration_c, var1_list, double_byte_string_spec) |
|
352 |
void *search_var_instance_decl_c::visit(double_byte_string_var_declaration_c *symbol) { |
|
353 |
current_type_decl = symbol->double_byte_string_spec; |
|
354 |
return symbol->var1_list->accept(*this); |
|
355 |
} |
|
356 |
||
357 |
/* WSTRING ['[' integer ']'] [ASSIGN double_byte_character_string] */ |
|
358 |
/* integer ->may be NULL ! */ |
|
359 |
/* double_byte_character_string ->may be NULL ! */ |
|
360 |
// SYM_REF2(double_byte_string_spec_c, integer, double_byte_character_string) |
|
361 |
// TODO!! |
|
362 |
||
363 |
/* variable_name incompl_location ':' var_spec */ |
|
364 |
// SYM_REF4(incompl_located_var_decl_c, variable_name, incompl_location, var_spec, unused) |
|
365 |
// TODO!! |
|
366 |
||
367 |
/* AT incompl_location_token */ |
|
368 |
// SYM_TOKEN(incompl_location_c) |
|
369 |
// TODO!! |
|
370 |
||
371 |
||
372 |
/**************************************/ |
|
373 |
/* B.1.5 - Program organization units */ |
|
374 |
/**************************************/ |
|
375 |
/***********************/ |
|
376 |
/* B 1.5.1 - Functions */ |
|
377 |
/***********************/ |
|
378 |
// SYM_REF4(function_declaration_c, derived_function_name, type_name, var_declarations_list, function_body) |
|
379 |
void *search_var_instance_decl_c::visit(function_declaration_c *symbol) { |
|
380 |
/* functions have a variable named after themselves, to store |
|
381 |
* the variable that will be returned!! |
|
382 |
*/ |
|
383 |
if (compare_identifiers(symbol->derived_function_name, search_name) == 0) |
|
384 |
return symbol->type_name; |
|
385 |
||
386 |
/* no need to search through all the body, so we only |
|
387 |
* visit the variable declarations...! |
|
388 |
*/ |
|
389 |
return symbol->var_declarations_list->accept(*this); |
|
390 |
} |
|
391 |
||
392 |
/*****************************/ |
|
393 |
/* B 1.5.2 - Function Blocks */ |
|
394 |
/*****************************/ |
|
395 |
void *search_var_instance_decl_c::visit(function_block_declaration_c *symbol) { |
|
396 |
/* no need to search through all the body, so we only |
|
397 |
* visit the variable declarations...! |
|
398 |
*/ |
|
399 |
return symbol->var_declarations->accept(*this); |
|
400 |
} |
|
401 |
||
402 |
/**********************/ |
|
403 |
/* B 1.5.3 - Programs */ |
|
404 |
/**********************/ |
|
405 |
void *search_var_instance_decl_c::visit(program_declaration_c *symbol) { |
|
406 |
/* no need to search through all the body, so we only |
|
407 |
* visit the variable declarations...! |
|
408 |
*/ |
|
409 |
return symbol->var_declarations->accept(*this); |
|
410 |
} |
|
411 |
||
412 |
||
413 |
/********************************/ |
|
414 |
/* B 1.7 Configuration elements */ |
|
415 |
/********************************/ |
|
416 |
||
417 |
/* |
|
418 |
CONFIGURATION configuration_name |
|
419 |
optional_global_var_declarations |
|
420 |
(resource_declaration_list | single_resource_declaration) |
|
421 |
optional_access_declarations |
|
422 |
optional_instance_specific_initializations |
|
423 |
END_CONFIGURATION |
|
424 |
*/ |
|
425 |
/* |
|
426 |
SYM_REF6(configuration_declaration_c, configuration_name, global_var_declarations, resource_declarations, access_declarations, instance_specific_initializations, unused) |
|
427 |
*/ |
|
428 |
void *search_var_instance_decl_c::visit(configuration_declaration_c *symbol) { |
|
429 |
/* no need to search through all the configuration, so we only |
|
430 |
* visit the global variable declarations...! |
|
431 |
*/ |
|
432 |
if (symbol->global_var_declarations != NULL) |
|
433 |
return symbol->global_var_declarations->accept(*this); |
|
434 |
else |
|
435 |
return NULL; |
|
436 |
} |
|
437 |
||
438 |
/* |
|
439 |
RESOURCE resource_name ON resource_type_name |
|
440 |
optional_global_var_declarations |
|
441 |
single_resource_declaration |
|
442 |
END_RESOURCE |
|
443 |
*/ |
|
444 |
// SYM_REF4(resource_declaration_c, resource_name, resource_type_name, global_var_declarations, resource_declaration) |
|
445 |
void *search_var_instance_decl_c::visit(resource_declaration_c *symbol) { |
|
446 |
/* no need to search through all the resource, so we only |
|
447 |
* visit the global variable declarations...! |
|
448 |
*/ |
|
449 |
if (symbol->global_var_declarations != NULL) |
|
450 |
return symbol->global_var_declarations->accept(*this); |
|
451 |
else |
|
452 |
return NULL; |
|
453 |
} |
|
454 |
||
455 |
/* task_configuration_list program_configuration_list */ |
|
456 |
// SYM_REF2(single_resource_declaration_c, task_configuration_list, program_configuration_list) |
|
457 |
void *search_var_instance_decl_c::visit(single_resource_declaration_c *symbol) { |
|
458 |
/* no need to search through all the resource, |
|
459 |
* and there is no global variable declarations...! |
|
460 |
*/ |
|
461 |
return NULL; |
|
462 |
} |
|
463 |
||
464 |
#if 0 |
|
465 |
/*********************/ |
|
466 |
/* B 1.4 - Variables */ |
|
467 |
/*********************/ |
|
468 |
SYM_REF2(symbolic_variable_c, var_name, unused) |
|
469 |
||
470 |
/********************************************/ |
|
471 |
/* B.1.4.1 Directly Represented Variables */ |
|
472 |
/********************************************/ |
|
473 |
SYM_TOKEN(direct_variable_c) |
|
474 |
||
475 |
/*************************************/ |
|
476 |
/* B.1.4.2 Multi-element Variables */ |
|
477 |
/*************************************/ |
|
478 |
/* subscripted_variable '[' subscript_list ']' */ |
|
479 |
SYM_REF2(array_variable_c, subscripted_variable, subscript_list) |
|
480 |
||
481 |
/* subscript_list ',' subscript */ |
|
482 |
SYM_LIST(subscript_list_c) |
|
483 |
||
484 |
/* record_variable '.' field_selector */ |
|
485 |
/* WARNING: input and/or output variables of function blocks |
|
486 |
* may be accessed as fields of a tructured variable! |
|
487 |
* Code handling a structured_variable_c must take |
|
488 |
* this into account! |
|
489 |
*/ |
|
490 |
SYM_REF2(structured_variable_c, record_variable, field_selector) |
|
491 |
||
492 |
||
493 |
||
494 |
}; |
|
495 |
#endif |