changeset 350 | 2c3c4dc34979 |
parent 336 | 229eb3e29216 |
child 355 | 30db860bd3bd |
341:ba80c3ceb6fb | 350:2c3c4dc34979 |
---|---|
33 * a C source program equivalent to the IL and ST, or SFC |
33 * a C source program equivalent to the IL and ST, or SFC |
34 * code. |
34 * code. |
35 */ |
35 */ |
36 |
36 |
37 |
37 |
38 |
|
39 #include "../../util/strdup.hh" |
|
40 |
|
38 /***********************************************************************/ |
41 /***********************************************************************/ |
39 /***********************************************************************/ |
42 /***********************************************************************/ |
40 /***********************************************************************/ |
43 /***********************************************************************/ |
41 /***********************************************************************/ |
44 /***********************************************************************/ |
42 |
45 |
432 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
435 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
433 if (!search_expression_type->is_same_type(left_type, right_type)) |
436 if (!search_expression_type->is_same_type(left_type, right_type)) |
434 ERROR; |
437 ERROR; |
435 if (search_expression_type->is_time_type(left_type) || |
438 if (search_expression_type->is_time_type(left_type) || |
436 search_expression_type->is_string_type(left_type)) |
439 search_expression_type->is_string_type(left_type)) |
437 return print_compare_function("__eq_", left_type, symbol->l_exp, symbol->r_exp); |
440 return print_compare_function("EQ_", left_type, symbol->l_exp, symbol->r_exp); |
438 return print_binary_expression(symbol->l_exp, symbol->r_exp, " == "); |
441 return print_binary_expression(symbol->l_exp, symbol->r_exp, " == "); |
439 } |
442 } |
440 |
443 |
441 void *visit(notequ_expression_c *symbol) { |
444 void *visit(notequ_expression_c *symbol) { |
442 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
445 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
443 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
446 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
444 if (!search_expression_type->is_same_type(left_type, right_type)) |
447 if (!search_expression_type->is_same_type(left_type, right_type)) |
445 ERROR; |
448 ERROR; |
446 if (search_expression_type->is_time_type(left_type) || |
449 if (search_expression_type->is_time_type(left_type) || |
447 search_expression_type->is_string_type(left_type)) |
450 search_expression_type->is_string_type(left_type)) |
448 return print_compare_function("__ne_", left_type, symbol->l_exp, symbol->r_exp); |
451 return print_compare_function("NE_", left_type, symbol->l_exp, symbol->r_exp); |
449 return print_binary_expression(symbol->l_exp, symbol->r_exp, " != "); |
452 return print_binary_expression(symbol->l_exp, symbol->r_exp, " != "); |
450 } |
453 } |
451 |
454 |
452 void *visit(lt_expression_c *symbol) { |
455 void *visit(lt_expression_c *symbol) { |
453 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
456 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
454 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
457 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
455 if (!search_expression_type->is_same_type(left_type, right_type)) |
458 if (!search_expression_type->is_same_type(left_type, right_type)) |
456 ERROR; |
459 ERROR; |
457 if (search_expression_type->is_time_type(left_type) || |
460 if (search_expression_type->is_time_type(left_type) || |
458 search_expression_type->is_string_type(left_type)) |
461 search_expression_type->is_string_type(left_type)) |
459 return print_compare_function("__lt_", left_type, symbol->l_exp, symbol->r_exp); |
462 return print_compare_function("LT_", left_type, symbol->l_exp, symbol->r_exp); |
460 if (!search_base_type.type_is_enumerated(left_type)) |
463 if (!search_base_type.type_is_enumerated(left_type)) |
461 return print_binary_expression(symbol->l_exp, symbol->r_exp, " < "); |
464 return print_binary_expression(symbol->l_exp, symbol->r_exp, " < "); |
462 ERROR; |
465 ERROR; |
463 return NULL; |
466 return NULL; |
464 } |
467 } |
468 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
471 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
469 if (!search_expression_type->is_same_type(left_type, right_type)) |
472 if (!search_expression_type->is_same_type(left_type, right_type)) |
470 ERROR; |
473 ERROR; |
471 if (search_expression_type->is_time_type(left_type) || |
474 if (search_expression_type->is_time_type(left_type) || |
472 search_expression_type->is_string_type(left_type)) |
475 search_expression_type->is_string_type(left_type)) |
473 return print_compare_function("__gt_", left_type, symbol->l_exp, symbol->r_exp); |
476 return print_compare_function("GT_", left_type, symbol->l_exp, symbol->r_exp); |
474 if (!search_base_type.type_is_enumerated(left_type)) |
477 if (!search_base_type.type_is_enumerated(left_type)) |
475 return print_binary_expression(symbol->l_exp, symbol->r_exp, " > "); |
478 return print_binary_expression(symbol->l_exp, symbol->r_exp, " > "); |
476 ERROR; |
479 ERROR; |
477 return NULL; |
480 return NULL; |
478 } |
481 } |
482 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
485 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
483 if (!search_expression_type->is_same_type(left_type, right_type)) |
486 if (!search_expression_type->is_same_type(left_type, right_type)) |
484 ERROR; |
487 ERROR; |
485 if (search_expression_type->is_time_type(left_type) || |
488 if (search_expression_type->is_time_type(left_type) || |
486 search_expression_type->is_string_type(left_type)) |
489 search_expression_type->is_string_type(left_type)) |
487 return print_compare_function("__le_", left_type, symbol->l_exp, symbol->r_exp); |
490 return print_compare_function("LE_", left_type, symbol->l_exp, symbol->r_exp); |
488 if (!search_base_type.type_is_enumerated(left_type)) |
491 if (!search_base_type.type_is_enumerated(left_type)) |
489 return print_binary_expression(symbol->l_exp, symbol->r_exp, " <= "); |
492 return print_binary_expression(symbol->l_exp, symbol->r_exp, " <= "); |
490 ERROR; |
493 ERROR; |
491 return NULL; |
494 return NULL; |
492 } |
495 } |
496 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
499 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
497 if (!search_expression_type->is_same_type(left_type, right_type)) |
500 if (!search_expression_type->is_same_type(left_type, right_type)) |
498 ERROR; |
501 ERROR; |
499 if (search_expression_type->is_time_type(left_type) || |
502 if (search_expression_type->is_time_type(left_type) || |
500 search_expression_type->is_string_type(left_type)) |
503 search_expression_type->is_string_type(left_type)) |
501 return print_compare_function("__ge_", left_type, symbol->l_exp, symbol->r_exp); |
504 return print_compare_function("GE_", left_type, symbol->l_exp, symbol->r_exp); |
502 if (!search_base_type.type_is_enumerated(left_type)) |
505 if (!search_base_type.type_is_enumerated(left_type)) |
503 return print_binary_expression(symbol->l_exp, symbol->r_exp, " >= "); |
506 return print_binary_expression(symbol->l_exp, symbol->r_exp, " >= "); |
504 ERROR; |
507 ERROR; |
505 return NULL; |
508 return NULL; |
506 } |
509 } |
509 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
512 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
510 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
513 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
511 if ((typeid(*left_type) == typeid(time_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) || |
514 if ((typeid(*left_type) == typeid(time_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) || |
512 (typeid(*left_type) == typeid(tod_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) || |
515 (typeid(*left_type) == typeid(tod_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) || |
513 (typeid(*left_type) == typeid(dt_type_name_c) && typeid(*right_type) == typeid(time_type_name_c))) |
516 (typeid(*left_type) == typeid(dt_type_name_c) && typeid(*right_type) == typeid(time_type_name_c))) |
514 return print_binary_function("__TIME_ADD", symbol->l_exp, symbol->r_exp); |
517 return print_binary_function("__time_add", symbol->l_exp, symbol->r_exp); |
515 if (!search_expression_type->is_same_type(left_type, right_type)) |
518 if (!search_expression_type->is_same_type(left_type, right_type)) |
516 ERROR; |
519 ERROR; |
517 if (search_expression_type->is_integer_type(left_type) || search_expression_type->is_real_type(left_type)) |
520 if (search_expression_type->is_integer_type(left_type) || search_expression_type->is_real_type(left_type)) |
518 return print_binary_expression(symbol->l_exp, symbol->r_exp, " + "); |
521 return print_binary_expression(symbol->l_exp, symbol->r_exp, " + "); |
519 ERROR; |
522 ERROR; |
527 (typeid(*left_type) == typeid(date_type_name_c) && typeid(*right_type) == typeid(date_type_name_c)) || |
530 (typeid(*left_type) == typeid(date_type_name_c) && typeid(*right_type) == typeid(date_type_name_c)) || |
528 (typeid(*left_type) == typeid(tod_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) || |
531 (typeid(*left_type) == typeid(tod_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) || |
529 (typeid(*left_type) == typeid(tod_type_name_c) && typeid(*right_type) == typeid(tod_type_name_c)) || |
532 (typeid(*left_type) == typeid(tod_type_name_c) && typeid(*right_type) == typeid(tod_type_name_c)) || |
530 (typeid(*left_type) == typeid(dt_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) || |
533 (typeid(*left_type) == typeid(dt_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) || |
531 (typeid(*left_type) == typeid(dt_type_name_c) && typeid(*right_type) == typeid(dt_type_name_c))) |
534 (typeid(*left_type) == typeid(dt_type_name_c) && typeid(*right_type) == typeid(dt_type_name_c))) |
532 return print_binary_function("__TIME_SUB", symbol->l_exp, symbol->r_exp); |
535 return print_binary_function("__time_sub", symbol->l_exp, symbol->r_exp); |
533 if (!search_expression_type->is_same_type(left_type, right_type)) |
536 if (!search_expression_type->is_same_type(left_type, right_type)) |
534 ERROR; |
537 ERROR; |
535 if (search_expression_type->is_integer_type(left_type) || search_expression_type->is_real_type(left_type)) |
538 if (search_expression_type->is_integer_type(left_type) || search_expression_type->is_real_type(left_type)) |
536 return print_binary_expression(symbol->l_exp, symbol->r_exp, " - "); |
539 return print_binary_expression(symbol->l_exp, symbol->r_exp, " - "); |
537 ERROR; |
540 ERROR; |
541 void *visit(mul_expression_c *symbol) { |
544 void *visit(mul_expression_c *symbol) { |
542 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
545 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
543 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
546 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
544 if ((typeid(*left_type) == typeid(time_type_name_c) && search_expression_type->is_integer_type(right_type)) || |
547 if ((typeid(*left_type) == typeid(time_type_name_c) && search_expression_type->is_integer_type(right_type)) || |
545 (typeid(*left_type) == typeid(time_type_name_c) && search_expression_type->is_real_type(right_type))) |
548 (typeid(*left_type) == typeid(time_type_name_c) && search_expression_type->is_real_type(right_type))) |
546 return print_binary_function("__TIME_MUL", symbol->l_exp, symbol->r_exp); |
549 return print_binary_function("__time_mul", symbol->l_exp, symbol->r_exp); |
547 if (!search_expression_type->is_same_type(left_type, right_type)) |
550 if (!search_expression_type->is_same_type(left_type, right_type)) |
548 ERROR; |
551 ERROR; |
549 if (search_expression_type->is_integer_type(left_type) || search_expression_type->is_real_type(left_type)) |
552 if (search_expression_type->is_integer_type(left_type) || search_expression_type->is_real_type(left_type)) |
550 return print_binary_expression(symbol->l_exp, symbol->r_exp, " * "); |
553 return print_binary_expression(symbol->l_exp, symbol->r_exp, " * "); |
551 ERROR; |
554 ERROR; |
555 void *visit(div_expression_c *symbol) { |
558 void *visit(div_expression_c *symbol) { |
556 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
559 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
557 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
560 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
558 if ((typeid(*left_type) == typeid(time_type_name_c) && search_expression_type->is_integer_type(right_type)) || |
561 if ((typeid(*left_type) == typeid(time_type_name_c) && search_expression_type->is_integer_type(right_type)) || |
559 (typeid(*left_type) == typeid(time_type_name_c) && search_expression_type->is_real_type(right_type))) |
562 (typeid(*left_type) == typeid(time_type_name_c) && search_expression_type->is_real_type(right_type))) |
560 return print_binary_function("__TIME_DIV", symbol->l_exp, symbol->r_exp); |
563 return print_binary_function("__time_div", symbol->l_exp, symbol->r_exp); |
561 if (!search_expression_type->is_same_type(left_type, right_type)) |
564 if (!search_expression_type->is_same_type(left_type, right_type)) |
562 ERROR; |
565 ERROR; |
563 if (search_expression_type->is_integer_type(left_type) || search_expression_type->is_real_type(left_type)) |
566 if (search_expression_type->is_integer_type(left_type) || search_expression_type->is_real_type(left_type)) |
564 return print_binary_expression(symbol->l_exp, symbol->r_exp, " / "); |
567 return print_binary_expression(symbol->l_exp, symbol->r_exp, " / "); |
565 ERROR; |
568 ERROR; |
612 if (NULL != symbol->nonformal_param_list) parameter_assignment_list = symbol->nonformal_param_list; |
615 if (NULL != symbol->nonformal_param_list) parameter_assignment_list = symbol->nonformal_param_list; |
613 if (NULL == parameter_assignment_list) ERROR; |
616 if (NULL == parameter_assignment_list) ERROR; |
614 |
617 |
615 function_call_param_iterator_c function_call_param_iterator(symbol); |
618 function_call_param_iterator_c function_call_param_iterator(symbol); |
616 |
619 |
617 function_declaration_c *f_decl = function_symtable.find_value(symbol->function_name); |
620 function_declaration_c *f_decl = (function_declaration_c *)symbol->called_function_declaration; |
618 if (f_decl == function_symtable.end_value()) { |
621 if (f_decl == NULL) ERROR; |
619 /* The function called is not in the symtable, so we test if it is a |
622 |
620 * standard function defined in standard */ |
623 function_name = symbol->function_name; |
621 |
624 |
622 function_type_t current_function_type = get_function_type((identifier_c *)symbol->function_name); |
625 /* loop through each function parameter, find the value we should pass |
623 if (current_function_type == function_none) ERROR; |
626 * to it, and then output the c equivalent... |
624 |
627 */ |
625 symbol_c *function_return_type = search_expression_type->get_type(symbol); |
628 function_param_iterator_c fp_iterator(f_decl); |
626 |
629 identifier_c *param_name; |
627 int nb_param = ((list_c *)parameter_assignment_list)->n; |
630 /* flag to cirreclty handle calls to extensible standard functions (i.e. functions with variable number of input parameters) */ |
628 |
631 bool found_first_extensible_parameter = false; |
629 symbol_c *en_param_name = (symbol_c *)(new identifier_c("EN")); |
632 for(int i = 1; (param_name = fp_iterator.next()) != NULL; i++) { |
630 /* Get the value from EN param */ |
633 if (fp_iterator.is_extensible_param() && (!found_first_extensible_parameter)) { |
631 symbol_c *EN_param_value = function_call_param_iterator.search_f(en_param_name); |
634 /* We are calling an extensible function. Before passing the extensible |
632 if (EN_param_value == NULL) |
635 * parameters, we must add a dummy paramater value to tell the called |
633 EN_param_value = (symbol_c*)(new boolean_literal_c((symbol_c*)(new bool_type_name_c()), new boolean_true_c())); |
636 * function how many extensible parameters we will be passing. |
634 else |
637 * |
635 nb_param --; |
638 * Note that stage 3 has already determined the number of extensible |
636 ADD_PARAM_LIST(en_param_name, EN_param_value, (symbol_c*)(new bool_type_name_c()), function_param_iterator_c::direction_in) |
639 * paramters, and stored that info in the abstract syntax tree. We simply |
637 |
640 * re-use that value. |
638 symbol_c *eno_param_name = (symbol_c *)(new identifier_c("ENO")); |
641 */ |
639 /* Get the value from ENO param */ |
642 /* NOTE: we are not freeing the malloc'd memory. This is not really a bug. |
640 symbol_c *ENO_param_value = function_call_param_iterator.search_f(eno_param_name); |
643 * Since we are writing a compiler, which runs to termination quickly, |
641 if (ENO_param_value != NULL) |
644 * we can consider this as just memory required for the compilation process |
642 nb_param --; |
645 * that will be free'd when the program terminates. |
643 ADD_PARAM_LIST(eno_param_name, ENO_param_value, (symbol_c*)(new bool_type_name_c()), function_param_iterator_c::direction_out) |
646 */ |
644 |
647 char *tmp = (char *)malloc(32); /* enough space for a call with 10^31 (larger than 2^64) input parameters! */ |
645 #include "st_code_gen.c" |
648 if (tmp == NULL) ERROR; |
646 |
649 int res = snprintf(tmp, 32, "%d", symbol->extensible_param_count); |
647 } |
650 if ((res >= 32) || (res < 0)) ERROR; |
648 else { |
651 identifier_c *param_value = new identifier_c(tmp); |
649 function_name = symbol->function_name; |
652 uint_type_name_c *param_type = new uint_type_name_c(); |
650 |
653 identifier_c *param_name = new identifier_c(""); |
651 /* loop through each function parameter, find the value we should pass |
654 ADD_PARAM_LIST(param_name, param_value, param_type, function_param_iterator_c::direction_in) |
652 * to it, and then output the c equivalent... |
655 found_first_extensible_parameter = true; |
656 } |
|
657 |
|
658 if (fp_iterator.is_extensible_param()) { |
|
659 /* since we are handling an extensible parameter, we must add the index to the |
|
660 * parameter name so we can go looking for the value passed to the correct |
|
661 * extended parameter (e.g. IN1, IN2, IN3, IN4, ...) |
|
662 */ |
|
663 char *tmp = (char *)malloc(32); /* enough space for a call with 10^31 (larger than 2^64) input parameters! */ |
|
664 int res = snprintf(tmp, 32, "%d", fp_iterator.extensible_param_index()); |
|
665 if ((res >= 32) || (res < 0)) ERROR; |
|
666 param_name = new identifier_c(strdup2(param_name->value, tmp)); |
|
667 if (param_name->value == NULL) ERROR; |
|
668 } |
|
669 |
|
670 symbol_c *param_type = fp_iterator.param_type(); |
|
671 if (param_type == NULL) ERROR; |
|
672 |
|
673 function_param_iterator_c::param_direction_t param_direction = fp_iterator.param_direction(); |
|
674 |
|
675 symbol_c *param_value = NULL; |
|
676 |
|
677 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
678 if (param_value == NULL) |
|
679 param_value = function_call_param_iterator.search_f(param_name); |
|
680 |
|
681 /* Get the value from a foo(<param_value>) style call */ |
|
682 if ((param_value == NULL) && !fp_iterator.is_en_eno_param_implicit()) { |
|
683 param_value = function_call_param_iterator.next_nf(); |
|
684 } |
|
685 |
|
686 /* if no more parameter values in function call, and the current parameter |
|
687 * of the function declaration is an extensible parameter, we |
|
688 * have reached the end, and should simply jump out of the for loop. |
|
653 */ |
689 */ |
654 function_param_iterator_c fp_iterator(f_decl); |
690 if ((param_value == NULL) && (fp_iterator.is_extensible_param())) { |
655 identifier_c *param_name; |
691 break; |
656 for(int i = 1; (param_name = fp_iterator.next()) != NULL; i++) { |
692 } |
657 |
693 |
658 symbol_c *param_type = fp_iterator.param_type(); |
694 if ((param_value == NULL) && (param_direction == function_param_iterator_c::direction_in)) { |
659 if (param_type == NULL) ERROR; |
695 /* No value given for parameter, so we must use the default... */ |
660 |
696 /* First check whether default value specified in function declaration...*/ |
661 function_param_iterator_c::param_direction_t param_direction = fp_iterator.param_direction(); |
697 param_value = fp_iterator.default_value(); |
662 |
698 } |
663 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
699 |
664 symbol_c *param_value = function_call_param_iterator.search_f(param_name); |
700 ADD_PARAM_LIST(param_name, param_value, param_type, param_direction) |
665 |
701 } /* for(...) */ |
666 /* Get the value from a foo(<param_value>) style call */ |
702 // symbol->parameter_assignment->accept(*this); |
667 if (param_value == NULL) { |
|
668 param_value = function_call_param_iterator.next_nf(); |
|
669 if (param_value != NULL && fp_iterator.is_en_eno_param_implicit()) ERROR; |
|
670 } |
|
671 |
|
672 if (param_value == NULL && param_direction == function_param_iterator_c::direction_in) { |
|
673 /* No value given for parameter, so we must use the default... */ |
|
674 /* First check whether default value specified in function declaration...*/ |
|
675 param_value = fp_iterator.default_value(); |
|
676 } |
|
677 |
|
678 ADD_PARAM_LIST(param_name, param_value, param_type, param_direction) |
|
679 } /* for(...) */ |
|
680 // symbol->parameter_assignment->accept(*this); |
|
681 } |
|
682 |
703 |
683 if (function_call_param_iterator.next_nf() != NULL) ERROR; |
704 if (function_call_param_iterator.next_nf() != NULL) ERROR; |
684 |
705 |
685 bool has_output_params = false; |
706 bool has_output_params = false; |
686 |
707 |
687 if (!this->is_variable_prefix_null()) { |
708 if (!this->is_variable_prefix_null()) { |
688 PARAM_LIST_ITERATOR() { |
709 PARAM_LIST_ITERATOR() { |
689 if ((PARAM_DIRECTION == function_param_iterator_c::direction_out || |
710 if ((PARAM_DIRECTION == function_param_iterator_c::direction_out || |
690 PARAM_DIRECTION == function_param_iterator_c::direction_inout) && |
711 PARAM_DIRECTION == function_param_iterator_c::direction_inout) && |
691 PARAM_VALUE != NULL) { |
712 PARAM_VALUE != NULL) { |
692 if (!has_output_params) { |
713 has_output_params = true; |
693 has_output_params = true; |
714 } |
694 } |
715 } |
695 } |
716 } |
696 } |
717 |
697 } |
718 /* Check whether we are calling an overloaded function! */ |
719 /* (fdecl_mutiplicity==2) => calling overloaded function */ |
|
720 int fdecl_mutiplicity = function_symtable.multiplicity(symbol->function_name); |
|
721 if (fdecl_mutiplicity == 0) ERROR; |
|
698 |
722 |
699 if (function_type_prefix != NULL) { |
723 if (function_type_prefix != NULL) { |
700 s4o.print("("); |
724 s4o.print("("); |
701 search_expression_type->default_literal_type(function_type_prefix)->accept(*this); |
725 search_expression_type->default_literal_type(function_type_prefix)->accept(*this); |
702 s4o.print(")"); |
726 s4o.print(")"); |
703 } |
727 } |
704 if (function_type_suffix != NULL) { |
728 if (function_type_suffix != NULL) { |
705 function_type_suffix = search_expression_type->default_literal_type(function_type_prefix); |
729 function_type_suffix = search_expression_type->default_literal_type(function_type_prefix); |
706 } |
730 } |
707 if (has_output_params) { |
731 if (has_output_params) { |
708 fcall_number++; |
732 fcall_number++; |
709 s4o.print("__"); |
733 s4o.print("__"); |
710 fbname->accept(*this); |
734 fbname->accept(*this); |
711 s4o.print("_"); |
735 s4o.print("_"); |
712 function_name->accept(*this); |
736 function_name->accept(*this); |
737 if (fdecl_mutiplicity == 2) { |
|
738 /* function being called is overloaded! */ |
|
739 s4o.print("__"); |
|
740 print_function_parameter_data_types_c overloaded_func_suf(&s4o); |
|
741 f_decl->accept(overloaded_func_suf); |
|
742 } |
|
713 if (function_type_suffix != NULL) |
743 if (function_type_suffix != NULL) |
714 function_type_suffix->accept(*this); |
744 function_type_suffix->accept(*this); |
715 s4o.print_integer(fcall_number); |
745 s4o.print_integer(fcall_number); |
716 } |
746 } |
717 else { |
747 else { |
718 function_name->accept(*this); |
748 function_name->accept(*this); |
749 if (fdecl_mutiplicity == 2) { |
|
750 /* function being called is overloaded! */ |
|
751 s4o.print("__"); |
|
752 print_function_parameter_data_types_c overloaded_func_suf(&s4o); |
|
753 f_decl->accept(overloaded_func_suf); |
|
754 } |
|
719 if (function_type_suffix != NULL) |
755 if (function_type_suffix != NULL) |
720 function_type_suffix->accept(*this); |
756 function_type_suffix->accept(*this); |
721 } |
757 } |
722 s4o.print("("); |
758 s4o.print("("); |
723 s4o.indent_right(); |
759 s4o.indent_right(); |
843 |
879 |
844 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
880 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
845 symbol_c *param_value = function_call_param_iterator.search_f(param_name); |
881 symbol_c *param_value = function_call_param_iterator.search_f(param_name); |
846 |
882 |
847 /* Get the value from a foo(<param_value>) style call */ |
883 /* Get the value from a foo(<param_value>) style call */ |
848 if (param_value == NULL) |
884 /* When using the informal invocation style, user can not pass values to EN or ENO parameters if these |
885 * were implicitly defined! |
|
886 */ |
|
887 if ((param_value == NULL) && !fp_iterator.is_en_eno_param_implicit()) |
|
849 param_value = function_call_param_iterator.next_nf(); |
888 param_value = function_call_param_iterator.next_nf(); |
850 |
889 |
851 symbol_c *param_type = fp_iterator.param_type(); |
890 symbol_c *param_type = fp_iterator.param_type(); |
852 if (param_type == NULL) ERROR; |
891 if (param_type == NULL) ERROR; |
853 |
892 |
887 |
926 |
888 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
927 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
889 symbol_c *param_value = function_call_param_iterator.search_f(param_name); |
928 symbol_c *param_value = function_call_param_iterator.search_f(param_name); |
890 |
929 |
891 /* Get the value from a foo(<param_value>) style call */ |
930 /* Get the value from a foo(<param_value>) style call */ |
892 if (param_value == NULL) |
931 /* When using the informal invocation style, user can not pass values to EN or ENO parameters if these |
932 * were implicitly defined! |
|
933 */ |
|
934 if ((param_value == NULL) && !fp_iterator.is_en_eno_param_implicit()) |
|
893 param_value = function_call_param_iterator.next_nf(); |
935 param_value = function_call_param_iterator.next_nf(); |
894 |
936 |
895 /* now output the value assignment */ |
937 /* now output the value assignment */ |
896 if (param_value != NULL) |
938 if (param_value != NULL) |
897 if ((param_direction == function_param_iterator_c::direction_out) || |
939 if ((param_direction == function_param_iterator_c::direction_out) || |