Skip to content
Snippets Groups Projects
Forked from cmucl / cmucl
Source project has a limited visibility.
  • rtoy's avatar
    1325c62e
    Add support for flushing out any state in an external format when · 1325c62e
    rtoy authored
    closing an output stream.  This causes things like
    
    (with-open-file (s "foo" :direction :output :external-format :utf-8)
      (write-char #\u+d800 s))
    
    to output the replacement character instead of creating an empty file.
    
    code/extfmts.lisp:
    o Add new slot to efx structure to hold the function to flush the
      state in an external format.
    o Add accessor for the flush-state slot.
    o Update DEFINE-EXTERNAL-FORMAT to allow specifying the flush
      function.
    o Add macro to call the flush-state function.
    o Added +EF-FLUSH+
    o Use vm::defenum to name the constants instead of the hand-written
      values.
    o Export +REPLACEMENT-CHARACTER-CODE+
    o Document the slots in an efx stucture.
    
    code/fd-stream.lisp:
    o Add ef-flush def-ef-macro to flush the state of an external format
      when closing an output file.  If ef-flush-state is NIL, we just call
      EF-COUT to send out the replacement character.  Otherwise, the
      flush-state function is called to handle it.
    o When closing an output character stream, call ef-flush to flush any
      state before flushing the buffers of the stream.
    o Document the unicode slots in an fd-stream.
    
    code/exports.lisp:
    o Export +REPLACEMENT-CHARACTER-CODE+
    1325c62e
    History
    Add support for flushing out any state in an external format when
    rtoy authored
    closing an output stream.  This causes things like
    
    (with-open-file (s "foo" :direction :output :external-format :utf-8)
      (write-char #\u+d800 s))
    
    to output the replacement character instead of creating an empty file.
    
    code/extfmts.lisp:
    o Add new slot to efx structure to hold the function to flush the
      state in an external format.
    o Add accessor for the flush-state slot.
    o Update DEFINE-EXTERNAL-FORMAT to allow specifying the flush
      function.
    o Add macro to call the flush-state function.
    o Added +EF-FLUSH+
    o Use vm::defenum to name the constants instead of the hand-written
      values.
    o Export +REPLACEMENT-CHARACTER-CODE+
    o Document the slots in an efx stucture.
    
    code/fd-stream.lisp:
    o Add ef-flush def-ef-macro to flush the state of an external format
      when closing an output file.  If ef-flush-state is NIL, we just call
      EF-COUT to send out the replacement character.  Otherwise, the
      flush-state function is called to handle it.
    o When closing an output character stream, call ef-flush to flush any
      state before flushing the buffers of the stream.
    o Document the unicode slots in an fd-stream.
    
    code/exports.lisp:
    o Export +REPLACEMENT-CHARACTER-CODE+