| 4656 | |
| 4657 | |
| 4658 | static void argument_list_to_python( struct arg_list * formal, int formal_count, |
| 4659 | FUNCTION * function, FRAME * frame, PyObject * kw ) |
| 4660 | { |
| 4661 | LOL * all_actual = frame->args; |
| 4662 | int i; |
| 4663 | |
| 4664 | for ( i = 0; i < formal_count; ++i ) |
| 4665 | { |
| 4666 | LIST * actual = lol_get( all_actual, i ); |
| 4667 | LISTITER actual_iter = list_begin( actual ); |
| 4668 | LISTITER const actual_end = list_end( actual ); |
| 4669 | int j; |
| 4670 | for ( j = 0; j < formal[ i ].size; ++j ) |
| 4671 | { |
| 4672 | struct argument * formal_arg = &formal[ i ].args[ j ]; |
| 4673 | PyObject * value; |
| 4674 | LIST * l; |
| 4675 | |
| 4676 | switch ( formal_arg->flags ) |
| 4677 | { |
| 4678 | case ARG_ONE: |
| 4679 | if ( actual_iter == actual_end ) |
| 4680 | argument_error( "missing argument", function, frame, |
| 4681 | formal_arg->arg_name ); |
| 4682 | type_check_range( formal_arg->type_name, actual_iter, list_next( |
| 4683 | actual_iter ), frame, function, formal_arg->arg_name ); |
| 4684 | value = PyString_FromString( object_str( list_item( actual_iter |
| 4685 | ) ) ); |
| 4686 | actual_iter = list_next( actual_iter ); |
| 4687 | break; |
| 4688 | case ARG_OPTIONAL: |
| 4689 | if ( actual_iter == actual_end ) |
| 4690 | value = 0; |
| 4691 | else |
| 4692 | { |
| 4693 | type_check_range( formal_arg->type_name, actual_iter, |
| 4694 | list_next( actual_iter ), frame, function, |
| 4695 | formal_arg->arg_name ); |
| 4696 | value = PyString_FromString( object_str( list_item( |
| 4697 | actual_iter ) ) ); |
| 4698 | actual_iter = list_next( actual_iter ); |
| 4699 | } |
| 4700 | break; |
| 4701 | case ARG_PLUS: |
| 4702 | if ( actual_iter == actual_end ) |
| 4703 | argument_error( "missing argument", function, frame, |
| 4704 | formal_arg->arg_name ); |
| 4705 | /* fallthrough */ |
| 4706 | case ARG_STAR: |
| 4707 | type_check_range( formal_arg->type_name, actual_iter, |
| 4708 | actual_end, frame, function, formal_arg->arg_name ); |
| 4709 | l = list_copy_range( actual, actual_iter, actual_end ); |
| 4710 | value = list_to_python( l ); |
| 4711 | list_free( l ); |
| 4712 | actual_iter = actual_end; |
| 4713 | break; |
| 4714 | case ARG_VARIADIC: |
| 4715 | return; |
no test coverage detected