| 4733 | #ifdef HAVE_PYTHON |
| 4734 | |
| 4735 | static struct arg_list * arg_list_compile_python( PyObject * bjam_signature, |
| 4736 | int * num_arguments ) |
| 4737 | { |
| 4738 | if ( bjam_signature ) |
| 4739 | { |
| 4740 | struct argument_list_compiler c[ 1 ]; |
| 4741 | struct arg_list * result; |
| 4742 | Py_ssize_t s; |
| 4743 | Py_ssize_t i; |
| 4744 | argument_list_compiler_init( c ); |
| 4745 | |
| 4746 | s = PySequence_Size( bjam_signature ); |
| 4747 | for ( i = 0; i < s; ++i ) |
| 4748 | { |
| 4749 | struct argument_compiler arg_comp[ 1 ]; |
| 4750 | struct arg_list arg; |
| 4751 | PyObject * v = PySequence_GetItem( bjam_signature, i ); |
| 4752 | Py_ssize_t j; |
| 4753 | Py_ssize_t inner; |
| 4754 | argument_compiler_init( arg_comp ); |
| 4755 | |
| 4756 | inner = PySequence_Size( v ); |
| 4757 | for ( j = 0; j < inner; ++j ) |
| 4758 | argument_compiler_add( arg_comp, object_new( PyString_AsString( |
| 4759 | PySequence_GetItem( v, j ) ) ), constant_builtin, -1 ); |
| 4760 | |
| 4761 | arg = arg_compile_impl( arg_comp, constant_builtin, -1 ); |
| 4762 | dynamic_array_push( c->args, arg ); |
| 4763 | argument_compiler_free( arg_comp ); |
| 4764 | Py_DECREF( v ); |
| 4765 | } |
| 4766 | |
| 4767 | *num_arguments = c->args->size; |
| 4768 | result = BJAM_MALLOC( c->args->size * sizeof( struct arg_list ) ); |
| 4769 | memcpy( result, c->args->data, c->args->size * sizeof( struct arg_list ) |
| 4770 | ); |
| 4771 | argument_list_compiler_free( c ); |
| 4772 | return result; |
| 4773 | } |
| 4774 | *num_arguments = 0; |
| 4775 | return 0; |
| 4776 | } |
| 4777 | |
| 4778 | FUNCTION * function_python( PyObject * function, PyObject * bjam_signature ) |
| 4779 | { |
no test coverage detected