From 6011f825ca62dec32013af01d876e95174410cf6 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 12 Sep 2006 01:22:25 +0000 Subject: Auto targets from functions now work well, but filtering is completely disabled. Fortunately, filtering is more of a nicety, and build is still useful. I'll put filtering back in next. --- src/buildparser.cpp | 74 +++++++++++++++++++++++++++---------------- src/buildparser.h | 4 ++- src/functiondirectoriesin.cpp | 2 ++ 3 files changed, 52 insertions(+), 28 deletions(-) diff --git a/src/buildparser.cpp b/src/buildparser.cpp index 04147d8..b8de35e 100644 --- a/src/buildparser.cpp +++ b/src/buildparser.cpp @@ -62,17 +62,17 @@ void BuildParser::setTargetType( const char *sType ) void BuildParser::addTargetInput() { - lTargetTmp.back().second.lInput.insert( - lTargetTmp.back().second.lInput.end(), - lTmp.begin(), lTmp.end() + lTargetTmp.back().second.lInput.first.insert( + lTargetTmp.back().second.lInput.first.end(), + lTmp.first.begin(), lTmp.first.end() ); } void BuildParser::addTargetRequires() { - lTargetTmp.back().second.lRequires.insert( - lTargetTmp.back().second.lRequires.end(), - lTmp.begin(), lTmp.end() + lTargetTmp.back().second.lRequires.first.insert( + lTargetTmp.back().second.lRequires.first.end(), + lTmp.first.begin(), lTmp.first.end() ); } @@ -104,28 +104,46 @@ void BuildParser::addFunctionParam( const char *sParam ) // void BuildParser::newList() { - lTmp.clear(); + lTmp.first.clear(); + lTmp.second = NULL; } void BuildParser::addListString( const char *str ) { - lTmp.push_back( BuildListItem(str, NULL) ); + lTmp.first.push_back( BuildListItem(str, NULL) ); } void BuildParser::addListFunc() { - lTmp.push_back( BuildListItem("", pTmpFunc ) ); + lTmp.first.push_back( BuildListItem("", pTmpFunc ) ); } void BuildParser::filterList() { + lTmp.second = pTmpFunc; + //StringList lTmp2; + //StringList lIn = buildToStringList( lTmp, StringList() ); + //pTmpFunc->execute( NULL, lIn, lTmp2 ); + //lTmp.clear(); + //for( StringList::iterator i = lTmp2.begin(); i != lTmp2.end(); i++ ) + //{ + // lTmp.push_back( BuildListItem( *i, NULL ) ); + //} +} + +void BuildParser::buildListFilter( BuildList &lSrc ) +{ + if( lSrc.second == NULL ) + return; + StringList lTmp2; - StringList lIn = buildToStringList( lTmp, StringList() ); + StringList lIn = buildToStringList( lSrc, StringList() ); pTmpFunc->execute( NULL, lIn, lTmp2 ); - lTmp.clear(); + lSrc.first.clear(); + delete lSrc.second; for( StringList::iterator i = lTmp2.begin(); i != lTmp2.end(); i++ ) { - lTmp.push_back( BuildListItem( *i, NULL ) ); + lSrc.first.push_back( BuildListItem( *i, NULL ) ); } } @@ -133,7 +151,8 @@ StringList BuildParser::buildToStringList( const BuildList &lSrc, const StringLi { StringList lOut; - for( BuildList::const_iterator i = lSrc.begin(); i != lSrc.end(); i++ ) + for( BuildListCore::const_iterator i = lSrc.first.begin(); + i != lSrc.first.end(); i++ ) { if( (*i).second ) { @@ -152,7 +171,8 @@ StringList BuildParser::buildToStringListDup( const BuildList &lSrc, const Strin { StringList lOut; - for( BuildList::const_iterator i = lSrc.begin(); i != lSrc.end(); i++ ) + for( BuildListCore::const_iterator i = lSrc.first.begin(); + i != lSrc.first.end(); i++ ) { if( (*i).second ) { @@ -186,17 +206,17 @@ void BuildParser::addRuleMatches() void BuildParser::addRuleProduces() { - lRuleTmp.back().lProduces.insert( - lRuleTmp.back().lProduces.end(), - lTmp.begin(), lTmp.end() + lRuleTmp.back().lProduces.first.insert( + lRuleTmp.back().lProduces.first.end(), + lTmp.first.begin(), lTmp.first.end() ); } void BuildParser::addRuleRequires() { - lRuleTmp.back().lRequires.insert( - lRuleTmp.back().lRequires.end(), - lTmp.begin(), lTmp.end() + lRuleTmp.back().lRequires.first.insert( + lRuleTmp.back().lRequires.first.end(), + lTmp.first.begin(), lTmp.first.end() ); } @@ -346,10 +366,10 @@ void BuildParser::debugDump() void BuildParser::printBuildList( const BuildList &lst ) { printf("["); - for( BuildList::const_iterator k = lst.begin(); - k != lst.end(); k++ ) + for( BuildListCore::const_iterator k = lst.first.begin(); + k != lst.first.end(); k++ ) { - if( k != lst.begin() ) + if( k != lst.first.begin() ) { printf(", "); } @@ -462,8 +482,8 @@ Build *BuildParser::genBuild() pRule->getPerformList().push_back( *j ); } - for( BuildList::iterator j = (*i).lProduces.begin(); - j != (*i).lProduces.end(); j++ ) + for( BuildListCore::iterator j = (*i).lProduces.first.begin(); + j != (*i).lProduces.first.end(); j++ ) { if( (*j).second ) { @@ -479,8 +499,8 @@ Build *BuildParser::genBuild() pRule->setAggregate( (*i).pAggregate ); } - for( BuildList::iterator j = (*i).lRequires.begin(); - j != (*i).lRequires.end(); j++ ) + for( BuildListCore::iterator j = (*i).lRequires.first.begin(); + j != (*i).lRequires.first.end(); j++ ) { if( (*j).second ) { diff --git a/src/buildparser.h b/src/buildparser.h index 3c79a5b..13c523c 100644 --- a/src/buildparser.h +++ b/src/buildparser.h @@ -52,7 +52,8 @@ enum eSetHow class BuildParser : public Parser { typedef std::pair BuildListItem; - typedef std::list BuildList; + typedef std::list BuildListCore; + typedef std::pair BuildList; typedef Triplet SetVar; typedef std::list SetVarList; public: @@ -117,6 +118,7 @@ public: // List functions void addListFunc(); void filterList(); + void buildListFilter( BuildList &lSrc ); StringList buildToStringList( const BuildList &lSrc, const StringList &lIn, Build *pPass=NULL ); StringList buildToStringListDup( const BuildList &lSrc, const StringList &lIn, Build &bld, const std::string &sCont, VarMap *mExtra, Build *pPass=NULL ); diff --git a/src/functiondirectoriesin.cpp b/src/functiondirectoriesin.cpp index 105e98d..cafea81 100644 --- a/src/functiondirectoriesin.cpp +++ b/src/functiondirectoriesin.cpp @@ -30,6 +30,8 @@ void FunctionDirectoriesIn::execute( Build *bld, const StringList &lInput, Strin { if( e->d_type == DT_DIR ) { + if( e->d_name[0] == '.' || e->d_name[0] == '\0' ) + continue; lOutput.push_back( e->d_name ); } } -- cgit v1.2.3