ENH: Merged use of the kwsys RegularExpression class instead of cmRegularExpression.
This commit is contained in:
parent
b2368399d9
commit
38482b46d1
|
@ -35,6 +35,7 @@ ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
|
||||||
SET(KWSYS_NAMESPACE cmsys)
|
SET(KWSYS_NAMESPACE cmsys)
|
||||||
SET(KWSYS_USE_SystemTools 1)
|
SET(KWSYS_USE_SystemTools 1)
|
||||||
SET(KWSYS_USE_Directory 1)
|
SET(KWSYS_USE_Directory 1)
|
||||||
|
SET(KWSYS_USE_RegularExpression 1)
|
||||||
SET(KWSYS_HEADER_ROOT ${CMake_BINARY_DIR}/Source)
|
SET(KWSYS_HEADER_ROOT ${CMake_BINARY_DIR}/Source)
|
||||||
SUBDIRS(Source/kwsys)
|
SUBDIRS(Source/kwsys)
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ cmake.cxx
|
||||||
cmakewizard.cxx
|
cmakewizard.cxx
|
||||||
cmMakeDepend.cxx
|
cmMakeDepend.cxx
|
||||||
cmMakefile.cxx
|
cmMakefile.cxx
|
||||||
cmRegularExpression.cxx
|
|
||||||
cmSourceFile.cxx
|
cmSourceFile.cxx
|
||||||
cmSystemTools.cxx
|
cmSystemTools.cxx
|
||||||
cmDocumentation.cxx
|
cmDocumentation.cxx
|
||||||
|
@ -25,7 +24,6 @@ cmake.h
|
||||||
cmakewizard.h
|
cmakewizard.h
|
||||||
cmMakeDepend.h
|
cmMakeDepend.h
|
||||||
cmMakefile.h
|
cmMakefile.h
|
||||||
cmRegularExpression.h
|
|
||||||
cmSourceFile.h
|
cmSourceFile.h
|
||||||
cmSystemTools.h
|
cmSystemTools.h
|
||||||
cmDynamicLoader.h
|
cmDynamicLoader.h
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
=========================================================================*/
|
=========================================================================*/
|
||||||
#include "cmBuildNameCommand.h"
|
#include "cmBuildNameCommand.h"
|
||||||
|
|
||||||
|
#include <cmsys/RegularExpression.hxx>
|
||||||
|
|
||||||
// cmBuildNameCommand
|
// cmBuildNameCommand
|
||||||
bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args)
|
bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args)
|
||||||
{
|
{
|
||||||
|
@ -28,7 +30,7 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args)
|
||||||
if(cacheValue)
|
if(cacheValue)
|
||||||
{
|
{
|
||||||
// do we need to correct the value?
|
// do we need to correct the value?
|
||||||
cmRegularExpression reg("[()/]");
|
cmsys::RegularExpression reg("[()/]");
|
||||||
if (reg.find(cacheValue))
|
if (reg.find(cacheValue))
|
||||||
{
|
{
|
||||||
std::string cv = cacheValue;
|
std::string cv = cacheValue;
|
||||||
|
@ -53,7 +55,7 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args)
|
||||||
if(buildname.length())
|
if(buildname.length())
|
||||||
{
|
{
|
||||||
std::string RegExp = "([^ ]*) [^ ]* ([^ ]*) ";
|
std::string RegExp = "([^ ]*) [^ ]* ([^ ]*) ";
|
||||||
cmRegularExpression reg( RegExp.c_str() );
|
cmsys::RegularExpression reg( RegExp.c_str() );
|
||||||
if(reg.find(buildname.c_str()))
|
if(reg.find(buildname.c_str()))
|
||||||
{
|
{
|
||||||
buildname = reg.match(1) + "-" + reg.match(2);
|
buildname = reg.match(1) + "-" + reg.match(2);
|
||||||
|
|
|
@ -15,10 +15,11 @@
|
||||||
|
|
||||||
=========================================================================*/
|
=========================================================================*/
|
||||||
#include "cmCTest.h"
|
#include "cmCTest.h"
|
||||||
#include "cmRegularExpression.h"
|
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include "cmListFileCache.h"
|
#include "cmListFileCache.h"
|
||||||
|
|
||||||
|
#include <cmsys/RegularExpression.hxx>
|
||||||
|
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_CURL
|
||||||
# include "cmCTestSubmit.h"
|
# include "cmCTestSubmit.h"
|
||||||
# include "curl/curl.h"
|
# include "curl/curl.h"
|
||||||
|
@ -590,10 +591,10 @@ int cmCTest::UpdateDirectory()
|
||||||
std::vector<cmStdString> lines;
|
std::vector<cmStdString> lines;
|
||||||
cmSystemTools::Split(goutput.c_str(), lines);
|
cmSystemTools::Split(goutput.c_str(), lines);
|
||||||
std::cout << "Updated; gathering version information" << std::endl;
|
std::cout << "Updated; gathering version information" << std::endl;
|
||||||
cmRegularExpression date_author("^date: +([^;]+); +author: +([^;]+); +state: +[^;]+;");
|
cmsys::RegularExpression date_author("^date: +([^;]+); +author: +([^;]+); +state: +[^;]+;");
|
||||||
cmRegularExpression revision("^revision +([^ ]*) *$");
|
cmsys::RegularExpression revision("^revision +([^ ]*) *$");
|
||||||
cmRegularExpression end_of_file("^=============================================================================$");
|
cmsys::RegularExpression end_of_file("^=============================================================================$");
|
||||||
cmRegularExpression end_of_comment("^----------------------------$");
|
cmsys::RegularExpression end_of_comment("^----------------------------$");
|
||||||
std::string current_path = "";
|
std::string current_path = "";
|
||||||
bool first_file = true;
|
bool first_file = true;
|
||||||
|
|
||||||
|
@ -974,7 +975,7 @@ int cmCTest::BuildDirectory()
|
||||||
// Errors
|
// Errors
|
||||||
for ( cc = 0; cmCTestErrorMatches[cc]; cc ++ )
|
for ( cc = 0; cmCTestErrorMatches[cc]; cc ++ )
|
||||||
{
|
{
|
||||||
cmRegularExpression re(cmCTestErrorMatches[cc]);
|
cmsys::RegularExpression re(cmCTestErrorMatches[cc]);
|
||||||
std::vector<std::string>::size_type kk;
|
std::vector<std::string>::size_type kk;
|
||||||
for ( kk = 0; kk < lines.size(); kk ++ )
|
for ( kk = 0; kk < lines.size(); kk ++ )
|
||||||
{
|
{
|
||||||
|
@ -987,7 +988,7 @@ int cmCTest::BuildDirectory()
|
||||||
// Warnings
|
// Warnings
|
||||||
for ( cc = 0; cmCTestWarningMatches[cc]; cc ++ )
|
for ( cc = 0; cmCTestWarningMatches[cc]; cc ++ )
|
||||||
{
|
{
|
||||||
cmRegularExpression re(cmCTestWarningMatches[cc]);
|
cmsys::RegularExpression re(cmCTestWarningMatches[cc]);
|
||||||
std::vector<std::string>::size_type kk;
|
std::vector<std::string>::size_type kk;
|
||||||
for ( kk = 0; kk < lines.size(); kk ++ )
|
for ( kk = 0; kk < lines.size(); kk ++ )
|
||||||
{
|
{
|
||||||
|
@ -1000,7 +1001,7 @@ int cmCTest::BuildDirectory()
|
||||||
// Errors exceptions
|
// Errors exceptions
|
||||||
for ( cc = 0; cmCTestErrorExceptions[cc]; cc ++ )
|
for ( cc = 0; cmCTestErrorExceptions[cc]; cc ++ )
|
||||||
{
|
{
|
||||||
cmRegularExpression re(cmCTestErrorExceptions[cc]);
|
cmsys::RegularExpression re(cmCTestErrorExceptions[cc]);
|
||||||
std::vector<int>::size_type kk;
|
std::vector<int>::size_type kk;
|
||||||
for ( kk =0; kk < markedLines.size(); kk ++ )
|
for ( kk =0; kk < markedLines.size(); kk ++ )
|
||||||
{
|
{
|
||||||
|
@ -1016,7 +1017,7 @@ int cmCTest::BuildDirectory()
|
||||||
// Warning exceptions
|
// Warning exceptions
|
||||||
for ( cc = 0; cmCTestWarningExceptions[cc]; cc ++ )
|
for ( cc = 0; cmCTestWarningExceptions[cc]; cc ++ )
|
||||||
{
|
{
|
||||||
cmRegularExpression re(cmCTestWarningExceptions[cc]);
|
cmsys::RegularExpression re(cmCTestWarningExceptions[cc]);
|
||||||
std::vector<int>::size_type kk;
|
std::vector<int>::size_type kk;
|
||||||
for ( kk =0; kk < markedLines.size(); kk ++ )
|
for ( kk =0; kk < markedLines.size(); kk ++ )
|
||||||
{
|
{
|
||||||
|
@ -1614,9 +1615,9 @@ void cmCTest::ProcessDirectory(std::vector<std::string> &passed,
|
||||||
int firstTest = 1;
|
int firstTest = 1;
|
||||||
long line = 0;
|
long line = 0;
|
||||||
|
|
||||||
cmRegularExpression ireg(this->m_IncludeRegExp.c_str());
|
cmsys::RegularExpression ireg(this->m_IncludeRegExp.c_str());
|
||||||
cmRegularExpression ereg(this->m_ExcludeRegExp.c_str());
|
cmsys::RegularExpression ereg(this->m_ExcludeRegExp.c_str());
|
||||||
cmRegularExpression dartStuff("([\t\n ]*<DartMeasurement.*/DartMeasurement[a-zA-Z]*>[\t ]*[\n]*)");
|
cmsys::RegularExpression dartStuff("([\t\n ]*<DartMeasurement.*/DartMeasurement[a-zA-Z]*>[\t ]*[\n]*)");
|
||||||
|
|
||||||
bool parseError;
|
bool parseError;
|
||||||
while ( fin )
|
while ( fin )
|
||||||
|
|
|
@ -19,9 +19,10 @@
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include "cmCacheManager.h"
|
#include "cmCacheManager.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
#include "cmRegularExpression.h"
|
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
|
|
||||||
|
#include <cmsys/RegularExpression.hxx>
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
@ -84,9 +85,9 @@ bool cmCacheManager::ParseEntry(const char* entry,
|
||||||
CacheEntryType& type)
|
CacheEntryType& type)
|
||||||
{
|
{
|
||||||
// input line is: key:type=value
|
// input line is: key:type=value
|
||||||
cmRegularExpression reg("^([^:]*):([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$");
|
cmsys::RegularExpression reg("^([^:]*):([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$");
|
||||||
// input line is: "key":type=value
|
// input line is: "key":type=value
|
||||||
cmRegularExpression regQuoted("^\"([^\"]*)\":([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$");
|
cmsys::RegularExpression regQuoted("^\"([^\"]*)\":([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$");
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
if(regQuoted.find(entry))
|
if(regQuoted.find(entry))
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
=========================================================================*/
|
=========================================================================*/
|
||||||
#include "cmConfigureFileCommand.h"
|
#include "cmConfigureFileCommand.h"
|
||||||
|
|
||||||
|
#include <cmsys/RegularExpression.hxx>
|
||||||
|
|
||||||
// cmConfigureFileCommand
|
// cmConfigureFileCommand
|
||||||
bool cmConfigureFileCommand::InitialPass(std::vector<std::string> const& args)
|
bool cmConfigureFileCommand::InitialPass(std::vector<std::string> const& args)
|
||||||
{
|
{
|
||||||
|
@ -106,7 +108,7 @@ void cmConfigureFileCommand::ConfigureFile()
|
||||||
// now copy input to output and expand variables in the
|
// now copy input to output and expand variables in the
|
||||||
// input file at the same time
|
// input file at the same time
|
||||||
std::string inLine;
|
std::string inLine;
|
||||||
cmRegularExpression cmdefine("#cmakedefine[ \t]*([A-Za-z_0-9]*)");
|
cmsys::RegularExpression cmdefine("#cmakedefine[ \t]*([A-Za-z_0-9]*)");
|
||||||
while( cmSystemTools::GetLineFromStream(fin, inLine) )
|
while( cmSystemTools::GetLineFromStream(fin, inLine) )
|
||||||
{
|
{
|
||||||
m_Makefile->ExpandVariablesInString(inLine, m_EscapeQuotes, m_AtOnly);
|
m_Makefile->ExpandVariablesInString(inLine, m_EscapeQuotes, m_AtOnly);
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
#include "cmIfCommand.h"
|
#include "cmIfCommand.h"
|
||||||
#include <stdlib.h> // required for atof
|
#include <stdlib.h> // required for atof
|
||||||
|
|
||||||
|
#include <cmsys/RegularExpression.hxx>
|
||||||
|
|
||||||
bool cmIfFunctionBlocker::
|
bool cmIfFunctionBlocker::
|
||||||
IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
|
IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
|
||||||
{
|
{
|
||||||
|
@ -217,7 +219,7 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args,
|
||||||
if (args.size() == 3 && (args[1] == "MATCHES"))
|
if (args.size() == 3 && (args[1] == "MATCHES"))
|
||||||
{
|
{
|
||||||
def = cmIfCommand::GetVariableOrString(args[0].c_str(), makefile);
|
def = cmIfCommand::GetVariableOrString(args[0].c_str(), makefile);
|
||||||
cmRegularExpression regEntry(args[2].c_str());
|
cmsys::RegularExpression regEntry(args[2].c_str());
|
||||||
|
|
||||||
// check for black line or comment
|
// check for black line or comment
|
||||||
if (!regEntry.find(def))
|
if (!regEntry.find(def))
|
||||||
|
|
|
@ -16,7 +16,8 @@
|
||||||
=========================================================================*/
|
=========================================================================*/
|
||||||
#include "cmListFileCache.h"
|
#include "cmListFileCache.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include "cmRegularExpression.h"
|
|
||||||
|
#include <cmsys/RegularExpression.hxx>
|
||||||
|
|
||||||
cmListFileCache* cmListFileCache::Instance = 0;
|
cmListFileCache* cmListFileCache::Instance = 0;
|
||||||
|
|
||||||
|
@ -174,10 +175,10 @@ bool cmListFileCache::ParseFunction(std::ifstream& fin,
|
||||||
{
|
{
|
||||||
++line;
|
++line;
|
||||||
RemoveComments(inbuffer);
|
RemoveComments(inbuffer);
|
||||||
cmRegularExpression blankLine("^[ \t\r]*$");
|
cmsys::RegularExpression blankLine("^[ \t\r]*$");
|
||||||
cmRegularExpression oneLiner("^[ \t]*([A-Za-z_0-9]*)[ \t]*\\((.*)\\)[ \t\r]*$");
|
cmsys::RegularExpression oneLiner("^[ \t]*([A-Za-z_0-9]*)[ \t]*\\((.*)\\)[ \t\r]*$");
|
||||||
cmRegularExpression multiLine("^[ \t]*([A-Za-z_0-9]*)[ \t]*\\((.*)$");
|
cmsys::RegularExpression multiLine("^[ \t]*([A-Za-z_0-9]*)[ \t]*\\((.*)$");
|
||||||
cmRegularExpression lastLine("^(.*)\\)[ \t\r]*$");
|
cmsys::RegularExpression lastLine("^(.*)\\)[ \t\r]*$");
|
||||||
|
|
||||||
// check for blank line or comment
|
// check for blank line or comment
|
||||||
if(blankLine.find(inbuffer.c_str()) )
|
if(blankLine.find(inbuffer.c_str()) )
|
||||||
|
@ -258,9 +259,9 @@ void cmListFileCache::GetArguments(std::string& line,
|
||||||
std::vector<cmListFileArgument>& arguments)
|
std::vector<cmListFileArgument>& arguments)
|
||||||
{
|
{
|
||||||
// Match a normal argument (not quoted, no spaces).
|
// Match a normal argument (not quoted, no spaces).
|
||||||
cmRegularExpression normalArgument("[ \t]*(([^ \t\r\\]|[\\].)+)[ \t\r]*");
|
cmsys::RegularExpression normalArgument("[ \t]*(([^ \t\r\\]|[\\].)+)[ \t\r]*");
|
||||||
// Match a quoted argument (surrounded by double quotes, spaces allowed).
|
// Match a quoted argument (surrounded by double quotes, spaces allowed).
|
||||||
cmRegularExpression quotedArgument("[ \t]*(\"([^\"\\]|[\\].)*\")[ \t\r]*");
|
cmsys::RegularExpression quotedArgument("[ \t]*(\"([^\"\\]|[\\].)*\")[ \t\r]*");
|
||||||
|
|
||||||
bool done = false;
|
bool done = false;
|
||||||
while(!done)
|
while(!done)
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
=========================================================================*/
|
=========================================================================*/
|
||||||
#include "cmLoadCacheCommand.h"
|
#include "cmLoadCacheCommand.h"
|
||||||
|
|
||||||
|
#include <cmsys/RegularExpression.hxx>
|
||||||
|
|
||||||
// cmLoadCacheCommand
|
// cmLoadCacheCommand
|
||||||
bool cmLoadCacheCommand::InitialPass(std::vector<std::string> const& args)
|
bool cmLoadCacheCommand::InitialPass(std::vector<std::string> const& args)
|
||||||
|
@ -202,9 +203,9 @@ bool cmLoadCacheCommand::ParseEntry(const char* entry, std::string& var,
|
||||||
std::string& value)
|
std::string& value)
|
||||||
{
|
{
|
||||||
// input line is: key:type=value
|
// input line is: key:type=value
|
||||||
cmRegularExpression reg("^([^:]*):([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$");
|
cmsys::RegularExpression reg("^([^:]*):([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$");
|
||||||
// input line is: "key":type=value
|
// input line is: "key":type=value
|
||||||
cmRegularExpression regQuoted("^\"([^\"]*)\":([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$");
|
cmsys::RegularExpression regQuoted("^\"([^\"]*)\":([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$");
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
if(regQuoted.find(entry))
|
if(regQuoted.find(entry))
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,6 +22,8 @@ PURPOSE. See the above copyright notices for more information.
|
||||||
#include "cmCacheManager.h"
|
#include "cmCacheManager.h"
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
|
|
||||||
|
#include <cmsys/RegularExpression.hxx>
|
||||||
|
|
||||||
cmLocalCodeWarriorGenerator::cmLocalCodeWarriorGenerator()
|
cmLocalCodeWarriorGenerator::cmLocalCodeWarriorGenerator()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -168,9 +170,9 @@ void cmLocalCodeWarriorGenerator::WriteSettingList(std::ostream& fout,
|
||||||
// library paths
|
// library paths
|
||||||
|
|
||||||
// now add in the libraries we depend on
|
// now add in the libraries we depend on
|
||||||
cmRegularExpression isAframework("[ \t]*\\-framework");
|
cmsys::RegularExpression isAframework("[ \t]*\\-framework");
|
||||||
cmRegularExpression isEnvironment("\\${");
|
cmsys::RegularExpression isEnvironment("\\${");
|
||||||
cmRegularExpression isUNIX("[ \t]*\\-l([^ \t]+)");
|
cmsys::RegularExpression isUNIX("[ \t]*\\-l([^ \t]+)");
|
||||||
const cmTarget::LinkLibraries& libs = l->GetLinkLibraries();
|
const cmTarget::LinkLibraries& libs = l->GetLinkLibraries();
|
||||||
cmTarget::LinkLibraries::const_iterator lib = libs.begin();
|
cmTarget::LinkLibraries::const_iterator lib = libs.begin();
|
||||||
for(; lib != libs.end(); ++lib)
|
for(; lib != libs.end(); ++lib)
|
||||||
|
@ -564,9 +566,9 @@ void cmLocalCodeWarriorGenerator::WriteFileList(std::ostream& fout,
|
||||||
}
|
}
|
||||||
|
|
||||||
// now add in the libraries we depend on
|
// now add in the libraries we depend on
|
||||||
cmRegularExpression isAframework("[ \t]*\\-framework");
|
cmsys::RegularExpression isAframework("[ \t]*\\-framework");
|
||||||
cmRegularExpression isEnvironment("\\${");
|
cmsys::RegularExpression isEnvironment("\\${");
|
||||||
cmRegularExpression isUNIX("[ \t]*\\-l([^ \t]+)");
|
cmsys::RegularExpression isUNIX("[ \t]*\\-l([^ \t]+)");
|
||||||
const cmTarget::LinkLibraries& libs = l->GetLinkLibraries();
|
const cmTarget::LinkLibraries& libs = l->GetLinkLibraries();
|
||||||
cmTarget::LinkLibraries::const_iterator lib = libs.begin();
|
cmTarget::LinkLibraries::const_iterator lib = libs.begin();
|
||||||
for(; lib != libs.end(); ++lib)
|
for(; lib != libs.end(); ++lib)
|
||||||
|
@ -694,9 +696,9 @@ void cmLocalCodeWarriorGenerator::WriteLinkOrder(std::ostream& fout,
|
||||||
}
|
}
|
||||||
|
|
||||||
// now add in the libraries we depend on
|
// now add in the libraries we depend on
|
||||||
cmRegularExpression isAframework("[ \t]*\\-framework");
|
cmsys::RegularExpression isAframework("[ \t]*\\-framework");
|
||||||
cmRegularExpression isEnvironment("\\${");
|
cmsys::RegularExpression isEnvironment("\\${");
|
||||||
cmRegularExpression isUNIX("[ \t]*\\-l([^ \t]+)");
|
cmsys::RegularExpression isUNIX("[ \t]*\\-l([^ \t]+)");
|
||||||
const cmTarget::LinkLibraries& libs = l->GetLinkLibraries();
|
const cmTarget::LinkLibraries& libs = l->GetLinkLibraries();
|
||||||
cmTarget::LinkLibraries::const_iterator lib = libs.begin();
|
cmTarget::LinkLibraries::const_iterator lib = libs.begin();
|
||||||
|
|
||||||
|
@ -814,7 +816,7 @@ void cmLocalCodeWarriorGenerator::WriteLinkOrder(std::ostream& fout,
|
||||||
|
|
||||||
// we need at least one framework for the XML to be valid
|
// we need at least one framework for the XML to be valid
|
||||||
// generate framework list
|
// generate framework list
|
||||||
cmRegularExpression reg("[ \t]*\\-framework[ \t]+([^ \t]+)");
|
cmsys::RegularExpression reg("[ \t]*\\-framework[ \t]+([^ \t]+)");
|
||||||
std::vector<std::string> frameworks;
|
std::vector<std::string> frameworks;
|
||||||
|
|
||||||
lib = libs.begin();
|
lib = libs.begin();
|
||||||
|
@ -967,9 +969,9 @@ void cmLocalCodeWarriorGenerator::WriteGroup(std::ostream& fout,
|
||||||
}
|
}
|
||||||
|
|
||||||
// now add in the libraries we depend on
|
// now add in the libraries we depend on
|
||||||
cmRegularExpression isAframework("[ \t]*\\-framework");
|
cmsys::RegularExpression isAframework("[ \t]*\\-framework");
|
||||||
cmRegularExpression isEnvironment("\\${");
|
cmsys::RegularExpression isEnvironment("\\${");
|
||||||
cmRegularExpression isUNIX("[ \t]*\\-l([^ \t]+)");
|
cmsys::RegularExpression isUNIX("[ \t]*\\-l([^ \t]+)");
|
||||||
const cmTarget::LinkLibraries& libs = l->GetLinkLibraries();
|
const cmTarget::LinkLibraries& libs = l->GetLinkLibraries();
|
||||||
cmTarget::LinkLibraries::const_iterator lib = libs.begin();
|
cmTarget::LinkLibraries::const_iterator lib = libs.begin();
|
||||||
for(; lib != libs.end(); ++lib)
|
for(; lib != libs.end(); ++lib)
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#include "cmMakeDepend.h"
|
#include "cmMakeDepend.h"
|
||||||
#include "cmCacheManager.h"
|
#include "cmCacheManager.h"
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
|
|
||||||
|
#include <cmsys/RegularExpression.hxx>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
cmLocalUnixMakefileGenerator::cmLocalUnixMakefileGenerator()
|
cmLocalUnixMakefileGenerator::cmLocalUnixMakefileGenerator()
|
||||||
|
@ -565,7 +567,7 @@ void cmLocalUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
|
||||||
std::string regexp = ".*\\";
|
std::string regexp = ".*\\";
|
||||||
regexp += linkSuffix;
|
regexp += linkSuffix;
|
||||||
regexp += "$";
|
regexp += "$";
|
||||||
cmRegularExpression hasSuffix(regexp.c_str());
|
cmsys::RegularExpression hasSuffix(regexp.c_str());
|
||||||
std::string librariesLinked;
|
std::string librariesLinked;
|
||||||
const cmTarget::LinkLibraries& libs = tgt.GetLinkLibraries();
|
const cmTarget::LinkLibraries& libs = tgt.GetLinkLibraries();
|
||||||
for(cmTarget::LinkLibraries::const_iterator lib = libs.begin();
|
for(cmTarget::LinkLibraries::const_iterator lib = libs.begin();
|
||||||
|
@ -579,7 +581,7 @@ void cmLocalUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
|
||||||
// if a variable expands to nothing.
|
// if a variable expands to nothing.
|
||||||
if (lib->first.size() == 0) continue;
|
if (lib->first.size() == 0) continue;
|
||||||
// if it is a full path break it into -L and -l
|
// if it is a full path break it into -L and -l
|
||||||
cmRegularExpression reg("([ \t]*\\-l)|([ \t]*\\-framework)|(\\${)");
|
cmsys::RegularExpression reg("([ \t]*\\-l)|([ \t]*\\-framework)|(\\${)");
|
||||||
if(lib->first.find('/') != std::string::npos
|
if(lib->first.find('/') != std::string::npos
|
||||||
&& !reg.find(lib->first))
|
&& !reg.find(lib->first))
|
||||||
{
|
{
|
||||||
|
@ -597,8 +599,8 @@ void cmLocalUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
|
||||||
runtimeDirs.push_back( libpath );
|
runtimeDirs.push_back( libpath );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cmRegularExpression libname("^lib([^/]*)(\\.so|\\.lib|\\.dll|\\.sl|\\.a|\\.dylib).*");
|
cmsys::RegularExpression libname("^lib([^/]*)(\\.so|\\.lib|\\.dll|\\.sl|\\.a|\\.dylib).*");
|
||||||
cmRegularExpression libname_noprefix("([^/]*)(\\.so|\\.lib|\\.dll|\\.sl|\\.a|\\.dylib).*");
|
cmsys::RegularExpression libname_noprefix("([^/]*)(\\.so|\\.lib|\\.dll|\\.sl|\\.a|\\.dylib).*");
|
||||||
if(libname.find(file))
|
if(libname.find(file))
|
||||||
{
|
{
|
||||||
// Library had "lib" prefix.
|
// Library had "lib" prefix.
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#include "cmCacheManager.h"
|
#include "cmCacheManager.h"
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
|
#include <cmsys/RegularExpression.hxx>
|
||||||
|
|
||||||
cmLocalVisualStudio6Generator::cmLocalVisualStudio6Generator()
|
cmLocalVisualStudio6Generator::cmLocalVisualStudio6Generator()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -607,7 +609,7 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b,
|
||||||
// possible
|
// possible
|
||||||
std::ifstream fin(m_DSPHeaderTemplate.c_str());
|
std::ifstream fin(m_DSPHeaderTemplate.c_str());
|
||||||
|
|
||||||
cmRegularExpression reg("# Name ");
|
cmsys::RegularExpression reg("# Name ");
|
||||||
if(!fin)
|
if(!fin)
|
||||||
{
|
{
|
||||||
cmSystemTools::Error("Error Reading ", m_DSPHeaderTemplate.c_str());
|
cmSystemTools::Error("Error Reading ", m_DSPHeaderTemplate.c_str());
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "cmStandardIncludes.h"
|
#include "cmStandardIncludes.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
|
|
||||||
|
#include <cmsys/RegularExpression.hxx>
|
||||||
|
|
||||||
void cmDependInformation::AddDependencies(cmDependInformation* info)
|
void cmDependInformation::AddDependencies(cmDependInformation* info)
|
||||||
{
|
{
|
||||||
|
@ -189,7 +190,7 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info)
|
||||||
// #include directives
|
// #include directives
|
||||||
void cmMakeDepend::DependWalk(cmDependInformation* info)
|
void cmMakeDepend::DependWalk(cmDependInformation* info)
|
||||||
{
|
{
|
||||||
cmRegularExpression includeLine("^[ \t]*#[ \t]*include[ \t]*[<\"]([^\">]+)[\">]");
|
cmsys::RegularExpression includeLine("^[ \t]*#[ \t]*include[ \t]*[<\"]([^\">]+)[\">]");
|
||||||
std::ifstream fin(info->m_FullPath.c_str());
|
std::ifstream fin(info->m_FullPath.c_str());
|
||||||
if(!fin)
|
if(!fin)
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,9 +19,10 @@
|
||||||
|
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
#include "cmSourceFile.h"
|
#include "cmSourceFile.h"
|
||||||
#include "cmRegularExpression.h"
|
|
||||||
#include "cmStandardIncludes.h"
|
#include "cmStandardIncludes.h"
|
||||||
|
|
||||||
|
#include <cmsys/RegularExpression.hxx>
|
||||||
|
|
||||||
/** \class cmDependInformation
|
/** \class cmDependInformation
|
||||||
* \brief Store dependency information for a single source file.
|
* \brief Store dependency information for a single source file.
|
||||||
*
|
*
|
||||||
|
@ -150,8 +151,8 @@ protected:
|
||||||
|
|
||||||
const cmMakefile* m_Makefile;
|
const cmMakefile* m_Makefile;
|
||||||
bool m_Verbose;
|
bool m_Verbose;
|
||||||
cmRegularExpression m_IncludeFileRegularExpression;
|
cmsys::RegularExpression m_IncludeFileRegularExpression;
|
||||||
cmRegularExpression m_ComplainFileRegularExpression;
|
cmsys::RegularExpression m_ComplainFileRegularExpression;
|
||||||
std::vector<std::string> m_IncludeDirectories;
|
std::vector<std::string> m_IncludeDirectories;
|
||||||
typedef std::map<cmStdString, cmDependInformation*> DependInformationMap;
|
typedef std::map<cmStdString, cmDependInformation*> DependInformationMap;
|
||||||
DependInformationMap m_DependInformationMap;
|
DependInformationMap m_DependInformationMap;
|
||||||
|
|
|
@ -29,6 +29,9 @@
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
#include <stdio.h> // required for sprintf
|
#include <stdio.h> // required for sprintf
|
||||||
#include <stdlib.h> // required for atoi
|
#include <stdlib.h> // required for atoi
|
||||||
|
|
||||||
|
#include <cmsys/RegularExpression.hxx>
|
||||||
|
|
||||||
// default is not to be building executables
|
// default is not to be building executables
|
||||||
cmMakefile::cmMakefile()
|
cmMakefile::cmMakefile()
|
||||||
{
|
{
|
||||||
|
@ -458,7 +461,7 @@ void cmMakefile::AddCustomCommand(const char* source,
|
||||||
d != outputs.end(); ++d)
|
d != outputs.end(); ++d)
|
||||||
{
|
{
|
||||||
// if this looks like a real file then use is as the main depend
|
// if this looks like a real file then use is as the main depend
|
||||||
cmRegularExpression SourceFiles("\\.(C|M|c|c\\+\\+|cc|cpp|cxx|m|mm|rc|def|r|odl|idl|hpj|bat|h|h\\+\\+|hm|hpp|hxx|in|txx|inl)$");
|
cmsys::RegularExpression SourceFiles("\\.(C|M|c|c\\+\\+|cc|cpp|cxx|m|mm|rc|def|r|odl|idl|hpj|bat|h|h\\+\\+|hm|hpp|hxx|in|txx|inl)$");
|
||||||
if (SourceFiles.find(source))
|
if (SourceFiles.find(source))
|
||||||
{
|
{
|
||||||
this->AddCustomCommandToOutput(d->c_str(), command, commandArgs,
|
this->AddCustomCommandToOutput(d->c_str(), command, commandArgs,
|
||||||
|
@ -1461,7 +1464,7 @@ void cmMakefile::RemoveVariablesInString(std::string& source,
|
||||||
{
|
{
|
||||||
if(!atOnly)
|
if(!atOnly)
|
||||||
{
|
{
|
||||||
cmRegularExpression var("(\\${[A-Za-z_0-9]*})");
|
cmsys::RegularExpression var("(\\${[A-Za-z_0-9]*})");
|
||||||
while (var.find(source))
|
while (var.find(source))
|
||||||
{
|
{
|
||||||
source.erase(var.start(),var.end() - var.start());
|
source.erase(var.start(),var.end() - var.start());
|
||||||
|
@ -1470,13 +1473,13 @@ void cmMakefile::RemoveVariablesInString(std::string& source,
|
||||||
|
|
||||||
if(!atOnly)
|
if(!atOnly)
|
||||||
{
|
{
|
||||||
cmRegularExpression varb("(\\$ENV{[A-Za-z_0-9]*})");
|
cmsys::RegularExpression varb("(\\$ENV{[A-Za-z_0-9]*})");
|
||||||
while (varb.find(source))
|
while (varb.find(source))
|
||||||
{
|
{
|
||||||
source.erase(varb.start(),varb.end() - varb.start());
|
source.erase(varb.start(),varb.end() - varb.start());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cmRegularExpression var2("(@[A-Za-z_0-9]*@)");
|
cmsys::RegularExpression var2("(@[A-Za-z_0-9]*@)");
|
||||||
while (var2.find(source))
|
while (var2.find(source))
|
||||||
{
|
{
|
||||||
source.erase(var2.start(),var2.end() - var2.start());
|
source.erase(var2.start(),var2.end() - var2.start());
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,378 +0,0 @@
|
||||||
/*=========================================================================
|
|
||||||
|
|
||||||
Program: CMake - Cross-Platform Makefile Generator
|
|
||||||
Module: $RCSfile$
|
|
||||||
Language: C++
|
|
||||||
Date: $Date$
|
|
||||||
Version: $Revision$
|
|
||||||
|
|
||||||
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
|
||||||
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
|
||||||
|
|
||||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
||||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. See the above copyright notices for more information.
|
|
||||||
|
|
||||||
=========================================================================*/
|
|
||||||
// Original Copyright notice:
|
|
||||||
// Copyright (C) 1991 Texas Instruments Incorporated.
|
|
||||||
//
|
|
||||||
// Permission is granted to any individual or institution to use, copy, modify,
|
|
||||||
// and distribute this software, provided that this complete copyright and
|
|
||||||
// permission notice is maintained, intact, in all copies and supporting
|
|
||||||
// documentation.
|
|
||||||
//
|
|
||||||
// Texas Instruments Incorporated provides this software "as is" without
|
|
||||||
// express or implied warranty.
|
|
||||||
//
|
|
||||||
// Created: MNF 06/13/89 Initial Design and Implementation
|
|
||||||
// Updated: LGO 08/09/89 Inherit from Generic
|
|
||||||
// Updated: MBN 09/07/89 Added conditional exception handling
|
|
||||||
// Updated: MBN 12/15/89 Sprinkled "const" qualifiers all over the place!
|
|
||||||
// Updated: DLS 03/22/91 New lite version
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef cmRegularExpression_h
|
|
||||||
#define cmRegularExpression_h
|
|
||||||
|
|
||||||
#include "cmStandardIncludes.h"
|
|
||||||
|
|
||||||
const int NSUBEXP = 10;
|
|
||||||
|
|
||||||
/** \class cmRegularExpression
|
|
||||||
* \brief Implements pattern matching with regular expressions.
|
|
||||||
*
|
|
||||||
* This is the header file for the regular expression class. An object of
|
|
||||||
* this class contains a regular expression, in a special "compiled" format.
|
|
||||||
* This compiled format consists of several slots all kept as the objects
|
|
||||||
* private data. The cmRegularExpression class provides a convenient way to
|
|
||||||
* represent regular expressions. It makes it easy to search for the same
|
|
||||||
* regular expression in many different strings without having to compile a
|
|
||||||
* string to regular expression format more than necessary.
|
|
||||||
*
|
|
||||||
* This class implements pattern matching via regular expressions.
|
|
||||||
* A regular expression allows a programmer to specify complex
|
|
||||||
* patterns that can be searched for and matched against the
|
|
||||||
* character string of a string object. In its simplest form, a
|
|
||||||
* regular expression is a sequence of characters used to
|
|
||||||
* search for exact character matches. However, many times the
|
|
||||||
* exact sequence to be found is not known, or only a match at
|
|
||||||
* the beginning or end of a string is desired. The cmRegularExpression regu-
|
|
||||||
* lar expression class implements regular expression pattern
|
|
||||||
* matching as is found and implemented in many UNIX commands
|
|
||||||
* and utilities.
|
|
||||||
*
|
|
||||||
* Example: The perl code
|
|
||||||
*
|
|
||||||
* $filename =~ m"([a-z]+)\.cc";
|
|
||||||
* print $1;
|
|
||||||
*
|
|
||||||
* Is written as follows in C++
|
|
||||||
*
|
|
||||||
* cmRegularExpression re("([a-z]+)\\.cc");
|
|
||||||
* re.find(filename);
|
|
||||||
* cerr << re.match(1);
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* The regular expression class provides a convenient mechanism
|
|
||||||
* for specifying and manipulating regular expressions. The
|
|
||||||
* regular expression object allows specification of such pat-
|
|
||||||
* terns by using the following regular expression metacharac-
|
|
||||||
* ters:
|
|
||||||
*
|
|
||||||
* ^ Matches at beginning of a line
|
|
||||||
*
|
|
||||||
* $ Matches at end of a line
|
|
||||||
*
|
|
||||||
* . Matches any single character
|
|
||||||
*
|
|
||||||
* [ ] Matches any character(s) inside the brackets
|
|
||||||
*
|
|
||||||
* [^ ] Matches any character(s) not inside the brackets
|
|
||||||
*
|
|
||||||
* - Matches any character in range on either side of a dash
|
|
||||||
*
|
|
||||||
* * Matches preceding pattern zero or more times
|
|
||||||
*
|
|
||||||
* + Matches preceding pattern one or more times
|
|
||||||
*
|
|
||||||
* ? Matches preceding pattern zero or once only
|
|
||||||
*
|
|
||||||
* () Saves a matched expression and uses it in a later match
|
|
||||||
*
|
|
||||||
* Note that more than one of these metacharacters can be used
|
|
||||||
* in a single regular expression in order to create complex
|
|
||||||
* search patterns. For example, the pattern [^ab1-9] says to
|
|
||||||
* match any character sequence that does not begin with the
|
|
||||||
* characters "ab" followed by numbers in the series one
|
|
||||||
* through nine.
|
|
||||||
*
|
|
||||||
* There are three constructors for cmRegularExpression. One just creates an
|
|
||||||
* empty cmRegularExpression object. Another creates a cmRegularExpression
|
|
||||||
* object and initializes it with a regular expression that is given in the
|
|
||||||
* form of a char*. The third takes a reference to a cmRegularExpression
|
|
||||||
* object as an argument and creates an object initialized with the
|
|
||||||
* information from the given cmRegularExpression object.
|
|
||||||
*
|
|
||||||
* The find member function finds the first occurence of the regualr
|
|
||||||
* expression of that object in the string given to find as an argument. Find
|
|
||||||
* returns a boolean, and if true, mutates the private data appropriately.
|
|
||||||
* Find sets pointers to the beginning and end of the thing last found, they
|
|
||||||
* are pointers into the actual string that was searched. The start and end
|
|
||||||
* member functions return indicies into the searched string that correspond
|
|
||||||
* to the beginning and end pointers respectively. The compile member
|
|
||||||
* function takes a char* and puts the compiled version of the char* argument
|
|
||||||
* into the object's private data fields. The == and != operators only check
|
|
||||||
* the to see if the compiled regular expression is the same, and the
|
|
||||||
* deep_equal functions also checks to see if the start and end pointers are
|
|
||||||
* the same. The is_valid function returns false if program is set to NULL,
|
|
||||||
* (i.e. there is no valid compiled exression). The set_invalid function sets
|
|
||||||
* the program to NULL (Warning: this deletes the compiled expression). The
|
|
||||||
* following examples may help clarify regular expression usage:
|
|
||||||
*
|
|
||||||
* * The regular expression "^hello" matches a "hello" only at the
|
|
||||||
* beginning of a line. It would match "hello there" but not "hi,
|
|
||||||
* hello there".
|
|
||||||
*
|
|
||||||
* * The regular expression "long$" matches a "long" only at the end
|
|
||||||
* of a line. It would match "so long\0", but not "long ago".
|
|
||||||
*
|
|
||||||
* * The regular expression "t..t..g" will match anything that has a
|
|
||||||
* "t" then any two characters, another "t", any two characters and
|
|
||||||
* then a "g". It will match "testing", or "test again" but would
|
|
||||||
* not match "toasting"
|
|
||||||
*
|
|
||||||
* * The regular expression "[1-9ab]" matches any number one through
|
|
||||||
* nine, and the characters "a" and "b". It would match "hello 1"
|
|
||||||
* or "begin", but would not match "no-match".
|
|
||||||
*
|
|
||||||
* * The regular expression "[^1-9ab]" matches any character that is
|
|
||||||
* not a number one through nine, or an "a" or "b". It would NOT
|
|
||||||
* match "hello 1" or "begin", but would match "no-match".
|
|
||||||
*
|
|
||||||
* * The regular expression "br* " matches something that begins with
|
|
||||||
* a "b", is followed by zero or more "r"s, and ends in a space. It
|
|
||||||
* would match "brrrrr ", and "b ", but would not match "brrh ".
|
|
||||||
*
|
|
||||||
* * The regular expression "br+ " matches something that begins with
|
|
||||||
* a "b", is followed by one or more "r"s, and ends in a space. It
|
|
||||||
* would match "brrrrr ", and "br ", but would not match "b " or
|
|
||||||
* "brrh ".
|
|
||||||
*
|
|
||||||
* * The regular expression "br? " matches something that begins with
|
|
||||||
* a "b", is followed by zero or one "r"s, and ends in a space. It
|
|
||||||
* would match "br ", and "b ", but would not match "brrrr " or
|
|
||||||
* "brrh ".
|
|
||||||
*
|
|
||||||
* * The regular expression "(..p)b" matches something ending with pb
|
|
||||||
* and beginning with whatever the two characters before the first p
|
|
||||||
* encounterd in the line were. It would find "repb" in "rep drepa
|
|
||||||
* qrepb". The regular expression "(..p)a" would find "repa qrepb"
|
|
||||||
* in "rep drepa qrepb"
|
|
||||||
*
|
|
||||||
* * The regular expression "d(..p)" matches something ending with p,
|
|
||||||
* beginning with d, and having two characters in between that are
|
|
||||||
* the same as the two characters before the first p encounterd in
|
|
||||||
* the line. It would match "drepa qrepb" in "rep drepa qrepb".
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class cmRegularExpression
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* Instantiate cmRegularExpression with program=NULL.
|
|
||||||
*/
|
|
||||||
inline cmRegularExpression ();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiate cmRegularExpression with compiled char*.
|
|
||||||
*/
|
|
||||||
inline cmRegularExpression (char const*);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiate cmRegularExpression as a copy of another regular expression.
|
|
||||||
*/
|
|
||||||
cmRegularExpression (cmRegularExpression const&);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destructor.
|
|
||||||
*/
|
|
||||||
inline ~cmRegularExpression();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compile a regular expression into internal code
|
|
||||||
* for later pattern matching.
|
|
||||||
*/
|
|
||||||
bool compile (char const*);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Matches the regular expression to the given string.
|
|
||||||
* Returns true if found, and sets start and end indexes accordingly.
|
|
||||||
*/
|
|
||||||
bool find (char const*);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Matches the regular expression to the given std string.
|
|
||||||
* Returns true if found, and sets start and end indexes accordingly.
|
|
||||||
*/
|
|
||||||
bool find (std::string const&);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Index to start of first find.
|
|
||||||
*/
|
|
||||||
inline std::string::size_type start() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Index to end of first find.
|
|
||||||
*/
|
|
||||||
inline std::string::size_type end() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if two regular expressions have the same
|
|
||||||
* compiled program for pattern matching.
|
|
||||||
*/
|
|
||||||
bool operator== (cmRegularExpression const&) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if two regular expressions have different
|
|
||||||
* compiled program for pattern matching.
|
|
||||||
*/
|
|
||||||
inline bool operator!= (cmRegularExpression const&) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if have the same compiled regular expressions
|
|
||||||
* and the same start and end pointers.
|
|
||||||
*/
|
|
||||||
bool deep_equal (cmRegularExpression const&) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* True if the compiled regexp is valid.
|
|
||||||
*/
|
|
||||||
inline bool is_valid() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Marks the regular expression as invalid.
|
|
||||||
*/
|
|
||||||
inline void set_invalid();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destructor.
|
|
||||||
*/
|
|
||||||
// awf added
|
|
||||||
std::string::size_type start(int n) const;
|
|
||||||
std::string::size_type end(int n) const;
|
|
||||||
std::string match(int n) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const char* startp[NSUBEXP];
|
|
||||||
const char* endp[NSUBEXP];
|
|
||||||
char regstart; // Internal use only
|
|
||||||
char reganch; // Internal use only
|
|
||||||
const char* regmust; // Internal use only
|
|
||||||
int regmlen; // Internal use only
|
|
||||||
char* program;
|
|
||||||
int progsize;
|
|
||||||
const char* searchstring;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an empty regular expression.
|
|
||||||
*/
|
|
||||||
inline cmRegularExpression::cmRegularExpression ()
|
|
||||||
{
|
|
||||||
this->program = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a regular expression from string s, and
|
|
||||||
* compiles s.
|
|
||||||
*/
|
|
||||||
inline cmRegularExpression::cmRegularExpression (const char* s)
|
|
||||||
{
|
|
||||||
this->program = 0;
|
|
||||||
if ( s )
|
|
||||||
{
|
|
||||||
this->compile(s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroys and frees space allocated for the regular expression.
|
|
||||||
*/
|
|
||||||
inline cmRegularExpression::~cmRegularExpression ()
|
|
||||||
{
|
|
||||||
//#ifndef WIN32
|
|
||||||
delete [] this->program;
|
|
||||||
//#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the start position for the regular expression.
|
|
||||||
*/
|
|
||||||
inline std::string::size_type cmRegularExpression::start () const
|
|
||||||
{
|
|
||||||
return(this->startp[0] - searchstring);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the start/end index of the last item found.
|
|
||||||
*/
|
|
||||||
inline std::string::size_type cmRegularExpression::end () const
|
|
||||||
{
|
|
||||||
return(this->endp[0] - searchstring);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if two regular expressions have different
|
|
||||||
* compiled program for pattern matching.
|
|
||||||
*/
|
|
||||||
inline bool cmRegularExpression::operator!= (const cmRegularExpression& r) const
|
|
||||||
{
|
|
||||||
return(!(*this == r));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if a valid regular expression is compiled
|
|
||||||
* and ready for pattern matching.
|
|
||||||
*/
|
|
||||||
inline bool cmRegularExpression::is_valid () const
|
|
||||||
{
|
|
||||||
return (this->program != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline void cmRegularExpression::set_invalid ()
|
|
||||||
{
|
|
||||||
//#ifndef WIN32
|
|
||||||
delete [] this->program;
|
|
||||||
//#endif
|
|
||||||
this->program = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return start index of nth submatch. start(0) is the start of the full match.
|
|
||||||
*/
|
|
||||||
inline std::string::size_type cmRegularExpression::start(int n) const
|
|
||||||
{
|
|
||||||
return this->startp[n] - searchstring;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return end index of nth submatch. end(0) is the end of the full match.
|
|
||||||
*/
|
|
||||||
inline std::string::size_type cmRegularExpression::end(int n) const
|
|
||||||
{
|
|
||||||
return this->endp[n] - searchstring;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return nth submatch as a string.
|
|
||||||
*/
|
|
||||||
inline std::string cmRegularExpression::match(int n) const
|
|
||||||
{
|
|
||||||
return std::string(this->startp[n], this->endp[n] - this->startp[n]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // cmRegularExpressionh
|
|
|
@ -16,6 +16,8 @@
|
||||||
=========================================================================*/
|
=========================================================================*/
|
||||||
#include "cmSiteNameCommand.h"
|
#include "cmSiteNameCommand.h"
|
||||||
|
|
||||||
|
#include <cmsys/RegularExpression.hxx>
|
||||||
|
|
||||||
// cmSiteNameCommand
|
// cmSiteNameCommand
|
||||||
bool cmSiteNameCommand::InitialPass(std::vector<std::string> const& args)
|
bool cmSiteNameCommand::InitialPass(std::vector<std::string> const& args)
|
||||||
{
|
{
|
||||||
|
@ -72,7 +74,7 @@ bool cmSiteNameCommand::InitialPass(std::vector<std::string> const& args)
|
||||||
{
|
{
|
||||||
// remove any white space from the host name
|
// remove any white space from the host name
|
||||||
std::string hostRegExp = "[ \t\n\r]*([^\t\n\r ]*)[ \t\n\r]*";
|
std::string hostRegExp = "[ \t\n\r]*([^\t\n\r ]*)[ \t\n\r]*";
|
||||||
cmRegularExpression hostReg (hostRegExp.c_str());
|
cmsys::RegularExpression hostReg (hostRegExp.c_str());
|
||||||
if (hostReg.find(host.c_str()))
|
if (hostReg.find(host.c_str()))
|
||||||
{
|
{
|
||||||
// strip whitespace
|
// strip whitespace
|
||||||
|
@ -109,7 +111,7 @@ bool cmSiteNameCommand::InitialPass(std::vector<std::string> const& args)
|
||||||
std::string RegExp = ".*Name:[ \t\n]*";
|
std::string RegExp = ".*Name:[ \t\n]*";
|
||||||
RegExp += host;
|
RegExp += host;
|
||||||
RegExp += "\\.([^ \t\n\r]*)[ \t\n\r]*Address:";
|
RegExp += "\\.([^ \t\n\r]*)[ \t\n\r]*Address:";
|
||||||
cmRegularExpression reg( RegExp.c_str() );
|
cmsys::RegularExpression reg( RegExp.c_str() );
|
||||||
if(reg.find(nsOutput.c_str()))
|
if(reg.find(nsOutput.c_str()))
|
||||||
{
|
{
|
||||||
siteName += '.' + cmSystemTools::LowerCase(reg.match(1));
|
siteName += '.' + cmSystemTools::LowerCase(reg.match(1));
|
||||||
|
|
|
@ -18,7 +18,8 @@
|
||||||
#define cmSourceGroup_h
|
#define cmSourceGroup_h
|
||||||
|
|
||||||
#include "cmStandardIncludes.h"
|
#include "cmStandardIncludes.h"
|
||||||
#include "cmRegularExpression.h"
|
#include <cmsys/RegularExpression.hxx>
|
||||||
|
|
||||||
class cmSourceFile;
|
class cmSourceFile;
|
||||||
|
|
||||||
/** \class cmSourceGroup
|
/** \class cmSourceGroup
|
||||||
|
@ -57,7 +58,7 @@ private:
|
||||||
/**
|
/**
|
||||||
* The regular expression matching the files in the group.
|
* The regular expression matching the files in the group.
|
||||||
*/
|
*/
|
||||||
cmRegularExpression m_GroupRegex;
|
cmsys::RegularExpression m_GroupRegex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* vector of all source files in this source group
|
* vector of all source files in this source group
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
|
|
||||||
=========================================================================*/
|
=========================================================================*/
|
||||||
#include "cmStringCommand.h"
|
#include "cmStringCommand.h"
|
||||||
|
#include <cmsys/RegularExpression.hxx>
|
||||||
|
|
||||||
#include <stdlib.h> // required for atoi
|
#include <stdlib.h> // required for atoi
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmStringCommand::InitialPass(std::vector<std::string> const& args)
|
bool cmStringCommand::InitialPass(std::vector<std::string> const& args)
|
||||||
|
@ -136,7 +138,7 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compile the regular expression.
|
// Compile the regular expression.
|
||||||
cmRegularExpression re;
|
cmsys::RegularExpression re;
|
||||||
if(!re.compile(regex.c_str()))
|
if(!re.compile(regex.c_str()))
|
||||||
{
|
{
|
||||||
std::string e = "sub-command REGEX, mode MATCH failed to compile regex \""+regex+"\".";
|
std::string e = "sub-command REGEX, mode MATCH failed to compile regex \""+regex+"\".";
|
||||||
|
@ -179,7 +181,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compile the regular expression.
|
// Compile the regular expression.
|
||||||
cmRegularExpression re;
|
cmsys::RegularExpression re;
|
||||||
if(!re.compile(regex.c_str()))
|
if(!re.compile(regex.c_str()))
|
||||||
{
|
{
|
||||||
std::string e = "sub-command REGEX, mode MATCHALL failed to compile regex \""+regex+"\".";
|
std::string e = "sub-command REGEX, mode MATCHALL failed to compile regex \""+regex+"\".";
|
||||||
|
@ -277,7 +279,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compile the regular expression.
|
// Compile the regular expression.
|
||||||
cmRegularExpression re;
|
cmsys::RegularExpression re;
|
||||||
if(!re.compile(regex.c_str()))
|
if(!re.compile(regex.c_str()))
|
||||||
{
|
{
|
||||||
std::string e = "sub-command REGEX, mode REPLACE failed to compile regex \""+regex+"\".";
|
std::string e = "sub-command REGEX, mode REPLACE failed to compile regex \""+regex+"\".";
|
||||||
|
|
|
@ -16,11 +16,11 @@
|
||||||
=========================================================================*/
|
=========================================================================*/
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "cmRegularExpression.h"
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <cmsys/RegularExpression.hxx>
|
||||||
#include <cmsys/Directory.hxx>
|
#include <cmsys/Directory.hxx>
|
||||||
|
|
||||||
// support for realpath call
|
// support for realpath call
|
||||||
|
@ -76,7 +76,7 @@ void cmSystemTools::ExpandRegistryValues(std::string& source)
|
||||||
// The "[^]]" part of this expression will match any character except
|
// The "[^]]" part of this expression will match any character except
|
||||||
// a close square-bracket. The ']' character must be the first in the
|
// a close square-bracket. The ']' character must be the first in the
|
||||||
// list of characters inside the [^...] block of the expression.
|
// list of characters inside the [^...] block of the expression.
|
||||||
cmRegularExpression regEntry("\\[(HKEY[^]]*)\\]");
|
cmsys::RegularExpression regEntry("\\[(HKEY[^]]*)\\]");
|
||||||
|
|
||||||
// check for black line or comment
|
// check for black line or comment
|
||||||
while (regEntry.find(source))
|
while (regEntry.find(source))
|
||||||
|
@ -263,7 +263,7 @@ bool cmSystemTools::IsOn(const char* val)
|
||||||
|
|
||||||
bool cmSystemTools::IsNOTFOUND(const char* val)
|
bool cmSystemTools::IsNOTFOUND(const char* val)
|
||||||
{
|
{
|
||||||
cmRegularExpression reg("-NOTFOUND$");
|
cmsys::RegularExpression reg("-NOTFOUND$");
|
||||||
if(reg.find(val))
|
if(reg.find(val))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -539,7 +539,7 @@ bool cmSystemTools::RunCommand(const char* command,
|
||||||
// one set of quotes in the arguments
|
// one set of quotes in the arguments
|
||||||
if(count > 2)
|
if(count > 2)
|
||||||
{
|
{
|
||||||
cmRegularExpression quoted("^\"([^\"]*)\"[ \t](.*)");
|
cmsys::RegularExpression quoted("^\"([^\"]*)\"[ \t](.*)");
|
||||||
if(quoted.find(command))
|
if(quoted.find(command))
|
||||||
{
|
{
|
||||||
std::string shortCmd;
|
std::string shortCmd;
|
||||||
|
@ -609,7 +609,7 @@ void cmSystemTools::Glob(const char *directory, const char *regexp,
|
||||||
std::vector<std::string>& files)
|
std::vector<std::string>& files)
|
||||||
{
|
{
|
||||||
cmsys::Directory d;
|
cmsys::Directory d;
|
||||||
cmRegularExpression reg(regexp);
|
cmsys::RegularExpression reg(regexp);
|
||||||
|
|
||||||
if (d.Load(directory))
|
if (d.Load(directory))
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
#include "cmUseMangledMesaCommand.h"
|
#include "cmUseMangledMesaCommand.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
|
|
||||||
|
#include <cmsys/RegularExpression.hxx>
|
||||||
|
|
||||||
// cmUseMangledMesaCommand
|
// cmUseMangledMesaCommand
|
||||||
bool cmUseMangledMesaCommand::InitialPass(std::vector<std::string> const& args)
|
bool cmUseMangledMesaCommand::InitialPass(std::vector<std::string> const& args)
|
||||||
{
|
{
|
||||||
|
@ -91,11 +93,11 @@ CopyAndFullPathMesaHeader(const char* source,
|
||||||
// input file at the same time
|
// input file at the same time
|
||||||
std::string inLine;
|
std::string inLine;
|
||||||
// regular expression for any #include line
|
// regular expression for any #include line
|
||||||
cmRegularExpression includeLine("^[ \t]*#[ \t]*include[ \t]*[<\"]([^\">]+)[\">]");
|
cmsys::RegularExpression includeLine("^[ \t]*#[ \t]*include[ \t]*[<\"]([^\">]+)[\">]");
|
||||||
// regular expression for gl/ or GL/ in a file (match(1) of above)
|
// regular expression for gl/ or GL/ in a file (match(1) of above)
|
||||||
cmRegularExpression glDirLine("(gl|GL)(/|\\\\)([^<\"]+)");
|
cmsys::RegularExpression glDirLine("(gl|GL)(/|\\\\)([^<\"]+)");
|
||||||
// regular expression for gl GL or xmesa in a file (match(1) of above)
|
// regular expression for gl GL or xmesa in a file (match(1) of above)
|
||||||
cmRegularExpression glLine("(gl|GL|xmesa)");
|
cmsys::RegularExpression glLine("(gl|GL|xmesa)");
|
||||||
while(cmSystemTools::GetLineFromStream(fin,inLine))
|
while(cmSystemTools::GetLineFromStream(fin,inLine))
|
||||||
{
|
{
|
||||||
if(includeLine.find(inLine.c_str()))
|
if(includeLine.find(inLine.c_str()))
|
||||||
|
|
|
@ -16,11 +16,11 @@
|
||||||
=========================================================================*/
|
=========================================================================*/
|
||||||
#include "cmaketest.h"
|
#include "cmaketest.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include "cmRegularExpression.h"
|
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
#include "cmListFileCache.h"
|
#include "cmListFileCache.h"
|
||||||
#include "cmCacheManager.h"
|
#include "cmCacheManager.h"
|
||||||
#include "cmDynamicLoader.h"
|
#include "cmDynamicLoader.h"
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,7 +30,6 @@ CMAKE_SOURCES="\
|
||||||
cmDocumentation \
|
cmDocumentation \
|
||||||
cmGlobalGenerator \
|
cmGlobalGenerator \
|
||||||
cmLocalGenerator \
|
cmLocalGenerator \
|
||||||
cmRegularExpression \
|
|
||||||
cmSourceFile \
|
cmSourceFile \
|
||||||
cmSystemTools \
|
cmSystemTools \
|
||||||
cmGlobalUnixMakefileGenerator \
|
cmGlobalUnixMakefileGenerator \
|
||||||
|
|
Loading…
Reference in New Issue