search_utils/search_utils.hh
author mario
Tue, 26 May 2009 18:04:27 +0200
changeset 178 1622dc05c6ca
permissions -rw-r--r--
Starting move of search utils to their own top level directory.
178
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
     1
/*
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
     2
 * (c) 2009 Mario de Sousa
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
     3
 *
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
     4
 * Offered to the public under the terms of the GNU General Public License
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
     5
 * as published by the Free Software Foundation; either version 2 of the
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
     6
 * License, or (at your option) any later version.
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
     7
 *
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
     8
 * This program is distributed in the hope that it will be useful, but
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
     9
 * WITHOUT ANY WARRANTY; without even the implied warranty of
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    11
 * Public License for more details.
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    12
 *
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    13
 * This code is made available on the understanding that it will not be
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    14
 * used in safety-critical situations without a full and competent review.
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    15
 */
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    16
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    17
/*
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    18
 * An IEC 61131-3 IL and ST compiler.
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    19
 *
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    20
 * Based on the
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    21
 * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    22
 *
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    23
 */
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    24
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    25
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    26
/*
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    27
 * This is the main stage 3a file.
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    28
 *
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    29
 * In stage 3a some helpful symbol tables are instanciated and populated.
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    30
 * These symbol tables wll then be used by stage3b and atage4 code generators.
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    31
 */
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    32
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    33
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    34
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    35
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    36
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    37
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    38
// #include <stdio.h>  /* required for NULL */
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    39
#include "../util/symtable.hh"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    40
#include "../util/dsymtable.hh"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    41
#include "../absyntax/visitor.hh"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    42
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    43
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    44
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    45
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    46
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    47
/* A symbol table with all globally declared functions... */
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    48
extern function_declaration_c null_symbol1;
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    49
extern dsymtable_c<function_declaration_c *, &null_symbol1> function_symtable;
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    50
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    51
/* A symbol table with all globally declared functions block types... */
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    52
extern function_block_declaration_c null_symbol2;
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    53
extern symtable_c<function_block_declaration_c *, &null_symbol2> function_block_type_symtable;
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    54
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    55
/* A symbol table with all globally declared program types... */
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    56
extern program_declaration_c null_symbol3;
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    57
extern symtable_c<program_declaration_c *, &null_symbol3> program_type_symtable;
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    58
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    59
/* A symbol table with all user declared type definitions... */
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    60
/* Note that function block types and program types have their
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    61
 * own symbol tables, so do not get placed in this symbol table!
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    62
 */
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    63
extern symbol_c null_symbol4;
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    64
extern symtable_c<symbol_c *, &null_symbol4> type_symtable;
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    65
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    66
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    67
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    68
/***********************************************************************/
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    69
/***********************************************************************/
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    70
/***********************************************************************/
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    71
/***********************************************************************/
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    72
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    73
/*
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    74
#include "spec_init_separator.cc"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    75
#include "function_param_iterator.cc"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    76
#include "function_call_iterator.cc"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    77
#include "function_call_param_iterator.cc"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    78
#include "type_initial_value.cc"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    79
#include "search_fb_instance_decl.cc"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    80
#include "search_fb_typedecl.cc"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    81
#include "search_base_type.cc"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    82
#include "search_var_instance_decl.cc"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    83
#include "decompose_var_instance_name.cc"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    84
#include "search_varfb_instance_type.cc"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    85
#include "search_constant_type.cc"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    86
#include "search_expression_type.cc"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    87
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    88
#include "generate_c_base.cc"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    89
#include "generate_c_typedecl.cc"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    90
#include "generate_c_sfcdecl.cc"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    91
#include "generate_c_vardecl.cc"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    92
#include "generate_c_configbody.cc"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    93
#include "generate_location_list.cc"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    94
#include "generate_var_list.cc"
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    95
*/
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    96
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    97
/***********************************************************************/
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    98
/***********************************************************************/
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
    99
/***********************************************************************/
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
   100
/***********************************************************************/
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
   101
/***********************************************************************/
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
   102
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
   103
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
   104
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
   105
1622dc05c6ca Starting move of search utils to their own top level directory.
mario
parents:
diff changeset
   106
void search_utils_init(symbol_c *tree_root);