equal
deleted
inserted
replaced
176 * fb_spec_init_c |
176 * fb_spec_init_c |
177 * Here, fb_spec_init_c is used whether it is an external, local, or global variable! |
177 * Here, fb_spec_init_c is used whether it is an external, local, or global variable! |
178 * Note too that we must also check the datatypes of external and global variables!! |
178 * Note too that we must also check the datatypes of external and global variables!! |
179 */ |
179 */ |
180 void *visit(fb_spec_init_c *symbol) { |
180 void *visit(fb_spec_init_c *symbol) { |
181 symbol_c *fb_decl = function_block_type_symtable.find_value(symbol->function_block_type_name); |
181 function_block_type_symtable_t::iterator iter = function_block_type_symtable.find(symbol->function_block_type_name); |
182 /* stage1_2 guarantees that we are sure to find a declaration in FB or Program symtable. */ |
182 /* stage1_2 guarantees that we are sure to find a declaration in FB or Program symtable. */ |
183 if (fb_decl == function_block_type_symtable.end_value()) |
183 if (iter == function_block_type_symtable.end()) |
184 ERROR; |
184 ERROR; |
185 fb_decl->accept(*this); |
185 iter->second->accept(*this); // iter->second is a fb_decl |
186 return NULL; |
186 return NULL; |
187 } |
187 } |
188 |
188 |
189 /*****************************/ |
189 /*****************************/ |
190 /* B 1.5.2 - Function Blocks */ |
190 /* B 1.5.2 - Function Blocks */ |
307 return NULL; |
307 return NULL; |
308 } |
308 } |
309 |
309 |
310 /* PROGRAM [RETAIN | NON_RETAIN] program_name [WITH task_name] ':' program_type_name ['(' prog_conf_elements ')'] */ |
310 /* PROGRAM [RETAIN | NON_RETAIN] program_name [WITH task_name] ':' program_type_name ['(' prog_conf_elements ')'] */ |
311 void *declaration_check_c::visit(program_configuration_c *symbol) { |
311 void *declaration_check_c::visit(program_configuration_c *symbol) { |
312 symbol_c *p_decl = program_type_symtable.find_value(symbol->program_type_name); |
312 symbol_c *p_decl = NULL; |
313 if (p_decl == program_type_symtable.end_value()) |
313 program_type_symtable_t ::iterator iter_p = program_type_symtable .find(symbol->program_type_name); |
314 p_decl = function_block_type_symtable.find_value(symbol->program_type_name); |
314 function_block_type_symtable_t::iterator iter_f = function_block_type_symtable.find(symbol->program_type_name); |
315 if (p_decl == function_block_type_symtable.end_value()) |
315 |
|
316 if (iter_p != program_type_symtable .end()) p_decl = iter_p->second; |
|
317 if (iter_f != function_block_type_symtable.end()) p_decl = iter_f->second; |
|
318 |
|
319 if ((iter_f != function_block_type_symtable.end()) && (iter_p != program_type_symtable.end())) |
|
320 ERROR; // Should never occur! stage1_2 guarantees that the same identifier cannot be re-used. |
|
321 if ((iter_f == function_block_type_symtable.end()) && (iter_p == program_type_symtable.end())) |
316 ERROR; // Should never occur! stage1_2 guarantees that we are sure to find a declaration in FB or Program symtable. |
322 ERROR; // Should never occur! stage1_2 guarantees that we are sure to find a declaration in FB or Program symtable. |
317 |
323 |
318 check_extern_c check_extern(current_pou_decl, current_resource_decl); |
324 check_extern_c check_extern(current_pou_decl, current_resource_decl); |
319 p_decl->accept(check_extern); |
325 p_decl->accept(check_extern); |
320 return NULL; |
326 return NULL; |
321 } |
327 } |
322 |
328 |