sunterlib/s48/binary-parse
Anthony Carrico 02699e0409 Add script to change install lib version from 1.2.0 to 1.3.0, and make that change. THIS IS UNTESTED. I have no idea if packages need further changes for 1.3.0. 2012-01-16 03:06:42 +00:00
..
AUTHORS
BLURB
NEWS Adjust version number in NEWS 2004-03-27 08:01:43 +00:00
README Add loading instructions 2004-03-27 07:44:22 +00:00
binary-parse.scm
packages.scm
pkg-def.scm Add script to change install lib version from 1.2.0 to 1.3.0, and make that change. THIS IS UNTESTED. I have no idea if packages need further changes for 1.3.0. 2012-01-16 03:06:42 +00:00

README

[This file and the accompanying source code were derived from
 Oleg's code for Gambit available from

     http://okmij.org/ftp/Scheme/index.html#binio

]

The structure BINARY-PARSE provides a procedure to read bits from a
byte-stream.

================================================================================

After installation, use the switch

-lel binary-parse/load.scm

to load this library.

================================================================================

(make-bit-reader byte-reader) -> bit-reader

Given a BYTE-READER (a thunk), construct and return a function

      (bit-reader N) -> integer

that reads N bits from a byte-stream represented by the BYTE-READER.

The BYTE-READER is a function that takes no arguments and returns
the current byte as an exact integer [0-255]. The byte reader
should return #f on EOF.
The bit reader returns N bits as an exact unsigned integer, 
0 -... (no limit). N must be a positive integer, otherwise the bit reader
returns #f. There is no upper limit on N -- other than the size of the
input stream itself and the amount of (virtual) memory an OS is willing
to give to your process. If you want to read 1M of _bits_, go ahead.

It is assumed that the bit order is the most-significant bit first.