mario@181: /* mario@181: * (c) 2003 Mario de Sousa mario@181: * mario@181: * Offered to the public under the terms of the GNU General Public License mario@181: * as published by the Free Software Foundation; either version 2 of the mario@181: * License, or (at your option) any later version. mario@181: * mario@181: * This program is distributed in the hope that it will be useful, but mario@181: * WITHOUT ANY WARRANTY; without even the implied warranty of mario@181: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General mario@181: * Public License for more details. mario@181: * mario@181: * This code is made available on the understanding that it will not be mario@181: * used in safety-critical situations without a full and competent review. mario@181: */ mario@181: mario@181: /* mario@181: * An IEC 61131-3 IL and ST compiler. mario@181: * mario@181: * Based on the mario@181: * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) mario@181: * mario@181: */ mario@181: mario@181: /* Returns the function block declaration symbol mario@181: * of a specific function block type. mario@181: */ mario@181: mario@181: #include "absyntax_utils.hh" mario@181: mario@181: mario@181: search_fb_typedecl_c::search_fb_typedecl_c(symbol_c *search_scope) { mario@181: this->search_scope = search_scope; mario@181: } mario@181: mario@181: symbol_c *search_fb_typedecl_c::get_decl(symbol_c *fb_type_name) { mario@181: this->search_name = fb_type_name; mario@181: return (symbol_c *)search_scope->accept(*this); mario@181: } mario@181: /**************************************/ mario@181: /* B.1.5 - Program organization units */ mario@181: /**************************************/ mario@181: mario@181: /*****************************/ mario@181: /* B 1.5.2 - Function Blocks */ mario@181: /*****************************/ mario@181: void *search_fb_typedecl_c::visit(function_block_declaration_c *symbol) { mario@181: if (compare_identifiers(symbol->fblock_name, search_name) == 0) mario@181: return symbol; mario@181: return NULL; mario@181: } mario@181: mario@181: /**********************/ mario@181: /* B 1.5.3 - Programs */ mario@181: /**********************/ mario@181: void *search_fb_typedecl_c::visit(program_declaration_c *symbol) { mario@181: if (compare_identifiers(symbol->program_type_name, search_name) == 0) mario@181: return symbol; mario@181: return NULL; mario@181: } mario@181: