Patches for review, mostly on ProcessSugar

Kevin Reid <kpreid-M/[email protected]>
Newsgroups gmane.comp.lang.e.general
Message-ID <[email protected]>
While working on an E project I wrote these changes to E-on-Java. They are simple and I am reasonably confident in their correctness, but I would appreciate a review, especially of #2 and #4 which are semantic changes.

The patches were generated by git format-patch; any suggestions on better ways to publish a bunch of commits for review are welcome. (I have moved my workflow to using git-svn instead of svn, as does Thomas Leonard.)

#1 fixes a typo bug: Sugar method Process#attachStderr actually attaches stdout. It also notes that these operations as defined leak vats.

#2 adds an operation Process#terminates/0; it is like resultsVow/0 in that it returns a promise for when the process terminates, but it does not claim stdout or stderr.

#3 fixes misspellings of "opening" and "opener" with two "n"s.

#4 makes CharPipeAdapter flush its Writer (and also copy in bulk); without this, output may be indefinitely delayed or lost if nothing other than the CharPipeAdapter is working with the Writer and the Writer buffers indefinitely.



-- 
Kevin Reid                                  <http://switchb.org/kpreid/>

_______________________________________________
e-lang mailing list
[email protected]
http://www.eros-os.org/mailman/listinfo/e-lang
0001-Bug-Process-attachStderr-2-took-stdout-instead-of-st.patch (application/octet-stream, 1.8 KB)
From 7498da080d9bcac3762017548ec2755705822d8c Mon Sep 17 00:00:00 2001
From: Kevin Reid <kpreid-M/[email protected]>
Date: Fri, 13 May 2011 16:47:55 -0500
Subject: [PATCH 1/4] Bug: Process#attachStderr/2 took stdout instead of
 stderr.

Also note that the attach operations currently leak vats.
---
 .../org/erights/e/meta/java/lang/ProcessSugar.java |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/jsrc/org/erights/e/meta/java/lang/ProcessSugar.java b/src/jsrc/org/erights/e/meta/java/lang/ProcessSugar.java
