Archive file SRFIs Lassi Kortela (01 Apr 2019 08:49 UTC)
Re: Archive file SRFIs Arthur A. Gleckler (01 Apr 2019 15:05 UTC)
Re: Archive file SRFIs Lassi Kortela (01 Apr 2019 16:29 UTC)
Re: Archive file SRFIs John Cowan (01 Apr 2019 16:47 UTC)
Re: Archive file SRFIs Lassi Kortela (01 Apr 2019 17:38 UTC)
Re: Archive file SRFIs Göran Weinholt (01 Apr 2019 20:14 UTC)
Re: Archive file SRFIs Lassi Kortela (05 Apr 2019 21:47 UTC)
Re: Archive file SRFIs Lassi Kortela (05 Apr 2019 22:17 UTC)
Re: Archive file SRFIs Lassi Kortela (07 Apr 2019 16:53 UTC)
Re: Archive file SRFIs John Cowan (07 Apr 2019 17:54 UTC)

Re: Archive file SRFIs Lassi Kortela 07 Apr 2019 16:52 UTC

> Here's what I have so far:
> <https://github.com/lassik/archive-srfis/tree/master/implementation>

Does anyone have a better solution for reading data from the archive
than this:

     (read-archive-entry
      archive entry
      (lambda (read-bytevector!*)
        (let ((bytes (make-bytevector 65536 0)))
          (let loop ()
            (let ((nread (read-bytevector!* bytes)))
              (cond ((> nread 0)
                     (display "read ")
                     (display nread)
                     (display " bytes")
                     (newline)
                     (loop))))))))

So user-supplied lambda reads the contents of a file inside the archive
by repeatedly calling the procedure `read-bytevector!*`. That procedure
is a closure made by the archive library and does whatever is needed to
fill the given bytevector with some more data from the file.

It would be nice to use an ordinary byte input stream to represent the
decompressed contents of a file inside the archive, but I haven't heard
of any reasonably portable way to make custom streams like that. Common
Lisp is in the same predicament (there's Gray streams, which are pretty
widely implemented, but not standard).

Given the situation, is that `read-bytevector!*` solution the best way
to go about it?