mario@181: /* msousa@265: * matiec - a compiler for the programming languages defined in IEC 61131-3 mario@181: * msousa@265: * Copyright (C) 2009-2011 Mario de Sousa (msousa@fe.up.pt) Edouard@279: * Copyright (C) 2007-2011 Laurent Bessard and Edouard Tisserant mario@181: * msousa@265: * This program is free software: you can redistribute it and/or modify msousa@265: * it under the terms of the GNU General Public License as published by msousa@265: * the Free Software Foundation, either version 3 of the License, or msousa@265: * (at your option) any later version. msousa@265: * msousa@265: * This program is distributed in the hope that it will be useful, msousa@265: * but WITHOUT ANY WARRANTY; without even the implied warranty of msousa@265: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the msousa@265: * GNU General Public License for more details. msousa@265: * msousa@265: * You should have received a copy of the GNU General Public License msousa@265: * along with this program. If not, see . msousa@265: * 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: /* msousa@265: * An IEC 61131-3 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: mario@181: /* mario@181: * This is the main stage 3a file. mario@181: * mario@181: * In stage 3a some helpful symbol tables are instanciated and populated. mario@181: * These symbol tables wll then be used by stage3b and atage4 code generators. mario@181: */ mario@181: mario@181: mario@181: mario@181: mario@181: #ifndef _SEARCH_UTILS_HH mario@181: #define _SEARCH_UTILS_HH mario@181: mario@181: // #include /* required for NULL */ mario@181: #include "../util/symtable.hh" mario@181: #include "../util/dsymtable.hh" mario@181: #include "../absyntax/absyntax.hh" mario@181: #include "../absyntax/visitor.hh" mario@181: mario@181: mario@181: mario@181: /* returns 0 if the names are equal!! Case is ignored. */ mario@181: int compare_identifiers(symbol_c *ident1, symbol_c *ident2); mario@181: msousa@350: /* extract the value of an integer from an integer_c object !! */ msousa@350: int extract_integer(symbol_c *integer); msousa@350: mario@181: /* A symbol table with all globally declared functions... */ mario@181: extern function_declaration_c null_symbol1; msousa@350: typedef dsymtable_c function_symtable_t; msousa@350: extern function_symtable_t function_symtable; mario@181: mario@181: /* A symbol table with all globally declared functions block types... */ mario@181: extern function_block_declaration_c null_symbol2; mario@181: extern symtable_c function_block_type_symtable; mario@181: mario@181: /* A symbol table with all globally declared program types... */ mario@181: extern program_declaration_c null_symbol3; mario@181: extern symtable_c program_type_symtable; mario@181: mario@181: /* A symbol table with all user declared type definitions... */ mario@181: /* Note that function block types and program types have their mario@181: * own symbol tables, so do not get placed in this symbol table! msousa@338: * msousa@338: * The symbol_c * associated to the value will point to the data type declaration. mario@181: */ mario@181: extern symbol_c null_symbol4; mario@181: extern symtable_c type_symtable; mario@181: laurent@328: /* A symbol table with all values declared for enumerated type... */ msousa@338: /* Notes: msousa@338: * - if the value is defined multiple times the value laurent@328: * is the null pointer. msousa@338: * msousa@338: * - The stored symbol_c * associated to the value points to the enumerated_type_name msousa@338: * (i.e. the name of the enumerated data type) in which the the value/identifier msousa@338: * is used/declared. msousa@338: * msousa@338: * - We could re-use the null_symbol4 object, but it is safer to use a distinct object msousa@338: * (i.e. it might make it easier to find strange bugs). laurent@328: */ msousa@338: extern symbol_c null_symbol5; msousa@338: extern symtable_c enumerated_value_symtable; mario@181: mario@181: mario@181: /***********************************************************************/ mario@181: /***********************************************************************/ mario@181: /***********************************************************************/ mario@181: /***********************************************************************/ mario@181: mario@181: #include "spec_init_separator.hh" laurent@377: #include "array_dimension_iterator.hh" laurent@347: #include "case_element_iterator.hh" mario@181: #include "function_param_iterator.hh" mario@181: #include "function_call_iterator.hh" mario@181: #include "function_call_param_iterator.hh" mario@181: #include "type_initial_value.hh" mario@181: #include "search_fb_instance_decl.hh" mario@181: #include "search_fb_typedecl.hh" mario@181: #include "search_base_type.hh" mario@181: #include "search_var_instance_decl.hh" mario@181: #include "decompose_var_instance_name.hh" mario@181: #include "search_varfb_instance_type.hh" mario@181: #include "search_constant_type.hh" ccb@202: #include "search_il_operand_type.hh" mario@181: #include "search_expression_type.hh" ccb@202: #include "add_en_eno_param_decl.hh" ccb@202: #include "get_sizeof_datatype.hh" mario@181: #include "get_function_type.h" msousa@459: #include "search_il_label.hh" mario@181: mario@181: /***********************************************************************/ mario@181: /***********************************************************************/ mario@181: /***********************************************************************/ mario@181: /***********************************************************************/ mario@181: /***********************************************************************/ mario@181: mario@181: mario@181: mario@181: mario@181: void absyntax_utils_init(symbol_c *tree_root); mario@181: mario@181: mario@181: #endif /* _SEARCH_UTILS_HH */