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