From 392f542ca74be7b3721e7a4af75544a39e0eceae Mon Sep 17 00:00:00 2001 From: marha Date: Tue, 4 Aug 2009 13:58:23 +0000 Subject: Escaping of the $ sign by doubling it was not always done correctly. --- tools/mhmake/src/mhmakefileparser.cpp | 22 +++++++++------------- tools/mhmake/src/mhmakelexer.l | 2 +- tools/mhmake/src/util.cpp | 16 ++++++++-------- tools/mhmake/src/util.h | 2 +- 4 files changed, 19 insertions(+), 23 deletions(-) (limited to 'tools/mhmake') diff --git a/tools/mhmake/src/mhmakefileparser.cpp b/tools/mhmake/src/mhmakefileparser.cpp index 28ad0a682..cbcb33648 100644 --- a/tools/mhmake/src/mhmakefileparser.cpp +++ b/tools/mhmake/src/mhmakefileparser.cpp @@ -167,7 +167,7 @@ string mhmakefileparser::ExpandExpression(const string &Expr) const int i=0; int Length=Expr.size(); string Ret; - bool DollarEscaped=false; + string ToAdd; while (ii) { - Ret+=ExpandMacro(Expr.substr(i,inew-i-1)); + ToAdd=ExpandMacro(Expr.substr(i,inew-i-1)); i=inew; } else { // This is a single character expression - Ret+=ExpandMacro(string(1,Expr[i-1])); + ToAdd=ExpandMacro(string(1,Expr[i-1])); } } + Ret+=ToAdd; } else { Ret+=Char; } - } - // Here we do a special case in case we still have a $ without a % if (m_InExpandExpression==1) { + // Here we do a special case in case we still have a $ within a % if (Ret.find('$')!=string::npos) Ret=ExpandExpression(Ret); - if (DollarEscaped) + int Pos; + while ((Pos=Ret.find("$$"))!=string::npos) { - int Pos; - while ((Pos=Ret.find("$$"))!=string::npos) - { - Ret=Ret.replace(Pos,2,"$"); - } + Ret=Ret.replace(Pos,2,"$"); } } ((mhmakefileparser*)this)->m_InExpandExpression--; diff --git a/tools/mhmake/src/mhmakelexer.l b/tools/mhmake/src/mhmakelexer.l index eb27ab9ed..b9484159a 100644 --- a/tools/mhmake/src/mhmakelexer.l +++ b/tools/mhmake/src/mhmakelexer.l @@ -672,7 +672,7 @@ export { } /*---------------------------------------------------------------------------*/ -\$[<@/] { +\$[<@/$] { PRINTF(("%s %d: DOLLAREXPR: %s\n",m_InputFileName.c_str(),m_Line,yytext)); theValue.theString=(const char *)yytext; return mhmakeparser::DOLLAREXPR; diff --git a/tools/mhmake/src/util.cpp b/tools/mhmake/src/util.cpp index 824c94b4d..be0e92281 100644 --- a/tools/mhmake/src/util.cpp +++ b/tools/mhmake/src/util.cpp @@ -274,24 +274,24 @@ loadedmakefile::loadedmakefile_statics::loadedmakefile_statics() string Output; bool Ret; try - { + { string SvnCommand=SearchCommand("svn",EXEEXT); Ret=OsExeCommand(SvnCommand,string(" info ")+m_MhMakeConf->GetFullFileName(),false,&Output); - } + } catch (int) - { + { Ret=false; - } + } char *pTok=strtok((char*)Output.c_str(),"\n"); // doing this is changing string, so this is very dangerous !!! while (pTok) - { + { if (!strncmp(pTok,"URL: ",5)) - { + { m_GlobalCommandLineVars[WC_URL]=pTok+5+7; - } + } else if (!strncmp(pTok,"Revision: ",10)) - { + { m_GlobalCommandLineVars[WC_REVISION]=pTok+10; break; } diff --git a/tools/mhmake/src/util.h b/tools/mhmake/src/util.h index 8d71e4ca5..6d660fc94 100644 --- a/tools/mhmake/src/util.h +++ b/tools/mhmake/src/util.h @@ -50,7 +50,7 @@ #define PLATFORM "linux" #endif -#define MHMAKEVER "1.3.21" +#define MHMAKEVER "1.3.22" #define MAKEDEPFILE ".makefile.dep" -- cgit v1.2.3