aboutsummaryrefslogtreecommitdiff
path: root/tools/mhmake/src/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/mhmake/src/util.h')
-rw-r--r--tools/mhmake/src/util.h44
1 files changed, 42 insertions, 2 deletions
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
{
@@ -139,6 +139,46 @@ inline const char *NextCharItem(const char *pTmp,string &Output,char Char)
}
///////////////////////////////////////////////////////////////////////////////
+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<string,string> m_CommandLineVars;
vector<string> m_CommandLineTargets;
- refptr<mhmakefileparser> m_pParser;
+ refptr<mhmakefileparser> m_pMakefileParser;
loadedmakefile(const fileinfo *pDir, vector<string> &Args,const string &Makefile=g_EmptyString);