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

Function function_call_rule

src/engine/function.cpp:448–501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

446}
447
448static LIST * function_call_rule( JAM_FUNCTION * function, FRAME * frame,
449 STACK * s, int32_t n_args, char const * unexpanded, OBJECT * file, int32_t line )
450{
451 FRAME inner[ 1 ];
452 int32_t i;
453 LIST * first = stack_pop( s );
454 LIST * result = L0;
455 OBJECT * rulename;
456 LIST * trailing;
457
458 frame->file = file;
459 frame->line = line;
460
461 if ( list_empty( first ) )
462 {
463 backtrace_line( frame );
464 out_printf( "warning: rulename %s expands to empty string\n", unexpanded );
465 backtrace( frame );
466 list_free( first );
467 for ( i = 0; i < n_args; ++i )
468 list_free( stack_pop( s ) );
469 return result;
470 }
471
472 rulename = object_copy( list_front( first ) );
473
474 frame_init( inner );
475 inner->prev = frame;
476 inner->prev_user = frame->module->user_module ? frame : frame->prev_user;
477 inner->module = frame->module; /* This gets fixed up in evaluate_rule(). */
478
479 for ( i = 0; i < n_args; ++i )
480 lol_add( inner->args, stack_at( s, n_args - i - 1 ) );
481
482 for ( i = 0; i < n_args; ++i )
483 stack_pop( s );
484
485 trailing = list_pop_front( first );
486 if ( trailing )
487 {
488 if ( inner->args->count == 0 )
489 lol_add( inner->args, trailing );
490 else
491 {
492 LIST * * const l = &inner->args->list[ 0 ];
493 *l = list_append( trailing, *l );
494 }
495 }
496
497 result = evaluate_rule( bindrule( rulename, inner->module ), rulename, inner );
498 frame_free( inner );
499 object_free( rulename );
500 return result;
501}
502
503static LIST * function_call_member_rule( JAM_FUNCTION * function, FRAME * frame, STACK * s, int32_t n_args, OBJECT * rulename, OBJECT * file, int32_t line )
504{

Callers 1

function_runFunction · 0.85

Calls 15

stack_popFunction · 0.85
backtrace_lineFunction · 0.85
out_printfFunction · 0.85
backtraceFunction · 0.85
list_freeFunction · 0.85
object_copyFunction · 0.85
frame_initFunction · 0.85
lol_addFunction · 0.85
stack_atFunction · 0.85
list_pop_frontFunction · 0.85
list_appendFunction · 0.85
evaluate_ruleFunction · 0.85

Tested by

no test coverage detected