MCPcopy Create free account
hub / github.com/boostorg/build / argument_list_to_python

Function argument_list_to_python

src/engine/function.cpp:5332–5414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5330
5331
5332static void argument_list_to_python( struct arg_list * formal, int32_t formal_count,
5333 FUNCTION * function, FRAME * frame, PyObject * kw )
5334{
5335 LOL * all_actual = frame->args;
5336 int32_t i;
5337
5338 for ( i = 0; i < formal_count; ++i )
5339 {
5340 LIST * actual = lol_get( all_actual, i );
5341 LISTITER actual_iter = list_begin( actual );
5342 LISTITER const actual_end = list_end( actual );
5343 int32_t j;
5344 for ( j = 0; j < formal[ i ].size; ++j )
5345 {
5346 struct argument * formal_arg = &formal[ i ].args[ j ];
5347 PyObject * value;
5348 LIST * l;
5349
5350 switch ( formal_arg->flags )
5351 {
5352 case ARG_ONE:
5353 if ( actual_iter == actual_end )
5354 argument_error( "missing argument", function, frame,
5355 formal_arg->arg_name );
5356 type_check_range( formal_arg->type_name, actual_iter, list_next(
5357 actual_iter ), frame, function, formal_arg->arg_name );
5358 value = PyString_FromString( object_str( list_item( actual_iter
5359 ) ) );
5360 actual_iter = list_next( actual_iter );
5361 break;
5362 case ARG_OPTIONAL:
5363 if ( actual_iter == actual_end )
5364 value = 0;
5365 else
5366 {
5367 type_check_range( formal_arg->type_name, actual_iter,
5368 list_next( actual_iter ), frame, function,
5369 formal_arg->arg_name );
5370 value = PyString_FromString( object_str( list_item(
5371 actual_iter ) ) );
5372 actual_iter = list_next( actual_iter );
5373 }
5374 break;
5375 case ARG_PLUS:
5376 if ( actual_iter == actual_end )
5377 argument_error( "missing argument", function, frame,
5378 formal_arg->arg_name );
5379 /* fallthrough */
5380 case ARG_STAR:
5381 type_check_range( formal_arg->type_name, actual_iter,
5382 actual_end, frame, function, formal_arg->arg_name );
5383 l = list_copy_range( actual, actual_iter, actual_end );
5384 value = list_to_python( l );
5385 list_free( l );
5386 actual_iter = actual_end;
5387 break;
5388 case ARG_VARIADIC:
5389 return;

Callers 1

call_python_functionFunction · 0.85

Calls 9

lol_getFunction · 0.85
list_beginFunction · 0.85
list_endFunction · 0.85
argument_errorFunction · 0.85
type_check_rangeFunction · 0.85
object_strFunction · 0.85
list_copy_rangeFunction · 0.85
list_to_pythonFunction · 0.85
list_freeFunction · 0.85

Tested by

no test coverage detected