unrolling forests without recursion
[sbp.git] / src / edu / berkeley / sbp / chr / CharInput.java
index f86e85f..530f25c 100644 (file)
@@ -13,7 +13,7 @@ public class CharInput extends Cartesian.Input<Character> {
     
     public CharInput(String s)                { this(new StringReader(s)); }
     public CharInput(Reader r)                { this(r, null); }
-    public CharInput(Reader r,      String s) { this.r = r; }
+    public CharInput(Reader r,      String s) { this.r = new BufferedReader(r); }
     public CharInput(InputStream i)           { this(i, null); }
     public CharInput(InputStream i, String s) { this(new InputStreamReader(i), s); }
     
@@ -26,7 +26,8 @@ public class CharInput extends Cartesian.Input<Character> {
         if (i==-1) { System.err.print("\r...done       \r"); return null; }
         char c = (char)i;
         cr = c=='\n';
-        System.err.print("  " + (count++) + "\r");
+        if ((count++) % 100 == 0)
+         System.err.print("  " + count + "\r");
         return c;
     }
 }