110 } |
110 } |
111 } |
111 } |
112 |
112 |
113 } |
113 } |
114 |
114 |
|
115 |
|
116 |
|
117 /*****************************/ |
|
118 /* B 1.5.2 - Function Blocks */ |
|
119 /*****************************/ |
|
120 /* FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations function_block_body END_FUNCTION_BLOCK */ |
|
121 // SYM_REF3(function_block_declaration_c, fblock_name, var_declarations, fblock_body) |
|
122 void *declaration_check_c::visit(function_block_declaration_c *symbol) { |
|
123 current_pou_decl = symbol; |
|
124 /* check if any FB declared as a VAR has any incompatible VAR_EXTERNAL declarations */ |
|
125 if (NULL != symbol->var_declarations) |
|
126 symbol->var_declarations->accept(*this); |
|
127 return NULL; |
|
128 } |
|
129 |
115 /******************************************/ |
130 /******************************************/ |
116 /* B 1.5.3 - Declaration & Initialisation */ |
131 /* B 1.5.3 - Declaration & Initialisation */ |
117 /******************************************/ |
132 /******************************************/ |
|
133 /* PROGRAM program_type_name program_var_declarations_list function_block_body END_PROGRAM */ |
|
134 // SYM_REF3(program_declaration_c, program_type_name, var_declarations, function_block_body) |
118 void *declaration_check_c::visit(program_declaration_c *symbol) { |
135 void *declaration_check_c::visit(program_declaration_c *symbol) { |
119 current_pou_decl = symbol; |
136 current_pou_decl = symbol; |
|
137 /* check if any FB declared as a VAR has any incompatible VAR_EXTERNAL declarations */ |
|
138 if (NULL != symbol->var_declarations) |
|
139 symbol->var_declarations->accept(*this); |
120 return NULL; |
140 return NULL; |
121 } |
141 } |
122 |
142 |
123 /********************************/ |
143 /********************************/ |
124 /* B 1.7 Configuration elements */ |
144 /* B 1.7 Configuration elements */ |
125 /********************************/ |
145 /********************************/ |
126 void *declaration_check_c::visit(program_configuration_c *symbol) { |
146 /* |
127 symbol_c *p_decl = program_type_symtable.find_value(symbol->program_type_name); |
147 * CONFIGURATION configuration_name |
128 if (p_decl == program_type_symtable.end_value()) |
148 * optional_global_var_declarations |
129 p_decl = function_block_type_symtable.find_value(symbol->program_type_name); |
149 * (resource_declaration_list | single_resource_declaration) |
130 /* stage1_2 guarantees that we are sure to find a declaration in FB or Program symtable. */ |
150 * optional_access_declarations |
131 if (p_decl == function_block_type_symtable.end_value()) |
151 * optional_instance_specific_initializations |
132 ERROR; |
152 * END_CONFIGURATION |
133 check_global_decl(p_decl); |
153 */ |
134 return NULL; |
154 //SYM_REF5(configuration_declaration_c, configuration_name, global_var_declarations, resource_declarations, access_declarations, instance_specific_initializations) |
|
155 void *declaration_check_c::visit(configuration_declaration_c *symbol) { |
|
156 current_pou_decl = symbol; |
|
157 /* check if any FB declared as a VAR has any incompatible VAR_EXTERNAL declarations */ |
|
158 if (NULL != symbol->resource_declarations) |
|
159 symbol->resource_declarations->accept(*this); |
|
160 return NULL; |
135 } |
161 } |
136 |
162 |
|
163 void *declaration_check_c::visit(program_configuration_c *symbol) { |
|
164 symbol_c *p_decl = program_type_symtable.find_value(symbol->program_type_name); |
|
165 if (p_decl == program_type_symtable.end_value()) |
|
166 p_decl = function_block_type_symtable.find_value(symbol->program_type_name); |
|
167 /* stage1_2 guarantees that we are sure to find a declaration in FB or Program symtable. */ |
|
168 if (p_decl == function_block_type_symtable.end_value()) |
|
169 ERROR; |
|
170 check_global_decl(p_decl); |
|
171 return NULL; |
|
172 } |
|
173 |