Changeset 14209


Ignore:
Timestamp:
10/21/12 16:09:53 (8 years ago)
Author:
ehuelsmann
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/ConcatenatedStream.java

    r12513 r14209  
    128128    public LispObject listen()
    129129    {
    130         if (unreadChar >= 0)
    131             return T;
    132130        if (streams == NIL)
    133131            return NIL;
    134         LispObject obj = readCharNoHang(false, this);
    135         if (obj == this)
    136             return NIL;
    137         unreadChar = ((LispCharacter)obj).getValue();
    138         return T;
    139     }
    140 
    141     private int unreadChar = -1;
     132        Stream stream = (Stream)streams.car();
     133        return stream.listen();
     134    }
    142135
    143136    // Returns -1 at end of file.
     
    146139    {
    147140        int n;
    148         if (unreadChar >= 0) {
    149             n = unreadChar;
    150             unreadChar = -1;
    151             return n;
    152         }
    153141        if (streams == NIL)
    154142            return -1;
     
    162150
    163151    @Override
    164     protected void _unreadChar(int n)
    165     {
    166         if (unreadChar >= 0)
    167             error(new StreamError(this, "UNREAD-CHAR was invoked twice consecutively without an intervening call to READ-CHAR."));
    168         unreadChar = n;
     152    protected void _unreadChar(int n) throws java.io.IOException
     153    {
     154      if (streams == NIL)
     155            error(new StreamError(this, "UNREAD-CHAR was invoked without a stream to unread into."));
     156      Stream stream = (Stream)streams.car();
     157
     158      stream._unreadChar(n);
    169159    }
    170160
     
    172162    protected boolean _charReady() throws java.io.IOException
    173163    {
    174         if (unreadChar >= 0)
    175             return true;
    176164        if (streams == NIL)
    177165            return false;
Note: See TracChangeset for help on using the changeset viewer.