29 * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) |
29 * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) |
30 * |
30 * |
31 */ |
31 */ |
32 |
32 |
33 |
33 |
34 /* Determine the data type of a specific variable instance, including |
34 /* Search in a VAR* END_VAR declaration for the delcration of the specified variable instance. |
35 * function block instances. |
35 * Will return: |
36 * A reference to the relevant variable declaration is returned. |
36 * - the declaration itself (get_decl() ) |
|
37 * - the type of declaration in which the variable was declared (get_vartype() ) |
|
38 * |
37 * The variable instance may NOT be a member of a structure of a memeber |
39 * The variable instance may NOT be a member of a structure of a memeber |
38 * of a structure of an element of an array of ... |
40 * of a structure of an element of an array of ... |
39 * |
41 * |
40 * example: |
42 * For example, considering the following 'variables': |
41 * window.points[1].coordinate.x |
43 * window.points[1].coordinate.x |
42 * window.points[1].colour |
44 * window.points[1].colour |
43 * etc... ARE NOT ALLOWED! |
45 * offset[99] |
|
46 * |
|
47 * passing a reference to 'points', 'points[1]', 'points[1].colour', 'colour' |
|
48 * ARE NOT ALLOWED! |
44 * |
49 * |
45 * This class must only be passed the name of the variable that will appear |
50 * This class must only be passed the name of the variable that will appear |
46 * in the variable declaration. In the above examples, this would be |
51 * in the variable declaration. In the above examples, this would be |
47 * 'window' !! |
52 * 'window.points[1].coordinate.x' |
48 * |
53 * 'window.points[1].coordinate' |
49 * |
54 * 'window.points[1]' |
50 * If you need to pass a complete name of a variable instance (such as |
55 * 'window' |
51 * 'window.points[1].coordinate.x') use the search_varfb_instance_type_c instead! |
56 * 'window.points[1].colour' |
52 */ |
57 * 'offset' |
53 /* Note that current_type_decl that this class returns may reference the |
58 * 'offset[99]' |
|
59 * |
|
60 * |
|
61 */ |
|
62 |
|
63 /* Note: |
|
64 * Determining the declaration type of a specific variable instance (including |
|
65 * function block instances) really means determining whether the variable was declared in a |
|
66 * VAR_INPUT |
|
67 * VAR_OUTPUT |
|
68 * VAR_IN_OUT |
|
69 * VAR |
|
70 * VAR_TEMP |
|
71 * VAR_EXTERNAL |
|
72 * VAR_GLOBAL |
|
73 * VAR <var_name> AT <location> -> Located variable! |
|
74 * |
|
75 */ |
|
76 |
|
77 /* Note: |
|
78 * The current_type_decl that this class returns may reference the |
54 * name of a type, or the type declaration itself! |
79 * name of a type, or the type declaration itself! |
55 * For an example of the first, consider a variable declared as ... |
80 * For an example of the first, consider a variable declared as ... |
56 * x : AAA; |
81 * x : AAA; |
57 * where the AAA type is previously declared as whatever. |
82 * where the AAA type is previously declared as whatever. |
58 * For an example of the second, consider a variable declared as ... |
83 * For an example of the second, consider a variable declared as ... |
264 |
289 |
265 /* task_configuration_list program_configuration_list */ |
290 /* task_configuration_list program_configuration_list */ |
266 // SYM_REF2(single_resource_declaration_c, task_configuration_list, program_configuration_list) |
291 // SYM_REF2(single_resource_declaration_c, task_configuration_list, program_configuration_list) |
267 void *visit(single_resource_declaration_c *symbol); |
292 void *visit(single_resource_declaration_c *symbol); |
268 |
293 |
269 #if 0 |
|
270 /*********************/ |
|
271 /* B 1.4 - Variables */ |
|
272 /*********************/ |
|
273 SYM_REF2(symbolic_variable_c, var_name, unused) |
|
274 |
|
275 /********************************************/ |
|
276 /* B.1.4.1 Directly Represented Variables */ |
|
277 /********************************************/ |
|
278 SYM_TOKEN(direct_variable_c) |
|
279 |
|
280 /*************************************/ |
|
281 /* B.1.4.2 Multi-element Variables */ |
|
282 /*************************************/ |
|
283 /* subscripted_variable '[' subscript_list ']' */ |
|
284 SYM_REF2(array_variable_c, subscripted_variable, subscript_list) |
|
285 |
|
286 /* subscript_list ',' subscript */ |
|
287 SYM_LIST(subscript_list_c) |
|
288 |
|
289 /* record_variable '.' field_selector */ |
|
290 /* WARNING: input and/or output variables of function blocks |
|
291 * may be accessed as fields of a tructured variable! |
|
292 * Code handling a structured_variable_c must take |
|
293 * this into account! |
|
294 */ |
|
295 SYM_REF2(structured_variable_c, record_variable, field_selector) |
|
296 #endif |
|
297 |
|
298 }; // search_var_instance_decl_c |
294 }; // search_var_instance_decl_c |
299 |
295 |