From b1565e868d5549753fd710529b88bd4c183889ab Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 25 Jun 2012 09:09:14 +0200 Subject: zlib is now compiled as a dll --- tools/mhmake/src/mhmakefileparser.cpp | 70 +++++++++++++++-------------------- 1 file changed, 29 insertions(+), 41 deletions(-) (limited to 'tools/mhmake/src/mhmakefileparser.cpp') diff --git a/tools/mhmake/src/mhmakefileparser.cpp b/tools/mhmake/src/mhmakefileparser.cpp index d1f41b07f..55ad056db 100644 --- a/tools/mhmake/src/mhmakefileparser.cpp +++ b/tools/mhmake/src/mhmakefileparser.cpp @@ -27,7 +27,7 @@ #include "flexlexer.h" #include "mhmakeparser.hpp" -commandqueue mhmakefileparser::sm_CommandQueue; +commandqueue mhmakefileparser::sm_CommandQueue; stack mhmakefileparser::sm_ParserStack; // Keeps track of the currently active parser string mhmakefileparser::GetFileNameLineNo(void) @@ -93,11 +93,7 @@ bool mhmakefileparser::IsDefined(const string &Var) const bool Ret = m_Variables.find(Var)!=m_Variables.end(); if (!Ret) { - string Env=GetFromEnv(Var); - if (!Env.empty()) - { - Ret=true; - } + GetFromEnv(Var, &Ret); } return Ret; } @@ -185,21 +181,21 @@ inline string mhmakefileparser::ExpandExpression(const string &ExprIn) const char Char=Expr[i++]; if (Char=='$') { - size_t inew=SkipMakeExpr(Expr,i); - i++; - if (inew>i) - { - ToAdd=ExpandMacro(Expr.substr(i,inew-i-1)); - i=inew; - } - else - { - // This is a single character expression - ToAdd=ExpandMacro(string(1,Expr[i-1])); - } - if (ToAdd.find('$')!=string::npos && ToAdd.length()!=1) - { - Recurse=true; + size_t inew=SkipMakeExpr(Expr,i); + i++; + if (inew>i) + { + ToAdd=ExpandMacro(Expr.substr(i,inew-i-1)); + i=inew; + } + else + { + // This is a single character expression + ToAdd=ExpandMacro(string(1,Expr[i-1])); + } + if (ToAdd.find('$')!=string::npos && ToAdd.length()!=1) + { + Recurse=true; } Ret+=ToAdd; } @@ -298,7 +294,7 @@ string mhmakefileparser::ExpandMacro(const string &Expr) const return ExpandExpression(Ret); else return Ret; -} + } } /////////////////////////////////////////////////////////////////////////////// @@ -682,7 +678,7 @@ const refptr mhmakefileparser::GetIncludeDirs() const ((mhmakefileparser*)this)->m_IncludeDirs=Includes; ((mhmakefileparser*)this)->m_pIncludeDirs=refptr(new fileinfoarray); if (Includes.empty()) // If not defined try a default path - Includes="include inc .."OSPATHSEPSTR"include .."OSPATHSEPSTR"inc"; + Includes="include inc .." OSPATHSEPSTR "include .." OSPATHSEPSTR "inc"; const char *pTmp=Includes.c_str(); while (*pTmp) { @@ -774,7 +770,7 @@ void mhmakefileparser::LoadAutoDepsFile(fileinfo *pDepFile) if (!pTarget->CompareMd5_32(0) && !pTarget->CompareMd5_32(Md5_32)) { - MakeNotDirty=false; /* BuildTarget had set the dirty flag, but since the md5 did not change it was a false dirty. This is for BuildTargets called before this routine */ + MakeNotDirty=false; /* BuildTarget had set the dirty flag, but since the md5 did not change it was a false dirty. This is for BuildTargets called before this routine */ #ifdef _DEBUG cout << "Warning: trying to set to different md5's for Target "<GetQuotedFullFileName()<<" Old: "<GetCommandsMd5_32()<<" New: "<::const_iterator pLineFind=m_CommandLineVars.find(Var); if (pLineFind!=m_CommandLineVars.end()) { ((mhmakefileparser*)this)->m_UsedEnvVars.insert(Var); - if (Cache) - ((mhmakefileparser*)this)->m_Variables[Var]=pLineFind->second; + ((mhmakefileparser*)this)->m_Variables[Var]=pLineFind->second; + if (pDefined) *pDefined=true; return pLineFind->second; } const char *pEnv=getenv(Var.c_str()); if (!pEnv) { + if (pDefined) *pDefined=false; return g_EmptyString; } ((mhmakefileparser*)this)->m_UsedEnvVars.insert(Var); - if (Cache) - ((mhmakefileparser*)this)->m_Variables[Var]=pEnv; + ((mhmakefileparser*)this)->m_Variables[Var]=pEnv; + if (pDefined) *pDefined=true; return pEnv; } /////////////////////////////////////////////////////////////////////////////// -// Creates the variable USER_ENVVARS to be saved in the autodeps file +// Creates the variable USED_ENVVARS to be saved in the autodeps file // void mhmakefileparser::CreateUSED_ENVVARS() -- cgit v1.2.3