This is the bitio Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 04:24:58 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
bitio
A wrapper for octet streams that enable bit level streams.
Peter Keller <psilord@cs.wisc.edu>
MIT License
0.1
fast-io
(system).
trivial-gray-streams
(system).
cl-package-locks
(system).
checkl
(system).
Modules are listed depth-first from the system components tree.
bitio/base
bitio
(system).
package.lisp
(file).
utils.lisp
(file).
bitio.lisp
(file).
bitio-read.lisp
(file).
tests.lisp
(file).
bitio/contrib
base
(module).
bitio
(system).
gray.lisp
(file).
gray-test.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
bitio/bitio.asd
bitio/base/package.lisp
bitio/base/utils.lisp
bitio/base/bitio.lisp
bitio/base/bitio-read.lisp
bitio/base/tests.lisp
bitio/contrib/gray.lisp
bitio/contrib/gray-test.lisp
bitio/base/utils.lisp
base
(module).
*octet-bit-reverse-table*
(special variable).
integer-reverse
(function).
octet-reverse
(function).
bitio/base/bitio.lisp
base
(module).
bitio
(class).
make-bitio
(function).
%bitio/read-octet
(reader method).
%bitio/read-sequence
(reader method).
bitio/read-octet
(generic function).
default-bit-endian
(reader method).
(setf default-bit-endian)
(writer method).
default-bits-per-byte
(reader method).
(setf default-bits-per-byte)
(writer method).
default-byte-endian
(reader method).
(setf default-byte-endian)
(writer method).
num-bits-in-stable
(reader method).
(setf num-bits-in-stable)
(writer method).
octet-read-buffer
(reader method).
(setf octet-read-buffer)
(writer method).
octet-stream
(reader method).
read-bit-stable
(reader method).
(setf read-bit-stable)
(writer method).
bitio/base/bitio-read.lisp
base
(module).
octet-read-boundary-p
(function).
read-bits
(function).
read-bytes
(function).
read-integer
(function).
read-one-byte
(function).
consume-read-bit-stable
(function).
fast-path/octet-aligned-bit-read
(function).
fill-read-stable
(function).
sign-extend
(function).
slow-path/octet-unaligned-bit-read
(function).
bitio/base/tests.lisp
base
(module).
dbgval
(function).
do-test
(macro).
doit
(function).
make-octet-vector
(function).
test-make-bitio/clhs
(function).
test-make-bitio/fast-io
(function).
test-read-bits
(function).
test-read-bytes
(function).
test-read-integer
(function).
test-read-one-byte
(function).
bitio/contrib/gray.lisp
contrib
(module).
input-stream-p
(method).
make-bitio-stream
(function).
peek-byte
(method).
stream-bit-endian
(method).
(setf stream-bit-endian)
(method).
stream-byte-endian
(method).
(setf stream-byte-endian)
(method).
(setf stream-element-type)
(method).
stream-element-type
(method).
(setf stream-file-position)
(method).
stream-file-position
(method).
stream-read-byte
(method).
stream-read-sequence
(method).
bitio-input-stream
(class).
bitio-stream
(class).
Packages are listed by definition order.
bitio
common-lisp
.
bitio
(class).
make-bitio
(function).
octet-read-boundary-p
(function).
read-bits
(function).
read-bytes
(function).
read-integer
(function).
read-one-byte
(function).
%bitio/read-octet
(generic reader).
%bitio/read-sequence
(generic reader).
*octet-bit-reverse-table*
(special variable).
bitio/read-octet
(generic function).
consume-read-bit-stable
(function).
dbgval
(function).
default-bit-endian
(generic reader).
(setf default-bit-endian)
(generic writer).
default-bits-per-byte
(generic reader).
(setf default-bits-per-byte)
(generic writer).
default-byte-endian
(generic reader).
(setf default-byte-endian)
(generic writer).
do-test
(macro).
doit
(function).
fast-path/octet-aligned-bit-read
(function).
fill-read-stable
(function).
integer-reverse
(function).
make-octet-vector
(function).
num-bits-in-stable
(generic reader).
(setf num-bits-in-stable)
(generic writer).
octet-read-buffer
(generic reader).
(setf octet-read-buffer)
(generic writer).
octet-reverse
(function).
octet-stream
(generic reader).
read-bit-stable
(generic reader).
(setf read-bit-stable)
(generic writer).
sign-extend
(function).
slow-path/octet-unaligned-bit-read
(function).
test-make-bitio/clhs
(function).
test-make-bitio/fast-io
(function).
test-read-bits
(function).
test-read-bytes
(function).
test-read-integer
(function).
test-read-one-byte
(function).
bitio.gray
bitio
.
checkl
.
cl-package-locks
.
common-lisp
.
fast-io
.
trivial-gray-streams
.
uiop/driver
.
make-bitio-stream
(function).
peek-byte
(generic function).
stream-bit-endian
(generic function).
(setf stream-bit-endian)
(generic function).
stream-byte-endian
(generic function).
(setf stream-byte-endian)
(generic function).
bitio-input-stream
(class).
bitio-stream
(class).
Definitions are sorted by export status, category, package, and then by lexicographic order.
OCTET-STREAM must be a stream that is ready to read/write binary octets of (unsigned-byte 8) type. BITIO/READ-OCTET is a function associated with the OCTET-STREAM that reads a single octet from that stream. BITIO/READ-SEQUENCE is a function associated with the octet stream that reads a vector of octets. The functions for BITIO/READ-OCTET and BITIO/READ-SEQUENCE both expect the same oridnary lambda list as CL’s READ-BYTE and READ-SEQUENCE, respectively. Returns aninstance of a BITIO class.
Return T if the reading of the bit stream is at an octet boundary. NIL otherwise. If at EOF, return T, since techically, it is a boundary.
Before describing how this function works, we’ll describe the form the
octets are in from the underlying octet-stream that the BITIO instance
contains. The octets are in a canonical form, with bits written left to right
and given labels:
octet: [2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0]
bit label: [ a b c d e f g h ]
We call bit ’a’ the MSBit and bit ’h’ the LSBit of the octet.
So, when we strip off bits from the octets, we look at BIT-ENDIAN to
determine which side of the octet we are getting the bits. If it
is :BE, we take the bits from the MSBit side of the octet, and if it
is :LE we take the bits form the LSBit side of the octet.
An example call of taking 8 bits from the BIT-ENDIAN :BE direction
will result in the function returns two values: the unsigned integer
with the bits in these positions: ’abcdefgh’ and the number of bits read,
in this case 8.
In a different scenario, we might read 5 bits :BE, to return the values: (’abcde’ 5), and then read 3 bits :LE, which returns the values: (’hgf’ 3).
Suppose we read 12 bits :LE from the start of an octet boundary. The
underlying octet stream might look like this in canonical form with
the left octet being the next octet ready to read:
[abcdefgh][ijklmnop][...]...
Then, we read 12 bits in this order: hgfedcbaponm and return the
values of it and 12 as the bits read. This read consumes the first
octet starting from the :LE side, then half of the second octet
starting from the :LE side, leaving the bits ’ijkl’ in the second
octet to be read in the next read-bits call, however you want to
read them, plus any additional bits from additional octet later in the
stream.
It is not required that you read 8 bit multiples or that those reads are aligned to the underlying octet boundaries in the stream. But, if EOF-ERROR-P and EOF-VALUE are used as in READ, you can know if you hit EOF properly. If you try to read X number of bits, but hit EOF while getting them, the bits of the short read will be returned and the number of successful bits read returned. It is recommended that you check the number of bits you expected to read to ensure the value is what you expect.
This reads UNSIGNED ’bytes’ into SEQ given :START and :END keywords.
The default span is the entire sequence. BIT-ENDIAN is how the
individual bits are read from the octet stream, and bits-per-byte is how
many bits wide a ’byte’ is in the stream. Return how many elements
have been read. The sequence is destructively modified. At EOF
conditions, a short read will happen for the last element read (and
there is no notification of this) or the function will return 0.
NOTE: This function is similar to CL’s READ-SEQUENCE except it only will read
the unsigned byte as defined in the function call arguments.
This function reads 1 or more bytes where each byte is defined by
BITS-PER-BYTE and BIT-ENDIAN. BITS-PER-BYTE indicates how many bits are in
the byte and it defaults to 8. BIT-ENDIAN defines how to read those
bits from the octet stream. It defaults to :BE (big endian), See
READ-BITS for further explanation. After the bytes are read, they
are arranged according to BYTE-ENDIAN in the traditional meaning of
multi-byte integers and that defaults to :LE. Then depending
on UNSIGNEDP, defaulting to T, the value is either returned unsigned
or treated as a twos complement number and possibly turned negative by
sign extension. The integer is returned. NOTE: The arguments don’t
have to require that you read multiple of 8 bits to assemble the
number.
Read a single unsigned ’byte’ from the bitio stream. You must specify the BIT-ENDIAN mode (:BE or :LE, See READ-BITS) and how big the byte is in bits: BITS-PER-BYTE. You can supply the optional keywords EOF-ERROR-P and EOF-VALUE as in READ-BYTE). The returned value is always unsigned. If the number of bits requested is more than is in the stream, you will get a short read of bits, so it is recommended to check the return value to ensure you got the number of bits you expected.
bitio-input-stream
) &optional peek-type eof-error-p eof-value) ¶bitio-stream
)) ¶bitio-stream
)) ¶bitio-stream
)) ¶bitio-stream
)) ¶bitio-stream
)) ¶bitio-input-stream
)) ¶trivial-gray-streams
.
bitio-stream
)) ¶stream must implement:
‘stream-file-position, stream-element-type (also setf!)’
trivial-gray-streams
.
bitio-input-stream
)) ¶sb-gray
.
bitio-stream
) sequence start end &key bit-endian bits-per-byte &allow-other-keys) ¶trivial-gray-streams
.
%bitio/read-octet
.
%bitio/read-sequence
.
(setf default-bit-endian)
.
default-bit-endian
.
(setf default-bits-per-byte)
.
default-bits-per-byte
.
(setf default-byte-endian)
.
default-byte-endian
.
(setf num-bits-in-stable)
.
num-bits-in-stable
.
(setf octet-read-buffer)
.
octet-read-buffer
.
octet-stream
.
(setf read-bit-stable)
.
read-bit-stable
.
:octet-stream
This slot is read-only.
:octet-read-buffer
0
:read-bit-stable
0
:num-bits-in-stable
:bitio/read-octet
This slot is read-only.
:bitio/read-sequence
This slot is read-only.
:be
:default-bit-endian
:le
:default-byte-endian
8
:default-bits-per-byte
This function assumes the read-bit-stable is empty in the BITIO stream and BIT-READ-COUNT is a multiple of 8. It reads BIT-READ-COUNT bits from the BITIO stream (reading the actual bits in each octet in BIT-ENDIAN manner) and then places them into an integer that it returns. The integer is in canonical form with the first bit read in the MSBit position.
This function asserts that the stable is empty, then fills it with a single octet from the stream. Returns T if stable was filled or NIL if it wasn’t (due to an EOF).
Read an octet from the funciton supplied with the stream instance the bitio is wrapping.
bitio-stream
.
fundamental-input-stream
.
bitio
.
fundamental-binary-stream
.
Jump to: | %
(
B C D F G I M N O P R S T |
---|
Jump to: | %
(
B C D F G I M N O P R S T |
---|
Jump to: | %
*
S |
---|
Jump to: | %
*
S |
---|
Jump to: | B C F G M P S T U |
---|
Jump to: | B C F G M P S T U |
---|