37 * struture element within a data structured type (a struct or a fb), or |
37 * struture element within a data structured type (a struct or a fb), or |
38 * an array element. |
38 * an array element. |
39 * A mixture of array element of a structure element of a structure element |
39 * A mixture of array element of a structure element of a structure element |
40 * of a .... is also suported! |
40 * of a .... is also suported! |
41 * |
41 * |
42 * A reference to the relevant base type __definition__ is returned. |
|
43 * This means that if we find that the variable is of type MY_INT, |
|
44 * which was previously declared to be |
|
45 * TYPE MY_INT: INT := 9; |
|
46 * this class wil return INT, and __not__ MY_INT !! |
|
47 * |
|
48 * |
|
49 * example: |
42 * example: |
50 * window.points[1].coordinate.x |
43 * window.points[1].coordinate.x |
51 * window.points[1].colour |
44 * window.points[1].colour |
52 * etc... ARE ALLOWED! |
45 * etc... ARE ALLOWED! |
53 * |
46 * |
54 * This class must be passed the scope within which the |
47 * This class must be passed the scope within which the |
55 * variable was declared, and the variable name... |
48 * variable was declared, and the variable name... |
56 */ |
49 * |
|
50 * |
|
51 * |
|
52 * |
|
53 * |
|
54 * This class has several members, depending on the exact data the caller |
|
55 * is looking for... |
|
56 * |
|
57 * - item i: we can get either the name of the data type(A), |
|
58 * or it's declaration (B) |
|
59 * (notice however that some variables belong to a data type that does |
|
60 * not have a name, only a declaration as in |
|
61 * VAR a: ARRAY [1..3] of INT; END_VAR |
|
62 * ) |
|
63 * - item ii: we can get either the direct data type (1), |
|
64 * or the base type (2) |
|
65 * |
|
66 * By direct type, I mean the data type of the variable. By base type, I |
|
67 * mean the data type on which the direct type is based on. For example, in |
|
68 * a subrange on INT, the direct type is the subrange itself, while the |
|
69 * base type is INT. |
|
70 * e.g. |
|
71 * This means that if we find that the variable is of type MY_INT, |
|
72 * which was previously declared to be |
|
73 * TYPE MY_INT: INT := 9; |
|
74 * option (1) will return MY_INT |
|
75 * option (2) will return INT |
|
76 * |
|
77 * |
|
78 * Member functions: |
|
79 * ================ |
|
80 * get_basetype_decl() ---> returns 2B |
|
81 * get_type_id() ---> returns 1A |
|
82 * |
|
83 * Since we haven't yet needed them, we don't yet implement |
|
84 * get_basetype_id() ----> would return 2A |
|
85 * get_type_decl() ----> would return 1B |
|
86 */ |
57 |
87 |
58 class search_varfb_instance_type_c: public search_base_type_c { |
88 class search_varfb_instance_type_c: public search_base_type_c { |
59 |
89 |
60 private: |
90 private: |
61 search_var_instance_decl_c search_var_instance_decl; |
91 search_var_instance_decl_c search_var_instance_decl; |
64 symbol_c *current_rawtype; |
94 symbol_c *current_rawtype; |
65 bool is_complex; |
95 bool is_complex; |
66 |
96 |
67 public: |
97 public: |
68 search_varfb_instance_type_c(symbol_c *search_scope); |
98 search_varfb_instance_type_c(symbol_c *search_scope); |
69 symbol_c *get_type(symbol_c *variable_name); |
99 symbol_c *get_basetype_decl(symbol_c *variable_name); |
70 symbol_c *get_rawtype(symbol_c *variable_name); |
100 symbol_c *get_type_id(symbol_c *variable_name); |
71 |
101 |
72 unsigned int get_vartype(symbol_c *variable_name); |
102 unsigned int get_vartype(symbol_c *variable_name); |
73 bool type_is_complex(void); |
103 bool type_is_complex(void); |
74 |
104 |
75 private: |
105 private: |