Changeset 12595


Ignore:
Timestamp:
04/10/10 20:28:06 (13 years ago)
Author:
ehuelsmann
Message:

Consolidate the functionality of faslReadPreservingWhitespace
and readPreservingWhitespace.

File:
1 edited

Legend:

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

    r12594 r12595  
    431431    {
    432432        LispObject result = readPreservingWhitespace(eofError, eofValue,
    433                                                      recursive, thread);
     433                                                     recursive, thread,
     434                                                     currentReadtable);
    434435        if (result != eofValue && !recursive) {
    435436            try {
     
    461462                                               LispObject eofValue,
    462463                                               boolean recursive,
    463                                                LispThread thread)
     464                                               LispThread thread,
     465                                               ReadtableAccessor rta)
    464466
    465467    {
    466468        if (recursive) {
    467             final Readtable rt = (Readtable) Symbol.CURRENT_READTABLE.symbolValue(thread);
     469            final Readtable rt = rta.rt(thread);
    468470            while (true) {
    469471                int n = -1;
     
    491493            thread.bindSpecial(_SHARP_EQUAL_ALIST_, NIL);
    492494            try {
    493                 return readPreservingWhitespace(eofError, eofValue, true, thread);
     495                return readPreservingWhitespace(eofError, eofValue, true,
     496                                                thread, rta);
    494497            } finally {
    495498                thread.resetSpecialBindings(mark);
     
    503506    {
    504507        try {
    505             LispObject result = faslReadPreservingWhitespace(eofError, eofValue,
    506                                 recursive, thread);
     508            LispObject result =
     509                    readPreservingWhitespace(eofError, eofValue, recursive,
     510                                             thread, faslReadtable);
    507511            if (result != eofValue && !recursive) {
    508512                if (_charReady()) {
     
    522526        } catch (IOException e) {
    523527            return error(new StreamError(this, e));
    524         }
    525     }
    526 
    527     private final LispObject faslReadPreservingWhitespace(boolean eofError,
    528             LispObject eofValue,
    529             boolean recursive,
    530             LispThread thread)
    531     throws IOException {
    532         if (recursive) {
    533             final Readtable rt = FaslReadtable.getInstance();
    534             while (true) {
    535                 int n = _readChar();
    536                 if (n < 0) {
    537                     if (eofError)
    538                         return error(new EndOfFile(this));
    539                     else
    540                         return eofValue;
    541                 }
    542                 char c = (char) n; // ### BUG: Codepoint conversion
    543                 if (rt.isWhitespace(c))
    544                     continue;
    545                 LispObject result = processChar(c, rt);
    546                 if (result != null)
    547                     return result;
    548             }
    549         } else {
    550             final SpecialBindingsMark mark = thread.markSpecialBindings();
    551             thread.bindSpecial(_SHARP_EQUAL_ALIST_, NIL);
    552             try {
    553                 return faslReadPreservingWhitespace(eofError, eofValue, true, thread);
    554             } finally {
    555                 thread.resetSpecialBindings(mark);
    556             }
    557528        }
    558529    }
     
    22662237            if (preserveWhitespace)
    22672238                result = in.readPreservingWhitespace(eofError, third, false,
    2268                                                      thread);
     2239                                                     thread, currentReadtable);
    22692240            else
    22702241                result = in.read(eofError, third, false, thread);
     
    23512322            return stream.readPreservingWhitespace(eofError, eofValue,
    23522323                                                   recursive,
    2353                                                    LispThread.currentThread());
     2324                                                   LispThread.currentThread(),
     2325                                                   currentReadtable);
    23542326        }
    23552327    };
Note: See TracChangeset for help on using the changeset viewer.