/* * Copyright 1993, 2000 Christopher Seiwald. * * This file is part of Jam - see jam.c for Copyright information. */ /* * 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. * 03/02/02 (seiwald) - rules can be invoked via variable names * 10/22/02 (seiwald) - list_new() now does its own newstr()/copystr() * 11/04/02 (seiwald) - const-ing for string literals * 12/09/02 (seiwald) - push regexp creation down to headers1(). */ # 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 #ifndef OPT_HEADER_CACHE_EXT static LIST *headers1( const char *file, LIST *hdrscan ); #endif /* * headers() - scan a target for include files and call HDRRULE */ # define MAXINC 10 void headers( TARGET *t ) { LIST *hdrscan; LIST *hdrrule; LOL lol; if( !( hdrscan = var_get( "HDRSCAN" ) ) || !( hdrrule = var_get( "HDRRULE" ) ) ) return; #ifdef OPT_HEADER_OPTION_EXT if( !globs.scanheaders ) return; #endif /* 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_new( L0, t->name, 1 ) ); #ifndef OPT_HEADER_CACHE_EXT lol_add( &lol, headers1( t->boundname, hdrscan ) ); #else lol_add( &lol, hcache( t, hdrscan ) ); #endif if( lol_get( &lol, 1 ) ) list_free( evaluate_rule( hdrrule->string, &lol, L0 ) ); /* Clean up */ lol_free( &lol ); } /* * 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( const char *file, LIST *hdrscan ) { FILE *f; int i; int rec = 0; LIST *result = 0; regexp *re[ MAXINC ]; char buf[ 1024 ]; if( !( f = fopen( file, "r" ) ) ) return result; while( rec < MAXINC && hdrscan ) { re[rec++] = regcomp( hdrscan->string ); hdrscan = list_next( hdrscan ); } while( fgets( buf, sizeof( buf ), f ) ) { for( i = 0; i < rec; i++ ) if( regexec( re[i], buf ) && re[i]->startp[1] ) { /* Copy and terminate extracted string. */ char buf2[ MAXSYM ]; int l = re[i]->endp[1] - re[i]->startp[1]; memcpy( buf2, re[i]->startp[1], l ); buf2[ l ] = 0; result = list_new( result, buf2, 0 ); if( DEBUG_HEADER ) printf( "header found: %s\n", buf2 ); } } while( rec ) free( (char *)re[--rec] ); fclose( f ); return result; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#7 | 3183 | Craig Mcpheeters | Integration of my jam mainline branch into my work branch. | ||
#6 | 1606 | Craig Mcpheeters |
Integration from my modified jam mainline. This is all the mainline changes into my work branch. |
||
#5 | 1347 | Craig Mcpheeters |
Integration from my public area. This is the latest header cache changes. |
||
#4 | 1188 | Craig Mcpheeters |
The latest updates from my A|W work copy. 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 |
||
#3 | 785 | Craig Mcpheeters |
Integration from //guest/craig_mcpheeters/jam/src/... This work area now contains both the Alias|Wavefront changes, and the latest integrations from the mainline. There are some changes in this area which shouldn't be merged back into the mainline. As I merge this branch back into my jam/src/... branch, I'll leave out a few of the changes. |
||
#2 | 782 | Craig Mcpheeters |
Initial return of the Alias|Wavefront mods to jam 2.2. I made a stab at a configuration system - see the file Jamfile.config. Most of the mods are now enclosed within #ifdef blocks, which kind of pollutes the code, but may make it easier to accept or reject some of these changes. Some of these #ifdefs could disappear completely if they are accepted into the mainline This return implements the following extensions: * header cache * dynamic command block size, allowing for *large* commands * slightly improved warnings and errors * serial output from jam - nice when working with multiple jobs * an extension to variable modifiers: $(>:/) and $(>:\\) * ability to ignore header dependencies for a build (jam -p) * new debug level, -d+10, which outputs the dependency graph * added no-care support to internal nodes. if they fail, dependents are built anyway * time stamps on output * a few minor output modifications * a fix for nt batch file names conflicing when more than one jam runs at a time Each of the above can be enabled/disabled on the command line. For example, to turn on the HeaderCache code: jam -sHeaderCache=1 that is, build jam first, then use that jam to build a new one with the options you want. Some of these changes may have been made in the mainline already, my next step will be to integrate the mainline changes into these ones This return isn't yet ready for prime-time |
||
#1 | 777 | Craig Mcpheeters |
Branch of my jam/src/... area. This new area establishes the integration base for the copy of Jam which has all the changes. |
||
//guest/craig_mcpheeters/jam/src/headers.c | |||||
#2 | 617 | Craig Mcpheeters | Integration from mainline as of @3 | ||
#1 | 616 | Craig Mcpheeters | Integration from Jam mainline, as of @2 |