/* * Copyright 1993, 2000 Christopher Seiwald. * * This file is part of Jam - see jam.c for Copyright information. */ # include "jam.h" # include "lists.h" # include "parse.h" # include "compile.h" # include "rules.h" # include "variable.h" # include "regexp.h" # include "headers.h" # include "newstr.h" #ifdef OPT_HEADER_CACHE_EXT # include "hcache.h" #endif /* * headers.c - handle #includes in source files * * Using regular expressions provided as the variable $(HDRSCAN), * headers() searches a file for #include files and phonies up a * rule invocation: * * $(HDRRULE) <target> : <include files> ; * * External routines: * headers() - scan a target for include files and call HDRRULE * * Internal routines: * headers1() - using regexp, scan a file and build include LIST * * 04/13/94 (seiwald) - added shorthand L0 for null list pointer * 09/10/00 (seiwald) - replaced call to compile_rule with evaluate_rule, * so that headers() doesn't have to mock up a parse structure * just to invoke a rule. */ #ifndef OPT_HEADER_CACHE_EXT static LIST *headers1( LIST *l, char *file, int rec, regexp *re[] ); #endif /* * headers() - scan a target for include files and call HDRRULE */ # define MAXINC 10 void headers( TARGET *t ) { LIST *hdrscan; LIST *hdrrule; #ifndef OPT_HEADER_CACHE_EXT LIST *headlist = 0; #endif LOL lol; regexp *re[ MAXINC ]; int rec = 0; if( !( hdrscan = var_get( "HDRSCAN" ) ) || !( hdrrule = var_get( "HDRRULE" ) ) ) return; #ifdef OPT_HEADER_OPTION_EXT if( !globs.scanheaders ) return; #endif if( DEBUG_HEADER ) printf( "header scan %s\n", t->name ); /* Compile all regular expressions in HDRSCAN */ while( rec < MAXINC && hdrscan ) { re[rec++] = regcomp( hdrscan->string ); hdrscan = list_next( hdrscan ); } /* Doctor up call to HDRRULE rule */ /* Call headers1() or hcache() to get LIST of included files. */ lol_init( &lol ); lol_add( &lol, list_new( L0, t->name ) ); #ifndef OPT_HEADER_CACHE_EXT lol_add( &lol, headers1( headlist, t->boundname, rec, re ) ); #else lol_add( &lol, hcache( t, rec, re, var_get("HDRSCAN") ) ); #endif if( lol_get( &lol, 1 ) ) evaluate_rule( hdrrule->string, &lol ); /* Clean up */ lol_free( &lol ); while( rec ) free( (char *)re[--rec] ); } /* * headers1() - using regexp, scan a file and build include LIST */ #ifndef OPT_HEADER_CACHE_EXT static /* Needs to be global if header caching is on */ #endif LIST * headers1( LIST *l, char *file, int rec, regexp *re[] ) { FILE *f; char buf[ 1024 ]; int i; if( !( f = fopen( file, "r" ) ) ) return l; while( fgets( buf, sizeof( buf ), f ) ) { for( i = 0; i < rec; i++ ) if( regexec( re[i], buf ) && re[i]->startp[1] ) { re[i]->endp[1][0] = '\0'; if( DEBUG_HEADER ) printf( "header found: %s\n", re[i]->startp[1] ); l = list_new( l, newstr( re[i]->startp[1] ) ); } } fclose( f ); return l; } void regerror( char *s ) { printf( "re error %s\n", s ); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 1227 | Craig Mcpheeters |
These are the enhancements that Matt Armstrong made to the header cache code. See their original copies in: //guest/matt_armstrong/jam/hdrscan_cache The file headers.c has been modified to incorporate the other extensions from my branch, the other three files are unaltered in this return. |
||
#1 | 1226 | Craig Mcpheeters |
Created a branch which will be used to integrate changes from Matt Armstrong's copy of Jam. |
||
//guest/craig_mcpheeters/jam/src/headers.c | |||||
#5 | 1189 | Craig Mcpheeters |
Integration of changes from my A|W work branch. Added a -d11 debug mode, which outputs information on fate changes Create jam variables to show job (-jn) information, such as the number of jobs requested, whether or not there is more than one job, and a list of the job slot numbers. These can be used in a variety of ways in supporting multi-job builds Added jobs slot expansion to the action blocks, the sequence !! is replaced by the job slot the action is running in. Modified the special shell handling to include unix. It used to be that on Unix, you could create an action block which exceeded the size that execvp() could handle (perhaps only when the DynamicCommandSize option is enabled.) On NT, all non-default shells are invoked through a intermediate file. This modification does the same for unix shells. Improved the -d+10 debug level, the dependency graph. It now shows the flags on the node as well (NOUPDATE, NOTFILE, etc.) Only issue the '...skipped' messages for nodes which would have been built |
||
#4 | 1023 | Craig Mcpheeters |
Integration from //guest/craig_mcpheeters/work/jam/src/... This return incorporates all of the Alias|Wavefront extensions to Jam, into an area which is a proper branch of the Jam mainline. An integration of these files into the Jam mainline will show all of the differences. There are several extensions to Jam in this return. Look at the new file Jamfile.config for an explanation of the extensions, and how to compile them into your own copy of Jam. If you want to build a copy of Jam with all of the extensions, do this: jam -sAllOptions=1 Read the config file for more info. The extensions range from minor output tweaks and simple fixes to more major things like a header cache, serialization of output from multiple jobs, dynamic command block sizing These are all offered without warranty, etc. |
||
#3 | 784 | Craig Mcpheeters | Integration from Jam mainline | ||
#2 | 617 | Craig Mcpheeters | Integration from mainline as of @3 | ||
#1 | 616 | Craig Mcpheeters | Integration from Jam mainline, as of @2 |