| 56 | */ |
| 57 | |
| 58 | LIST * evaluate_rule( RULE * rule, OBJECT * rulename, FRAME * frame ) |
| 59 | { |
| 60 | LIST * result = L0; |
| 61 | profile_frame prof[ 1 ]; |
| 62 | module_t * prev_module = frame->module; |
| 63 | |
| 64 | if ( DEBUG_COMPILE ) |
| 65 | { |
| 66 | /* Try hard to indicate in which module the rule is going to execute. */ |
| 67 | char buf[ 256 ] = ""; |
| 68 | if ( rule->module->name ) |
| 69 | { |
| 70 | strncat( buf, object_str( rule->module->name ), sizeof( buf ) - |
| 71 | 1 ); |
| 72 | strncat( buf, ".", sizeof( buf ) - 1 ); |
| 73 | if ( strncmp( buf, object_str( rule->name ), strlen( buf ) ) == 0 ) |
| 74 | { |
| 75 | buf[ 0 ] = 0; |
| 76 | } |
| 77 | } |
| 78 | strncat( buf, object_str( rule->name ), sizeof( buf ) - 1 ); |
| 79 | debug_compile( 1, buf, frame ); |
| 80 | |
| 81 | lol_print( frame->args ); |
| 82 | out_printf( "\n" ); |
| 83 | } |
| 84 | |
| 85 | if ( rule->procedure && rule->module != prev_module ) |
| 86 | { |
| 87 | /* Propagate current module to nested rule invocations. */ |
| 88 | frame->module = rule->module; |
| 89 | } |
| 90 | |
| 91 | /* Record current rule name in frame. */ |
| 92 | if ( rule->procedure ) |
| 93 | { |
| 94 | frame->rulename = object_str( rulename ); |
| 95 | /* And enter record profile info. */ |
| 96 | if ( DEBUG_PROFILE ) |
| 97 | profile_enter( function_rulename( rule->procedure ), prof ); |
| 98 | } |
| 99 | |
| 100 | /* Check traditional targets $(<) and sources $(>). */ |
| 101 | if ( !rule->actions && !rule->procedure ) |
| 102 | unknown_rule( frame, NULL, frame->module, rulename ); |
| 103 | |
| 104 | /* If this rule will be executed for updating the targets then construct the |
| 105 | * action for make(). |
| 106 | */ |
| 107 | if ( rule->actions ) |
| 108 | { |
| 109 | TARGETS * t; |
| 110 | |
| 111 | /* The action is associated with this instance of this rule. */ |
| 112 | ACTION * const action = (ACTION *)BJAM_MALLOC( sizeof( ACTION ) ); |
| 113 | memset( (char *)action, '\0', sizeof( *action ) ); |
| 114 | |
| 115 | action->rule = rule; |
no test coverage detected