diff options
Diffstat (limited to 'Source/cmStringCommand.cxx')
-rw-r--r-- | Source/cmStringCommand.cxx | 44 |
1 files changed, 6 insertions, 38 deletions
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index ea762eb..65912da 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -305,7 +305,7 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args) input += args[i]; } - this->ClearMatches(this->Makefile); + this->Makefile->ClearMatches(); // Compile the regular expression. cmsys::RegularExpression re; if(!re.compile(regex.c_str())) @@ -320,7 +320,7 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args) std::string output; if(re.find(input.c_str())) { - this->StoreMatches(this->Makefile, re); + this->Makefile->StoreMatches(re); std::string::size_type l = re.start(); std::string::size_type r = re.end(); if(r-l == 0) @@ -354,7 +354,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args) input += args[i]; } - this->ClearMatches(this->Makefile); + this->Makefile->ClearMatches(); // Compile the regular expression. cmsys::RegularExpression re; if(!re.compile(regex.c_str())) @@ -371,7 +371,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args) const char* p = input.c_str(); while(re.find(p)) { - this->StoreMatches(this->Makefile, re); + this->Makefile->StoreMatches(re); std::string::size_type l = re.start(); std::string::size_type r = re.end(); if(r-l == 0) @@ -458,7 +458,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args) input += args[i]; } - this->ClearMatches(this->Makefile); + this->Makefile->ClearMatches(); // Compile the regular expression. cmsys::RegularExpression re; if(!re.compile(regex.c_str())) @@ -475,7 +475,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args) std::string::size_type base = 0; while(re.find(input.c_str()+base)) { - this->StoreMatches(this->Makefile, re); + this->Makefile->StoreMatches(re); std::string::size_type l2 = re.start(); std::string::size_type r = re.end(); @@ -536,38 +536,6 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args) } //---------------------------------------------------------------------------- -void cmStringCommand::ClearMatches(cmMakefile* mf) -{ - for (unsigned int i=0; i<10; i++) - { - char name[128]; - sprintf(name, "CMAKE_MATCH_%d", i); - const char* s = mf->GetDefinition(name); - if(s && *s != 0) - { - mf->AddDefinition(name, ""); - mf->MarkVariableAsUsed(name); - } - } -} - -//---------------------------------------------------------------------------- -void cmStringCommand::StoreMatches(cmMakefile* mf,cmsys::RegularExpression& re) -{ - for (unsigned int i=0; i<10; i++) - { - std::string m = re.match(i); - if(m.size() > 0) - { - char name[128]; - sprintf(name, "CMAKE_MATCH_%d", i); - mf->AddDefinition(name, re.match(i).c_str()); - mf->MarkVariableAsUsed(name); - } - } -} - -//---------------------------------------------------------------------------- bool cmStringCommand::HandleFindCommand(std::vector<std::string> const& args) { |