From a6b55ae8bf2b22dc11e1b98a190600d16fc7dcca Mon Sep 17 00:00:00 2001 From: Bob Jamison Date: Fri, 17 Nov 2006 20:22:51 +0000 Subject: add (bzr r1972) --- buildtool.cpp | 195 ++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 161 insertions(+), 34 deletions(-) (limited to 'buildtool.cpp') diff --git a/buildtool.cpp b/buildtool.cpp index d738e03a2..e3efeff5e 100644 --- a/buildtool.cpp +++ b/buildtool.cpp @@ -21,18 +21,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -/* - - - - - - - - +/** + * To use this file, compile with: + *
+ * g++ -O3 buildtool.cpp -o build.exe
+ * (or whatever your compiler might be) 
+ * Then
+ * build
+ * or 
+ * build {target}
+ */  
 
 
-*/
 
 #include 
 #include 
@@ -1990,6 +1990,16 @@ protected:
     std::vector tokenize(const String &val,
 	                      const String &delimiters);
 
+    /**
+     *  replace runs of whitespace with a space
+     */
+    String strip(const String &s);
+
+    /**
+     *  remove leading whitespace from each line
+     */
+    String leftJustify(const String &s);
+
     /**
      *  remove leading and trailing whitespace from string
      */
@@ -2233,6 +2243,78 @@ std::vector MakeBase::tokenize(const String &str,
 
 
 
+/**
+ *  replace runs of whitespace with a single space
+ */
+String MakeBase::strip(const String &s)
+{
+    int len = s.size();
+    String stripped;
+    for (int i = 0 ; igetValue();
-    int len = s.size();
     //Replace all runs of whitespace with a single space
-    String stripped; 
-    for (int i = 0 ; i");
+            return true;
+            }
+        //trace("fullName:%s", fullName.c_str());
+        FILE *f = fopen(fullName.c_str(), "w");
+        if (!f)
+            {
+            error(" could not open %s for writing : %s",
+                fullName.c_str(), strerror(errno));
+            return false;
+            }
+        for (unsigned int i=0 ; i requires 'file=\"filename\"' attribute");
+            return false;
+            }
+        if (!parent.getValue(elem, text))
+            return false;
+        text = leftJustify(text);
+        //trace("dirname:%s", dirName.c_str());
+        return true;
+        }
+
+private:
+
+    String fileName;
+    String text;
+};
+
+
+
 /**
  * Create a named directory
  */
@@ -5800,6 +5925,8 @@ Task *Task::createTask(Element *elem)
         task = new TaskJavac(parent);
     else if (tagName == "link")
         task = new TaskLink(parent);
+    else if (tagName == "makefile")
+        task = new TaskMakeFile(parent);
     else if (tagName == "mkdir")
         task = new TaskMkDir(parent);
     else if (tagName == "msgfmt")
-- 
cgit v1.2.3