ENH: better fix for dos return in lines, use the regular expression and don't edit the input line

This commit is contained in:
Bill Hoffman 2001-10-09 10:25:51 -04:00
parent d0aec59356
commit 6b1ab49ae6
1 changed files with 3 additions and 17 deletions

View File

@ -484,18 +484,6 @@ const char *cmSystemTools::ConvertToWindowsSlashesAndCleanUp(std::string& path)
return path.c_str();
}
inline void CleanText(char* s)
{
while(*s != 0)
{
if(*s == '\r')
{
*s = ' ';
}
s++;
}
}
bool cmSystemTools::ParseFunction(std::ifstream& fin,
std::string& name,
std::vector<std::string>& arguments,
@ -511,12 +499,11 @@ bool cmSystemTools::ParseFunction(std::ifstream& fin,
}
if(fin.getline(inbuffer, BUFFER_SIZE ) )
{
CleanText(&inbuffer[0]);
cmRegularExpression blankLine("^[ \t]*$");
cmRegularExpression blankLine("^[ \t\r]*$");
cmRegularExpression comment("^[ \t]*#.*$");
cmRegularExpression oneLiner("^[ \t]*([A-Za-z_0-9]*)[ \t]*\\((.*)\\)[ \t]*$");
cmRegularExpression oneLiner("^[ \t]*([A-Za-z_0-9]*)[ \t]*\\((.*)\\)[ \t\r]*$");
cmRegularExpression multiLine("^[ \t]*([A-Za-z_0-9]*)[ \t]*\\((.*)$");
cmRegularExpression lastLine("^(.*)\\)[ \t]*$");
cmRegularExpression lastLine("^(.*)\\)[ \t\r]*$");
// check for black line or comment
if(blankLine.find(inbuffer) || comment.find(inbuffer))
@ -546,7 +533,6 @@ bool cmSystemTools::ParseFunction(std::ifstream& fin,
// read lines until the end paren is found
if(fin.getline(inbuffer, BUFFER_SIZE ) )
{
CleanText(&inbuffer[0]);
// Check for comment lines and ignore them.
if(blankLine.find(inbuffer) || comment.find(inbuffer))
{ continue; }