| 4597 | #ifdef HAVE_PYTHON |
| 4598 | |
| 4599 | static struct arg_list * arg_list_compile_python( PyObject * bjam_signature, |
| 4600 | int * num_arguments ) |
| 4601 | { |
| 4602 | if ( bjam_signature ) |
| 4603 | { |
| 4604 | struct argument_list_compiler c[ 1 ]; |
| 4605 | struct arg_list * result; |
| 4606 | Py_ssize_t s; |
| 4607 | Py_ssize_t i; |
| 4608 | argument_list_compiler_init( c ); |
| 4609 | |
| 4610 | s = PySequence_Size( bjam_signature ); |
| 4611 | for ( i = 0; i < s; ++i ) |
| 4612 | { |
| 4613 | struct argument_compiler arg_comp[ 1 ]; |
| 4614 | struct arg_list arg; |
| 4615 | PyObject * v = PySequence_GetItem( bjam_signature, i ); |
| 4616 | Py_ssize_t j; |
| 4617 | Py_ssize_t inner; |
| 4618 | argument_compiler_init( arg_comp ); |
| 4619 | |
| 4620 | inner = PySequence_Size( v ); |
| 4621 | for ( j = 0; j < inner; ++j ) |
| 4622 | argument_compiler_add( arg_comp, object_new( PyString_AsString( |
| 4623 | PySequence_GetItem( v, j ) ) ), constant_builtin, -1 ); |
| 4624 | |
| 4625 | arg = arg_compile_impl( arg_comp, constant_builtin, -1 ); |
| 4626 | dynamic_array_push( c->args, arg ); |
| 4627 | argument_compiler_free( arg_comp ); |
| 4628 | Py_DECREF( v ); |
| 4629 | } |
| 4630 | |
| 4631 | *num_arguments = c->args->size; |
| 4632 | result = BJAM_MALLOC( c->args->size * sizeof( struct arg_list ) ); |
| 4633 | memcpy( result, c->args->data, c->args->size * sizeof( struct arg_list ) |
| 4634 | ); |
| 4635 | argument_list_compiler_free( c ); |
| 4636 | return result; |
| 4637 | } |
| 4638 | *num_arguments = 0; |
| 4639 | return 0; |
| 4640 | } |
| 4641 | |
| 4642 | FUNCTION * function_python( PyObject * function, PyObject * bjam_signature ) |
| 4643 | { |
no test coverage detected