387 symbol_c *param_value = NULL; |
387 symbol_c *param_value = NULL; |
388 |
388 |
389 /* if it is the first parameter, semantics specifies that we should |
389 /* if it is the first parameter, semantics specifies that we should |
390 * get the value off the IL default variable! |
390 * get the value off the IL default variable! |
391 */ |
391 */ |
392 if (1 == i) |
392 if (1 == i) |
393 param_value = &this->default_variable_name; |
393 param_value = &this->default_variable_name; |
394 |
394 |
395 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
395 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
396 /* NOTE: the following line of code is not required in this case, but it doesn't |
396 /* NOTE: the following line of code is not required in this case, but it doesn't |
397 * harm to leave it in, as in the case of a non-formal syntax function call, |
397 * harm to leave it in, as in the case of a non-formal syntax function call, |
398 * it will always return NULL. |
398 * it will always return NULL. |
402 */ |
402 */ |
403 if (param_value == NULL) |
403 if (param_value == NULL) |
404 param_value = function_call_param_iterator.search_f(param_name); |
404 param_value = function_call_param_iterator.search_f(param_name); |
405 |
405 |
406 /* Get the value from a foo(<param_value>) style call */ |
406 /* Get the value from a foo(<param_value>) style call */ |
407 if (param_value == NULL) |
407 if (param_value == NULL) { |
408 param_value = function_call_param_iterator.next_nf(); |
408 param_value = function_call_param_iterator.next_nf(); |
|
409 if (param_value != NULL && fp_iterator.is_en_eno_param_implicit()) ERROR; |
|
410 } |
409 |
411 |
410 if (param_value == NULL && param_direction == function_param_iterator_c::direction_in) { |
412 if (param_value == NULL && param_direction == function_param_iterator_c::direction_in) { |
411 /* No value given for parameter, so we must use the default... */ |
413 /* No value given for parameter, so we must use the default... */ |
412 /* First check whether default value specified in function declaration...*/ |
414 /* First check whether default value specified in function declaration...*/ |
413 param_value = fp_iterator.default_value(); |
415 param_value = fp_iterator.default_value(); |
414 } |
416 } |
415 |
417 |
416 ADD_PARAM_LIST(param_name, param_value, param_type, fp_iterator.param_direction()) |
418 ADD_PARAM_LIST(param_name, param_value, param_type, fp_iterator.param_direction()) |
417 } /* for(...) */ |
419 } /* for(...) */ |
|
420 |
|
421 if (function_call_param_iterator.next_nf() != NULL) ERROR; |
418 |
422 |
419 PARAM_LIST_ITERATOR() { |
423 PARAM_LIST_ITERATOR() { |
420 if ((PARAM_DIRECTION == function_param_iterator_c::direction_out || |
424 if ((PARAM_DIRECTION == function_param_iterator_c::direction_out || |
421 PARAM_DIRECTION == function_param_iterator_c::direction_inout) && |
425 PARAM_DIRECTION == function_param_iterator_c::direction_inout) && |
422 PARAM_VALUE != NULL) { |
426 PARAM_VALUE != NULL) { |
470 * it will always return NULL. |
474 * it will always return NULL. |
471 * We leave it in in case we later decide to merge this part of the code together |
475 * We leave it in in case we later decide to merge this part of the code together |
472 * with the function calling code in generate_c_st_c, which does require |
476 * with the function calling code in generate_c_st_c, which does require |
473 * the following line... |
477 * the following line... |
474 */ |
478 */ |
475 if (param_value == NULL) |
479 if (param_value == NULL) { |
476 param_value = function_call_param_iterator.next_nf(); |
480 param_value = function_call_param_iterator.next_nf(); |
|
481 if (param_value != NULL && fp_iterator.is_en_eno_param_implicit()) ERROR; |
|
482 } |
477 |
483 |
478 if (param_value == NULL) { |
484 if (param_value == NULL) { |
479 /* No value given for parameter, so we must use the default... */ |
485 /* No value given for parameter, so we must use the default... */ |
480 /* First check whether default value specified in function declaration...*/ |
486 /* First check whether default value specified in function declaration...*/ |
481 param_value = fp_iterator.default_value(); |
487 param_value = fp_iterator.default_value(); |
482 } |
488 } |
483 |
489 |
484 ADD_PARAM_LIST(param_name, param_value, param_type, fp_iterator.param_direction()) |
490 ADD_PARAM_LIST(param_name, param_value, param_type, fp_iterator.param_direction()) |
485 } |
491 } |
|
492 |
|
493 if (function_call_param_iterator.next_nf() != NULL) ERROR; |
486 |
494 |
487 PARAM_LIST_ITERATOR() { |
495 PARAM_LIST_ITERATOR() { |
488 if ((PARAM_DIRECTION == function_param_iterator_c::direction_out || |
496 if ((PARAM_DIRECTION == function_param_iterator_c::direction_out || |
489 PARAM_DIRECTION == function_param_iterator_c::direction_inout) && |
497 PARAM_DIRECTION == function_param_iterator_c::direction_inout) && |
490 PARAM_VALUE != NULL) { |
498 PARAM_VALUE != NULL) { |
529 */ |
537 */ |
530 function_param_iterator_c fp_iterator(f_decl); |
538 function_param_iterator_c fp_iterator(f_decl); |
531 identifier_c *param_name; |
539 identifier_c *param_name; |
532 function_call_param_iterator_c function_call_param_iterator(symbol); |
540 function_call_param_iterator_c function_call_param_iterator(symbol); |
533 for(int i = 1; (param_name = fp_iterator.next()) != NULL; i++) { |
541 for(int i = 1; (param_name = fp_iterator.next()) != NULL; i++) { |
|
542 symbol_c *param_type = fp_iterator.param_type(); |
|
543 if (param_type == NULL) ERROR; |
534 |
544 |
535 function_param_iterator_c::param_direction_t param_direction = fp_iterator.param_direction(); |
545 function_param_iterator_c::param_direction_t param_direction = fp_iterator.param_direction(); |
536 |
546 |
537 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
547 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
538 symbol_c *param_value = function_call_param_iterator.search_f(param_name); |
548 symbol_c *param_value = function_call_param_iterator.search_f(param_name); |
539 |
549 |
540 /* Get the value from a foo(<param_value>) style call */ |
550 /* Get the value from a foo(<param_value>) style call */ |
541 if (param_value == NULL) |
551 if (param_value == NULL) { |
542 param_value = function_call_param_iterator.next_nf(); |
552 param_value = function_call_param_iterator.next_nf(); |
|
553 if (param_value != NULL && fp_iterator.is_en_eno_param_implicit()) ERROR; |
|
554 } |
543 |
555 |
544 if (param_value == NULL && param_direction == function_param_iterator_c::direction_in) { |
556 if (param_value == NULL && param_direction == function_param_iterator_c::direction_in) { |
545 /* No value given for parameter, so we must use the default... */ |
557 /* No value given for parameter, so we must use the default... */ |
546 /* First check whether default value specified in function declaration...*/ |
558 /* First check whether default value specified in function declaration...*/ |
547 param_value = fp_iterator.default_value(); |
559 param_value = fp_iterator.default_value(); |
548 } |
560 } |
549 |
561 |
550 symbol_c *param_type = fp_iterator.param_type(); |
|
551 if (param_type == NULL) ERROR; |
|
552 |
|
553 ADD_PARAM_LIST(param_name, param_value, param_type, param_direction) |
562 ADD_PARAM_LIST(param_name, param_value, param_type, param_direction) |
554 } /* for(...) */ |
563 } /* for(...) */ |
555 // symbol->parameter_assignment->accept(*this); |
564 // symbol->parameter_assignment->accept(*this); |
|
565 |
|
566 if (function_call_param_iterator.next_nf() != NULL) ERROR; |
556 |
567 |
557 PARAM_LIST_ITERATOR() { |
568 PARAM_LIST_ITERATOR() { |
558 if ((PARAM_DIRECTION == function_param_iterator_c::direction_out || |
569 if ((PARAM_DIRECTION == function_param_iterator_c::direction_out || |
559 PARAM_DIRECTION == function_param_iterator_c::direction_inout) && |
570 PARAM_DIRECTION == function_param_iterator_c::direction_inout) && |
560 PARAM_VALUE != NULL) { |
571 PARAM_VALUE != NULL) { |