Skip to content
  • Christophe Rhodes's avatar
    Working input-replacement restart for decoding errors · de26a27d
    Christophe Rhodes authored
    It's all mildly horrible.  The input buffer-handling code is in
    streams.lisp, notionally generic code, which means that it's very hard
    to communicate out-of-band reasons for filling 0 characters (which could
    happen on end-of-file, on forced-end-of-file, on resync and now on
    input-replacement).  Instead, we have to communicate that out-of-band
    information between different fd-streams functions using extra slots in
    the stream, which is all fragile and intertwingly.
    
    One thing that has changed is that we're no longer using an UNREAD slot
    for dealing with unread-char; instead we always alter the buffer
    pointers.  We don't get that slot back, though; instead we use it for
    stuff to read in preference to the input buffer, FD-STREAM-INSTEAD.
    Most of the work in this patch is making sure that this is in fact
    always read first when necessary.
    
    This rearrangement also fixes the double-decoding-error when using the
    force-end-of-file restart, by using yet another new slot for noting that
    EOF was forced, so test for that in the relevant regression test (by
    counting the number of times the handler function is called).
    de26a27d