[armedbear-cvs] r14209 - trunk/abcl/src/org/armedbear/lisp

ehuelsmann at common-lisp.net ehuelsmann at common-lisp.net
Sun Oct 21 16:09:55 UTC 2012


Author: ehuelsmann
Date: Sun Oct 21 09:09:53 2012
New Revision: 14209

Log:
Re #253: BABEL-TESTS fails to compile; Fix character being discarded
due to not being unread into underlying stream.

Modified:
   trunk/abcl/src/org/armedbear/lisp/ConcatenatedStream.java

Modified: trunk/abcl/src/org/armedbear/lisp/ConcatenatedStream.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/ConcatenatedStream.java	Sun Oct 21 06:40:48 2012	(r14208)
+++ trunk/abcl/src/org/armedbear/lisp/ConcatenatedStream.java	Sun Oct 21 09:09:53 2012	(r14209)
@@ -127,29 +127,17 @@
     @Override
     public LispObject listen()
     {
-        if (unreadChar >= 0)
-            return T;
         if (streams == NIL)
             return NIL;
-        LispObject obj = readCharNoHang(false, this);
-        if (obj == this)
-            return NIL;
-        unreadChar = ((LispCharacter)obj).getValue();
-        return T;
+        Stream stream = (Stream)streams.car();
+        return stream.listen();
     }
 
-    private int unreadChar = -1;
-
     // Returns -1 at end of file.
     @Override
     protected int _readChar() throws java.io.IOException
     {
         int n;
-        if (unreadChar >= 0) {
-            n = unreadChar;
-            unreadChar = -1;
-            return n;
-        }
         if (streams == NIL)
             return -1;
         Stream stream = (Stream) streams.car();
@@ -161,18 +149,18 @@
     }
 
     @Override
-    protected void _unreadChar(int n)
+    protected void _unreadChar(int n) throws java.io.IOException
     {
-        if (unreadChar >= 0)
-            error(new StreamError(this, "UNREAD-CHAR was invoked twice consecutively without an intervening call to READ-CHAR."));
-        unreadChar = n;
+      if (streams == NIL)
+            error(new StreamError(this, "UNREAD-CHAR was invoked without a stream to unread into."));
+      Stream stream = (Stream)streams.car();
+
+      stream._unreadChar(n);
     }
 
     @Override
     protected boolean _charReady() throws java.io.IOException
     {
-        if (unreadChar >= 0)
-            return true;
         if (streams == NIL)
             return false;
         Stream stream = (Stream) streams.car();




More information about the armedbear-cvs mailing list