304 /* determine the data type of the subscripted_variable... |
304 /* determine the data type of the subscripted_variable... |
305 * This should be an array_specification_c |
305 * This should be an array_specification_c |
306 * ARRAY [xx..yy] OF Stored_Data_Type |
306 * ARRAY [xx..yy] OF Stored_Data_Type |
307 */ |
307 */ |
308 symbol->subscripted_variable->accept(*this); |
308 symbol->subscripted_variable->accept(*this); |
|
309 symbol_c *basetype_decl = current_basetype_decl; |
|
310 this->init(); /* set all current_*** pointers to NULL ! */ |
309 |
311 |
310 /* Now we determine the 'Stored_Data_Type', i.e. the data type of the variable stored in the array. */ |
312 /* Now we determine the 'Stored_Data_Type', i.e. the data type of the variable stored in the array. */ |
311 if (NULL != current_basetype_decl) { |
313 if (NULL != basetype_decl) { |
312 current_basetype_decl->accept(*this); |
314 basetype_decl->accept(*this); |
313 } |
315 } |
314 |
316 |
315 return NULL; |
317 return NULL; |
316 } |
318 } |
317 |
319 |
318 |
320 |
319 /* record_variable '.' field_selector */ |
321 /* record_variable '.' field_selector */ |
320 /* WARNING: input and/or output variables of function blocks |
322 /* WARNING: input and/or output variables of function blocks |
321 * may be accessed as fields of a structured variable! |
323 * may be accessed as fields of a structured variable! |
322 * Code handling a structured_variable_c must take |
324 * Code handling a structured_variable_c must take this into account! |
323 * this into account! |
325 * (i.e. that a FB instance may be accessed as a structured variable)! |
|
326 * |
|
327 * WARNING: Status bit (.X) and activation time (.T) of STEPS in SFC diagrams |
|
328 * may be accessed as fields of a structured variable! |
|
329 * Code handling a structured_variable_c must take this into account |
|
330 * (i.e. that an SFC STEP may be accessed as a structured variable)! |
324 */ |
331 */ |
325 // SYM_REF2(structured_variable_c, record_variable, field_selector) |
332 // SYM_REF2(structured_variable_c, record_variable, field_selector) |
326 void *search_varfb_instance_type_c::visit(structured_variable_c *symbol) { |
333 void *search_varfb_instance_type_c::visit(structured_variable_c *symbol) { |
327 symbol->record_variable->accept(*this); |
334 symbol->record_variable->accept(*this); |
|
335 symbol_c *basetype_decl = current_basetype_decl; |
|
336 this->init(); /* set all current_*** pointers to NULL ! */ |
328 |
337 |
329 /* Now we search for the data type of the field... But only if we were able to determine the data type of the variable */ |
338 /* Now we search for the data type of the field... But only if we were able to determine the data type of the variable */ |
330 if (NULL != current_basetype_decl) { |
339 if (NULL != basetype_decl) { |
331 current_field_selector = symbol->field_selector; |
340 current_field_selector = symbol->field_selector; |
332 current_basetype_decl->accept(*this); |
341 basetype_decl->accept(*this); |
333 current_field_selector = NULL; |
342 current_field_selector = NULL; |
334 } |
343 } |
335 |
344 |
336 return NULL; |
345 return NULL; |
337 } |
346 } |
357 current_basetype_decl = search_base_type.get_basetype_decl(current_type_id); |
366 current_basetype_decl = search_base_type.get_basetype_decl(current_type_id); |
358 current_basetype_id = search_base_type.get_basetype_id (current_type_id); |
367 current_basetype_id = search_base_type.get_basetype_id (current_type_id); |
359 |
368 |
360 return NULL; |
369 return NULL; |
361 } |
370 } |
|
371 |
|
372 |
|
373 |
|
374 /*********************************************/ |
|
375 /* B.1.6 Sequential function chart elements */ |
|
376 /*********************************************/ |
|
377 /* INITIAL_STEP step_name ':' action_association_list END_STEP */ |
|
378 // SYM_REF2(initial_step_c, step_name, action_association_list) |
|
379 /* NOTE: this method may be called from visit(structured_variable_c *symbol) method| */ |
|
380 void *search_varfb_instance_type_c::visit(initial_step_c *symbol) { |
|
381 if (NULL == current_field_selector) ERROR; |
|
382 |
|
383 identifier_c T("T"); |
|
384 identifier_c X("X"); |
|
385 |
|
386 if (compare_identifiers(&T, current_field_selector) == 0) |
|
387 current_type_id = &search_constant_type_c::time_type_name; |
|
388 if (compare_identifiers(&X, current_field_selector) == 0) |
|
389 current_type_id = &search_constant_type_c::bool_type_name; |
|
390 |
|
391 current_basetype_decl = search_base_type.get_basetype_decl(current_type_id); |
|
392 current_basetype_id = search_base_type.get_basetype_id (current_type_id); |
|
393 |
|
394 return NULL; |
|
395 } |
|
396 |
|
397 |
|
398 /* STEP step_name ':' action_association_list END_STEP */ |
|
399 // SYM_REF2(step_c, step_name, action_association_list) |
|
400 /* NOTE: this method may be called from visit(structured_variable_c *symbol) method| */ |
|
401 void *search_varfb_instance_type_c::visit(step_c *symbol) { |
|
402 /* The code here should be identicial to the code in the visit(initial_step_c *) visitor! So we simply call the other visitor! */ |
|
403 initial_step_c initial_step(NULL, NULL); |
|
404 return initial_step.accept(*this); |
|
405 } |