66 |
66 |
67 public: |
67 public: |
68 constant_folding_c(symbol_c *symbol = NULL); |
68 constant_folding_c(symbol_c *symbol = NULL); |
69 virtual ~constant_folding_c(void); |
69 virtual ~constant_folding_c(void); |
70 int get_error_count(); |
70 int get_error_count(); |
71 int handle_var_extern_global_pair(symbol_c *extern_var_name, symbol_c *extern_var_decl, symbol_c *global_var_name, symbol_c *global_var_decl); |
|
72 typedef symtable_c<const_value_c> map_values_t; |
71 typedef symtable_c<const_value_c> map_values_t; |
73 private: |
72 private: |
|
73 symbol_c *current_resource; |
|
74 symbol_c *current_configuration; |
74 map_values_t values; |
75 map_values_t values; |
|
76 map_values_t var_global_values; |
75 void *handle_var_list_decl(symbol_c *var_list, symbol_c *type_decl); |
77 void *handle_var_list_decl(symbol_c *var_list, symbol_c *type_decl); |
76 void *handle_var_decl (symbol_c *var_list, bool fixed_init_value); |
78 void *handle_var_decl (symbol_c *var_list, bool fixed_init_value); |
77 // Flag to indicate whether the variables in the variable declaration list will always have a fixed value when the POU is executed! |
79 // Flag to indicate whether the variables in the variable declaration list will always have a fixed value when the POU is executed! |
78 // VAR CONSTANT ... END_VAR will always be true |
80 // VAR CONSTANT ... END_VAR will always be true |
79 // VAR ... END_VAR will always be true for functions (who initialise local variables every time they are called), but false for FBs and PROGRAMS |
81 // VAR ... END_VAR will always be true for functions (who initialise local variables every time they are called), but false for FBs and PROGRAMS |
91 // returns true if both symbols have the same value in all the cvalues |
93 // returns true if both symbols have the same value in all the cvalues |
92 static bool is_equal_cvalue(symbol_c *symbol_1, symbol_c *symbol_2); |
94 static bool is_equal_cvalue(symbol_c *symbol_1, symbol_c *symbol_2); |
93 #endif |
95 #endif |
94 |
96 |
95 private: |
97 private: |
|
98 /***************************/ |
|
99 /* B 0 - Programming Model */ |
|
100 /***************************/ |
|
101 void *visit(library_c *symbol); |
96 /*********************/ |
102 /*********************/ |
97 /* B 1.2 - Constants */ |
103 /* B 1.2 - Constants */ |
98 /*********************/ |
104 /*********************/ |
99 /******************************/ |
105 /******************************/ |
100 /* B 1.2.1 - Numeric Literals */ |
106 /* B 1.2.1 - Numeric Literals */ |
164 /********************************/ |
170 /********************************/ |
165 /* B 1.7 Configuration elements */ |
171 /* B 1.7 Configuration elements */ |
166 /********************************/ |
172 /********************************/ |
167 void *visit( configuration_declaration_c *symbol); |
173 void *visit( configuration_declaration_c *symbol); |
168 void *visit( resource_declaration_c *symbol); |
174 void *visit( resource_declaration_c *symbol); |
|
175 void *visit( program_configuration_c *symbol); |
|
176 void *visit( fb_task_c *symbol); |
169 |
177 |
170 |
178 |
171 /****************************************/ |
179 /****************************************/ |
172 /* B.2 - Language IL (Instruction List) */ |
180 /* B.2 - Language IL (Instruction List) */ |
173 /****************************************/ |
181 /****************************************/ |