ENH: also handle comments for variables which contain newlines

Alex
This commit is contained in:
Alexander Neundorf 2007-06-01 11:06:48 -04:00
parent 8cba2c55f9
commit 26a5a295eb
1 changed files with 20 additions and 17 deletions

View File

@ -223,8 +223,16 @@ bool cmCacheManager::LoadCache(const char* path,
continue;
}
while(realbuffer[0] == '/' && realbuffer[1] == '/')
{
if ((realbuffer[2] == '\\') && (realbuffer[3]=='n'))
{
e.Properties["HELPSTRING"] += "\n";
e.Properties["HELPSTRING"] += &realbuffer[4];
}
else
{
e.Properties["HELPSTRING"] += &realbuffer[2];
}
cmSystemTools::GetLineFromStream(fin, buffer);
realbuffer = buffer.c_str();
if(!fin)
@ -657,28 +665,23 @@ void cmCacheManager::OutputHelpString(std::ofstream& fout,
}
std::string oneLine;
std::string::size_type pos = 0;
std::string::size_type nextBreak = 60;
bool done = false;
while(!done)
for (std::string::size_type i=0; i<=end; i++)
{
if(nextBreak >= end)
if ((i==end)
|| (helpString[i]=='\n')
|| ((i-pos >= 60) && (helpString[i]==' ')))
{
nextBreak = end;
done = true;
fout << "//";
if (helpString[pos] == '\n')
{
pos++;
fout << "\\n";
}
else
{
while(nextBreak < end && helpString[nextBreak] != ' ')
{
nextBreak++;
oneLine = helpString.substr(pos, i - pos);
fout << oneLine.c_str() << "\n";
pos = i;
}
}
oneLine = helpString.substr(pos, nextBreak - pos);
fout << "//" << oneLine.c_str() << "\n";
pos = nextBreak;
nextBreak += 60;
}
}
void cmCacheManager::RemoveCacheEntry(const char* key)