250 void *visit(equ_expression_c *symbol) { |
250 void *visit(equ_expression_c *symbol) { |
251 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
251 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
252 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
252 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
253 if (!search_expression_type->is_same_type(left_type, right_type)) |
253 if (!search_expression_type->is_same_type(left_type, right_type)) |
254 ERROR; |
254 ERROR; |
255 if (search_expression_type->is_time_type(left_type)) |
255 if (search_expression_type->is_time_type(left_type) || |
|
256 search_expression_type->is_string_type(left_type)) |
256 return print_compare_function("__eq_", left_type, symbol->l_exp, symbol->r_exp); |
257 return print_compare_function("__eq_", left_type, symbol->l_exp, symbol->r_exp); |
257 return print_binary_expression(symbol->l_exp, symbol->r_exp, " == "); |
258 return print_binary_expression(symbol->l_exp, symbol->r_exp, " == "); |
258 } |
259 } |
259 |
260 |
260 void *visit(notequ_expression_c *symbol) { |
261 void *visit(notequ_expression_c *symbol) { |
261 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
262 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
262 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
263 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
263 if (!search_expression_type->is_same_type(left_type, right_type)) |
264 if (!search_expression_type->is_same_type(left_type, right_type)) |
264 ERROR; |
265 ERROR; |
265 if (search_expression_type->is_time_type(left_type)) |
266 if (search_expression_type->is_time_type(left_type) || |
|
267 search_expression_type->is_string_type(left_type)) |
266 return print_compare_function("__ne_", left_type, symbol->l_exp, symbol->r_exp); |
268 return print_compare_function("__ne_", left_type, symbol->l_exp, symbol->r_exp); |
267 return print_binary_expression(symbol->l_exp, symbol->r_exp, " != "); |
269 return print_binary_expression(symbol->l_exp, symbol->r_exp, " != "); |
268 } |
270 } |
269 |
271 |
270 void *visit(lt_expression_c *symbol) { |
272 void *visit(lt_expression_c *symbol) { |
271 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
273 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
272 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
274 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
273 if (!search_expression_type->is_same_type(left_type, right_type)) |
275 if (!search_expression_type->is_same_type(left_type, right_type)) |
274 ERROR; |
276 ERROR; |
275 if (search_expression_type->is_time_type(left_type)) |
277 if (search_expression_type->is_time_type(left_type) || |
|
278 search_expression_type->is_string_type(left_type)) |
276 return print_compare_function("__lt_", left_type, symbol->l_exp, symbol->r_exp); |
279 return print_compare_function("__lt_", left_type, symbol->l_exp, symbol->r_exp); |
277 return print_binary_expression(symbol->l_exp, symbol->r_exp, " < "); |
280 if (!search_base_type.type_is_enumerated(left_type)) |
|
281 return print_binary_expression(symbol->l_exp, symbol->r_exp, " < "); |
|
282 ERROR; |
|
283 return NULL; |
278 } |
284 } |
279 |
285 |
280 void *visit(gt_expression_c *symbol) { |
286 void *visit(gt_expression_c *symbol) { |
281 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
287 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
282 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
288 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
283 if (!search_expression_type->is_same_type(left_type, right_type)) |
289 if (!search_expression_type->is_same_type(left_type, right_type)) |
284 ERROR; |
290 ERROR; |
285 if (search_expression_type->is_time_type(left_type)) |
291 if (search_expression_type->is_time_type(left_type) || |
|
292 search_expression_type->is_string_type(left_type)) |
286 return print_compare_function("__gt_", left_type, symbol->l_exp, symbol->r_exp); |
293 return print_compare_function("__gt_", left_type, symbol->l_exp, symbol->r_exp); |
287 return print_binary_expression(symbol->l_exp, symbol->r_exp, " > "); |
294 if (!search_base_type.type_is_enumerated(left_type)) |
|
295 return print_binary_expression(symbol->l_exp, symbol->r_exp, " > "); |
|
296 ERROR; |
|
297 return NULL; |
288 } |
298 } |
289 |
299 |
290 void *visit(le_expression_c *symbol) { |
300 void *visit(le_expression_c *symbol) { |
291 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
301 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
292 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
302 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
293 if (!search_expression_type->is_same_type(left_type, right_type)) |
303 if (!search_expression_type->is_same_type(left_type, right_type)) |
294 ERROR; |
304 ERROR; |
295 if (search_expression_type->is_time_type(left_type)) |
305 if (search_expression_type->is_time_type(left_type) || |
|
306 search_expression_type->is_string_type(left_type)) |
296 return print_compare_function("__le_", left_type, symbol->l_exp, symbol->r_exp); |
307 return print_compare_function("__le_", left_type, symbol->l_exp, symbol->r_exp); |
297 return print_binary_expression(symbol->l_exp, symbol->r_exp, " <= "); |
308 if (!search_base_type.type_is_enumerated(left_type)) |
|
309 return print_binary_expression(symbol->l_exp, symbol->r_exp, " <= "); |
|
310 ERROR; |
|
311 return NULL; |
298 } |
312 } |
299 |
313 |
300 void *visit(ge_expression_c *symbol) { |
314 void *visit(ge_expression_c *symbol) { |
301 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
315 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
302 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
316 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
303 if (!search_expression_type->is_same_type(left_type, right_type)) |
317 if (!search_expression_type->is_same_type(left_type, right_type)) |
304 ERROR; |
318 ERROR; |
305 if (search_expression_type->is_time_type(left_type)) |
319 if (search_expression_type->is_time_type(left_type) || |
|
320 search_expression_type->is_string_type(left_type)) |
306 return print_compare_function("__ge_", left_type, symbol->l_exp, symbol->r_exp); |
321 return print_compare_function("__ge_", left_type, symbol->l_exp, symbol->r_exp); |
307 return print_binary_expression(symbol->l_exp, symbol->r_exp, " >= "); |
322 if (!search_base_type.type_is_enumerated(left_type)) |
|
323 return print_binary_expression(symbol->l_exp, symbol->r_exp, " >= "); |
|
324 ERROR; |
|
325 return NULL; |
308 } |
326 } |
309 |
327 |
310 void *visit(add_expression_c *symbol) { |
328 void *visit(add_expression_c *symbol) { |
311 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
329 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
312 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
330 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
657 param_value = function_call_param_iterator.next(); |
679 param_value = function_call_param_iterator.next(); |
658 |
680 |
659 symbol_c *param_type = fp_iterator.param_type(); |
681 symbol_c *param_type = fp_iterator.param_type(); |
660 if (param_type == NULL) ERROR; |
682 if (param_type == NULL) ERROR; |
661 |
683 |
662 search_base_type.explore_type(param_type); |
|
663 |
|
664 /* now output the value assignment */ |
684 /* now output the value assignment */ |
665 if (param_value != NULL) |
685 if (param_value != NULL) |
666 if ((param_direction == function_param_iterator_c::direction_in) || |
686 if ((param_direction == function_param_iterator_c::direction_in) || |
667 (param_direction == function_param_iterator_c::direction_inout)) { |
687 (param_direction == function_param_iterator_c::direction_inout)) { |
668 print_variable_prefix(); |
688 print_variable_prefix(); |
669 symbol->fb_name->accept(*this); |
689 symbol->fb_name->accept(*this); |
670 s4o.print("."); |
690 s4o.print("."); |
671 param_name->accept(*this); |
691 param_name->accept(*this); |
672 s4o.print(" = "); |
692 s4o.print(" = "); |
673 if (search_base_type.base_is_subrange()) { |
693 if (search_base_type.type_is_subrange(param_type)) { |
674 s4o.print("__CHECK_"); |
694 s4o.print("__CHECK_"); |
675 param_type->accept(*this); |
695 param_type->accept(*this); |
676 s4o.print("("); |
696 s4o.print("("); |
677 } |
697 } |
678 param_value->accept(*this); |
698 param_value->accept(*this); |
679 if (search_base_type.base_is_subrange()) |
699 if (search_base_type.type_is_subrange(param_type)) |
680 s4o.print(")"); |
700 s4o.print(")"); |
681 s4o.print(";\n" + s4o.indent_spaces); |
701 s4o.print(";\n" + s4o.indent_spaces); |
682 } |
702 } |
683 } /* for(...) */ |
703 } /* for(...) */ |
684 |
704 |
708 /* now output the value assignment */ |
728 /* now output the value assignment */ |
709 if (param_value != NULL) |
729 if (param_value != NULL) |
710 if ((param_direction == function_param_iterator_c::direction_out) || |
730 if ((param_direction == function_param_iterator_c::direction_out) || |
711 (param_direction == function_param_iterator_c::direction_inout)) { |
731 (param_direction == function_param_iterator_c::direction_inout)) { |
712 symbol_c *param_type = search_varfb_instance_type->get_type(param_value, false); |
732 symbol_c *param_type = search_varfb_instance_type->get_type(param_value, false); |
713 search_base_type.explore_type(param_type); |
|
714 |
733 |
715 s4o.print(";\n"+ s4o.indent_spaces); |
734 s4o.print(";\n"+ s4o.indent_spaces); |
716 param_value->accept(*this); |
735 param_value->accept(*this); |
717 s4o.print(" = "); |
736 s4o.print(" = "); |
718 if (search_base_type.base_is_subrange()) { |
737 if (search_base_type.type_is_subrange(param_type)) { |
719 s4o.print("__CHECK_"); |
738 s4o.print("__CHECK_"); |
720 param_type->accept(*this); |
739 param_type->accept(*this); |
721 s4o.print("("); |
740 s4o.print("("); |
722 } |
741 } |
723 print_variable_prefix(); |
742 print_variable_prefix(); |
724 symbol->fb_name->accept(*this); |
743 symbol->fb_name->accept(*this); |
725 s4o.print("."); |
744 s4o.print("."); |
726 param_name->accept(*this); |
745 param_name->accept(*this); |
727 if (search_base_type.base_is_subrange()) |
746 if (search_base_type.type_is_subrange(param_type)) |
728 s4o.print(")"); |
747 s4o.print(")"); |
729 } |
748 } |
730 } /* for(...) */ |
749 } /* for(...) */ |
731 |
750 |
732 return NULL; |
751 return NULL; |