void headers( TARGET * t ) { LIST * hdrscan; LIST * hdrrule; #ifndef OPT_HEADER_CACHE_EXT LIST * headlist = L0; #endif regexp * re[ MAXINC ]; int rec = 0; LISTITER iter, end; hdrscan = var_get( root_module(), constant_HDRSCAN ); if ( list_empty( hdrscan ) ) return; hdrrule = var_get( root_module(), constant_HDRRULE ); if ( list_empty( hdrrule ) ) return; if ( DEBUG_HEADER ) printf( "header scan %s\n", object_str( t->name ) ); /* Compile all regular expressions in HDRSCAN */ iter = list_begin( hdrscan ), end = list_end( hdrscan ); for ( ; ( rec < MAXINC ) && iter != end; iter = list_next( iter ) ) { re[ rec++ ] = regex_compile( list_item( iter ) ); } /* Doctor up call to HDRRULE rule */ /* Call headers1() to get LIST of included files. */ { FRAME frame[1]; frame_init( frame ); lol_add( frame->args, list_new( object_copy( t->name ) ) ); #ifdef OPT_HEADER_CACHE_EXT lol_add( frame->args, hcache( t, rec, re, hdrscan ) ); #else lol_add( frame->args, headers1( headlist, t->boundname, rec, re ) ); #endif if ( lol_get( frame->args, 1 ) ) { /* The third argument to HDRRULE is the bound name of * $(<) */ lol_add( frame->args, list_new( object_copy( t->boundname ) ) ); list_free( evaluate_rule( list_front( hdrrule ), frame ) ); } /* Clean up. */ frame_free( frame ); } }
void headers( TARGET *t ) { LIST *hdrscan; LIST *hdrrule; LIST *headlist = 0; regexp *re[ MAXINC ]; int rec = 0; if( !( hdrscan = var_get( "HDRSCAN" ) ) || !( hdrrule = var_get( "HDRRULE" ) ) ) return; if( DEBUG_HEADER ) printf( "header scan %s\n", t->name ); /* Compile all regular expressions in HDRSCAN */ while( rec < MAXINC && hdrscan ) { re[rec++] = regex_compile( hdrscan->string ); hdrscan = list_next( hdrscan ); } /* Doctor up call to HDRRULE rule */ /* Call headers1() to get LIST of included files. */ { FRAME frame[1]; frame_init( frame ); lol_add( frame->args, list_new( L0, t->name ) ); #ifdef OPT_HEADER_CACHE_EXT lol_add( frame->args, hcache( t, rec, re, hdrscan ) ); #else lol_add( frame->args, headers1( headlist, t->boundname, rec, re ) ); #endif if( lol_get( frame->args, 1 ) ) { /* The third argument to HDRRULE is the bound name of * $(<) */ lol_add( frame->args, list_new( L0, t->boundname ) ); list_free( evaluate_rule( hdrrule->string, frame ) ); } /* Clean up */ frame_free( frame ); } }
void headers( TARGET *t ) { LIST *hdrscan; LIST *hdrrule; LOL lol; if( !list_first( hdrscan = var_get( "HDRSCAN" ) ) || !list_first( hdrrule = var_get( "HDRRULE" ) ) ) return; /* Doctor up call to HDRRULE rule */ /* Call headers1() to get LIST of included files. */ if( DEBUG_HEADER ) printf( "header scan %s\n", t->name ); lol_init( &lol ); lol_add( &lol, list_append( L0, t->name, 1 ) ); #ifdef OPT_HEADER_CACHE_EXT lol_add( &lol, hcache( t, hdrscan ) ); #else lol_add( &lol, headers1( t->boundname, hdrscan ) ); #endif if( list_first(lol_get( &lol, 1 )) ) { #ifdef OPT_HDRRULE_BOUNDNAME_ARG_EXT /* The third argument to HDRRULE is the bound name of * $(<) */ lol_add( &lol, list_append( L0, t->boundname, 0 ) ); #endif list_free( evaluate_rule( list_value(list_first(hdrrule)), &lol, L0 ) ); } /* Clean up */ lol_free( &lol ); }