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

Function function_call_rule

src/engine/function.c:430–483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

428}
429
430static LIST * function_call_rule( JAM_FUNCTION * function, FRAME * frame,
431 STACK * s, int n_args, char const * unexpanded, OBJECT * file, int line )
432{
433 FRAME inner[ 1 ];
434 int i;
435 LIST * first = stack_pop( s );
436 LIST * result = L0;
437 OBJECT * rulename;
438 LIST * trailing;
439
440 frame->file = file;
441 frame->line = line;
442
443 if ( list_empty( first ) )
444 {
445 backtrace_line( frame );
446 out_printf( "warning: rulename %s expands to empty string\n", unexpanded );
447 backtrace( frame );
448 list_free( first );
449 for ( i = 0; i < n_args; ++i )
450 list_free( stack_pop( s ) );
451 return result;
452 }
453
454 rulename = object_copy( list_front( first ) );
455
456 frame_init( inner );
457 inner->prev = frame;
458 inner->prev_user = frame->module->user_module ? frame : frame->prev_user;
459 inner->module = frame->module; /* This gets fixed up in evaluate_rule(). */
460
461 for ( i = 0; i < n_args; ++i )
462 lol_add( inner->args, stack_at( s, n_args - i - 1 ) );
463
464 for ( i = 0; i < n_args; ++i )
465 stack_pop( s );
466
467 trailing = list_pop_front( first );
468 if ( trailing )
469 {
470 if ( inner->args->count == 0 )
471 lol_add( inner->args, trailing );
472 else
473 {
474 LIST * * const l = &inner->args->list[ 0 ];
475 *l = list_append( trailing, *l );
476 }
477 }
478
479 result = evaluate_rule( bindrule( rulename, inner->module ), rulename, inner );
480 frame_free( inner );
481 object_free( rulename );
482 return result;
483}
484
485static LIST * function_call_member_rule( JAM_FUNCTION * function, FRAME * frame, STACK * s, int n_args, OBJECT * rulename, OBJECT * file, int line )
486{

Callers 1

function_runFunction · 0.85

Calls 15

stack_popFunction · 0.85
backtrace_lineFunction · 0.85
out_printfFunction · 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
bindruleFunction · 0.85

Tested by

no test coverage detected