diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-06-08 18:18:31 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-06-08 18:18:31 (GMT) |
commit | bbf1c3a0e87c4358b65d41393455fc393d8e16e0 (patch) | |
tree | a2bd3776a2947d1caac17f2da80aa29844715077 /Source/cmCommandArgumentParserHelper.cxx | |
parent | 859b51751811f1b4c160793010cf3ad20c00140d (diff) | |
download | CMake-bbf1c3a0e87c4358b65d41393455fc393d8e16e0.zip CMake-bbf1c3a0e87c4358b65d41393455fc393d8e16e0.tar.gz CMake-bbf1c3a0e87c4358b65d41393455fc393d8e16e0.tar.bz2 |
ENH: Handle more cases
Diffstat (limited to 'Source/cmCommandArgumentParserHelper.cxx')
-rw-r--r-- | Source/cmCommandArgumentParserHelper.cxx | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 07f5554..e925bf2 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -26,6 +26,8 @@ int cmCommandArgument_yyparse( yyscan_t yyscanner ); cmCommandArgumentParserHelper::cmCommandArgumentParserHelper() { m_FileLine = -1; + m_FileName = 0; + m_EmptyVariable[0] = 0; } @@ -79,17 +81,21 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key, cons char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) { - if(var == "CMAKE_CURRENT_LIST_FILE") + if(m_FileName && strcmp(var, "CMAKE_CURRENT_LIST_FILE") == 0) { - return this->AddString(m_FileName.c_str()); + return this->AddString(m_FileName); } - else if(m_FileLine >= 0 && (var == "CMAKE_CURRENT_LIST_LINE")) + else if(m_FileLine >= 0 && strcmp(var, "CMAKE_CURRENT_LIST_LINE") == 0) { cmOStringStream ostr; ostr << m_FileLine; return this->AddString(ostr.str().c_str()); } const char* value = m_Makefile->GetDefinition(var); + if (m_EscapeQuotes) + { + return this->AddString(cmSystemTools::EscapeQuotes(value).c_str()); + } return this->AddString(value); } @@ -228,7 +234,8 @@ int cmCommandArgumentParserHelper::ParseString(const char* str, int verb) cmCommandArgument_yylex_destroy(yyscanner); if ( res != 0 ) { - std::cout << "JP_Parse returned: " << res << std::endl; + std::cerr << "CAL_Parser returned: " << res << std::endl; + std::cerr << "When parsing: [" << str << "]" << std::endl; return 0; } @@ -289,7 +296,7 @@ int cmCommandArgumentParserHelper::LexInput(char* buf, int maxlen) void cmCommandArgumentParserHelper::Error(const char* str) { unsigned long pos = static_cast<unsigned long>(this->InputBufferPos); - fprintf(stderr, "JPError: %s (%lu / Line: %d)\n", str, pos, this->CurrentLine); + fprintf(stderr, "Argument Parser Error: %s (%lu / Line: %d)\n", str, pos, this->CurrentLine); int cc; std::cerr << "String: ["; for ( cc = 0; cc < 30 && *(this->InputBuffer.c_str() + this->InputBufferPos + cc); @@ -345,6 +352,7 @@ void cmCommandArgumentParserHelper::SetResult(const char* value) { if ( !value ) { + m_Result = ""; return; } m_Result = value; |