Don't indent the __cplusplus ifdef block in generated headers.
authorAlp Toker <alp@mono-cvs.ximian.com>
Fri, 10 Dec 2004 19:05:43 +0000 (19:05 -0000)
committerAlp Toker <alp@mono-cvs.ximian.com>
Fri, 10 Dec 2004 19:05:43 +0000 (19:05 -0000)
svn path=/trunk/mcs/; revision=37590

mcs/tools/cilc/ChangeLog
mcs/tools/cilc/cilc.cs

index 5086c07ed80d9640488dc7c1fbd094b3c6be910a..4a7097c70a9c334fab881551c2d226c208ad1ede 100644 (file)
@@ -8,6 +8,7 @@
        If only one argument is given, generate sources to a temporary directory,
        build them (as bundle), and install them to the current directory.
        Otherwise, the old behaviour applies.
+       Don't indent the __cplusplus ifdef block in generated headers.
        * README:
        Update with details of the new bundle feature and single-argument operation.
        * Makefile:
index df69ffafbb66315e7afdebeed41a1032aa8ddf96..07294f08d2b8b2edbf729e9bf9c1b8f9c1be76de 100644 (file)
@@ -286,7 +286,7 @@ public class cilc
                H.WriteLine ();
 
                H.WriteLine ("#ifdef __cplusplus");
-               H.WriteLine ("extern \"C\" {");
+               H.WriteLine ("extern \"C\" {", false);
                H.WriteLine ("#endif /* __cplusplus */");
                H.WriteLine ();
 
@@ -300,7 +300,7 @@ public class cilc
 
                H.WriteLine ();
                H.WriteLine ("#ifdef __cplusplus");
-               H.WriteLine ("}");
+               H.WriteLine ("}", false);
                H.WriteLine ("#endif /* __cplusplus */");
                H.WriteLine ();
 
@@ -888,17 +888,22 @@ class CodeWriter
        }
 
        public void WriteLine (string text)
+       {
+               WriteLine (text, true);
+       }
+
+       public void WriteLine (string text, bool autoindent)
        {
                char[] opentags = {'{', '('};
                char[] closetags = {'}', ')'};
 
-               if (text.TrimStart (closetags) != text)
+               if (autoindent && text.TrimStart (closetags) != text)
                        Outdent ();
 
                w.Write (cur_indent);
                w.WriteLine (text);
 
-               if (text.TrimEnd (opentags) != text)
+               if (autoindent && text.TrimEnd (opentags) != text)
                        Indent ();
        }