| 56 | #define MAXINC 10 |
| 57 | |
| 58 | void headers( TARGET * t ) |
| 59 | { |
| 60 | LIST * hdrscan; |
| 61 | LIST * hdrrule; |
| 62 | #ifndef OPT_HEADER_CACHE_EXT |
| 63 | LIST * headlist = L0; |
| 64 | #endif |
| 65 | regexp * re[ MAXINC ]; |
| 66 | int rec = 0; |
| 67 | LISTITER iter; |
| 68 | LISTITER end; |
| 69 | |
| 70 | hdrscan = var_get( root_module(), constant_HDRSCAN ); |
| 71 | if ( list_empty( hdrscan ) ) |
| 72 | return; |
| 73 | |
| 74 | hdrrule = var_get( root_module(), constant_HDRRULE ); |
| 75 | if ( list_empty( hdrrule ) ) |
| 76 | return; |
| 77 | |
| 78 | if ( DEBUG_HEADER ) |
| 79 | out_printf( "header scan %s\n", object_str( t->name ) ); |
| 80 | |
| 81 | /* Compile all regular expressions in HDRSCAN */ |
| 82 | iter = list_begin( hdrscan ); |
| 83 | end = list_end( hdrscan ); |
| 84 | for ( ; ( rec < MAXINC ) && iter != end; iter = list_next( iter ) ) |
| 85 | { |
| 86 | re[ rec++ ] = regex_compile( list_item( iter ) ); |
| 87 | } |
| 88 | |
| 89 | /* Doctor up call to HDRRULE rule */ |
| 90 | /* Call headers1() to get LIST of included files. */ |
| 91 | { |
| 92 | FRAME frame[ 1 ]; |
| 93 | frame_init( frame ); |
| 94 | lol_add( frame->args, list_new( object_copy( t->name ) ) ); |
| 95 | #ifdef OPT_HEADER_CACHE_EXT |
| 96 | lol_add( frame->args, hcache( t, rec, re, hdrscan ) ); |
| 97 | #else |
| 98 | lol_add( frame->args, headers1( headlist, t->boundname, rec, re ) ); |
| 99 | #endif |
| 100 | |
| 101 | if ( lol_get( frame->args, 1 ) ) |
| 102 | { |
| 103 | OBJECT * rulename = list_front( hdrrule ); |
| 104 | /* The third argument to HDRRULE is the bound name of $(<). */ |
| 105 | lol_add( frame->args, list_new( object_copy( t->boundname ) ) ); |
| 106 | list_free( evaluate_rule( bindrule( rulename, frame->module ), rulename, frame ) ); |
| 107 | } |
| 108 | |
| 109 | /* Clean up. */ |
| 110 | frame_free( frame ); |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | |
| 115 | /* |
no test coverage detected