130 * Remember that the standard does not allow a STRUCT data type to have elements that are FB instances! |
130 * Remember that the standard does not allow a STRUCT data type to have elements that are FB instances! |
131 * Similarly, arrays of FB instances is also not allowed. |
131 * Similarly, arrays of FB instances is also not allowed. |
132 * So, as soon as we find one record/structure element that is not a FB, no other record/structure element |
132 * So, as soon as we find one record/structure element that is not a FB, no other record/structure element |
133 * will be of FB type, which means we can quit this check! |
133 * will be of FB type, which means we can quit this check! |
134 */ |
134 */ |
135 function_block_declaration_c *fb_decl = function_block_type_symtable.find_value(basetype_id); |
135 function_block_type_symtable_t::iterator iter = function_block_type_symtable.find(basetype_id); |
136 if (function_block_type_symtable.end_value() == fb_decl) return; |
136 if (function_block_type_symtable.end() == iter) return; |
|
137 function_block_declaration_c *fb_decl = iter->second; |
137 |
138 |
138 while (NULL != (struct_elem = decompose_lvalue.get_next())) { |
139 while (NULL != (struct_elem = decompose_lvalue.get_next())) { |
139 search_var_instance_decl_c fb_search_var_instance_decl(fb_decl); |
140 search_var_instance_decl_c fb_search_var_instance_decl(fb_decl); |
140 if (search_var_instance_decl_c::output_vt == fb_search_var_instance_decl.get_vartype(struct_elem)) { |
141 if (search_var_instance_decl_c::output_vt == fb_search_var_instance_decl.get_vartype(struct_elem)) { |
141 STAGE3_ERROR(0, struct_elem, struct_elem, "Assignment to FB output variable is not allowed."); |
142 STAGE3_ERROR(0, struct_elem, struct_elem, "Assignment to FB output variable is not allowed."); |
144 |
145 |
145 /* prepare for any possible further record/structure elements */ |
146 /* prepare for any possible further record/structure elements */ |
146 type_decl = fb_search_var_instance_decl.get_decl(struct_elem); |
147 type_decl = fb_search_var_instance_decl.get_decl(struct_elem); |
147 basetype_id = search_base_type_c::get_basetype_id(type_decl); |
148 basetype_id = search_base_type_c::get_basetype_id(type_decl); |
148 if (NULL == basetype_id) return; /* same comment as above... */ |
149 if (NULL == basetype_id) return; /* same comment as above... */ |
149 fb_decl = function_block_type_symtable.find_value(basetype_id); |
150 |
150 if (function_block_type_symtable.end_value() == fb_decl) return; /* same comment as above... */ |
151 iter = function_block_type_symtable.find(basetype_id); |
|
152 if (function_block_type_symtable.end() == iter) return; /* same comment as above... */ |
|
153 fb_decl = iter->second; |
151 } |
154 } |
152 } |
155 } |
153 |
156 |
154 |
157 |
155 /* No writing to CONSTANTs */ |
158 /* No writing to CONSTANTs */ |