Changeset 12323


Ignore:
Timestamp:
01/01/10 19:41:15 (11 years ago)
Author:
ehuelsmann
Message:

Implement setting of external format on a stream;

only supported on the Java side for now.

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
2 edited

Legend:

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

    r12319 r12323  
    152152    }
    153153
     154    @Override
     155    public void setExternalFormat(LispObject format) {
     156        super.setExternalFormat(format);
     157
     158        if (racf != null)
     159            // setExternalFormat also called before 'racf' is set up
     160            racf.setEncoding(encoding);
     161    }
     162
    154163    public Pathname getPathname()
    155164    {
  • trunk/abcl/src/org/armedbear/lisp/Stream.java

    r12288 r12323  
    270270      return externalFormat;
    271271  }
    272  
     272
    273273  public String getEncoding() {
    274274      return encoding;
    275275  }
    276  
     276
    277277  public void setExternalFormat(LispObject format) {
     278    // make sure we encode any remaining buffers with the current format
     279    finishOutput();
     280
    278281    if (format == keywordDefault) {
    279282      encoding = null;
     
    283286      return;
    284287    }
    285      
     288
    286289    LispObject enc;
    287290    boolean encIsCp = false;
    288    
     291
    289292    if (format instanceof Cons) {
    290293        // meaning a non-empty list
     
    295298            enc = getf(format.cdr(), keywordID, null);
    296299        }
    297          
     300
    298301        LispObject eol = getf(format.cdr(), keywordEolStyle, keywordRAW);
    299302        if (eol == keywordCR)
     
    305308        else if (eol != keywordRAW)
    306309            ; //###FIXME: raise an error
    307        
     310
    308311    } else
    309312      enc = format;
    310    
     313
    311314    if (enc.numberp())
    312315        encoding = enc.toString();
Note: See TracChangeset for help on using the changeset viewer.