index 5ea3aba..10873a9 100644
--- a/src/jsrc/org/erights/e/meta/java/lang/ProcessSugar.java
+++ b/src/jsrc/org/erights/e/meta/java/lang/ProcessSugar.java
@@ -43,7 +43,7 @@ public class ProcessSugar {
      */
     static public CharPipeAdapter attachStdin(Process self, Reader altin) {
         CharPipeAdapter result = new CharPipeAdapter(altin, getStdin(self));
-        result.startCopy("stdin-adapter");
+        result.startCopy("stdin-adapter"); // XXX leaks a vat
         return result;
     }
 
@@ -60,7 +60,7 @@ public class ProcessSugar {
      */
     static public CharPipeAdapter attachStdout(Process self, Writer altout) {
         CharPipeAdapter result = new CharPipeAdapter(getStdout(self), altout);
-        result.startCopy("stdout-adapter");
+        result.startCopy("stdout-adapter"); // XXX leaks a vat
         return result;
     }
 
@@ -76,8 +76,8 @@ public class ProcessSugar {
      * @return
      */
     static public CharPipeAdapter attachStderr(Process self, Writer alterr) {
-        CharPipeAdapter result = new CharPipeAdapter(getStdout(self), alterr);
-        result.startCopy("stderr-adapter");
+        CharPipeAdapter result = new CharPipeAdapter(getStderr(self), alterr);
+        result.startCopy("stderr-adapter"); // XXX leaks a vat
         return result;
     }
 
-- 
1.7.5
0002-Add-terminates-0-to-Process-like-resultsVow-but-does.patch (application/octet-stream, 1.7 KB)
From 7f50a304771050fced37653f7d2284ec45e7ab64 Mon Sep 17 00:00:00 2001
From: Kevin Reid <kpreid-M/[email protected]>
Date: Sat, 14 May 2011 09:08:15 -0600
Subject: [PATCH 2/4] Add terminates/0 to Process; like resultsVow but does
 not capture stdout/stderr.

---
 .../org/erights/e/meta/java/lang/ProcessSugar.java |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/src/jsrc/org/erights/e/meta/java/lang/ProcessSugar.java b/src/jsrc/org/erights/e/meta/java/lang/ProcessSugar.java
index 10873a9..f2b0265 100644
--- a/src/jsrc/org/erights/e/meta/java/lang/ProcessSugar.java
+++ b/src/jsrc/org/erights/e/meta/java/lang/ProcessSugar.java
@@ -120,9 +120,24 @@ public class ProcessSugar {
      *         Process#waitFor() waiting for} that process.
      */
     static public Object[] resultsVow(Process self) {
-        Vat procVat = Vat.make("headless", "process");
+        Vat procVat = Vat.make("headless", "Process resultsVow");
         Object outcomeVow = procVat.seed(self, "results", E.NO_ARGS);
         Object[] result = {outcomeVow, procVat};
         return result;
     }
+    
+    /**
+     * Unlike {@link results(Process)}, does not capture stdout and stderr.
+     * 
+     * @param self
+     * @return A pair of a vow for the exit code as returned by
+     *         {@link Process#waitFor()}, and the vat which is waiting for that
+     *         process.
+     */
+    static public Object terminates(Process self) {
+        Vat procVat = Vat.make("headless", "Process terminated");
+        Object outcomeVow = procVat.seed(self, "waitFor", E.NO_ARGS);
+        Object[] result = {outcomeVow, procVat};
+        return result;
+    }
 }
-- 
1.7.5
0003-Fix-all-misspellings-of-opener-and-opening-with-two-.patch (application/octet-stream, 23.4 KB)
From cee7d6ca1981ae3133c9fe17a1070e6385767112 Mon Sep 17 00:00:00 2001
From: Kevin Reid <kpreid-M/[email protected]>
Date: Sat, 14 May 2011 09:12:48 -0600
Subject: [PATCH 3/4] Fix all misspellings of "opener" and "opening" with two
 "n"s.

---
 .../e/tools/causeway/causewayEditorAuthor.emaker   |   12 ++++----
 .../org/erights/e/ui/jed/abstractJedAuthor.emaker  |   14 ++++----
 src/esrc/scripts/causeway.e-swt                    |   10 +++---
 src/esrc/scripts/jed.e-swt                         |    4 +-
 src/esrc/scripts/test/updoc/no-newline-bug.updoc   |    2 +-
 .../erights/e/elang/smallcaps/SmallcapsOps.java    |    2 +-
 src/jsrc/org/erights/e/elang/syntax/ELexer.java    |   10 +++---
 src/jsrc/org/quasiliteral/quasiterm/QAstroArg.java |    2 +-
 src/jsrc/org/quasiliteral/syntax/BaseLexer.java    |   28 ++++++++--------
 src/jsrc/org/quasiliteral/syntax/Indenter.java     |   32 ++++++++++----------
 src/jsrc/org/quasiliteral/syntax/LineFeeder.java   |    2 +-
 .../org/quasiliteral/syntax/NeedMoreException.java |    2 +-
 .../org/quasiliteral/syntax/SyntaxException.java   |   22 +++++++-------
 src/jsrc/org/quasiliteral/term/TermLexer.java      |   10 +++---
 14 files changed, 76 insertions(+), 76 deletions(-)

diff --git a/src/esrc/org/erights/e/tools/causeway/causewayEditorAuthor.emaker b/src/esrc/org/erights/e/tools/causeway/causewayEditorAuthor.emaker
index b35f10f..29b19f5 100644
--- a/src/esrc/org/erights/e/tools/causeway/causewayEditorAuthor.emaker
+++ b/src/esrc/org/erights/e/tools/causeway/causewayEditorAuthor.emaker
@@ -37,7 +37,7 @@ def onlineHelpAuthor := <causeway:onlineHelpAuthor>
 
 def causewayEditorAuthor(rezKit,
                          abstractAction,
-                         makers, openners,
+                         makers, openers,
                          <file>, <jar>, props,
                          activate, shutdown,
                          tcr,
@@ -165,7 +165,7 @@ def causewayEditorAuthor(rezKit,
             to run() :void {
                 def waitCursor := makers["cursor"](SWT.getCURSOR_WAIT())
                 def oldEditorShell := causewayEditor.getEditorShell()
-                var optPaths :List := openners["openFile"](oldEditorShell)
+                var optPaths :List := openers["openFile"](oldEditorShell)
                 if (optPaths != []) {
                     if (rootDirName == "") {
                         doSetSourceRoot()
@@ -218,8 +218,8 @@ def causewayEditorAuthor(rezKit,
                 def waitCursor := makers["cursor"](SWT.getCURSOR_WAIT())
                 def editorShell := causewayEditor.getEditorShell()
                 
-                def dotFile := openners["exportFile"](editorShell,
-                                                      "messageGraph.gv", [])
+                def dotFile := openers["exportFile"](editorShell,
+                                                     "messageGraph.gv", [])
                 
                 if (dotFile != null) {
                     editorShell.setCursor(waitCursor)
@@ -458,8 +458,8 @@ def causewayEditorAuthor(rezKit,
          */
         bind doSetSourceRoot extends abstractAction(doSetSourceRoot) {
             to run() :void {
-                def dir := openners["openDir"](causewayEditor.getEditorShell(),
-                                               "Select the source code root directory.")
+                def dir := openers["openDir"](causewayEditor.getEditorShell(),
+                                              "Select the source code root directory.")
                 if (dir != null) {
                     rootDirName := dir.getPath()
                 }
diff --git a/src/esrc/org/erights/e/ui/jed/abstractJedAuthor.emaker b/src/esrc/org/erights/e/ui/jed/abstractJedAuthor.emaker
index e1559f3..bc85117 100644
--- a/src/esrc/org/erights/e/ui/jed/abstractJedAuthor.emaker
+++ b/src/esrc/org/erights/e/ui/jed/abstractJedAuthor.emaker
@@ -47,15 +47,15 @@ def setMargins(layout, marginSize) :void {
  * @param display The current Display
  * @param makeFrame No arguments function that makes and returns a new Shell
  *                  labeled with an icon.
- * @param openner A thunk that prompts the user for files, and returns a vow
- *                for the files the user will select. This vow resolves
- *                either to a possibly empty list of File objects.
- *                XXX Currently, FileDialogs are modal, so the returned value
- *                may already be so resolved.
+ * @param opener A thunk that prompts the user for files, and returns a vow
+ *               for the files the user will select. This vow resolves
+ *               either to a possibly empty list of File objects.
+ *               XXX Currently, FileDialogs are modal, so the returned value
+ *               may already be so resolved.
  */
 def abstractJedAuthor(display,
                       makeFrame,
-                      openner,
+                      opener,
                       props,
                       runtime,
                       timer,
@@ -208,7 +208,7 @@ def abstractJedAuthor(display,
          */
         bind doOpen extends abstractAction(doOpen) {
             to run() :void {
-                when (openner(shell)) -> done(files) :void {
+                when (opener(shell)) -> done(files) :void {
                     for file in files {
                         editGroup.obtainEditor(file, self)
                     }
diff --git a/src/esrc/scripts/causeway.e-swt b/src/esrc/scripts/causeway.e-swt
index a4ec840..bcc610a 100755
--- a/src/esrc/scripts/causeway.e-swt
+++ b/src/esrc/scripts/causeway.e-swt
@@ -125,11 +125,11 @@ def makeCursor(style :int) :any {
     return <swt:graphics.makeCursor>(currentDisplay, style)
 }
 
-def openners := [].asMap().diverge()
+def openers := [].asMap().diverge()
 
-openners.put("openFile", openFile)
-openners.put("openDir", openDir)
-openners.put("exportFile", exportFile)
+openers.put("openFile", openFile)
+openers.put("openDir", openDir)
+openers.put("exportFile", exportFile)
 
 def makers := [].asMap().diverge()
 
@@ -149,7 +149,7 @@ def causewayEditorAuthor := <import:org.erights.e.tools.causeway.causewayEditorA
 def makeCausewayEditor := causewayEditorAuthor(rezKit,
                                                abstractAction,
                                                makers.snapshot(),
-                                               openners.snapshot(),
+                                               openers.snapshot(),
                                                <file>, <jar>,
                                                props,
                                                activate, shutdown,
diff --git a/src/esrc/scripts/jed.e-swt b/src/esrc/scripts/jed.e-swt
index b19e60b..fdf6dd4 100755
--- a/src/esrc/scripts/jed.e-swt
+++ b/src/esrc/scripts/jed.e-swt
@@ -40,7 +40,7 @@ def shutdown() :void {
  * @param shell The parent.
  * @return A vow for a list of Files that the user will select.
  */
-def openner(shell :Shell) :vow {
+def opener(shell :Shell) :vow {
     def dialog := <widget:makeFileDialog>(shell, SWT.getMULTI() | SWT.getOPEN())
     dialog.open()
     var optNames := dialog.getFileNames()
@@ -61,7 +61,7 @@ def runtime := <unsafe:java.lang.makeRuntime>.getRuntime()
 def abstractJed :=
   <import:org.erights.e.ui.jed.abstractJedAuthor>(currentDisplay,
                                                   makeFrame,
-                                                  openner,
+                                                  opener,
                                                   interp.getProps(),
                                                   runtime,
                                                   timer,
diff --git a/src/esrc/scripts/test/updoc/no-newline-bug.updoc b/src/esrc/scripts/test/updoc/no-newline-bug.updoc
index 5790bb1..d0f1a16 100644
--- a/src/esrc/scripts/test/updoc/no-newline-bug.updoc
+++ b/src/esrc/scripts/test/updoc/no-newline-bug.updoc
@@ -32,7 +32,7 @@ line as the start of a stack-trace. ]
 
     ? try { eParser("\"") } catch ex { ex }
     # value: syntax error: File ends inside string literal, \
-    #               unmatched openning bracket:
+    #               unmatched opening bracket:
     #
     #   "
     #   ^
diff --git a/src/jsrc/org/erights/e/elang/smallcaps/SmallcapsOps.java b/src/jsrc/org/erights/e/elang/smallcaps/SmallcapsOps.java
index 468cc99..2865be6 100644
--- a/src/jsrc/org/erights/e/elang/smallcaps/SmallcapsOps.java
+++ b/src/jsrc/org/erights/e/elang/smallcaps/SmallcapsOps.java
@@ -148,7 +148,7 @@ public interface SmallcapsOps {
      * [],[handler] =&gt; OP_END_HANDLER =&gt; [],[]
      * <p/>
      * Drops the top handler on the handler stack. This is the closing bracket
-     * that balances an openning {@link #OP_EJECTOR_ONLY handler-introducing
+     * that balances an opening {@link #OP_EJECTOR_ONLY handler-introducing
      * op}.
      */
     int OP_END_HANDLER = 18;
diff --git a/src/jsrc/org/erights/e/elang/syntax/ELexer.java b/src/jsrc/org/erights/e/elang/syntax/ELexer.java
index e6600bb..e5ae04e 100644
--- a/src/jsrc/org/erights/e/elang/syntax/ELexer.java
+++ b/src/jsrc/org/erights/e/elang/syntax/ELexer.java
@@ -492,9 +492,9 @@ public class ELexer extends BaseLexer {
             //be called when we're continuing after a hole, in which
             //case there is no leading backquote.
             nextChar();
-            Twine openner =
+            Twine opener =
               getSpan(myOptStartPos, myPos, "File ends inside quasiliteral");
-            myIndenter.push(openner, '`', 0);
+            myIndenter.push(opener, '`', 0);
             return quasiPart();
         }
         case'0':
@@ -697,14 +697,14 @@ public class ELexer extends BaseLexer {
                 }
 
             } else {
-                Twine openner = endToken();
+                Twine opener = endToken();
                 //Pushes a '$' to protect the hole from the '`'
-                myIndenter.nest(openner, '$');
+                myIndenter.nest(opener, '$');
                 //interpolated '$' or '@' is neither eaten nor added to the
                 //value of the resulting QuasiOpen token.
                 return composite(EParser.QuasiOpen,
                                  buf.toString(),
-                                 openner.getOptSpan());
+                                 opener.getOptSpan());
             }
         }
     }
diff --git a/src/jsrc/org/quasiliteral/quasiterm/QAstroArg.java b/src/jsrc/org/quasiliteral/quasiterm/QAstroArg.java
index a8a5d2b..ef89a11 100644
--- a/src/jsrc/org/quasiliteral/quasiterm/QAstroArg.java
+++ b/src/jsrc/org/quasiliteral/quasiterm/QAstroArg.java
@@ -124,7 +124,7 @@ public abstract class QAstroArg
      * For this subtree and this index elements, 'shape' is the number of index
      * elements that have been successfully enumerated.
      * <p/>
-     * For each prefix, startShape and endShape form the openning and closing
+     * For each prefix, startShape and endShape form the opening and closing
      * brackets around calls to matchBindSlice or substSlice.
      */
     abstract void endShape(FlexList optBindings, int[] prefix, int shape);
diff --git a/src/jsrc/org/quasiliteral/syntax/BaseLexer.java b/src/jsrc/org/quasiliteral/syntax/BaseLexer.java
index 30dfdbb..9719c27 100644
--- a/src/jsrc/org/quasiliteral/syntax/BaseLexer.java
+++ b/src/jsrc/org/quasiliteral/syntax/BaseLexer.java
@@ -561,21 +561,21 @@ public abstract class BaseLexer implements LexerFace {
     protected Astro openBracket(char closer) throws IOException {
         short tagCode = (short)myChar;
         nextChar();
-        Twine openner = endToken();
-        return openBracket(tagCode, openner, closer);
+        Twine opener = endToken();
+        return openBracket(tagCode, opener, closer);
     }
 
     /**
      *
      */
-    protected Astro openBracket(short tagCode, Twine openner, char closer) {
+    protected Astro openBracket(short tagCode, Twine opener, char closer) {
         if (isRestBlank(myPos)) {
-            myIndenter.nest(openner, closer);
+            myIndenter.nest(opener, closer);
         } else {
             //Indent the next line to right after the open.
-            myIndenter.push(openner, closer, myPos);
+            myIndenter.push(opener, closer, myPos);
         }
-        return leafTag(tagCode, openner.getOptSpan());
+        return leafTag(tagCode, opener.getOptSpan());
     }
 
     /**
@@ -585,7 +585,7 @@ public abstract class BaseLexer implements LexerFace {
         char closerChar = myChar;
         nextChar();
         Twine closer = endToken();
-        //on mismatched close, throws SyntaxError at openner
+        //on mismatched close, throws SyntaxError at opener
         //on unmatched close, throws Syntax error at closer
         myIndenter.pop(closerChar, closer);
         return leafTag((short)closerChar, closer.getOptSpan());
@@ -715,9 +715,9 @@ public abstract class BaseLexer implements LexerFace {
      */
     protected Astro stringLiteral() throws IOException, SyntaxException {
         nextChar();
-        Twine openner =
+        Twine opener =
           getSpan(myOptStartPos, myPos, "File ends inside string literal");
-        myIndenter.push(openner, '"', 0);
+        myIndenter.push(opener, '"', 0);
         StringBuffer buf = new StringBuffer();
         while ('"' != myChar) {
             if (isEndOfFile()) {
@@ -739,8 +739,8 @@ public abstract class BaseLexer implements LexerFace {
         if (isEndOfFile()) {
             needMore(complaint);
         }
-        Twine openner = (Twine)myOptLTwine.run(start, bound);
-        return openner;
+        Twine opener = (Twine)myOptLTwine.run(start, bound);
+        return opener;
     }
 
     /**
@@ -752,11 +752,11 @@ public abstract class BaseLexer implements LexerFace {
     protected Astro docComment(short tagCode)
       throws IOException, SyntaxException {
 
-        //The openner is the initial '/**'
-        Twine openner =
+        //The opener is the initial '/**'
+        Twine opener =
           getSpan(myOptStartPos, myPos, "File ends inside doc-comment");
         // line it up with the first '*' of '/**'
-        myIndenter.push(openner, '*', myPos - 2);
+        myIndenter.push(opener, '*', myPos - 2);
         StringBuffer buf = new StringBuffer();
 
         String line = myOptLTwine.bare();
diff --git a/src/jsrc/org/quasiliteral/syntax/Indenter.java b/src/jsrc/org/quasiliteral/syntax/Indenter.java
index 7c2c8a1..4b9db79 100644
--- a/src/jsrc/org/quasiliteral/syntax/Indenter.java
+++ b/src/jsrc/org/quasiliteral/syntax/Indenter.java
@@ -35,9 +35,9 @@ public class Indenter {
     private int myTOS;
 
     /**
-     * The openners are Twine for reporting located errors at close time
+     * The openers are Twine for reporting located errors at close time
      */
-    private Twine[] myOpennerStack;
+    private Twine[] myOpenerStack;
 
     /**
      * The closers -- close bracketing characters that would close the
@@ -56,7 +56,7 @@ public class Indenter {
     /**
      * Was this open bracket also a nesting?
      * <p/>
-     * I.e., was the openner the last character on its line?  If so, then its
+     * I.e., was the opener the last character on its line?  If so, then its
      * popping should also decrement myNest.
      */
     private boolean[] myNestStack;
@@ -67,8 +67,8 @@ public class Indenter {
     public Indenter() {
         myNest = 0;
         myTOS = 0;
-        myOpennerStack = new Twine[16];
-        myOpennerStack[0] = null;       //dummy initial openner
+        myOpenerStack = new Twine[16];
+        myOpenerStack[0] = null;       //dummy initial opener
         myCloserStack = new char[16];
         myCloserStack[myTOS] = 'x';     // dummy initial closer
         myIndentStack = new int[16];
@@ -88,18 +88,18 @@ public class Indenter {
     /**
      * Internal push
      */
-    private void push(Twine openner,
+    private void push(Twine opener,
                       char closerChar,
                       int indent,
                       boolean isNest) {
         myTOS++;
         if (myTOS >= myCloserStack.length) {
-            myOpennerStack = (Twine[])grow(myOpennerStack);
+            myOpenerStack = (Twine[])grow(myOpenerStack);
             myCloserStack = (char[])grow(myCloserStack);
             myIndentStack = (int[])grow(myIndentStack);
             myNestStack = (boolean[])grow(myNestStack);
         }
-        myOpennerStack[myTOS] = openner;
+        myOpenerStack[myTOS] = opener;
         myCloserStack[myTOS] = closerChar;
         myIndentStack[myTOS] = indent;
         myNestStack[myTOS] = isNest;
@@ -108,16 +108,16 @@ public class Indenter {
     /**
      * Push a nester
      */
-    public void nest(Twine openner, char closerChar) {
+    public void nest(Twine opener, char closerChar) {
         myNest++;
-        push(openner, closerChar, myNest * 4, true);
+        push(opener, closerChar, myNest * 4, true);
     }
 
     /**
      * Push a non-nester
      */
-    public void push(Twine openner, char closerChar, int indent) {
-        push(openner, closerChar, indent, false);
+    public void push(Twine opener, char closerChar, int indent) {
+        push(opener, closerChar, indent, false);
     }
 
     /**
@@ -141,10 +141,10 @@ public class Indenter {
               closer.size());
         }
         if (myCloserStack[myTOS] != closerChar) {
-            Twine openner = myOpennerStack[myTOS];
+            Twine opener = myOpenerStack[myTOS];
             throw new SyntaxException(
               "mismatch: " + myCloserStack[myTOS] + " vs " + closerChar,
-              openner,
+              opener,
               closer,
               0,
               closer.size());
@@ -164,8 +164,8 @@ public class Indenter {
             //all's fine
             return;
         }
-        throw new SyntaxException(msg + ", unmatched openning bracket: ",
-                                  myOpennerStack[myTOS]);
+        throw new SyntaxException(msg + ", unmatched opening bracket: ",
+                                  myOpenerStack[myTOS]);
     }
 
     /**
diff --git a/src/jsrc/org/quasiliteral/syntax/LineFeeder.java b/src/jsrc/org/quasiliteral/syntax/LineFeeder.java
index 5a2e3b1..757ca16 100644
--- a/src/jsrc/org/quasiliteral/syntax/LineFeeder.java
+++ b/src/jsrc/org/quasiliteral/syntax/LineFeeder.java
@@ -44,7 +44,7 @@ public interface LineFeeder {
      * @param indent      The suggested indentation level for the next line,
      *                    unless the next line begins with closer.
      * @param closer      The character that would close the most recent
-     *                    unclosed openner.
+     *                    unclosed opener.
      * @param closeIndent The suggested indentation level for the next line if
      *                    it does begin (after trimming) with closer.
      */
diff --git a/src/jsrc/org/quasiliteral/syntax/NeedMoreException.java b/src/jsrc/org/quasiliteral/syntax/NeedMoreException.java
index 4db101a..b1b7e35 100644
--- a/src/jsrc/org/quasiliteral/syntax/NeedMoreException.java
+++ b/src/jsrc/org/quasiliteral/syntax/NeedMoreException.java
@@ -49,7 +49,7 @@ public class NeedMoreException extends RuntimeException {
      * @param indent      The suggested indentation level for the next line,
      *                    unless the next line begins with closer.
      * @param closer      The character that would close the most recent
-     *                    unclosed openner.
+     *                    unclosed opener.
      * @param closeIndent The suggested indentation level for the next line if
      *                    it does begin (after trimming) with closer.
      */
diff --git a/src/jsrc/org/quasiliteral/syntax/SyntaxException.java b/src/jsrc/org/quasiliteral/syntax/SyntaxException.java
index f2e277a..2c2f2ad 100644
--- a/src/jsrc/org/quasiliteral/syntax/SyntaxException.java
+++ b/src/jsrc/org/quasiliteral/syntax/SyntaxException.java
@@ -37,7 +37,7 @@ public class SyntaxException extends RuntimeException implements EPrintable {
 
     static private final long serialVersionUID = -1915268229312821277L;
 
-    private final Twine myOptOpenner;
+    private final Twine myOptOpener;
 
     private final Twine myOptLine;
 
@@ -46,18 +46,18 @@ public class SyntaxException extends RuntimeException implements EPrintable {
     private final int myBound;
 
     /**
-     * @param optOpenner optional start of syntax problem
+     * @param optOpener optional start of syntax problem
      * @param optLine    line containing error
      * @param start      index into optLine
      * @param bound      index into optLine
      */
     public SyntaxException(String msg,
-                           Twine optOpenner,
+                           Twine optOpener,
                            Twine optLine,
                            int start,
                            int bound) {
         super(msg);
-        myOptOpenner = optOpenner;
+        myOptOpener = optOpener;
         myOptLine = optLine;
         myStart = start;
         myBound = bound;
@@ -68,7 +68,7 @@ public class SyntaxException extends RuntimeException implements EPrintable {
      */
     public SyntaxException(String msg, Twine optLine) {
         super(msg);
-        myOptOpenner = null;
+        myOptOpener = null;
         myOptLine = optLine;
         myStart = 0;
         myBound = optLine == null ? 0 : optLine.size();
@@ -77,8 +77,8 @@ public class SyntaxException extends RuntimeException implements EPrintable {
     /**
      *
      */
-    public Twine getOptOpenner() {
-        return myOptOpenner;
+    public Twine getOptOpener() {
+        return myOptOpener;
     }
 
     /**
@@ -107,17 +107,17 @@ public class SyntaxException extends RuntimeException implements EPrintable {
      */
     public Twine optDamage() {
         if (null == myOptLine) {
-            if (null == myOptOpenner) {
+            if (null == myOptOpener) {
                 return null;
             } else {
-                return myOptOpenner;
+                return myOptOpener;
             }
         } else {
             Twine result = (Twine)myOptLine.run(myStart, myBound);
-            if (null == myOptOpenner) {
+            if (null == myOptOpener) {
                 return result;
             } else {
-                return (Twine)myOptOpenner.add(result);
+                return (Twine)myOptOpener.add(result);
             }
         }
     }
diff --git a/src/jsrc/org/quasiliteral/term/TermLexer.java b/src/jsrc/org/quasiliteral/term/TermLexer.java
index 9d09689..280989a 100644
--- a/src/jsrc/org/quasiliteral/term/TermLexer.java
+++ b/src/jsrc/org/quasiliteral/term/TermLexer.java
@@ -332,9 +332,9 @@ public class TermLexer extends BaseLexer {
      */
     protected Astro charsLiteral() throws IOException, SyntaxException {
         nextChar();
-        Twine openner =
+        Twine opener =
           getSpan(myOptStartPos, myPos, "File ends inside character literal");
-        myIndenter.push(openner, '\'', 0);
+        myIndenter.push(opener, '\'', 0);
         StringBuffer buf = new StringBuffer();
         while ('\'' != myChar) {
             if (isEndOfFile()) {
@@ -519,11 +519,11 @@ public class TermLexer extends BaseLexer {
      */
     private void skipBlockComment() throws IOException, SyntaxException {
 
-        //The openner is the initial '/*'
-        Twine openner =
+        //The opener is the initial '/*'
+        Twine opener =
           getSpan(myOptStartPos, myPos, "File ends inside block comment");
         // line it up with the first '*' of '/*'
-        myIndenter.push(openner, '*', myPos - 2);
+        myIndenter.push(opener, '*', myPos - 2);
 
         String line = myOptLTwine.bare();
         int bound;
-- 
1.7.5
0004-Make-CharPipeAdapter-autoflush-its-output.patch (application/octet-stream, 1.7 KB)
From abfdc0be5066baeea6880d73d61d4658cd46786f Mon Sep 17 00:00:00 2001
From: Kevin Reid <kpreid-M/[email protected]>
Date: Sat, 14 May 2011 18:53:43 -0600
Subject: [PATCH 4/4] Make CharPipeAdapter autoflush its output.

This ensures that data is not indefinitely delayed when the CharPipeAdapter
is the sole holder of its OutputStream.
---
 .../org/erights/e/elib/oldeio/CharPipeAdapter.java |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/jsrc/org/erights/e/elib/oldeio/CharPipeAdapter.java b/src/jsrc/org/erights/e/elib/oldeio/CharPipeAdapter.java
index 4c3f7db..c77554d 100644
--- a/src/jsrc/org/erights/e/elib/oldeio/CharPipeAdapter.java
+++ b/src/jsrc/org/erights/e/elib/oldeio/CharPipeAdapter.java
@@ -14,7 +14,10 @@ import java.io.Writer;
 /**
  * Moves characters from a Reader to a Writer in a blocking loop, which should
  * be run in a separate vat & runner.
- *
+ * 
+ * The Writer is flushed whenever there does not appear to be more input
+ * immediately arriving.
+ * 
  * @author Mark S. Miller
  */
 public class CharPipeAdapter implements Thunk {
@@ -48,9 +51,13 @@ public class CharPipeAdapter implements Thunk {
     public Object run() {
         try {
             try {
-                int c;
-                while (-1 != (c = myReader.read())) {
-                    myWriter.write((char)c);
+                char[] buffer = new char[4096];
+                int count;
+                while (-1 != (count = myReader.read(buffer))) {
+                    myWriter.write(buffer, 0, count);
+                    if (count < buffer.length) {
+                        myWriter.flush();
+                    }
                 }
                 return Boolean.TRUE;
             } finally {
-- 
1.7.5
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.