summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1160f0d)
raw | patch | inline | side by side (parent: 1160f0d)
author | ishmal <ishmal@users.sourceforge.net> | |
Tue, 13 May 2008 18:21:32 +0000 (18:21 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Tue, 13 May 2008 18:21:32 +0000 (18:21 +0000) |
buildtool.cpp | patch | blob | history |
diff --git a/buildtool.cpp b/buildtool.cpp
index 6c38eddb71775cb33b5582ea2dbb4bf6ec83677a..12f3d63e7c13fdfbef0502e083f3ee1a2f4174d9 100644 (file)
--- a/buildtool.cpp
+++ b/buildtool.cpp
*
*/
-#define BUILDTOOL_VERSION "BuildTool v0.9.0"
+#define BUILDTOOL_VERSION "BuildTool v0.9.1"
#include <stdio.h>
#include <fcntl.h>
bool lookupProperty(const String &s, String &result);
/**
- * replace variable refs in a sting like ${a} with their values
+ * called by getSubstitutions(). This is in case a looked-up string
+ * has substitutions also.
+ */
+ bool getSubstitutionsRecursive(const String &s, String &result, int depth);
+
+ /**
+ * replace variable refs in a string like ${a} with their values
*/
bool getSubstitutions(const String &s, String &result);
* Analyse a string, looking for any substitutions or other
* things that need resilution
*/
-bool MakeBase::getSubstitutions(const String &str, String &result)
+bool MakeBase::getSubstitutionsRecursive(const String &str,
+ String &result, int depth)
{
+ if (depth > 4)
+ {
+ error("getSubstitutions: nesting of substitutions too deep");
+ return false;
+ }
String s = trim(str);
int len = (int)s.size();
String val;
String varval;
if (!lookupProperty(varname, varval))
return false;
- val.append(varval);
+ String varval2;
+ //Now see if the answer has ${} in it, too
+ if (!getSubstitutionsRecursive(varval, varval2, depth + 1))
+ return false;
+ val.append(varval2);
break;
}
else
return true;
}
+/**
+ * Analyse a string, looking for any substitutions or other
+ * things that need resilution
+ */
+bool MakeBase::getSubstitutions(const String &str, String &result)
+{
+ return getSubstitutionsRecursive(str, result, 0);
+}
+
/**
/**
- * Compile a resource file into a .res
+ * Compile a resource file into a binary object
*/
class TaskRC : public Task
{