From dbe1b719f8037dda23279b8bc7d8200578415e15 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 4 Mar 2011 11:26:33 +0000 Subject: Implement eval sort warning functions (see gnu make manual for description) Solved errors in if and foreach implementations Removed message and reparse function (use info and eval instead) $n can be used to add new line define can be used to specify multi-line macros Solved error in argument expansion in call function --- tools/mhmake/src/util.h | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'tools/mhmake/src/util.h') diff --git a/tools/mhmake/src/util.h b/tools/mhmake/src/util.h index f789584a1..68cb032d7 100644 --- a/tools/mhmake/src/util.h +++ b/tools/mhmake/src/util.h @@ -50,7 +50,7 @@ #define PLATFORM "linux" #endif -#define MHMAKEVER "2.4.5" +#define MHMAKEVER "3.0.0" class makecommand { @@ -138,6 +138,46 @@ inline const char *NextCharItem(const char *pTmp,string &Output,char Char) return pTmp; } +/////////////////////////////////////////////////////////////////////////////// +inline const char *SkipMakeExpr(const char *pMacro) +{ +#ifdef _DEBUG + const char *pMacroIn=pMacro; +#endif + char Char=*pMacro++; + char EndChar; + if (Char=='(') + EndChar=')'; + else if (Char=='{') + EndChar='}'; + else + return pMacro; + Char=*pMacro++; + while (Char!=EndChar) + { + if (Char=='$') + { + pMacro=SkipMakeExpr(pMacro); + } else if (Char=='(') + { + pMacro=SkipMakeExpr(pMacro-1); + } +#ifdef _DEBUG + if (!*pMacro) + throw(string(1,EndChar)+" not found in "+pMacroIn); +#endif + Char=*pMacro++; + } + return pMacro; +} + +/////////////////////////////////////////////////////////////////////////////// +inline size_t SkipMakeExpr(const string &Expr,size_t i) +{ + const char *pTmp=Expr.c_str(); + return SkipMakeExpr(pTmp+i)-pTmp; +} + /////////////////////////////////////////////////////////////////////////////// string Substitute(const string &ToSubst,const string &SrcStr,const string &ToStr); @@ -170,7 +210,7 @@ struct loadedmakefile : public refbase map m_CommandLineVars; vector m_CommandLineTargets; - refptr m_pParser; + refptr m_pMakefileParser; loadedmakefile(const fileinfo *pDir, vector &Args,const string &Makefile=g_EmptyString); -- cgit v1.2.3