diff src/pt-pr-code.cc @ 4980:003bbf6c13d8

[project @ 2004-09-09 15:47:17 by jwe]
author jwe
date Thu, 09 Sep 2004 15:47:17 +0000
parents 7b145222fea3
children b04b30d30c66
line wrap: on
line diff
--- a/src/pt-pr-code.cc	Wed Sep 08 23:25:05 2004 +0000
+++ b/src/pt-pr-code.cc	Thu Sep 09 15:47:17 2004 +0000
@@ -883,9 +883,12 @@
       cmd->accept (*this);
 
       if (! stmt.print_result ())
-	os << ";";
-
-      newline ();
+	{
+	  os << ";";
+	  newline (" ");
+	}
+      else
+	newline ();
     }
   else
     {
@@ -896,9 +899,12 @@
 	  expr->accept (*this);
 
 	  if (! stmt.print_result ())
-	    os << ";";
-
-	  newline ();
+	    {
+	      os << ";";
+	      newline (" ");
+	    }
+	  else
+	    newline ();
 	}
     }
 }
@@ -1283,24 +1289,27 @@
 tree_print_code::indent (void)
 {
   assert (curr_print_indent_level >= 0);
- 
-  if (beginning_of_line)
-    {
-      os << prefix;
 
-      for (int i = 0; i < curr_print_indent_level; i++)
-	os << " ";
+  if (printing_newlines)
+    {
+      if (beginning_of_line)
+	{
+	  os << prefix;
 
-      beginning_of_line = false;
+	  for (int i = 0; i < curr_print_indent_level; i++)
+	    os << " ";
+
+	  beginning_of_line = false;
+	}
     }
 }
 
 // All print_code() functions should use this to print new lines.
 
 void
-tree_print_code::newline (void)
+tree_print_code::newline (const char *alt_txt)
 {
-  os << "\n";
+  os << (printing_newlines ? "\n" : alt_txt);
 
   beginning_of_line = true;
 }