The lisp-binary Reference Manual

This is the lisp-binary Reference Manual, version 1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 05:41:42 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 lisp-binary

Declare binary formats as structs and then read and write them.

Author

Jeremy Phelps

License

GPLv3

Version

1

Dependencies
  • closer-mop (system).
  • moptilities (system).
  • flexi-streams (system).
  • quasiquote-2.0 (system).
  • alexandria (system).
  • cffi (system).
Source

lisp-binary.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 lisp-binary/lisp-binary.asd

Source

lisp-binary.asd.

Parent Component

lisp-binary (system).

ASDF Systems

lisp-binary.


3.1.2 lisp-binary/binary-1.lisp

Dependencies
Source

lisp-binary.asd.

Parent Component

lisp-binary (system).

Packages

lisp-binary.

Public Interface
Internals

3.1.3 lisp-binary/binary-2.lisp

Dependencies
Source

lisp-binary.asd.

Parent Component

lisp-binary (system).

Public Interface

defbinary (macro).

Internals

3.1.4 lisp-binary/types.lisp

Dependencies
Source

lisp-binary.asd.

Parent Component

lisp-binary (system).


3.1.5 lisp-binary/simple-bit-stream.lisp

Dependency

integer.lisp (file).

Source

lisp-binary.asd.

Parent Component

lisp-binary (system).

Packages

simple-bit-stream.

Public Interface
Internals

3.1.6 lisp-binary/reverse-stream.lisp

Dependency

integer.lisp (file).

Source

lisp-binary.asd.

Parent Component

lisp-binary (system).

Packages

reverse-stream.

Public Interface
Internals

3.1.7 lisp-binary/integer.lisp

Dependency

utils.lisp (file).

Source

lisp-binary.asd.

Parent Component

lisp-binary (system).

Packages

lisp-binary/integer.

Public Interface
Internals

3.1.8 lisp-binary/float.lisp

Dependency

integer.lisp (file).

Source

lisp-binary.asd.

Parent Component

lisp-binary (system).

Packages

lisp-binary/float.

Public Interface
Internals

3.1.9 lisp-binary/utils.lisp

Source

lisp-binary.asd.

Parent Component

lisp-binary (system).

Packages

lisp-binary-utils.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 lisp-binary/float

Source

float.lisp.

Use List
Used By List

lisp-binary.

Public Interface
Internals

4.2 reverse-stream

A stream that reads from another stream and reverses the bit order
of each byte so that the low-order bit becomes the high-order bit and vice versa.

This functionality is called for by the TIFF file format, because "It is easy and inexpensive for writers to reverse bit order by using a 256-byte lookup table." It is devillishly tricky to include this functionality directly in the DEFBINARY macro, however, when the macro was written without gratuitous bit-reversal in mind.

The REVERSE-STREAM does not keep track of any file positioning information. That means it can coexist with its client stream, and you can mix reads and/or writes between the two.

REVERSE-STREAM is not limited to 8-bit bytes. It can handle any byte size that the underlying Lisp implementation supports. On PC hardware, some Lisps can read byte sizes that are multiples of 8 bits, such as (UNSIGNED-BYTE 24).

Source

reverse-stream.lisp.

Use List
Public Interface
Internals

4.3 simple-bit-stream

Source

simple-bit-stream.lisp.

Use List
Used By List

lisp-binary.

Public Interface
Internals

4.4 lisp-binary/integer

Source

integer.lisp.

Use List
Used By List
Public Interface
Internals

4.5 lisp-binary-utils

Source

utils.lisp.

Use List
  • common-lisp.
  • metabang.moptilities.
Used By List
Public Interface
Internals

4.6 lisp-binary

Read binary data directly into structs, and write it back out again. Also provides a lower-level API for reading and writing integers and floating-point numbers. Also provides a bit-stream API.

Source

binary-1.lisp.

Use List
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Special variables

Special Variable: *byte-order*
Package

lisp-binary.

Source

binary-1.lisp.

Special Variable: +inf
Package

lisp-binary/float.

Source

float.lisp.

Special Variable: -inf
Package

lisp-binary/float.

Source

float.lisp.

Special Variable: pointer
Package

lisp-binary.

Source

binary-1.lisp.

Special Variable: quiet-nan
Package

lisp-binary/float.

Source

float.lisp.

Special Variable: signalling-nan
Package

lisp-binary/float.

Source

float.lisp.


5.1.2 Macros

Macro: aif (test then &optional else)
Package

lisp-binary-utils.

Source

utils.lisp.

Macro: awhen (test &rest body)
Package

lisp-binary-utils.

Source

utils.lisp.

Macro: bind-class-slots (class instance &body body)

Evaluates BODY with the slots from the CLASS bound to the values taken from INSTANCE. The CLASS must be a class object at compile-time, so the macro can extract the needed variable names for binding.

Package

lisp-binary-utils.

Source

utils.lisp.

Macro: decode-float-bits (integer &key format result-type)

Decodes the bits from an IEEE floating point number. Supported formats are listed in the variable LISP-BINARY/FLOAT::*FORMAT-TABLE*.

If the FORMAT is either :SINGLE or :DOUBLE, then the decoding is
done by storing the bits in memory and having the CPU reinterpret that buffer as a float. Otherwise, arithmetic methods are used to arrive at the correct value.

To prevent precision loss if you are decoding a larger type such as :QUADRUPLE or :OCTUPLE precision, use ’RATIONAL for the RESULT-TYPE to avoid a conversion to a smaller 32- or 64-bit float.

Package

lisp-binary/float.

Source

float.lisp.

Macro: defbinary (name (&rest defstruct-options &key byte-order preserve-*byte-order* align untyped-struct include documentation export byte-count-name &allow-other-keys) &rest field-descriptions)

Defines a struct that represents binary data. Also generates two methods for this struct, named
READ-BINARY and WRITE-BINARY, which (de)serialize the struct to or from a stream. The serialization is
a direct binary representation of the fields of the struct. For instance, if there’s a field with a :TYPE of
(UNSIGNED-BYTE 32), 4 bytes will be written in the specified :BYTE-ORDER. The fields are written (or read) in
the order in which they are specified in the body of the DEFBINARY form.

ARGUMENTS

NAME - Used as the name in the generated DEFSTRUCT form.

:BYTE-ORDER - The byte-order to use when reading or writing multi-byte
data. Accepted values are :BIG-ENDIAN, :LITTLE-ENDIAN,
and :DYNAMIC. If :DYNAMIC is specified, then the
READ- and WRITE-BINARY methods will consult the special
variable LISP-BINARY:*BYTE-ORDER* at runtime to decide
which byte order to use. That variable is expected to
be either :LITTLE-ENDIAN or :BIG-ENDIAN.

:PRESERVE-*BYTE-ORDER* - Don’t revert changes that get made to
LISP-BINARY:*BYTE-ORDER* during the call
to either READ- or WRITE-BINARY.

:ALIGN - Align to the specified byte boundary before reading or writing
the struct.

:EXPORT - Export all symbols associated with the generated struct,
including the name of the struct, the name of the constructor,
and all the slot names.

:BYTE-COUNT-NAME - In all value and type forms, bind to this name
the number of bytes in the struct written so far.

&ALLOW-OTHER-KEYS - All other keyword arguments will be passed through
to the generated CL:DEFSTRUCT form as part of the
NAME-AND-OPTIONS argument.

FIELD-DESCRIPTIONS - A list of slot specifications, having the following structure:

(FIELD-NAME DEFAULT-VALUE &KEY TYPE BYTE-ORDER ALIGN ELEMENT-ALIGN
READER WRITER BIND-INDEX-TO)

The parameters have the following meanings:

FIELD-NAME - The name of the slot.

DEFAULT-VALUE - The default value.

TYPE - The type of the field. Some Common Lisp types such as
(UNSIGNED-BYTE 32) are supported. Any type defined
with DEFBINARY is also supported. For more info, see
’TYPES’ below.

BYTE-ORDER - The byte order to use when reading or writing this
field. Defaults to the BYTE-ORDER given for the whole
struct.

ALIGN - If specified, reads and writes will be aligned on this
boundary. When reading, bytes will be thrown away until
alignment is achieved. When writing, NUL bytes will be
written.

UNTYPED-STRUCT - Don’t declare the :TYPEs of the fields in the generated
DEFSTRUCT form.

ELEMENT-ALIGN - If the TYPE is an array, each element of the array will
be aligned to this boundary.

READER - If speficied, this function will be used to read the field.
It must accept one argument (a stream), and return two
values - The object read, and the the number of bytes read.
The number of bytes read is used for alignment purposes.

WRITER - If specified, this function will be used to write the field.
It must accept two arguments (the object to write, and the
stream), and return the number of bytes written, which is
used for alignment purposes.

BIND-INDEX-TO - If the EVAL type specifier is used as an array’s element type
(see below), BIND-INDEX-TO will be bound to the current index
into the array, in case that matters for determining the type
of the next element.

Example:

(defbinary simple-binary (:export t
:byte-order :little-endian)
(magic 38284 :type (magic :actual-type (unsigned-byte 16)
:value 38284))
(size 0 :type (unsigned-byte 32))
(oddball-value 0 :type (unsigned-byte 32)
:byte-order :big-endian)
((b g r) 0 :type (bit-field :raw-type (unsigned-byte 8)
:member-types
((unsigned-byte 2)
(unsigned-byte 3)
(unsigned-byte 3))))
(name "" :type (counted-string 1 :external-format :utf8))
(alias #() :type (counted-buffer 4)
:byte-order :big-endian)
(floating-point 0.0d0 :type double-float)
(big-float 0 :type octuple-float)
(odd-float 0 :type (double-float :byte-order :big-endian))
(c-string "" :type (terminated-buffer 1 :terminator 0))
(nothing nil :type null) ;; Reads and writes nothing.
(other-struct nil :type other-binary
:reader #’read-other-binary
:writer #’write-other-binary)
(struct-array #() :type (counted-array 1 simple-binary))
(blah-type 0 :type (unsigned-byte 32))
(blah nil :type (eval (case oddball-value
((1) ’(unsigned-byte 32))
((2) ’(counted-string 2)))))
(an-array #() :type (simple-array (unsigned-byte 32) ((length c-string))))
(body #() :type (simple-array (unsigned-byte 8) (size))))

The above generates a DEFSTRUCT definition for SIMPLE-BINARY, along with
a definition for a READ-BINARY method and a WRITE-BINARY method.

The READ-BINARY method is EQL-specialized, and will construct the needed
object for you. It can be invoked like this:

(read-binary ’simple-binary stream)

The WRITE-BINARY method is called like this:

(write-binary object stream)

TYPES

DEFBINARY supports two kinds of types: Ordinary Common Lisp types, and Virtual Types.

Out of the Common Lisp types, DEFBINARY knows how to read:

(UNSIGNED-BYTE n) and (SIGNED-BYTE n &key (signed-representation :twos-complement),
where N is the number of bits. Since these types are used so frequently in DEFBINARY
structs, there is a shorthand for them: You can simply use the number of bits as the
type. Positive for unsigned, and negative for signed (two’s complement only). Example:

(defbinary foobar ()
(x 0 :type 16) ;; 16-bit unsigned
(y 1 :type -16)) ;; 16-bit signed

If you need to read one’s complement, it must be written out:

(defbinary foobar ()
(x 0 :type (signed-byte 16 :signed-representation :ones-complement)))

float, short-float, half-float, single-float, double-float, quadruple-float,
and octuple-float.

FLOAT and SINGLE-FLOAT are treated as IEEE Single Precision,
DOUBLE-FLOAT is treated as IEEE Double Precision, while the others are read
in as IEEE Half Precision, Quadruple Precision, etc.

HALF-FLOAT is stored in memory as a single-float, while floats larger than
Double Precision are decoded into RATIONAL numbers to preserve their
precision (they are encoded in their proper format on writing).

(SIMPLE-ARRAY element-type (size))

Example:

(defbinary foobar ()
(size 0 :type (unsigned-byte 16))
(arr #() :type (simple-array (unsigned-byte 8) (size))))

For the element type, any real or virtual type supported by DEFBINARY is allowed.
The SIZE is a Lisp expression that will be evaluated in an environment where all
previous members of the struct are bound to their names.

DEFBINARY will read and write all other CL objects using their READ-BINARY and
WRITE-BINARY methods, if defined.

The virtual types are:

(COUNTED-ARRAY count-size-in-bytes element-type &key bind-index-to)

This is a SIMPLE-ARRAY preceded by an integer specifying how many
elements are in it. The SIMPLE-ARRAY example above could be rewritten to use
a COUNTED-ARRAY instead, like this:

(defbinary foobar ()
(arr #() :type (counted-array 2 (unsigned-byte 8))))

Obscure fact: The COUNT-SIZE-IN-BYTES does not have to be an integer. It can also be a
fraction, which will trigger non-byte-aligned I/O. (example, if the size is 1/2, then the count
is 4 bits wide, and the first element begins halfway into the same byte as the count) The
ELEMENT-TYPE can also be non-byte-aligned. Doing this can result in needing to use a BIT-STREAM
to do I/O with the struct.

The same obscure fact applies anywhere the library accepts a size in bytes.

(COUNTED-STRING count-size-in-bytes &key (EXTERNAL-FORMAT :latin1))
(COUNTED-BUFFER count-size-in-bytes)

These are like COUNTED-ARRAYS, but their elements are one byte long. Furthermore, a
COUNTED-STRING will be encoded or decoded into a Lisp string according to its EXTERNAL-FORMAT.

The encoding/decoding is done using the FLEXI-STREAMS library, and valid EXTERNAL-FORMATs are those
that are accepted by FLEXI-STREAMS:OCTETS-TO-STRING.

Example:

(defbinary foobar ()
(str "" :type (counted-string 2 :external-format :utf8)))

(TERMINATED-STRING termination-length &key (terminator 0) (extenal-format :latin1))
(TERMINATED-BUFFER termination-length &key (terminator 0))

Specifies a C-style terminated string. The TERMINATOR is an integer that will be en/decoded
according to the field’s BYTE-ORDER. As such, it is capable of being more than one byte long,
so it can be used to specify multi-character terminators such as CRLF.

(FIXED-LENGTH-STRING length &key (external-format :latin1) (padding-character #Nul))

Specifies a string of fixed length. When writing, any excess space
in the string will be padded with the PADDING-CHARACTER. The LENGTH is the
number of bytes desired after encoding.

If the input string is longer than the provided LENGTH, a condition of type
LISP-BINARY:INPUT-STRING-TOO-LONG will be raised. Invoke the restart CL:TRUNCATE
to trim enough excess characters from the string to make it equal to the LENGTH.

(MAGIC &key actual-type value)

Specifies that a magic value will be read and written. The value will be
read as type ACTUAL-TYPE.

If the value read is not CL:EQUAL to the VALUE given, then a condition of type
BAD-MAGIC-VALUE will be raised.

A BAD-MAGIC-VALUE object contains the slots BAD-VALUE and REQUIRED-VALUE.

The error can be ignored by invoking the CL:CONTINUE restart.

BASE-POINTER

Instead of reading or writing this field, CL:FILE-POSITION will be called
on the current stream, and the address returned will be stored under a tag
with the same name as this slot. The tag can then be used to calculate
file positions and offsets. See the POINTER type for an example.

FILE-POSITION

Like BASE-POINTER, but no global tag is stored. The slot will contain the
address in the file of the next thing to be read. No actual reading or
writing is triggered by a slot of this type.

(REGION-TAG &key base-pointer-name)

Instead of writing the value of this slot, all POINTERs that have the same
REGION-TAG name as this slot will be written out here, and the corresponding
offsets will be updated. The file being written must be opened with
:DIRECTION :IO. The POINTERs themselves will be written as offsets from
whatever object has the BASE-POINTER named BASE-POINTER-NAME.

(POINTER &key pointer-type data-type base-pointer-name region-tag)

Specifies that the value is really a pointer to another value somewhere else
in the file. When reading, if a BASE-POINTER-NAME is supplied and a base-pointer
tag has been created, then the pointer will be treated as an offset from that
base-pointer. If no BASE-POINTER-NAME is provided, then the pointer is treated
as being an absolute file-position.

The :POINTER-TYPE key specifies the type of the pointer itself, and must be some kind
of integer.

The :DATA-TYPE specifies the data that is being pointed to.

The :REGION-TAG is used when writing. When WRITE-BINARY writes this field, what
it really does is just write a zero pointer (since the object being pointed to
proably occurs later in the file, so we don’t know what the address is going to
be yet). Then WRITE-BINARY stores the address OF THE POINTER, along with a
serialized representation of the data to be written.

When any WRITE-BINARY method gets to a REGION-TAG field, it writes out all the data
that has been stored under that tag’s name, and goes back to update the pointers.

POINTERs cannot be automatically written if they point to an earlier part of the file
than they themselves occur (no backwards-pointing pointers).

Because it must go back and change what it has previously written, the stream must
be opened with :DIRECTION :IO.

All I/O involving POINTERs, REGION-TAGs, or BASE-POINTERs should be performed
within a WITH-LOCAL-POINTER-RESOLVING-CONTEXT block.

Example:

(defbinary bar ()
(pointer-1 nil :type (pointer :pointer-type (unsigned-byte 16)
:data-type (terminated-string 1)
:base-pointer-name foo-base
:region-tag foo-region))
(pointer-2 0 :type (pointer :pointer-type (unsigned-byte 16)
:data-type quadruple-float
:base-pointer-name foo-base
:region-tag foo-region)))

(defbinary foo ()
(foo-base 0 :type base-pointer)
(bar nil :type bar)
;; POINTER-1 and POINTER-2 will point to this:
(foo-region nil :type (region-tag :base-pointer-name foo-base)))

(with-local-pointer-resolving-context
(let ((input (with-open-binary-file (in "foo.bin")
(read-binary ’foo in))))
(with-open-binary-file (out "bar.bin"
:direction :io)
(write-binary input stream))))

(BIT-FIELD &key raw-type member-types)

Specifies that multiple values are to be OR’d into a single integer for serialization
purposes. The name of a slot of this type must be specified as a list of names,
one for each value in the bit field. :RAW-TYPE specifies the type of the single integer
into which everything is being stored, and must meet the following requirements:

1. Be of the form (UNSIGNED-BYTE n)
2. Where N is divisible by 8.

The :MEMBER-TYPES is an unevaluated list of types that must consist entirely of
(UNSIGNED-BYTE b) or (SIGNED-BYTE b) types. The Bs must add up to N above.

READ-BINARY will automatically separate the values in the bit field into their
slots, and WRITE-BINARY will automatically OR them back together.

The default value you specify for this field should be given as a list
of default values for each of the subfields.

(CUSTOM &key reader writer (lisp-type t))

Specifies a slot of type LISP-TYPE that will be read by the provided
READER function and written with the provided WRITER function

The READER function must accept the lambda-list (STREAM), and its
argument will be the stream currently being read.

The WRITER function must accept the lambda-list (OBJECT STREAM), and
it is generally expected to write the OBJECT to the STREAM.

If these functions are specified as LAMBDA forms, then they will
be closures. The READER can expect every field that has been read
so far to be bound to their names, while the WRITER can expect
to be able to see all the slots in the struct being written.

Both functions are optional.

NULL

Reading and writing will be a no-op. The value of a field of type NULL will always read
as NIL and be ignored when writing.

RUNTIME TYPE DETERMINATION

(EVAL unquoted-type-expression)

The EVAL type specifier causes the type to be computed at runtime. The UNQUOTED-TYPE-EXPRESSION will be
evaluated just before attempting to read the field of this type in an environment where all the
previously-defined fields are bound to their names.

Example:

(defbinary foobar ()
(type-tag 0 :type (unsigned-byte 32))
(data nil :type (eval (case type-tag
(1 ’(unsigned-byte 16))
(2 ’(counted-string 1 :external-format :utf-8))))))

In the above example, READ-BINARY will first read the TYPE-TAG as an (UNSIGNED-BYTE 32),
then it will evaluate the CASE expression in order to get the type of the DATA. Then it
will generate a reader and a writer the same way DEFBINARY normally does, except at runtime
instead of compile time.

The CASE expression is not actually evaluated with a runtime call to EVAL. Instead, it is
embedded directly in the source code of the generated READ-BINARY and WRITE-BINARY methods.

The reader/writer code derived from the resulting type expression, however, *is* evaluated with
a runtime call to EVAL, and the part of the macroexpander that handles type fields gets called
at runtime as well.

If the UNQUOTED-TYPE-EXPRESSION evaluates to another EVAL type specifier, then that specifier
will be expanded once again.

DEFINING STRINGS

:EXTERNAL-FORMAT is any value accepted by flexi-streams:octets-to-string, such as :latin1 or :utf8.

String count and terminated-buffer terminator lengths are given in BYTES, unlike the
Common Lisp type ’(unsigned-byte n)’ in which the length is given in bits.

The types COUNTED-STRING and COUNTED-BUFFER are virtual types. When encountered, DEFBINARY will
generate code that deals with counted strings and buffers, which are blocks of data that begin
with a size. The number passed with this type is the size of the count. The difference between the
two is that one of them is converted to and from a STRING while the other retains its raw binary
representation and will be a SIMPLE-ARRAY of (UNSIGNED-BYTE 8).

(TERMINATED-STRING terminator-size) and (TERMINATED-BUFFER terminator-size) are for blocks of data that end with a
terminator of some kind. The terminator is not produced as part of the buffer. The terminator-size defaults to 1.

All generated buffers and strings are guaranteed to have the type SIMPLE-ARRAY.

ARRAYS OF COMPLEX TYPES

In the (SIMPLE-ARRAY element-type length) type specifier, the LENGTH is evaluated when the array is being read.
Previously defined fields will be bound. The ELEMENT-TYPE can be any type supported by DEFBINARY, including
the EVAL type specifier and the COUNTED-STRING, COUNTED-BUFFER, TERMINATED-STRING, and TERMINATED-BUFFER virtual
types. Notably, ELEMENT-TYPE can be other types that were previously defined with DEFBINARY.

There is also the type (COUNTED-ARRAY count-size element-type), which functions like COUNTED-STRING or COUNTED-BUFFER,
except that each element of the array can be a complex type.

NON-BYTE-ALIGNED I/O: AN ALTERNATIVE TO BIT FIELDS

DEFBINARY supports non-byte-aligned reads. For example, if you want to read a 4-bit
unsigned integer and a 12-bit signed integer:

(defbinary non-conforming (:byte-order :big-endian)
(x 0 :type 4)
(y 0 :type 12)) ;; Total: 16 bits.

The above will compile to a single 16-bit read, and the two values will be automatically
extracted into their respective fields. The reverse operation is generated for writing.

In fact, the above is converted into a BIT-FIELD declaration, so it is exactly equivalent
to the following:

(defbinary non-conforming-bit-field-version (:byte-order :big-endian)
((x y) 0 :type (bit-field :raw-type (unsigned-byte 16)
:member-types ((unsigned-byte 4)
(unsigned-byte 12)))))

The macro will group sets signed or unsigned bytes to achieve a read that consists of
whole bytes. This grouping mechanism only works for SIGNED-BYTE and UNSIGNED-BYTE integers.

For other types, DEFBINARY will generate a temporary BIT-STREAM for the non-byte-aligned parts:

(defbinary non-byte-aligned-string (:byte-order :big-endian)
(x 0 :type 4)
(string "" :type (counted-string 1))
(y 0 :type 4))
;; End of non-byte-aligned part
(z "" :type (counted-string 1)))

As long as the sum of the bits adds up to a whole number of bytes, no
special handling is required on the part of the programmer. Internally,
the above generates a temporary bit-stream and reads from it, and it discards
the bit-stream before reading Z, because Z doesn’t require non-byte-aligned I/O.
This is slower than doing whole-byte reads.

Finally, you can specify bytes that throw off the byte-alignment of the
stream:

(defbinary stays-non-byte-aligned ()
(x 0 :type 3))

If the macro cannot group the fields in the struct into byte-aligned reads,
then the struct can only be read from a BIT-STREAM and not a normal
stream (see WRAP-IN-BIT-STREAM and WITH-WRAPPED-IN-BIT-STREAM). In this
case, the macro will generate READ-BINARY and WRITE-BINARY methods that
are specialized to a second argument of type BIT-STREAM.

BIT-STREAMs can wrap any type of stream, including other BIT-STREAMs. This
means that you can nest one struct that does BIT-STREAM I/O inside another:

(defbinary stays-non-byte-aligned ()
(x 0 :type 3)
(y nil :type non-byte-aligned-string)) ;; See above

NON-BYTE-ALIGNED FIELDS and LITTLE ENDIANNESS

Bit fields are inherently confusing when they are applied to little-endian data (unlike
big-endian data, where they make perfect sense). This is because programmers who write
specifications for little-endian formats sometimes still describe the bit fields by
starting with the most significant bit.

Also, code that handles bit fields from little endian data may also handle that data
starting with the most significant bit (including some byte-order-independent code in
this library).

The BIT-FIELD type in DEFBINARY adds to this confusion, since the fields must always
be given starting with the most significant bit, regardless of the format’s byte order.

However, when specifying non-byte-aligned fields without using BIT-FIELDs, they must be
specified starting with the LEAST significant bit in a LITTLE-ENDIAN format, but they
must be specified starting with the MOST significant bit in a BIG-ENDIAN format. For
example, consider the following toy format:

(defbinary toy-format (:byte-order :little-endian)
(a 0 :type 4)
(b 0 :type 16)
(c 0 :type 4))

Write it to disk with the following code:

(with-open-binary-file (out #P"/tmp/test-1.bin" :direction :output
:if-exists :supersede
:if-does-not-exist :create)
(write-binary (make-toy-format :a #x1 :b #x2345 :c #x6) out))

The resulting file would produce the following confusing hex dump:

51 34 62

What is that 5 from the middle doing at the very beginning?!?! Since 0x5 is
the second-least-significant nibble in the structure, it appears in the
most significant nibble of the least significant byte.

Reading the above as a little-endian, 24-bit unsigned integer gives the
integer #x623451, which is what you should have been expecting, since
C is the most significant field, and its value is 6.

You can also specify the above format using the BIT-FIELD type. But then you
have to account for the fact that in a BIT-FIELD type description, you always
describe the most significant bits first, no matter what. So the variables
and their corresponding types have to be reversed:

(defbinary toy-format/bit-field (:byte-order :little-endian)
((c b a) nil :type (bit-field :raw-type (unsigned-byte 24)
:member-types ((unsigned-byte 4)
(unsigned-byte 16)
(unsigned-byte 4)))))

ALIGNMENT

DEFBINARY can generate aligned structures. Alignment is calculated as an offset from the beginning of the structure
being defined. If a SIMPLE-ARRAY is defined with :ALIGN-ELEMENT {boundary}, then each element will be aligned to that
boundary. On writes, the alignment is achieved by writing NUL (0) bytes. On reads, the alignment is performed by
reading bytes from the stream one at a time. Alignment is always performed before reading and writing, never after.

MANUAL ALIGNMENT

If the &KEY argument :BYTE-COUNT-NAME is specified, then the name given will be bound as a variable whose value is the number of bytes read or written so far. This binding is visible in forms that are evaluated at runtime, such as array-length specifiers and EVAL type specifiers.

FLOATING-POINT NUMBERS

DEFBINARY can read IEEE floats ranging from half-precision up to octuple precision. Double-precision and below are
represented in memory by hardware floats, while larger-precision floats are decoded into RATIONALs.

Furthermore, single and double-precision floats are decoded from their byte representation by using CFFI, which
lets the hardware do the work on those systems that have FPUs (such as x86/AMD machines).

All other types of floating-point number are encoded and decoded using arithmetic.

Package

lisp-binary.

Source

binary-2.lisp.

Macro: define-enum (name size/bytes (&key signed signed-representation byte-order reader writer) &rest values)

Define an enum type. What this does is allow LISP-BINARY to automatically map between keywords and integer values that are expected to be found in a binary file. The SIZE is in bytes.

Example:

(define-enum speeds 2 ()
slow ;; Implicitly 0
light-speed ;; Implicitly 1
(ridiculous-speed 5) ;; Explicit value
ludicrous-speed) ;; Implicitly 6

The READER and WRITER functions must accept the same lambda-lists
as READ-INTEGER and WRITE-INTEGER, and have the same return
values (ie, the READER returns (VALUES object bytes-read) and the
WRITER returns bytes-written).

Package

lisp-binary.

Source

binary-1.lisp.

Macro: destructuring-case (expression &rest cases)

Matches the EXPRESSION against one of the CASES. Each CASE is of
the form (lambda-list &key where &body body) and can have a guard clause.

The first pattern that successfully DESTRUCTURING-BINDs against the EXPRESSION without an error *and* satisfies the optional :WHERE expression is the one that will be selected. OTHERWISE is supported and works just as in the CL:CASE form.

Example:

(destructuring-case ’(1 2 3)
((a b c) :where (symbolp a)
(declare (ignore b c))
(list :symbol a))
((a b &optional c) :where (number b)
(declare (ignore a c)))
(list :number b))
((a &rest b)
(declare (ignore b))
(list :whatever a))
(otherwise
:nothing-matched))

The DECLARE form is processed before the :WHERE clause even though it appears after it.

Package

lisp-binary-utils.

Source

utils.lisp.

Macro: destructuring-lambda (lambda-list &body body)
Package

lisp-binary-utils.

Source

utils.lisp.

Macro: encode-float-bits (fraction &key format)
Package

lisp-binary/float.

Source

float.lisp.

Macro: let-values (bindings &body body)
Package

lisp-binary-utils.

Source

utils.lisp.

Macro: let-values* (bindings &body body)

Optimized implementation of LET-VALUES*. You can bind a multiple-value expression to
a list of variables, or you can bind a single value. Generates as few nested MULTIPLE-VALUE-BIND and LET* forms as possible.

Package

lisp-binary-utils.

Source

utils.lisp.

Macro: letf (place-bindings &body body)

Temporarily rebind places like you would special variables. Before control enters the BODY, the PLACE-BINDINGS are altered using SETF, and after exiting the BODY, their values are restored to their original values with SETF.

Similar to CL-LETF in Emacs.

Package

lisp-binary-utils.

Source

utils.lisp.

Macro: named-let (name defs &body body)
Package

lisp-binary-utils.

Source

utils.lisp.

Macro: pop-bits (n-bits integer-size integer-place)

Pops the N most significant bits off the front of the INTEGER-PLACE and returns it. INTEGER-SIZE is the number of unpopped bits in the integer.

Package

lisp-binary/integer.

Source

integer.lisp.

Macro: pop-bits/le (n-bits integer-place)

Pops the N LEAST significant bits off the front of the INTEGER-PLACE and returns it. INTEGER-SIZE is the number of bits in the integer.

Package

lisp-binary/integer.

Source

integer.lisp.

Macro: push-bits (n integer-size integer-place)

Pushes N onto the front of INTEGER-PLACE,
the ’front’ being defined as the MOST significant bits. The INTEGER-SIZE specifies how many bits are already in the INTEGER-PLACE.

Package

lisp-binary/integer.

Source

integer.lisp.

Macro: push-bits/le (n n-bits integer-place)

Pushes N-BITS bits from N onto the front of INTEGER-PLACE, the ’front’ being defined as the LEAST significant bits. The INTEGER-SIZE specifies how many bits are already in the INTEGER-PLACE.

Package

lisp-binary/integer.

Source

integer.lisp.

Macro: pushover (obj* place &key key test)

Pushes the OBJ* into the PLACE. If an "identical" object is already there, it is overwritten. Whether something in the PLACE is considered "identical" can be controlled with the :TEST and :KEY keywords.

Package

lisp-binary-utils.

Source

utils.lisp.

Macro: read-float (format &key stream result-type byte-order)
Package

lisp-binary/float.

Source

float.lisp.

Macro: simple-define-condition (name parent-classes slots)
Package

lisp-binary-utils.

Source

utils.lisp.

Macro: struct-like-defclass (name superclasses &rest slot-defs)

An extremely simplified version of DEFCLASS. Written because I needed to be able to list the slots of a certain struct.

Package

lisp-binary-utils.

Source

utils.lisp.

Macro: with-buffered-output ((var stream) &body body)

Creates buffered output stream VAR. Data written to VAR will be written to STREAM after the BODY returns. This makes it possible to write binaries that require streams opened in :DIRECTION :IO to streams that are open in :DIRECTION :OUT

Package

lisp-binary.

Source

binary-1.lisp.

Macro: with-file-position ((position stream) &body body)
Package

lisp-binary-utils.

Source

utils.lisp.

Macro: with-local-pointer-resolving-context (&body body)

Deal with POINTERs in a thread-safe manner. Generated READ-BINARY and WRITE-BINARY methods rely on special variables to store information to make sure that offsets are calculated correctly. This macro creates local bindings of all the relevant special variables.

Package

lisp-binary.

Source

binary-1.lisp.

Macro: with-open-binary-file ((stream filespec &rest options &key direction if-exists if-does-not-exist) &body body)

Like WITH-OPEN-FILE, but always opens the file as a binary file.

Package

lisp-binary.

Source

binary-1.lisp.

Macro: with-wrapped-in-bit-stream ((var non-bitstream &key byte-order close-when-done) &body body)
Package

simple-bit-stream.

Source

simple-bit-stream.lisp.

Macro: with-wrapped-in-reverse-stream ((var non-bitstream &key close-when-done) &body body)
Package

reverse-stream.

Source

reverse-stream.lisp.

Macro: write-float (format fraction &key stream byte-order)
Package

lisp-binary/float.

Source

float.lisp.


5.1.3 Ordinary functions

Function: assoc-cdr (item assoc-list &key test)
Package

lisp-binary-utils.

Source

utils.lisp.

Function: buffer (&rest elements)
Package

lisp-binary.

Source

binary-1.lisp.

Function: byte-aligned-p (bit-stream)
Package

simple-bit-stream.

Source

simple-bit-stream.lisp.

Function: decode-ip-addr (raw-msb)
Package

lisp-binary.

Source

binary-1.lisp.

Function: decode-lsb (bytes)
Package

lisp-binary/integer.

Source

integer.lisp.

Function: decode-msb (bytes)
Package

lisp-binary/integer.

Source

integer.lisp.

Function: divisiblep (num denom)
Package

lisp-binary-utils.

Source

utils.lisp.

Function: encode-lsb (number bytes)
Package

lisp-binary/integer.

Source

integer.lisp.

Function: encode-msb (number bytes)
Package

lisp-binary/integer.

Source

integer.lisp.

Function: find-sublist (sublist list)

Finds any part of LIST is equal to SUBLIST and returns it, otherwise returns NIL

Package

lisp-binary-utils.

Source

utils.lisp.

Function: get-lsb-byte (number byte)
Package

lisp-binary/integer.

Source

integer.lisp.

Function: group (list &key test key)
Package

lisp-binary-utils.

Source

utils.lisp.

Function: infinityp (decoded-value)

Returns two values:
T if the DECODED-VALUE represents a floating-point infinity
T if the DECODED-VALUE represents positive infinity, or NIL if it’s negative infinity.

Some Lisp implementations support real floating-point infinities, but the ANSI standard does
not require it, and some Lisp implementations don’t bother to support them. On those implementations, infinities are represented by the keywords :+INF and :-INF. To detect positive/negative infinity portably, use this function.

Package

lisp-binary/float.

Source

float.lisp.

Function: insert-before (before-item new-item list &key test key)
Package

lisp-binary-utils.

Source

utils.lisp.

Function: join-field-bits (field-bits field-signedness field-values)
Package

lisp-binary/integer.

Source

integer.lisp.

Function: mapseq (function sequence)
Package

lisp-binary-utils.

Source

utils.lisp.

Function: nanp (decoded-value)
Package

lisp-binary/float.

Source

float.lisp.

Function: open-binary (pathname &key direction if-exists if-does-not-exist)

Like OPEN, but always opens a binary stream suitable for use with the DEFBINARY library.

Package

lisp-binary.

Source

binary-1.lisp.

Function: plist-replace (plist indicator new-value)
Package

lisp-binary-utils.

Source

utils.lisp.

Function: read-binary-type (type stream &key byte-order align element-align)

Read a value of type TYPE from the STREAM. TYPE is any type supported by the DEFBINARY macro.

Package

lisp-binary.

Source

binary-1.lisp.

Function: read-bits (bits stream)

Reads BITS bits from STREAM. If the STREAM is big-endian, the most significant BITS bits will be read, otherwise, the least significant BITS bits will be. The result is an integer of BITS bits.

Package

simple-bit-stream.

Source

simple-bit-stream.lisp.

Function: read-bytes-with-partial (stream bits)

Reads BITS bits from the STREAM, where BITS is expected to be more than a byte’s worth
of bits. Returns three values:

1. A buffer containing as many whole bytes as possible. This buffer
is always read first, regardless of whether the bitstream is byte-aligned.
2. The partial byte.
3. The number of bits that were read for the partial byte.

The byte order is determined from the STREAM object, which must be a SIMPLE-BIT-STREAM:BIT-STREAM.

Package

simple-bit-stream.

Source

simple-bit-stream.lisp.

Function: read-counted-string (size-len stream &key byte-order)

Reads an unsigned integer of SIZE-LEN bytes in the specified BYTE-ORDER, then reads a byte vector of SIZE-LEN bytes. Returns two values:

1. The byte vector
2. The total number of bytes that were read.

Package

lisp-binary.

Source

binary-1.lisp.

Function: read-enum (enum stream)
Package

lisp-binary.

Source

binary-1.lisp.

Function: read-file (filename &key element-type)
Package

lisp-binary.

Source

binary-1.lisp.

Function: read-integer (length stream &key byte-order signed signed-representation)

Reads an integer of LENGTH bytes from the STREAM in the specified BYTE-ORDER.

If SIGNED is non-NIL, the number is interpreted as being in two’s complement format.

If the STREAM is a BIT-STREAM, then the LENGTH doesn’t have to be an integer.

Package

lisp-binary/integer.

Source

integer.lisp.

Function: read-terminated-string (stream &key terminator)

Reads a string ending in the byte sequence specified by TERMINATOR. The TERMINATOR is not included in the resulting buffer. The default is to read C-style strings, terminated by a zero.

Package

lisp-binary.

Source

binary-1.lisp.

Function: recursive-find (item tree &key test)
Package

lisp-binary-utils.

Source

utils.lisp.

Function: recursive-find-if (pred tree)
Package

lisp-binary-utils.

Source

utils.lisp.

Function: recursive-find-sublist (sublist tree)
Package

lisp-binary-utils.

Source

utils.lisp.

Function: recursive-find/collect (pred tree)
Package

lisp-binary-utils.

Source

utils.lisp.

Function: recursive-map (function tree)
Package

lisp-binary-utils.

Source

utils.lisp.

Function: recursive-mapcar (function tree &optional traverse-results result)

Maps the FUNCTION onto every node in the TREE. Works correctly with improper lists.

If TRAVERSE-RESULTS is non-NIL, then RECURSIVE-MAPCAR will traverse the result of the FUNCTION even if it is not EQ to the original value.

Package

lisp-binary-utils.

Source

utils.lisp.

Function: relative-file-position (stream offset)
Package

lisp-binary-utils.

Source

utils.lisp.

Function: remove-binding (var form)

Removes any binding for VAR from all LET, LET*, LET-VALUES, or LET-VALUES* forms found in the FORM.

Package

lisp-binary-utils.

Source

utils.lisp.

Function: remove-plist-keys (plist &rest keys)
Package

lisp-binary-utils.

Source

utils.lisp.

Function: signed->unsigned (n bytes &optional type)
Package

lisp-binary/integer.

Source

integer.lisp.

Function: signed->unsigned/bits (n bits)
Package

lisp-binary/integer.

Source

integer.lisp.

Function: split-bit-field (integer field-bits &optional field-signedness)

Given the INTEGER, split it up as a bit field. The sizes and number of elements are given by the FIELD-BITS parameter. If FIELD-SIGNEDNESS is specified, then it must be a list that contains NIL for each element that will be interpreted as an unsigned integer, and non-NIL for signed integers.

Example:

CL-USER> (split-bit-field #xffaaff ’(8 8 8))
255
170
255
CL-USER>

Better performance could be acheived if INTEGER could be a FIXNUM, but it can’t.

Package

lisp-binary/integer.

Source

integer.lisp.

Function: subst* (bindings form &key test)
Package

lisp-binary-utils.

Source

utils.lisp.

Function: unsigned->signed (n bytes &key type)
Package

lisp-binary/integer.

Source

integer.lisp.

Function: unsigned->signed/bits (n bits)
Package

lisp-binary/integer.

Source

integer.lisp.

Function: write-binary-type (value type stream &key byte-order align element-align)

Write the VALUE, interpreting it as type TYPE, to the STREAM. The TYPE is any type supported by the DEFBINARY macro.

Package

lisp-binary.

Source

binary-1.lisp.

Function: write-bits (n n-bits stream)
Package

simple-bit-stream.

Source

simple-bit-stream.lisp.

Function: write-counted-string (size-len stream buffer &key byte-order)

Writes the length of the BUFFER on the STREAM as an unsigned integer of SIZE-LEN bytes in the specified BYTE-ORDER, then writes out the BUFFER.

Package

lisp-binary.

Source

binary-1.lisp.

Function: write-enum (enum symbol stream)
Package

lisp-binary.

Source

binary-1.lisp.

Function: write-integer (number size stream &key byte-order signed-representation signed)
Package

lisp-binary/integer.

Source

integer.lisp.

Function: write-terminated-string (string stream &key terminator)
Package

lisp-binary.

Source

binary-1.lisp.


5.1.4 Generic functions

Generic Function: read-binary (type stream)
Package

lisp-binary.

Source

binary-1.lisp.

Methods
Method: read-binary ((type (eql lisp-binary:terminated-string)) stream)
Generic Function: read-bytes (n stream &key element-type)

Read N bytes of type ELEMENT-TYPE from STREAM and return them in a newly-allocated array.

Returns two values: The array containing the bytes, and the number of bytes read.

For some types of stream, it is legal to use a fractional number for N. In that case,
the whole bytes are read first, and then the leftover bits. The leftover bits are given
their own byte at the end of the returned array. The second return value (# of bytes read)
will also be fractional in this case. The fractional part can be used to calculate
how many bits the partial byte represents.

If you’re using 8-bit bytes and want to read 11 bits (a whole byte plus three bits), give
11/8 as the value of N.

NOTE: If you’re using this with a bit-stream created with WRAP-IN-BIT-STREAM, the :BYTE-ORDER given to that function should match the one given to this function.

Package

lisp-binary/integer.

Source

integer.lisp.

Methods
Method: read-bytes (n (stream bit-stream) &key element-type)
Source

binary-1.lisp.

Method: read-bytes (n stream &key element-type)
Generic Function: wrap-in-bit-stream (object &key byte-order)

Creates a BIT-STREAM that can read one bit at a time from the OBJECT. The BIT-STREAM can be discarded if BYTE-ALIGNED-P returns T.

Package

simple-bit-stream.

Source

simple-bit-stream.lisp.

Methods
Method: wrap-in-bit-stream ((object stream) &key byte-order)
Generic Function: wrap-in-reverse-stream (object)

Creates a REVERSE-STREAM that can read one bit at a time from the OBJECT. The REVERSE-STREAM can be discarded if BYTE-ALIGNED-P returns T.

Package

reverse-stream.

Source

reverse-stream.lisp.

Methods
Method: wrap-in-reverse-stream ((object stream))
Generic Function: write-binary (obj stream)
Package

lisp-binary.

Source

binary-1.lisp.

Generic Function: write-bytes (buffer stream &optional bytes)

Write BYTES bytes of the BUFFER into the STREAM. If
BYTES is not provided, then the whole BUFFER is written.

For some types of stream, it is legal to use a fractional number for BYTES. In that case, the whole bytes are written first, and then the leftover bits. The leftover bits must be given their own byte at the end of the BUFFER. WRITE-BYTES assumes that all bytes are 8 bits long, so to write 4 bits, you would give 1/2 as the value of BYTES.

NOTE: If you’re using this with a bit-stream created with WRAP-IN-BIT-STREAM, the :BYTE-ORDER given to that function should match the one given to this function.

Package

lisp-binary/integer.

Source

integer.lisp.

Methods
Method: write-bytes (buffer (stream bit-stream) &optional bytes)
Source

binary-1.lisp.

Method: write-bytes (buffer stream &optional bytes)

5.1.5 Standalone methods

Method: close ((stream reverse-stream) &key abort)
Source

reverse-stream.lisp.

Method: close ((stream bit-stream) &key abort)
Source

simple-bit-stream.lisp.

Method: stream-element-type ((stream bit-stream))
Source

simple-bit-stream.lisp.

Method: stream-file-position ((stream reverse-stream) &optional position-spec)
Package

sb-gray.

Source

reverse-stream.lisp.

Method: stream-file-position ((stream bit-stream) &optional position-spec)
Package

sb-gray.

Source

simple-bit-stream.lisp.

Method: stream-finish-output ((stream reverse-stream))
Package

sb-gray.

Source

reverse-stream.lisp.

Method: stream-finish-output ((stream bit-stream))
Package

sb-gray.

Source

simple-bit-stream.lisp.

Method: stream-force-output ((stream reverse-stream))
Package

sb-gray.

Source

reverse-stream.lisp.

Method: stream-force-output ((stream bit-stream))
Package

sb-gray.

Source

simple-bit-stream.lisp.

Method: stream-read-byte ((stream reverse-stream))
Package

sb-gray.

Source

reverse-stream.lisp.

Method: stream-read-byte ((stream bit-stream))
Package

sb-gray.

Source

simple-bit-stream.lisp.

Method: stream-read-sequence ((stream reverse-stream) (sequence array) &optional start end)
Package

sb-gray.

Source

reverse-stream.lisp.

Method: stream-read-sequence ((stream bit-stream) (sequence array) &optional start end)
Package

sb-gray.

Source

simple-bit-stream.lisp.

Method: stream-write-byte ((stream reverse-stream) integer)
Package

sb-gray.

Source

reverse-stream.lisp.

Method: stream-write-byte ((stream bit-stream) integer)
Package

sb-gray.

Source

simple-bit-stream.lisp.

Method: stream-write-sequence ((stream reverse-stream) seq &optional start end)
Package

sb-gray.

Source

reverse-stream.lisp.

Method: stream-write-sequence ((stream bit-stream) seq &optional start end)
Package

sb-gray.

Source

simple-bit-stream.lisp.


5.1.6 Conditions

Condition: bad-enum-value
Package

lisp-binary.

Source

binary-1.lisp.

Direct superclasses

simple-error.

Direct slots
Slot: integer-value
Initargs

:integer-value

Slot: symbol-value
Package

common-lisp.

Initargs

:symbol-value

Slot: enum-name
Initargs

:enum-name

Condition: bad-magic-value
Package

lisp-binary.

Source

binary-1.lisp.

Direct superclasses

simple-error.

Direct slots
Slot: bad-value
Initargs

:bad-value

Slot: required-value
Initargs

:required-value

Condition: input-string-too-long
Package

lisp-binary.

Source

binary-1.lisp.

Direct superclasses

simple-error.

Direct slots
Slot: input-string
Initargs

:input-string

Condition: no-destructuring-match
Package

lisp-binary-utils.

Source

utils.lisp.

Direct superclasses

warning.


5.1.7 Classes

Class: bit-stream
Package

lisp-binary/integer.

Source

simple-bit-stream.lisp.

Direct superclasses
  • fundamental-binary-stream.
  • fundamental-input-stream.
  • fundamental-output-stream.
Direct methods
Direct slots
Slot: element-bits
Package

simple-bit-stream.

Type

fixnum

Initform

8

Initargs

:element-bits

Slot: real-stream
Package

simple-bit-stream.

Type

stream

Initargs

:real-stream

Slot: last-byte
Package

simple-bit-stream.

Type

(or unsigned-byte null)

Initform

0

Slot: last-op
Package

simple-bit-stream.

Type

symbol

Slot: bits-left
Package

simple-bit-stream.

Type

integer

Initform

0

Slot: byte-order
Package

simple-bit-stream.

Type

keyword

Initform

:little-endian

Initargs

:byte-order

Class: pointer
Package

lisp-binary.

Source

binary-1.lisp.

Direct methods
Direct slots
Slot: offset
Type

integer

Initform

0

Initargs

:offset

Readers

pointer-offset.

Writers

(setf pointer-offset).

Slot: type
Package

common-lisp.

Type

symbol

Initargs

:type

Readers

pointer-type.

Writers

(setf pointer-type).

Slot: base-pointer
Type

keyword

Initform

:beginning

Initargs

:base-pointer

Readers

pointer-base-pointer.

Writers

(setf pointer-base-pointer).

Slot: stream
Package

common-lisp.

Type

stream

Initform

*standard-input*

Initargs

:stream

Readers

pointer-stream.

Writers

(setf pointer-stream).

Class: reverse-stream
Package

reverse-stream.

Source

reverse-stream.lisp.

Direct superclasses

fundamental-binary-stream.

Direct methods
Direct slots
Slot: element-bits
Type

fixnum

Initform

8

Initargs

:element-bits

Slot: lookup-table
Initargs

:lookup-table

Slot: real-stream
Type

stream

Initargs

:real-stream


5.2 Internals


5.2.1 Special variables

Special Variable: *8-bit-lookup-table*
Package

reverse-stream.

Source

reverse-stream.lisp.

Special Variable: *always-produce-byte-count*

These functions are known to always produce a byte count, so DEFBINARY doesn’t have to generate code to verify that they did.

Package

lisp-binary.

Source

binary-1.lisp.

Special Variable: *base-pointer-tags*
Package

lisp-binary.

Source

binary-1.lisp.

Special Variable: *debug*
Package

lisp-binary.

Source

binary-1.lisp.

Special Variable: *denormals*
Package

lisp-binary/float.

Source

float.lisp.

Special Variable: *enum-definitions*
Package

lisp-binary.

Source

binary-1.lisp.

Special Variable: *format-table*
Package

lisp-binary/float.

Source

float.lisp.

Special Variable: *ignore-eval-type-bitstream-issue*

If a DEFBINARY struct contains a field of type (EVAL ...),
then the macro cannot statically determine whether the struct can
be read without using a BIT-STREAM. If this is set to NIL, then
a condition is raised every time an (EVAL ...) type is encountered,
with restarts available to tell the macro whether a bitstream is
required for that particular field.

Typically, the error would reach EMACS, and the programmer can then
pick a restart from the menu.

However, this doesn’t work if you’re using COMPILE-FILE, because COMPILE-FILE
catches exceptions, so you don’t see the error until it has already been
caught, so you will not be presented with the restarts that I have set up.

For most programs, just ignoring the issue is good enough. Setting this to T (the default) causes the expander to ignore this problem and not raise a condition.

Package

lisp-binary.

Source

binary-1.lisp.

Special Variable: *ignore-on-write*
Package

lisp-binary.

Source

binary-1.lisp.

Special Variable: *known-defbinary-types*

An alist whose keys are the names of DEFBINARY structs and whose values are the field-descriptions of those structs. Needed by TYPE-SIZE

Package

lisp-binary.

Source

binary-1.lisp.

Special Variable: *last-f*
Package

lisp-binary.

Source

binary-2.lisp.

Special Variable: *outer-stream-file-position*
Package

lisp-binary.

Source

binary-1.lisp.

Special Variable: *queued-pointers*
Package

lisp-binary.

Source

binary-1.lisp.

Special Variable: *type-expanders*
Package

lisp-binary.

Source

binary-1.lisp.

Special Variable: *type-info-objects*
Package

lisp-binary.

Source

binary-1.lisp.

Special Variable: *virtual-types*
Package

lisp-binary.

Source

binary-1.lisp.

Special Variable: debug-data
Package

lisp-binary.

Source

binary-1.lisp.

Special Variable: defbinary-type
Package

lisp-binary.

Source

binary-1.lisp.


5.2.2 Macros

Macro: acond (&rest cases)
Package

lisp-binary-utils.

Source

utils.lisp.

Macro: decode-float-bits/arithmetic-macro (integer &key format result-type)
Package

lisp-binary/float.

Source

float.lisp.

Macro: define-lisp-binary-type (type-info-var lambda-list &body body)

Defines a LISP-BINARY type. The TYPE-INFO-VAR will be bound to a DEFBINARY-TYPE
object that describes the field. The LAMBDA-LIST will be structurally matched against
the :TYPE parameter specified in the DEFBINARY form. The BODY may begin with the keyword
:WHERE followed by a form. If present, this form acts as a further condition for considering
the LAMBDA-LIST to match the :TYPE parameter.

The BODY is expected to return 3 values:

1. The Lisp type that should be used to represent the instance of this LISP-BINARY type described
by the LAMBDA-LIST.
2. A form that reads an instance of the data described by the LAMBDA-LIST from a stream whose name
will be bound to STREAM-SYMBOL.
3. A form that writes an instance of the data from a variable whose name will be bound to NAME, into
a stream whose name is bound to STREAM-SYMBOL.

The slots of the DEFBINARY-TYPE object provide extra information, and will be bound in the BODY using WITH-SLOTS. These slots are described below:

NAME - The name of the variable to be defined. The WRITER-FORM will be evaluated in a context
where the NAME is bound to the object being written.
TYPE - The type specifier. It’s the same value that will have been matched against the LAMBDA-LIST.

BYTE-ORDER - :LITTLE-ENDIAN or :BIG-ENDIAN.
TERMINATOR - A SIMPLE-ARRAY that will be matched against the input to determine the end of a string.
If the TYPE is itself a SIMPLE-ARRAY, TERMINATOR can be a function, which will be passed
each element read. (TODO: Actually implement that function part)
READER - A user-specified function that overrides the reader that this function would otherwise generate.
WRITER - A user-specified writer function that overrides the default writer.
STREAM-SYMBOL - The name that will be given to the input and output stream.

PREVIOUS-DEFS-SYMBOL - A symbol that will be bound to a list of LET bindings at runtime. In the event of
an EVAL type, code is generated that will splice the LET bindings found here
into a runtime-constructed LET form that will then be EVAL’d.
BYTE-COUNT-NAME - The name of the variable that will be bound to the number of bytes read or written so far. ALIGN - The alignment boundary
ELEMENT-ALIGN - The alignment boundary for individual elements in an array.
BIND-INDEX-TO - In array reads and writes, may specify a variable to bind the loop index to.
Or it can be NIL.

Package

lisp-binary.

Source

binary-1.lisp.

Macro: define-virtual-type (name lambda-list reader writer lisp-type &key estimated-total-bits stream-required can-be-in-bit-field)

Define a new Virtual Type.

A Virtual Type is a rule that tells the LISP-BINARY how to read a particular kind of
value from a stream, and how to write it back. The result of reading a Virtually-Typed object
can be an object of any Lisp type. Which Lisp type the Virtual Type corresponds to must
be specified in the LISP-TYPE argument.

The same LISP-TYPE can be produced by many different Virtual Types. As a result, the LISP-BINARY library must always be told which type it is reading or writing. This is usually done at compile-time through the DEFBINARY macro.

The READER and WRITER must be functions.

The READER accepts a STREAM argument and returns two values:

1. The fully-processed value that was read.
2. The number of bytes that were read from the STREAM. If the STREAM is a BIT-STREAM,
then the number of bytes can be fractional, to indicate how much was read down to
the bit. 1/8 of a byte = 1 bit.

The WRITER accepts the lambda list (OBJ STREAM), where OBJ is the value to be written. It
returns the number of bytes that were written.

Package

lisp-binary.

Source

binary-1.lisp.

Macro: encode-float-bits/arithmetic-macro (fraction format)
Package

lisp-binary/float.

Source

float.lisp.

Macro: let-values/stupid* (bindings &body body)

A naive implementation of LET-VALUES*. Each binding must bind a multiple-value expression to a list of variables, and will expand to a nested MULTIPLE-VALUE-BIND expression.

Package

lisp-binary-utils.

Source

utils.lisp.

Macro: make-reader-let-def (f)
Package

lisp-binary.

Source

binary-2.lisp.

Macro: popbit (place)
Package

lisp-binary/float.

Source

float.lisp.

Macro: read-bytes-with-partial/macro (stream* bits byte-order &key adjustable)
Package

simple-bit-stream.

Source

simple-bit-stream.lisp.

Macro: read-octets-to-string (read-form &rest options)
Package

lisp-binary.

Source

binary-1.lisp.

Macro: read/write-binary-type (read-or-write type stream &key value byte-order align element-align)
Package

lisp-binary.

Source

binary-1.lisp.

Macro: tif (expr if-t if-nil)
Package

lisp-binary/integer.

Source

integer.lisp.

Macro: tlabels (labels &body body)
Package

lisp-binary/integer.

Source

integer.lisp.

Macro: with-letf-bindings ((temp-var place-var value-var temp-binding place-binding) &body body)
Package

lisp-binary-utils.

Source

utils.lisp.


5.2.3 Ordinary functions

Function: %infinityp (integer significand-bits exponent-bits)
Package

lisp-binary/float.

Source

float.lisp.

Function: %make-infinity (positivep significand-bits exponent-bits)
Package

lisp-binary/float.

Source

float.lisp.

Function: %make-quiet-nan (significand-bits exponent-bits)
Package

lisp-binary/float.

Source

float.lisp.

Function: %make-reader-let-def (f form-value most-recent-byte-count previous-defs previous-defs-push previous-defs-symbol byte-count-name byte-order)

Creates a single variable definition to go in the let-def form within READ-BINARY. F is a BINARY-FIELD object that describes the field.

Package

lisp-binary.

Source

binary-2.lisp.

Function: %make-signalling-nan (significand-bits exponent-bits)
Package

lisp-binary/float.

Source

float.lisp.

Function: %qnanp (integer significand-bits exponent-bits)
Package

lisp-binary/float.

Source

float.lisp.

Function: %read-float (format stream result-type byte-order)
Package

lisp-binary/float.

Source

float.lisp.

Function: %snanp (integer significand-bits exponent-bits)
Package

lisp-binary/float.

Source

float.lisp.

Function: %stream-read-sequence (stream sequence start end)
Package

reverse-stream.

Source

reverse-stream.lisp.

Function: %stream-read-sequence (stream sequence start end)
Package

simple-bit-stream.

Source

simple-bit-stream.lisp.

Function: %stream-write-sequence (stream sequence start end)
Package

reverse-stream.

Source

reverse-stream.lisp.

Function: %stream-write-sequence (stream sequence start end)
Package

simple-bit-stream.

Source

simple-bit-stream.lisp.

Function: %write-float (format fraction stream byte-order)
Package

lisp-binary/float.

Source

float.lisp.

Function: add-base-pointer-tag (tag pointer)
Package

lisp-binary.

Source

binary-1.lisp.

Function: add-bit-stream-id (field-descriptions)
Package

lisp-binary.

Source

binary-2.lisp.

Function: add-bit-stream-vars (bit-stream-groups stream-symbol byte-order make-let-def let-defs)
Package

lisp-binary.

Source

binary-2.lisp.

Function: add-default-value-if-needed (def)
Package

lisp-binary-utils.

Source

utils.lisp.

Function: add-stream-definitions (bit-stream-groups stream-symbol byte-order let-defs)

If the LET-DEFS contain fields that must be read from a bit-stream, this function
adds the necessary BIT-STREAM type variables to them. BIT-STREAM-GROUPS is a hash table that maps each bit-stream variable name to the BINARY-FIELD objects of the variables that must be read from that bit-stream. The STREAM-SYMBOL is the name of the default stream, and BYTE-ORDER is the :BYTE-ORDER option passed to the DEFBINARY macro (only :BIG-ENDIAN and :LITTLE-ENDIAN are supported. Handling for :DYNAMIC byte order must happen elsewhere).

Package

lisp-binary.

Source

binary-2.lisp.

Function: align-to-boundary (byte-count boundary move-op stream)
Package

lisp-binary.

Source

binary-1.lisp.

Function: array-pop (arr)
Package

lisp-binary.

Source

binary-1.lisp.

Function: ash* (&rest integers)
Package

lisp-binary/integer.

Source

integer.lisp.

Reader: binary-field-bit-stream-id (instance)
Writer: (setf binary-field-bit-stream-id) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

bit-stream-id.

Reader: binary-field-defstruct-field (instance)
Writer: (setf binary-field-defstruct-field) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

defstruct-field.

Reader: binary-field-name (instance)
Writer: (setf binary-field-name) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

name.

Function: binary-field-p (object)
Package

lisp-binary.

Source

binary-1.lisp.

Reader: binary-field-read-form (instance)
Writer: (setf binary-field-read-form) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

read-form.

Reader: binary-field-type (instance)
Writer: (setf binary-field-type) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

type.

Reader: binary-field-write-form (instance)
Writer: (setf binary-field-write-form) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

write-form.

Function: bit-field-type-p (type)
Package

lisp-binary.

Source

binary-2.lisp.

Function: bitfield-spec->defstruct-specs (name default-values options untyped-struct)
Package

lisp-binary.

Source

binary-2.lisp.

Function: build-virtual-type-reader/writer-expander (expression-form value-name stream-symbol)
Package

lisp-binary.

Source

binary-1.lisp.

Function: calculate-exponent (sign fraction)
Package

lisp-binary/float.

Source

float.lisp.

Function: calculate-significand (fraction exponent significand-bits)

Given a FRACTION and number of SIGNIFICAND-BITS, calculates the integer significand. The significand returned includes the implicit bit, which must be removed in the final floating-point encoding.

Package

lisp-binary/float.

Source

float.lisp.

Function: clear-tag (tag)
Package

lisp-binary.

Source

binary-1.lisp.

Function: combine-field-descriptions (field-descriptions)

Group the FIELD-DESCRIPTIONS according to how they should be grouped into bit-fields.

Returns two values:

1. A list of fields very similar to the FIELD-DESCRIPTIONS, except that some elements of the list will be replaced by lists of fields that should be grouped together. Since a single field description is itself a list, use LIST-OF-FIELDS-P to tell the difference between one field and a list of fields.

2. Either :BIT-STREAM-REQUIRED if the whole struct can only be read with a bit-stream, or no second value otherwise.

Package

lisp-binary.

Source

binary-2.lisp.

Function: compute-reversed-byte (n bits)
Package

reverse-stream.

Source

reverse-stream.lisp.

Function: convert-to-bit-fields (field-descriptions)

Converts groups of non-byte-aligning field descriptions into bitfields where possible. If they can’t be read as bitfields, then a :BIT-STREAM-ID option is added to the field.

Package

lisp-binary.

Source

binary-2.lisp.

Function: copy-binary-field (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Function: copy-enum-definition (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Function: copy-out-pointer (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Function: copy-virtual-type (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Function: decode-float-bits/arithmetic (integer significand-bits exponent-bits exponent-bias)

Decodes IEEE floating-point from an integer bit-pattern.

Package

lisp-binary/float.

Source

float.lisp.

Function: decode-float-bits/cffi (integer &key format)

Decodes the bits from a read-in floating-point number using the hardware. Assumes that only :SINGLE and :DOUBLE work.

Package

lisp-binary/float.

Source

float.lisp.

Function: decode-significand (significand significand-bits raw-exponent)

Given an encoded SIGNIFICAND of length SIGNIFICAND-BITS, calculate the
number it represents. RAW-EXPONENT is only used to determine whether to use
the denormalized interpretation of the SIGNIFICAND. The value of SIGNIFICAND-BITS includes the ’implicit bit’ which is not actually encoded in the significand. So, if the SIGNIFICAND is physically 23 bits, plus one implicit bit, then SIGNIFICAND-BITS is 24.

Package

lisp-binary/float.

Source

float.lisp.

Function: defbinary-constructor-name (name defstruct-options)
Package

lisp-binary.

Source

binary-2.lisp.

Function: denormalp (number format)
Package

lisp-binary/float.

Source

float.lisp.

Function: denormalp/arithmetic (number significand-bits exponent-bits exponent-bias)
Package

lisp-binary/float.

Source

float.lisp.

Function: dump-tag (tag base-pointer stream &optional previous-result)
Package

lisp-binary.

Source

binary-1.lisp.

Function: encode-float-bits/arithmetic (fraction significand-bits exponent-bits exponent-bias)

Calculate the bits of a floating-point number using plain arithmetic, given the FRACTION and the format information SIGNIFICAND-BITS, EXPONENT-BITS, and EXPONENT-BIAS. The returned value is an integer.

Package

lisp-binary/float.

Source

float.lisp.

Function: encode-float-bits/cffi (fraction &key format)
Package

lisp-binary/float.

Source

float.lisp.

Function: encode-float-bits/runtime-format (fraction format)
Package

lisp-binary/float.

Source

float.lisp.

Function: encode-significand (significand significand-bits)
Package

lisp-binary/float.

Source

float.lisp.

Reader: enum-definition-byte-order (instance)
Writer: (setf enum-definition-byte-order) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

byte-order.

Reader: enum-definition-name (instance)
Writer: (setf enum-definition-name) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

name.

Function: enum-definition-p (object)
Package

lisp-binary.

Source

binary-1.lisp.

Reader: enum-definition-reader (instance)
Writer: (setf enum-definition-reader) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

reader.

Reader: enum-definition-signed (instance)
Writer: (setf enum-definition-signed) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

signed.

Reader: enum-definition-signed-representation (instance)
Writer: (setf enum-definition-signed-representation) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

signed-representation.

Reader: enum-definition-size (instance)
Writer: (setf enum-definition-size) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

size.

Reader: enum-definition-variables (instance)
Writer: (setf enum-definition-variables) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

variables.

Reader: enum-definition-writer (instance)
Writer: (setf enum-definition-writer) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

writer.

Function: enump (symbol)
Package

lisp-binary.

Source

binary-1.lisp.

Function: expand-byte-shorthand (n)
Package

lisp-binary.

Source

binary-2.lisp.

Function: expand-defbinary-field (name default-value &rest other-keys &key type byte-order byte-count-name align element-align bit-stream-id reader writer stream-symbol previous-defs-symbol bind-index-to &allow-other-keys)

Expands the field into three values: A slot-descriptor suitable for CL:DEFSTRUCT, a form that reads this slot from a stream, and a form that writes it to a stream. The reader and writer must be evaluated in a context where the NAME is bound to the slot’s value.

Package

lisp-binary.

Source

binary-2.lisp.

Function: expand-defbinary-type-field (type-info)

Expands the :TYPE field of a DEFBINARY form. Returns three values:
1. A :TYPE specifier that can be spliced into a slot definition in a DEFSTRUCT form.

2. A READER-FORM that can be spliced into another function to read a datum of the specified
type. The READER-FORM will assume that it will be spliced into a scope where there’s
a readable stream. The name of this stream must be stored in (SLOT-VALUE TYPE-INFO ’STREAM-SYMBOL).

3. A WRITER-FORM to write such a datum. It can be spliced into a scope similar to that of the READER-FORM.

Package

lisp-binary.

Source

binary-2.lisp.

Function: expand-previous-defs (symbol value form)
Package

lisp-binary.

Source

binary-1.lisp.

Function: expand-read/write-binary-type-body (field-name value stream-name stream read/write-form)
Package

lisp-binary.

Source

binary-1.lisp.

Function: expand-struct-like-defclass-slot (class-name name default-value &key type)
Package

lisp-binary-utils.

Source

utils.lisp.

Function: exponent-all-ones-p (integer significand-bits exponent-bits)
Package

lisp-binary/float.

Source

float.lisp.

Function: exponent-zero-p (integer significand-bits exponent-bits)
Package

lisp-binary/float.

Source

float.lisp.

Function: externally-byte-aligned-p (field-descriptions)
Package

lisp-binary.

Source

binary-2.lisp.

Function: field-description-plist (field-description)
Package

lisp-binary.

Source

binary-2.lisp.

Function: field-description-type (field-description)
Package

lisp-binary.

Source

binary-2.lisp.

Function: field-option (field-description option &optional default)
Package

lisp-binary.

Source

binary-2.lisp.

Function: find-bit-field-groups (list &key key)

Identifies those fields in the LIST of fields that must be read/written either as a BIT-FIELD or through a BIT-STREAM wrapper. A list of the original fields is returned, with those groups that will be read/written in a non-byte-aligned mode grouped
in sublists.

See also: TYPE-SIZE

Package

lisp-binary.

Source

binary-2.lisp.

Function: float-coerce (value result-type)

Coerce the VALUE to the RESULT-TYPE, taking into account the fact that values
generated by this library are not always actually numbers. So on Lisp systems that don’t support infinity, (FLOAT-COERCE :+INF ’DOUBLE-FLOAT) will actually leave it alone.

Also takes into account the fact that even on Lisps that do support infinities and NaNs, you can’t coerce them to non-floating-point numbers, so it passes infinities and NaNs through untouched if the RESULT-TYPE isn’t floating-point.

There should never be an error as a result of trying to decode a floating-point bit pattern to a number.

Package

lisp-binary/float.

Source

float.lisp.

Function: float-value (sign significand exponent &optional base)

Given the decoded parameters of a floating-point number, calculate its numerical value.

Package

lisp-binary/float.

Source

float.lisp.

Function: format-size (format)

Returns the size in bytes of a given floating-point format.

Package

lisp-binary/float.

Source

float.lisp.

Function: get-base-pointer-tag (tag)
Package

lisp-binary.

Source

binary-1.lisp.

Function: get-enum-definition (symbol)
Package

lisp-binary.

Source

binary-1.lisp.

Function: get-enum-name (enum value)

Returns the name that corresponds to the VALUE in the given ENUM.

Package

lisp-binary.

Source

binary-1.lisp.

Function: get-enum-value (enum symbol)
Package

lisp-binary.

Source

binary-1.lisp.

Function: get-exponent (integer significand-bits exponent-bits exponent-bias)
Package

lisp-binary/float.

Source

float.lisp.

Function: get-format (format)
Package

lisp-binary/float.

Source

float.lisp.

Function: get-significand (integer significand-bits)

Given an INTEGER that represents the bit-pattern of a floating point number, extract the bits that represent the significand. SIGNIFICAND-BITS specifies the number of bits in the significand. Does not add the implicit bit.

Package

lisp-binary/float.

Source

float.lisp.

Function: get-tag (tag)
Package

lisp-binary.

Source

binary-1.lisp.

Function: get-type-fields (type-name)
Package

lisp-binary.

Source

binary-1.lisp.

Function: group-write-forms (stream-names write-forms)

Groups a list of WRITE-FORMS according to which stream they write to. The streams are identified by matching them to their names, which must be given in STREAM-NAMES.

Package

lisp-binary.

Source

binary-2.lisp.

Function: init-read (stream)
Package

simple-bit-stream.

Source

simple-bit-stream.lisp.

Function: init-write (stream)
Package

simple-bit-stream.

Source

simple-bit-stream.lisp.

Function: list-begins-with-p (list prefix &key test)
Package

lisp-binary-utils.

Source

utils.lisp.

Function: list-of-fields-p (datum)
Package

lisp-binary.

Source

binary-2.lisp.

Function: load-offset (offset)
Package

lisp-binary.

Source

binary-1.lisp.

Function: logior* (&rest args)
Package

lisp-binary/integer.

Source

integer.lisp.

Function: make-binary-field (&key name defstruct-field read-form write-form type bit-stream-id)
Package

lisp-binary.

Source

binary-1.lisp.

Function: make-bit-field (source-fields)
Package

lisp-binary.

Source

binary-2.lisp.

Function: make-enum-definition (&key name size signed byte-order variables signed-representation reader writer)
Package

lisp-binary.

Source

binary-1.lisp.

Function: make-fixed-length-string (normal-string required-length external-format &optional padding-character)

Creates a FIXED-LENGTH-STRING and encodes it for writing. The REQUIRED-LENGTH is the length in bytes of the string
after encoding. The EXTERNAL-FORMAT is any value accepted by the FLEXI-STREAMS library as an external-format.

If the NORMAL-STRING is longer than the REQUIRED-LENGTH after encoding without any padding, then a condition of type INPUT-STRING-TOO-LONG is raised. The restart CL:TRUNCATE tells this function to truncate the string to the required
length.

FIXME:

There is still a potential problem here. Suppose that getting to the REQUIRED-LENGTH requires adding an odd number
of bytes, but the PADDING-CHARACTER is encoded as an even number of bytes. Then this function would loop forever.

Alternately, suppose that the input is too long, and the TRUNCATE restart is chosen. If the input is one byte longer
than the REQUIRED-LENGTH, but the last character in the string is encoded as two bytes, then MAKE-TRUNCATED-FIXED-LENGTH-STRING will never find the right number of characters to trim (the answer is to trim the two-byte character and then pad with a one-byte character). I need to find concrete examples of this. These examples are likely to be found in the UTF-8 encoding.

Package

lisp-binary.

Source

binary-1.lisp.

Function: make-infinity (positivep format)

Creates a floating-point infinity. Returns the integer bit pattern.

Package

lisp-binary/float.

Source

float.lisp.

Function: make-largest-denormal (format result-type)
Package

lisp-binary/float.

Source

float.lisp.

Function: make-lookup-table (bits)
Package

reverse-stream.

Source

reverse-stream.lisp.

Function: make-out-pointer (&key offset-position offset-size/bytes offset-byte-order offset-signedness data-to-store closure)
Package

lisp-binary.

Source

binary-1.lisp.

Function: make-quiet-nan (format)
Package

lisp-binary/float.

Source

float.lisp.

Function: make-signalling-nan (format)
Package

lisp-binary/float.

Source

float.lisp.

Function: make-simple-array (complex-arr element-type)
Package

lisp-binary.

Source

binary-1.lisp.

Function: make-smallest-denormal (format result-type)
Package

lisp-binary/float.

Source

float.lisp.

Function: make-truncated-fixed-length-string (normal-string required-length external-format)
Package

lisp-binary.

Source

binary-1.lisp.

Function: make-virtual-type (&key name lambda-list reader writer lisp-type estimated-total-bits stream-required can-be-in-bit-field)
Package

lisp-binary.

Source

binary-1.lisp.

Function: ones-complement->twos-complement (n)

Given a number that has been decoded as one’s complement, correct it to what its value should be if the original bits were a two’s complement representation. This function doesn’t need the number of bits because all ones in one’s complement represents ’negative zero’, a value that can’t be represented in Common Lisp integers.

Package

lisp-binary/integer.

Source

integer.lisp.

Function: optimize-let-values (let let-values bindings body)
Package

lisp-binary-utils.

Source

utils.lisp.

Reader: out-pointer-closure (instance)
Writer: (setf out-pointer-closure) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

closure.

Reader: out-pointer-data-to-store (instance)
Writer: (setf out-pointer-data-to-store) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

data-to-store.

Reader: out-pointer-offset-byte-order (instance)
Writer: (setf out-pointer-offset-byte-order) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

offset-byte-order.

Reader: out-pointer-offset-position (instance)
Writer: (setf out-pointer-offset-position) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

offset-position.

Reader: out-pointer-offset-signedness (instance)
Writer: (setf out-pointer-offset-signedness) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

offset-signedness.

Reader: out-pointer-offset-size/bytes (instance)
Writer: (setf out-pointer-offset-size/bytes) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

offset-size/bytes.

Function: out-pointer-p (object)
Package

lisp-binary.

Source

binary-1.lisp.

Function: push-to-tag (obj tag)

Add the OBJ to the queue for TAG.

This is the shittiest implementation ever. It functionally rebuilds the entire tag list each time it runs, sometimes discarding this rebuild and going with the original version.

There are several reasons for this. First, the tag system can tolerate a direct SETF of *QUEUED-POINTERS*, but it cannot tolerate mutation of the underlying data structure. That is because I’m attempting to rely on the way special variables work in multithreaded Lisps as a source of thread safety. Mutating *QUEUED-POINTERS* with RPLACA or RPLACD could be seen
in another thread, but rebuilding the list and SETFing it will not affect other threads.

FIXME: This approach doesn’t provide thread safety unless every
thread binds *QUEUED-POINTERS* with a LET or LAMBDA form. The
WRITE-BINARY method can’t do this because it must be able to
push items onto the tag that can be seen by other implementations
of WRITE-BINARY that might have the corresponding DUMP-TAG call.

Package

lisp-binary.

Source

binary-1.lisp.

Function: queue-write-pointer (tag offset-position offset-size/bytes offset-byte-order offset-signedness data-to-store closure)

Queue some data along with a closure to write it at a later time, and arrange for its address to be written to the OFFSET-POSITION at that time.

Package

lisp-binary.

Source

binary-1.lisp.

Function: read-bits/big-endian (bits stream)
Package

simple-bit-stream.

Source

simple-bit-stream.lisp.

Function: read-bits/little-endian (bits stream)
Package

simple-bit-stream.

Source

simple-bit-stream.lisp.

Function: read-partial-byte/big-endian (bits stream)
Package

simple-bit-stream.

Source

simple-bit-stream.lisp.

Function: read-partial-byte/little-endian (bits stream)
Package

simple-bit-stream.

Source

simple-bit-stream.lisp.

Function: recursive-field-list (current-list parents)

Build a list of fields; grandparents are included as their field lists are inclusive.

Package

lisp-binary.

Source

binary-2.lisp.

Function: remove-all-restart-case (form)

Strips out all RESTART-CASE forms from the FORM, replacing them with their value form. Improves performance at the cost of easy error recovery.

Package

lisp-binary.

Source

binary-1.lisp.

Function: remove-double-multiple-value-bind (form)
Package

lisp-binary.

Source

binary-1.lisp.

Function: remove-impossible-error-checks (form)
Package

lisp-binary.

Source

binary-1.lisp.

Function: reset-op (stream op)
Package

simple-bit-stream.

Source

simple-bit-stream.lisp.

Function: reverse-bit-stream-groups (bit-stream-hash real-stream-symbol let-defs)
Package

lisp-binary.

Source

binary-2.lisp.

Function: reverse-byte (byte lookup-table)
Package

reverse-stream.

Source

reverse-stream.lisp.

Function: right-pad (string pad-length padding-character)

Pads the STRING with PAD-LENGTH copies of the PADDING-CHARACTER. If PAD-LENGTH is negative, removes characters from the right end of the string instead.

Package

lisp-binary.

Source

binary-1.lisp.

Function: runtime-reader/writer-form (reader-or-writer byte-count-name byte-count stream-symbol stream let-defs)

Wraps READER-OR-WRITER in the lexical context required for it to work. READER-OR-WRITER is a reader or writer form generated by EXPAND-DEFBINARY-TYPE-FIELD at runtime as a result of an EVAL type specifier being used. This form assumes that it will be spliced into the body of a READ-BINARY or WRITE-BINARY method, where certain variables are bound. Since the EVAL type specifier produces code that will use this form in an EVAL, the values that would normally be bound must be added with a LET form.

Package

lisp-binary.

Source

binary-1.lisp.

Function: simple-array-p (obj)
Package

lisp-binary.

Source

binary-1.lisp.

Function: take-while (pred list)
Package

lisp-binary-utils.

Source

utils.lisp.

Function: twos-complement->ones-complement (n bits)

Given a number that has been decoded as two’s complement, correct it to what its value should be if the original bits were a one’s complement representation.

Package

lisp-binary/integer.

Source

integer.lisp.

Function: type-size (type-spec)

Determines the size in bits of a DEFBINARY type, for the purposes
of determining whether reading the field requires doing non-byte-aligned I/O.

The types accepted are those handled by EXPAND-DEFBINARY-TYPE-FIELD.

It relies on a few simplifications when it comes to arrays and strings, which allow it to not need to know the exact size of the array, only the count size and the size of the element-type.

Returns three values:

- The (approximate) number of bits that the field will take up.
- T if the field could be treated as part of a BIT-FIELD, or
NIL if it can only be read using a BIT-STREAM. BIT-FIELD support
is limited to UNSIGNED-BYTEs and SIGNED-BYTEs.
- :BIT-STREAM-ONLY if the field generates so much alignment uncertainty that the whole structure and everything thereafter must be read
from a BIT-STREAM, and :NORMAL-STREAM if it’s okay to read
byte-aligned parts of the struct from a regular stream.

Package

lisp-binary.

Source

binary-1.lisp.

Function: var-bit-stream (var bit-stream-groups)
Package

lisp-binary.

Source

binary-2.lisp.

Reader: virtual-type-can-be-in-bit-field (instance)
Writer: (setf virtual-type-can-be-in-bit-field) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

can-be-in-bit-field.

Reader: virtual-type-estimated-total-bits (instance)
Writer: (setf virtual-type-estimated-total-bits) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

estimated-total-bits.

Reader: virtual-type-lambda-list (instance)
Writer: (setf virtual-type-lambda-list) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

lambda-list.

Reader: virtual-type-lisp-type (instance)
Writer: (setf virtual-type-lisp-type) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

lisp-type.

Reader: virtual-type-name (instance)
Writer: (setf virtual-type-name) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

name.

Function: virtual-type-p (object)
Package

lisp-binary.

Source

binary-1.lisp.

Reader: virtual-type-reader (instance)
Writer: (setf virtual-type-reader) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

reader.

Reader: virtual-type-stream-required (instance)
Writer: (setf virtual-type-stream-required) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

stream-required.

Reader: virtual-type-writer (instance)
Writer: (setf virtual-type-writer) (instance)
Package

lisp-binary.

Source

binary-1.lisp.

Target Slot

writer.


5.2.4 Generic functions

Generic Reader: defbinary-type-align (object)
Package

lisp-binary.

Methods
Reader Method: defbinary-type-align ((defbinary-type defbinary-type))

automatically generated reader method

Source

binary-1.lisp.

Target Slot

align.

Generic Writer: (setf defbinary-type-align) (object)
Package

lisp-binary.

Methods
Writer Method: (setf defbinary-type-align) ((defbinary-type defbinary-type))

automatically generated writer method

Source

binary-1.lisp.

Target Slot

align.

Generic Reader: defbinary-type-bind-index-to (object)
Package

lisp-binary.

Methods
Reader Method: defbinary-type-bind-index-to ((defbinary-type defbinary-type))

automatically generated reader method

Source

binary-1.lisp.

Target Slot

bind-index-to.

Generic Writer: (setf defbinary-type-bind-index-to) (object)
Package

lisp-binary.

Methods
Writer Method: (setf defbinary-type-bind-index-to) ((defbinary-type defbinary-type))

automatically generated writer method

Source

binary-1.lisp.

Target Slot

bind-index-to.

Generic Reader: defbinary-type-byte-count-name (object)
Package

lisp-binary.

Methods
Reader Method: defbinary-type-byte-count-name ((defbinary-type defbinary-type))

automatically generated reader method

Source

binary-1.lisp.

Target Slot

byte-count-name.

Generic Writer: (setf defbinary-type-byte-count-name) (object)
Package

lisp-binary.

Methods
Writer Method: (setf defbinary-type-byte-count-name) ((defbinary-type defbinary-type))

automatically generated writer method

Source

binary-1.lisp.

Target Slot

byte-count-name.

Generic Reader: defbinary-type-byte-order (object)
Package

lisp-binary.

Methods
Reader Method: defbinary-type-byte-order ((defbinary-type defbinary-type))

automatically generated reader method

Source

binary-1.lisp.

Target Slot

byte-order.

Generic Writer: (setf defbinary-type-byte-order) (object)
Package

lisp-binary.

Methods
Writer Method: (setf defbinary-type-byte-order) ((defbinary-type defbinary-type))

automatically generated writer method

Source

binary-1.lisp.

Target Slot

byte-order.

Generic Reader: defbinary-type-element-align (object)
Package

lisp-binary.

Methods
Reader Method: defbinary-type-element-align ((defbinary-type defbinary-type))

automatically generated reader method

Source

binary-1.lisp.

Target Slot

element-align.

Generic Writer: (setf defbinary-type-element-align) (object)
Package

lisp-binary.

Methods
Writer Method: (setf defbinary-type-element-align) ((defbinary-type defbinary-type))

automatically generated writer method

Source

binary-1.lisp.

Target Slot

element-align.

Generic Reader: defbinary-type-name (object)
Package

lisp-binary.

Methods
Reader Method: defbinary-type-name ((defbinary-type defbinary-type))

automatically generated reader method

Source

binary-1.lisp.

Target Slot

name.

Generic Writer: (setf defbinary-type-name) (object)
Package

lisp-binary.

Methods
Writer Method: (setf defbinary-type-name) ((defbinary-type defbinary-type))

automatically generated writer method

Source

binary-1.lisp.

Target Slot

name.

Generic Reader: defbinary-type-previous-defs-symbol (object)
Package

lisp-binary.

Methods
Reader Method: defbinary-type-previous-defs-symbol ((defbinary-type defbinary-type))

automatically generated reader method

Source

binary-1.lisp.

Target Slot

previous-defs-symbol.

Generic Writer: (setf defbinary-type-previous-defs-symbol) (object)
Package

lisp-binary.

Methods
Writer Method: (setf defbinary-type-previous-defs-symbol) ((defbinary-type defbinary-type))

automatically generated writer method

Source

binary-1.lisp.

Target Slot

previous-defs-symbol.

Generic Reader: defbinary-type-reader (object)
Package

lisp-binary.

Methods
Reader Method: defbinary-type-reader ((defbinary-type defbinary-type))

automatically generated reader method

Source

binary-1.lisp.

Target Slot

reader.

Generic Writer: (setf defbinary-type-reader) (object)
Package

lisp-binary.

Methods
Writer Method: (setf defbinary-type-reader) ((defbinary-type defbinary-type))

automatically generated writer method

Source

binary-1.lisp.

Target Slot

reader.

Generic Reader: defbinary-type-stream-symbol (object)
Package

lisp-binary.

Methods
Reader Method: defbinary-type-stream-symbol ((defbinary-type defbinary-type))

automatically generated reader method

Source

binary-1.lisp.

Target Slot

stream-symbol.

Generic Writer: (setf defbinary-type-stream-symbol) (object)
Package

lisp-binary.

Methods
Writer Method: (setf defbinary-type-stream-symbol) ((defbinary-type defbinary-type))

automatically generated writer method

Source

binary-1.lisp.

Target Slot

stream-symbol.

Generic Reader: defbinary-type-type (object)
Package

lisp-binary.

Methods
Reader Method: defbinary-type-type ((defbinary-type defbinary-type))

automatically generated reader method

Source

binary-1.lisp.

Target Slot

type.

Generic Writer: (setf defbinary-type-type) (object)
Package

lisp-binary.

Methods
Writer Method: (setf defbinary-type-type) ((defbinary-type defbinary-type))

automatically generated writer method

Source

binary-1.lisp.

Target Slot

type.

Generic Reader: defbinary-type-writer (object)
Package

lisp-binary.

Methods
Reader Method: defbinary-type-writer ((defbinary-type defbinary-type))

automatically generated reader method

Source

binary-1.lisp.

Target Slot

writer.

Generic Writer: (setf defbinary-type-writer) (object)
Package

lisp-binary.

Methods
Writer Method: (setf defbinary-type-writer) ((defbinary-type defbinary-type))

automatically generated writer method

Source

binary-1.lisp.

Target Slot

writer.

Generic Reader: pointer-base-pointer (object)
Package

lisp-binary.

Methods
Reader Method: pointer-base-pointer ((pointer pointer))

automatically generated reader method

Source

binary-1.lisp.

Target Slot

base-pointer.

Generic Writer: (setf pointer-base-pointer) (object)
Package

lisp-binary.

Methods
Writer Method: (setf pointer-base-pointer) ((pointer pointer))

automatically generated writer method

Source

binary-1.lisp.

Target Slot

base-pointer.

Generic Reader: pointer-offset (object)
Package

lisp-binary.

Methods
Reader Method: pointer-offset ((pointer pointer))

automatically generated reader method

Source

binary-1.lisp.

Target Slot

offset.

Generic Writer: (setf pointer-offset) (object)
Package

lisp-binary.

Methods
Writer Method: (setf pointer-offset) ((pointer pointer))

automatically generated writer method

Source

binary-1.lisp.

Target Slot

offset.

Generic Reader: pointer-stream (object)
Package

lisp-binary.

Methods
Reader Method: pointer-stream ((pointer pointer))

automatically generated reader method

Source

binary-1.lisp.

Target Slot

stream.

Generic Writer: (setf pointer-stream) (object)
Package

lisp-binary.

Methods
Writer Method: (setf pointer-stream) ((pointer pointer))

automatically generated writer method

Source

binary-1.lisp.

Target Slot

stream.

Generic Reader: pointer-type (object)
Package

lisp-binary.

Methods
Reader Method: pointer-type ((pointer pointer))

automatically generated reader method

Source

binary-1.lisp.

Target Slot

type.

Generic Writer: (setf pointer-type) (object)
Package

lisp-binary.

Methods
Writer Method: (setf pointer-type) ((pointer pointer))

automatically generated writer method

Source

binary-1.lisp.

Target Slot

type.


5.2.5 Conditions

Condition: unknown-type-size
Package

lisp-binary.

Source

binary-1.lisp.

Direct superclasses

simple-error.

Condition: unspecified-type-error
Package

lisp-binary.

Source

binary-1.lisp.

Direct superclasses

simple-condition.


5.2.6 Structures

Structure: binary-field
Package

lisp-binary.

Source

binary-1.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: name
Readers

binary-field-name.

Writers

(setf binary-field-name).

Slot: defstruct-field
Readers

binary-field-defstruct-field.

Writers

(setf binary-field-defstruct-field).

Slot: read-form
Readers

binary-field-read-form.

Writers

(setf binary-field-read-form).

Slot: write-form
Readers

binary-field-write-form.

Writers

(setf binary-field-write-form).

Slot: type
Package

common-lisp.

Readers

binary-field-type.

Writers

(setf binary-field-type).

Slot: bit-stream-id
Readers

binary-field-bit-stream-id.

Writers

(setf binary-field-bit-stream-id).

Structure: enum-definition
Package

lisp-binary.

Source

binary-1.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: name
Type

symbol

Readers

enum-definition-name.

Writers

(setf enum-definition-name).

Slot: size
Type

number

Initform

0

Readers

enum-definition-size.

Writers

(setf enum-definition-size).

Slot: signed
Type

boolean

Readers

enum-definition-signed.

Writers

(setf enum-definition-signed).

Slot: byte-order
Type

keyword

Initform

:little-endian

Readers

enum-definition-byte-order.

Writers

(setf enum-definition-byte-order).

Slot: variables
Type

list

Readers

enum-definition-variables.

Writers

(setf enum-definition-variables).

Slot: signed-representation
Type

keyword

Initform

:twos-complement

Readers

enum-definition-signed-representation.

Writers

(setf enum-definition-signed-representation).

Slot: reader
Readers

enum-definition-reader.

Writers

(setf enum-definition-reader).

Slot: writer
Readers

enum-definition-writer.

Writers

(setf enum-definition-writer).

Structure: out-pointer
Package

lisp-binary.

Source

binary-1.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: offset-position
Type

number

Initform

0

Readers

out-pointer-offset-position.

Writers

(setf out-pointer-offset-position).

Slot: offset-size/bytes
Type

number

Initform

0

Readers

out-pointer-offset-size/bytes.

Writers

(setf out-pointer-offset-size/bytes).

Slot: offset-byte-order
Type

keyword

Initform

:little-endian

Readers

out-pointer-offset-byte-order.

Writers

(setf out-pointer-offset-byte-order).

Slot: offset-signedness
Type

boolean

Readers

out-pointer-offset-signedness.

Writers

(setf out-pointer-offset-signedness).

Slot: data-to-store
Readers

out-pointer-data-to-store.

Writers

(setf out-pointer-data-to-store).

Slot: closure
Type

function

Initform

(function identity)

Readers

out-pointer-closure.

Writers

(setf out-pointer-closure).

Structure: virtual-type
Package

lisp-binary.

Source

binary-1.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: name
Readers

virtual-type-name.

Writers

(setf virtual-type-name).

Slot: lambda-list
Readers

virtual-type-lambda-list.

Writers

(setf virtual-type-lambda-list).

Slot: reader
Readers

virtual-type-reader.

Writers

(setf virtual-type-reader).

Slot: writer
Readers

virtual-type-writer.

Writers

(setf virtual-type-writer).

Slot: lisp-type
Readers

virtual-type-lisp-type.

Writers

(setf virtual-type-lisp-type).

Slot: estimated-total-bits
Initform

8

Readers

virtual-type-estimated-total-bits.

Writers

(setf virtual-type-estimated-total-bits).

Slot: stream-required
Initform

:normal-stream

Readers

virtual-type-stream-required.

Writers

(setf virtual-type-stream-required).

Slot: can-be-in-bit-field
Readers

virtual-type-can-be-in-bit-field.

Writers

(setf virtual-type-can-be-in-bit-field).


5.2.7 Classes

Class: defbinary-type
Package

lisp-binary.

Source

binary-1.lisp.

Direct methods
Direct slots
Slot: name
Initargs

:name

Readers

defbinary-type-name.

Writers

(setf defbinary-type-name).

Slot: type
Package

common-lisp.

Initargs

:type

Readers

defbinary-type-type.

Writers

(setf defbinary-type-type).

Slot: byte-order
Type

symbol

Initform

:little-endian

Initargs

:byte-order

Readers

defbinary-type-byte-order.

Writers

(setf defbinary-type-byte-order).

Slot: reader
Initargs

:reader

Readers

defbinary-type-reader.

Writers

(setf defbinary-type-reader).

Slot: writer
Initargs

:writer

Readers

defbinary-type-writer.

Writers

(setf defbinary-type-writer).

Slot: stream-symbol
Initargs

:stream-symbol

Readers

defbinary-type-stream-symbol.

Writers

(setf defbinary-type-stream-symbol).

Slot: previous-defs-symbol
Initargs

:previous-defs-symbol

Readers

defbinary-type-previous-defs-symbol.

Writers

(setf defbinary-type-previous-defs-symbol).

Slot: byte-count-name
Initargs

:byte-count-name

Readers

defbinary-type-byte-count-name.

Writers

(setf defbinary-type-byte-count-name).

Slot: align
Initargs

:align

Readers

defbinary-type-align.

Writers

(setf defbinary-type-align).

Slot: element-align
Initargs

:element-align

Readers

defbinary-type-element-align.

Writers

(setf defbinary-type-element-align).

Slot: bind-index-to
Initargs

:bind-index-to

Readers

defbinary-type-bind-index-to.

Writers

(setf defbinary-type-bind-index-to).


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   %   (  
A   B   C   D   E   F   G   I   J   L   M   N   O   P   Q   R   S   T   U   V   W  
Index Entry  Section

%
%infinityp: Private ordinary functions
%make-infinity: Private ordinary functions
%make-quiet-nan: Private ordinary functions
%make-reader-let-def: Private ordinary functions
%make-signalling-nan: Private ordinary functions
%qnanp: Private ordinary functions
%read-float: Private ordinary functions
%snanp: Private ordinary functions
%stream-read-sequence: Private ordinary functions
%stream-read-sequence: Private ordinary functions
%stream-write-sequence: Private ordinary functions
%stream-write-sequence: Private ordinary functions
%write-float: Private ordinary functions

(
(setf binary-field-bit-stream-id): Private ordinary functions
(setf binary-field-defstruct-field): Private ordinary functions
(setf binary-field-name): Private ordinary functions
(setf binary-field-read-form): Private ordinary functions
(setf binary-field-type): Private ordinary functions
(setf binary-field-write-form): Private ordinary functions
(setf defbinary-type-align): Private generic functions
(setf defbinary-type-align): Private generic functions
(setf defbinary-type-bind-index-to): Private generic functions
(setf defbinary-type-bind-index-to): Private generic functions
(setf defbinary-type-byte-count-name): Private generic functions
(setf defbinary-type-byte-count-name): Private generic functions
(setf defbinary-type-byte-order): Private generic functions
(setf defbinary-type-byte-order): Private generic functions
(setf defbinary-type-element-align): Private generic functions
(setf defbinary-type-element-align): Private generic functions
(setf defbinary-type-name): Private generic functions
(setf defbinary-type-name): Private generic functions
(setf defbinary-type-previous-defs-symbol): Private generic functions
(setf defbinary-type-previous-defs-symbol): Private generic functions
(setf defbinary-type-reader): Private generic functions
(setf defbinary-type-reader): Private generic functions
(setf defbinary-type-stream-symbol): Private generic functions
(setf defbinary-type-stream-symbol): Private generic functions
(setf defbinary-type-type): Private generic functions
(setf defbinary-type-type): Private generic functions
(setf defbinary-type-writer): Private generic functions
(setf defbinary-type-writer): Private generic functions
(setf enum-definition-byte-order): Private ordinary functions
(setf enum-definition-name): Private ordinary functions
(setf enum-definition-reader): Private ordinary functions
(setf enum-definition-signed): Private ordinary functions
(setf enum-definition-signed-representation): Private ordinary functions
(setf enum-definition-size): Private ordinary functions
(setf enum-definition-variables): Private ordinary functions
(setf enum-definition-writer): Private ordinary functions
(setf out-pointer-closure): Private ordinary functions
(setf out-pointer-data-to-store): Private ordinary functions
(setf out-pointer-offset-byte-order): Private ordinary functions
(setf out-pointer-offset-position): Private ordinary functions
(setf out-pointer-offset-signedness): Private ordinary functions
(setf out-pointer-offset-size/bytes): Private ordinary functions
(setf pointer-base-pointer): Private generic functions
(setf pointer-base-pointer): Private generic functions
(setf pointer-offset): Private generic functions
(setf pointer-offset): Private generic functions
(setf pointer-stream): Private generic functions
(setf pointer-stream): Private generic functions
(setf pointer-type): Private generic functions
(setf pointer-type): Private generic functions
(setf virtual-type-can-be-in-bit-field): Private ordinary functions
(setf virtual-type-estimated-total-bits): Private ordinary functions
(setf virtual-type-lambda-list): Private ordinary functions
(setf virtual-type-lisp-type): Private ordinary functions
(setf virtual-type-name): Private ordinary functions
(setf virtual-type-reader): Private ordinary functions
(setf virtual-type-stream-required): Private ordinary functions
(setf virtual-type-writer): Private ordinary functions

A
acond: Private macros
add-base-pointer-tag: Private ordinary functions
add-bit-stream-id: Private ordinary functions
add-bit-stream-vars: Private ordinary functions
add-default-value-if-needed: Private ordinary functions
add-stream-definitions: Private ordinary functions
aif: Public macros
align-to-boundary: Private ordinary functions
array-pop: Private ordinary functions
ash*: Private ordinary functions
assoc-cdr: Public ordinary functions
awhen: Public macros

B
binary-field-bit-stream-id: Private ordinary functions
binary-field-defstruct-field: Private ordinary functions
binary-field-name: Private ordinary functions
binary-field-p: Private ordinary functions
binary-field-read-form: Private ordinary functions
binary-field-type: Private ordinary functions
binary-field-write-form: Private ordinary functions
bind-class-slots: Public macros
bit-field-type-p: Private ordinary functions
bitfield-spec->defstruct-specs: Private ordinary functions
buffer: Public ordinary functions
build-virtual-type-reader/writer-expander: Private ordinary functions
byte-aligned-p: Public ordinary functions

C
calculate-exponent: Private ordinary functions
calculate-significand: Private ordinary functions
clear-tag: Private ordinary functions
close: Public standalone methods
close: Public standalone methods
combine-field-descriptions: Private ordinary functions
compute-reversed-byte: Private ordinary functions
convert-to-bit-fields: Private ordinary functions
copy-binary-field: Private ordinary functions
copy-enum-definition: Private ordinary functions
copy-out-pointer: Private ordinary functions
copy-virtual-type: Private ordinary functions

D
decode-float-bits: Public macros
decode-float-bits/arithmetic: Private ordinary functions
decode-float-bits/arithmetic-macro: Private macros
decode-float-bits/cffi: Private ordinary functions
decode-ip-addr: Public ordinary functions
decode-lsb: Public ordinary functions
decode-msb: Public ordinary functions
decode-significand: Private ordinary functions
defbinary: Public macros
defbinary-constructor-name: Private ordinary functions
defbinary-type-align: Private generic functions
defbinary-type-align: Private generic functions
defbinary-type-bind-index-to: Private generic functions
defbinary-type-bind-index-to: Private generic functions
defbinary-type-byte-count-name: Private generic functions
defbinary-type-byte-count-name: Private generic functions
defbinary-type-byte-order: Private generic functions
defbinary-type-byte-order: Private generic functions
defbinary-type-element-align: Private generic functions
defbinary-type-element-align: Private generic functions
defbinary-type-name: Private generic functions
defbinary-type-name: Private generic functions
defbinary-type-previous-defs-symbol: Private generic functions
defbinary-type-previous-defs-symbol: Private generic functions
defbinary-type-reader: Private generic functions
defbinary-type-reader: Private generic functions
defbinary-type-stream-symbol: Private generic functions
defbinary-type-stream-symbol: Private generic functions
defbinary-type-type: Private generic functions
defbinary-type-type: Private generic functions
defbinary-type-writer: Private generic functions
defbinary-type-writer: Private generic functions
define-enum: Public macros
define-lisp-binary-type: Private macros
define-virtual-type: Private macros
denormalp: Private ordinary functions
denormalp/arithmetic: Private ordinary functions
destructuring-case: Public macros
destructuring-lambda: Public macros
divisiblep: Public ordinary functions
dump-tag: Private ordinary functions

E
encode-float-bits: Public macros
encode-float-bits/arithmetic: Private ordinary functions
encode-float-bits/arithmetic-macro: Private macros
encode-float-bits/cffi: Private ordinary functions
encode-float-bits/runtime-format: Private ordinary functions
encode-lsb: Public ordinary functions
encode-msb: Public ordinary functions
encode-significand: Private ordinary functions
enum-definition-byte-order: Private ordinary functions
enum-definition-name: Private ordinary functions
enum-definition-p: Private ordinary functions
enum-definition-reader: Private ordinary functions
enum-definition-signed: Private ordinary functions
enum-definition-signed-representation: Private ordinary functions
enum-definition-size: Private ordinary functions
enum-definition-variables: Private ordinary functions
enum-definition-writer: Private ordinary functions
enump: Private ordinary functions
expand-byte-shorthand: Private ordinary functions
expand-defbinary-field: Private ordinary functions
expand-defbinary-type-field: Private ordinary functions
expand-previous-defs: Private ordinary functions
expand-read/write-binary-type-body: Private ordinary functions
expand-struct-like-defclass-slot: Private ordinary functions
exponent-all-ones-p: Private ordinary functions
exponent-zero-p: Private ordinary functions
externally-byte-aligned-p: Private ordinary functions

F
field-description-plist: Private ordinary functions
field-description-type: Private ordinary functions
field-option: Private ordinary functions
find-bit-field-groups: Private ordinary functions
find-sublist: Public ordinary functions
float-coerce: Private ordinary functions
float-value: Private ordinary functions
format-size: Private ordinary functions
Function, %infinityp: Private ordinary functions
Function, %make-infinity: Private ordinary functions
Function, %make-quiet-nan: Private ordinary functions
Function, %make-reader-let-def: Private ordinary functions
Function, %make-signalling-nan: Private ordinary functions
Function, %qnanp: Private ordinary functions
Function, %read-float: Private ordinary functions
Function, %snanp: Private ordinary functions
Function, %stream-read-sequence: Private ordinary functions
Function, %stream-read-sequence: Private ordinary functions
Function, %stream-write-sequence: Private ordinary functions
Function, %stream-write-sequence: Private ordinary functions
Function, %write-float: Private ordinary functions
Function, (setf binary-field-bit-stream-id): Private ordinary functions
Function, (setf binary-field-defstruct-field): Private ordinary functions
Function, (setf binary-field-name): Private ordinary functions
Function, (setf binary-field-read-form): Private ordinary functions
Function, (setf binary-field-type): Private ordinary functions
Function, (setf binary-field-write-form): Private ordinary functions
Function, (setf enum-definition-byte-order): Private ordinary functions
Function, (setf enum-definition-name): Private ordinary functions
Function, (setf enum-definition-reader): Private ordinary functions
Function, (setf enum-definition-signed): Private ordinary functions
Function, (setf enum-definition-signed-representation): Private ordinary functions
Function, (setf enum-definition-size): Private ordinary functions
Function, (setf enum-definition-variables): Private ordinary functions
Function, (setf enum-definition-writer): Private ordinary functions
Function, (setf out-pointer-closure): Private ordinary functions
Function, (setf out-pointer-data-to-store): Private ordinary functions
Function, (setf out-pointer-offset-byte-order): Private ordinary functions
Function, (setf out-pointer-offset-position): Private ordinary functions
Function, (setf out-pointer-offset-signedness): Private ordinary functions
Function, (setf out-pointer-offset-size/bytes): Private ordinary functions
Function, (setf virtual-type-can-be-in-bit-field): Private ordinary functions
Function, (setf virtual-type-estimated-total-bits): Private ordinary functions
Function, (setf virtual-type-lambda-list): Private ordinary functions
Function, (setf virtual-type-lisp-type): Private ordinary functions
Function, (setf virtual-type-name): Private ordinary functions
Function, (setf virtual-type-reader): Private ordinary functions
Function, (setf virtual-type-stream-required): Private ordinary functions
Function, (setf virtual-type-writer): Private ordinary functions
Function, add-base-pointer-tag: Private ordinary functions
Function, add-bit-stream-id: Private ordinary functions
Function, add-bit-stream-vars: Private ordinary functions
Function, add-default-value-if-needed: Private ordinary functions
Function, add-stream-definitions: Private ordinary functions
Function, align-to-boundary: Private ordinary functions
Function, array-pop: Private ordinary functions
Function, ash*: Private ordinary functions
Function, assoc-cdr: Public ordinary functions
Function, binary-field-bit-stream-id: Private ordinary functions
Function, binary-field-defstruct-field: Private ordinary functions
Function, binary-field-name: Private ordinary functions
Function, binary-field-p: Private ordinary functions
Function, binary-field-read-form: Private ordinary functions
Function, binary-field-type: Private ordinary functions
Function, binary-field-write-form: Private ordinary functions
Function, bit-field-type-p: Private ordinary functions
Function, bitfield-spec->defstruct-specs: Private ordinary functions
Function, buffer: Public ordinary functions
Function, build-virtual-type-reader/writer-expander: Private ordinary functions
Function, byte-aligned-p: Public ordinary functions
Function, calculate-exponent: Private ordinary functions
Function, calculate-significand: Private ordinary functions
Function, clear-tag: Private ordinary functions
Function, combine-field-descriptions: Private ordinary functions
Function, compute-reversed-byte: Private ordinary functions
Function, convert-to-bit-fields: Private ordinary functions
Function, copy-binary-field: Private ordinary functions
Function, copy-enum-definition: Private ordinary functions
Function, copy-out-pointer: Private ordinary functions
Function, copy-virtual-type: Private ordinary functions
Function, decode-float-bits/arithmetic: Private ordinary functions
Function, decode-float-bits/cffi: Private ordinary functions
Function, decode-ip-addr: Public ordinary functions
Function, decode-lsb: Public ordinary functions
Function, decode-msb: Public ordinary functions
Function, decode-significand: Private ordinary functions
Function, defbinary-constructor-name: Private ordinary functions
Function, denormalp: Private ordinary functions
Function, denormalp/arithmetic: Private ordinary functions
Function, divisiblep: Public ordinary functions
Function, dump-tag: Private ordinary functions
Function, encode-float-bits/arithmetic: Private ordinary functions
Function, encode-float-bits/cffi: Private ordinary functions
Function, encode-float-bits/runtime-format: Private ordinary functions
Function, encode-lsb: Public ordinary functions
Function, encode-msb: Public ordinary functions
Function, encode-significand: Private ordinary functions
Function, enum-definition-byte-order: Private ordinary functions
Function, enum-definition-name: Private ordinary functions
Function, enum-definition-p: Private ordinary functions
Function, enum-definition-reader: Private ordinary functions
Function, enum-definition-signed: Private ordinary functions
Function, enum-definition-signed-representation: Private ordinary functions
Function, enum-definition-size: Private ordinary functions
Function, enum-definition-variables: Private ordinary functions
Function, enum-definition-writer: Private ordinary functions
Function, enump: Private ordinary functions
Function, expand-byte-shorthand: Private ordinary functions
Function, expand-defbinary-field: Private ordinary functions
Function, expand-defbinary-type-field: Private ordinary functions
Function, expand-previous-defs: Private ordinary functions
Function, expand-read/write-binary-type-body: Private ordinary functions
Function, expand-struct-like-defclass-slot: Private ordinary functions
Function, exponent-all-ones-p: Private ordinary functions
Function, exponent-zero-p: Private ordinary functions
Function, externally-byte-aligned-p: Private ordinary functions
Function, field-description-plist: Private ordinary functions
Function, field-description-type: Private ordinary functions
Function, field-option: Private ordinary functions
Function, find-bit-field-groups: Private ordinary functions
Function, find-sublist: Public ordinary functions
Function, float-coerce: Private ordinary functions
Function, float-value: Private ordinary functions
Function, format-size: Private ordinary functions
Function, get-base-pointer-tag: Private ordinary functions
Function, get-enum-definition: Private ordinary functions
Function, get-enum-name: Private ordinary functions
Function, get-enum-value: Private ordinary functions
Function, get-exponent: Private ordinary functions
Function, get-format: Private ordinary functions
Function, get-lsb-byte: Public ordinary functions
Function, get-significand: Private ordinary functions
Function, get-tag: Private ordinary functions
Function, get-type-fields: Private ordinary functions
Function, group: Public ordinary functions
Function, group-write-forms: Private ordinary functions
Function, infinityp: Public ordinary functions
Function, init-read: Private ordinary functions
Function, init-write: Private ordinary functions
Function, insert-before: Public ordinary functions
Function, join-field-bits: Public ordinary functions
Function, list-begins-with-p: Private ordinary functions
Function, list-of-fields-p: Private ordinary functions
Function, load-offset: Private ordinary functions
Function, logior*: Private ordinary functions
Function, make-binary-field: Private ordinary functions
Function, make-bit-field: Private ordinary functions
Function, make-enum-definition: Private ordinary functions
Function, make-fixed-length-string: Private ordinary functions
Function, make-infinity: Private ordinary functions
Function, make-largest-denormal: Private ordinary functions
Function, make-lookup-table: Private ordinary functions
Function, make-out-pointer: Private ordinary functions
Function, make-quiet-nan: Private ordinary functions
Function, make-signalling-nan: Private ordinary functions
Function, make-simple-array: Private ordinary functions
Function, make-smallest-denormal: Private ordinary functions
Function, make-truncated-fixed-length-string: Private ordinary functions
Function, make-virtual-type: Private ordinary functions
Function, mapseq: Public ordinary functions
Function, nanp: Public ordinary functions
Function, ones-complement->twos-complement: Private ordinary functions
Function, open-binary: Public ordinary functions
Function, optimize-let-values: Private ordinary functions
Function, out-pointer-closure: Private ordinary functions
Function, out-pointer-data-to-store: Private ordinary functions
Function, out-pointer-offset-byte-order: Private ordinary functions
Function, out-pointer-offset-position: Private ordinary functions
Function, out-pointer-offset-signedness: Private ordinary functions
Function, out-pointer-offset-size/bytes: Private ordinary functions
Function, out-pointer-p: Private ordinary functions
Function, plist-replace: Public ordinary functions
Function, push-to-tag: Private ordinary functions
Function, queue-write-pointer: Private ordinary functions
Function, read-binary-type: Public ordinary functions
Function, read-bits: Public ordinary functions
Function, read-bits/big-endian: Private ordinary functions
Function, read-bits/little-endian: Private ordinary functions
Function, read-bytes-with-partial: Public ordinary functions
Function, read-counted-string: Public ordinary functions
Function, read-enum: Public ordinary functions
Function, read-file: Public ordinary functions
Function, read-integer: Public ordinary functions
Function, read-partial-byte/big-endian: Private ordinary functions
Function, read-partial-byte/little-endian: Private ordinary functions
Function, read-terminated-string: Public ordinary functions
Function, recursive-field-list: Private ordinary functions
Function, recursive-find: Public ordinary functions
Function, recursive-find-if: Public ordinary functions
Function, recursive-find-sublist: Public ordinary functions
Function, recursive-find/collect: Public ordinary functions
Function, recursive-map: Public ordinary functions
Function, recursive-mapcar: Public ordinary functions
Function, relative-file-position: Public ordinary functions
Function, remove-all-restart-case: Private ordinary functions
Function, remove-binding: Public ordinary functions
Function, remove-double-multiple-value-bind: Private ordinary functions
Function, remove-impossible-error-checks: Private ordinary functions
Function, remove-plist-keys: Public ordinary functions
Function, reset-op: Private ordinary functions
Function, reverse-bit-stream-groups: Private ordinary functions
Function, reverse-byte: Private ordinary functions
Function, right-pad: Private ordinary functions
Function, runtime-reader/writer-form: Private ordinary functions
Function, signed->unsigned: Public ordinary functions
Function, signed->unsigned/bits: Public ordinary functions
Function, simple-array-p: Private ordinary functions
Function, split-bit-field: Public ordinary functions
Function, subst*: Public ordinary functions
Function, take-while: Private ordinary functions
Function, twos-complement->ones-complement: Private ordinary functions
Function, type-size: Private ordinary functions
Function, unsigned->signed: Public ordinary functions
Function, unsigned->signed/bits: Public ordinary functions
Function, var-bit-stream: Private ordinary functions
Function, virtual-type-can-be-in-bit-field: Private ordinary functions
Function, virtual-type-estimated-total-bits: Private ordinary functions
Function, virtual-type-lambda-list: Private ordinary functions
Function, virtual-type-lisp-type: Private ordinary functions
Function, virtual-type-name: Private ordinary functions
Function, virtual-type-p: Private ordinary functions
Function, virtual-type-reader: Private ordinary functions
Function, virtual-type-stream-required: Private ordinary functions
Function, virtual-type-writer: Private ordinary functions
Function, write-binary-type: Public ordinary functions
Function, write-bits: Public ordinary functions
Function, write-counted-string: Public ordinary functions
Function, write-enum: Public ordinary functions
Function, write-integer: Public ordinary functions
Function, write-terminated-string: Public ordinary functions

G
Generic Function, (setf defbinary-type-align): Private generic functions
Generic Function, (setf defbinary-type-bind-index-to): Private generic functions
Generic Function, (setf defbinary-type-byte-count-name): Private generic functions
Generic Function, (setf defbinary-type-byte-order): Private generic functions
Generic Function, (setf defbinary-type-element-align): Private generic functions
Generic Function, (setf defbinary-type-name): Private generic functions
Generic Function, (setf defbinary-type-previous-defs-symbol): Private generic functions
Generic Function, (setf defbinary-type-reader): Private generic functions
Generic Function, (setf defbinary-type-stream-symbol): Private generic functions
Generic Function, (setf defbinary-type-type): Private generic functions
Generic Function, (setf defbinary-type-writer): Private generic functions
Generic Function, (setf pointer-base-pointer): Private generic functions
Generic Function, (setf pointer-offset): Private generic functions
Generic Function, (setf pointer-stream): Private generic functions
Generic Function, (setf pointer-type): Private generic functions
Generic Function, defbinary-type-align: Private generic functions
Generic Function, defbinary-type-bind-index-to: Private generic functions
Generic Function, defbinary-type-byte-count-name: Private generic functions
Generic Function, defbinary-type-byte-order: Private generic functions
Generic Function, defbinary-type-element-align: Private generic functions
Generic Function, defbinary-type-name: Private generic functions
Generic Function, defbinary-type-previous-defs-symbol: Private generic functions
Generic Function, defbinary-type-reader: Private generic functions
Generic Function, defbinary-type-stream-symbol: Private generic functions
Generic Function, defbinary-type-type: Private generic functions
Generic Function, defbinary-type-writer: Private generic functions
Generic Function, pointer-base-pointer: Private generic functions
Generic Function, pointer-offset: Private generic functions
Generic Function, pointer-stream: Private generic functions
Generic Function, pointer-type: Private generic functions
Generic Function, read-binary: Public generic functions
Generic Function, read-bytes: Public generic functions
Generic Function, wrap-in-bit-stream: Public generic functions
Generic Function, wrap-in-reverse-stream: Public generic functions
Generic Function, write-binary: Public generic functions
Generic Function, write-bytes: Public generic functions
get-base-pointer-tag: Private ordinary functions
get-enum-definition: Private ordinary functions
get-enum-name: Private ordinary functions
get-enum-value: Private ordinary functions
get-exponent: Private ordinary functions
get-format: Private ordinary functions
get-lsb-byte: Public ordinary functions
get-significand: Private ordinary functions
get-tag: Private ordinary functions
get-type-fields: Private ordinary functions
group: Public ordinary functions
group-write-forms: Private ordinary functions

I
infinityp: Public ordinary functions
init-read: Private ordinary functions
init-write: Private ordinary functions
insert-before: Public ordinary functions

J
join-field-bits: Public ordinary functions

L
let-values: Public macros
let-values*: Public macros
let-values/stupid*: Private macros
letf: Public macros
list-begins-with-p: Private ordinary functions
list-of-fields-p: Private ordinary functions
load-offset: Private ordinary functions
logior*: Private ordinary functions

M
Macro, acond: Private macros
Macro, aif: Public macros
Macro, awhen: Public macros
Macro, bind-class-slots: Public macros
Macro, decode-float-bits: Public macros
Macro, decode-float-bits/arithmetic-macro: Private macros
Macro, defbinary: Public macros
Macro, define-enum: Public macros
Macro, define-lisp-binary-type: Private macros
Macro, define-virtual-type: Private macros
Macro, destructuring-case: Public macros
Macro, destructuring-lambda: Public macros
Macro, encode-float-bits: Public macros
Macro, encode-float-bits/arithmetic-macro: Private macros
Macro, let-values: Public macros
Macro, let-values*: Public macros
Macro, let-values/stupid*: Private macros
Macro, letf: Public macros
Macro, make-reader-let-def: Private macros
Macro, named-let: Public macros
Macro, pop-bits: Public macros
Macro, pop-bits/le: Public macros
Macro, popbit: Private macros
Macro, push-bits: Public macros
Macro, push-bits/le: Public macros
Macro, pushover: Public macros
Macro, read-bytes-with-partial/macro: Private macros
Macro, read-float: Public macros
Macro, read-octets-to-string: Private macros
Macro, read/write-binary-type: Private macros
Macro, simple-define-condition: Public macros
Macro, struct-like-defclass: Public macros
Macro, tif: Private macros
Macro, tlabels: Private macros
Macro, with-buffered-output: Public macros
Macro, with-file-position: Public macros
Macro, with-letf-bindings: Private macros
Macro, with-local-pointer-resolving-context: Public macros
Macro, with-open-binary-file: Public macros
Macro, with-wrapped-in-bit-stream: Public macros
Macro, with-wrapped-in-reverse-stream: Public macros
Macro, write-float: Public macros
make-binary-field: Private ordinary functions
make-bit-field: Private ordinary functions
make-enum-definition: Private ordinary functions
make-fixed-length-string: Private ordinary functions
make-infinity: Private ordinary functions
make-largest-denormal: Private ordinary functions
make-lookup-table: Private ordinary functions
make-out-pointer: Private ordinary functions
make-quiet-nan: Private ordinary functions
make-reader-let-def: Private macros
make-signalling-nan: Private ordinary functions
make-simple-array: Private ordinary functions
make-smallest-denormal: Private ordinary functions
make-truncated-fixed-length-string: Private ordinary functions
make-virtual-type: Private ordinary functions
mapseq: Public ordinary functions
Method, (setf defbinary-type-align): Private generic functions
Method, (setf defbinary-type-bind-index-to): Private generic functions
Method, (setf defbinary-type-byte-count-name): Private generic functions
Method, (setf defbinary-type-byte-order): Private generic functions
Method, (setf defbinary-type-element-align): Private generic functions
Method, (setf defbinary-type-name): Private generic functions
Method, (setf defbinary-type-previous-defs-symbol): Private generic functions
Method, (setf defbinary-type-reader): Private generic functions
Method, (setf defbinary-type-stream-symbol): Private generic functions
Method, (setf defbinary-type-type): Private generic functions
Method, (setf defbinary-type-writer): Private generic functions
Method, (setf pointer-base-pointer): Private generic functions
Method, (setf pointer-offset): Private generic functions
Method, (setf pointer-stream): Private generic functions
Method, (setf pointer-type): Private generic functions
Method, close: Public standalone methods
Method, close: Public standalone methods
Method, defbinary-type-align: Private generic functions
Method, defbinary-type-bind-index-to: Private generic functions
Method, defbinary-type-byte-count-name: Private generic functions
Method, defbinary-type-byte-order: Private generic functions
Method, defbinary-type-element-align: Private generic functions
Method, defbinary-type-name: Private generic functions
Method, defbinary-type-previous-defs-symbol: Private generic functions
Method, defbinary-type-reader: Private generic functions
Method, defbinary-type-stream-symbol: Private generic functions
Method, defbinary-type-type: Private generic functions
Method, defbinary-type-writer: Private generic functions
Method, pointer-base-pointer: Private generic functions
Method, pointer-offset: Private generic functions
Method, pointer-stream: Private generic functions
Method, pointer-type: Private generic functions
Method, read-binary: Public generic functions
Method, read-bytes: Public generic functions
Method, read-bytes: Public generic functions
Method, stream-element-type: Public standalone methods
Method, stream-file-position: Public standalone methods
Method, stream-file-position: Public standalone methods
Method, stream-finish-output: Public standalone methods
Method, stream-finish-output: Public standalone methods
Method, stream-force-output: Public standalone methods
Method, stream-force-output: Public standalone methods
Method, stream-read-byte: Public standalone methods
Method, stream-read-byte: Public standalone methods
Method, stream-read-sequence: Public standalone methods
Method, stream-read-sequence: Public standalone methods
Method, stream-write-byte: Public standalone methods
Method, stream-write-byte: Public standalone methods
Method, stream-write-sequence: Public standalone methods
Method, stream-write-sequence: Public standalone methods
Method, wrap-in-bit-stream: Public generic functions
Method, wrap-in-reverse-stream: Public generic functions
Method, write-bytes: Public generic functions
Method, write-bytes: Public generic functions

N
named-let: Public macros
nanp: Public ordinary functions

O
ones-complement->twos-complement: Private ordinary functions
open-binary: Public ordinary functions
optimize-let-values: Private ordinary functions
out-pointer-closure: Private ordinary functions
out-pointer-data-to-store: Private ordinary functions
out-pointer-offset-byte-order: Private ordinary functions
out-pointer-offset-position: Private ordinary functions
out-pointer-offset-signedness: Private ordinary functions
out-pointer-offset-size/bytes: Private ordinary functions
out-pointer-p: Private ordinary functions

P
plist-replace: Public ordinary functions
pointer-base-pointer: Private generic functions
pointer-base-pointer: Private generic functions
pointer-offset: Private generic functions
pointer-offset: Private generic functions
pointer-stream: Private generic functions
pointer-stream: Private generic functions
pointer-type: Private generic functions
pointer-type: Private generic functions
pop-bits: Public macros
pop-bits/le: Public macros
popbit: Private macros
push-bits: Public macros
push-bits/le: Public macros
push-to-tag: Private ordinary functions
pushover: Public macros

Q
queue-write-pointer: Private ordinary functions

R
read-binary: Public generic functions
read-binary: Public generic functions
read-binary-type: Public ordinary functions
read-bits: Public ordinary functions
read-bits/big-endian: Private ordinary functions
read-bits/little-endian: Private ordinary functions
read-bytes: Public generic functions
read-bytes: Public generic functions
read-bytes: Public generic functions
read-bytes-with-partial: Public ordinary functions
read-bytes-with-partial/macro: Private macros
read-counted-string: Public ordinary functions
read-enum: Public ordinary functions
read-file: Public ordinary functions
read-float: Public macros
read-integer: Public ordinary functions
read-octets-to-string: Private macros
read-partial-byte/big-endian: Private ordinary functions
read-partial-byte/little-endian: Private ordinary functions
read-terminated-string: Public ordinary functions
read/write-binary-type: Private macros
recursive-field-list: Private ordinary functions
recursive-find: Public ordinary functions
recursive-find-if: Public ordinary functions
recursive-find-sublist: Public ordinary functions
recursive-find/collect: Public ordinary functions
recursive-map: Public ordinary functions
recursive-mapcar: Public ordinary functions
relative-file-position: Public ordinary functions
remove-all-restart-case: Private ordinary functions
remove-binding: Public ordinary functions
remove-double-multiple-value-bind: Private ordinary functions
remove-impossible-error-checks: Private ordinary functions
remove-plist-keys: Public ordinary functions
reset-op: Private ordinary functions
reverse-bit-stream-groups: Private ordinary functions
reverse-byte: Private ordinary functions
right-pad: Private ordinary functions
runtime-reader/writer-form: Private ordinary functions

S
signed->unsigned: Public ordinary functions
signed->unsigned/bits: Public ordinary functions
simple-array-p: Private ordinary functions
simple-define-condition: Public macros
split-bit-field: Public ordinary functions
stream-element-type: Public standalone methods
stream-file-position: Public standalone methods
stream-file-position: Public standalone methods
stream-finish-output: Public standalone methods
stream-finish-output: Public standalone methods
stream-force-output: Public standalone methods
stream-force-output: Public standalone methods
stream-read-byte: Public standalone methods
stream-read-byte: Public standalone methods
stream-read-sequence: Public standalone methods
stream-read-sequence: Public standalone methods
stream-write-byte: Public standalone methods
stream-write-byte: Public standalone methods
stream-write-sequence: Public standalone methods
stream-write-sequence: Public standalone methods
struct-like-defclass: Public macros
subst*: Public ordinary functions

T
take-while: Private ordinary functions
tif: Private macros
tlabels: Private macros
twos-complement->ones-complement: Private ordinary functions
type-size: Private ordinary functions

U
unsigned->signed: Public ordinary functions
unsigned->signed/bits: Public ordinary functions

V
var-bit-stream: Private ordinary functions
virtual-type-can-be-in-bit-field: Private ordinary functions
virtual-type-estimated-total-bits: Private ordinary functions
virtual-type-lambda-list: Private ordinary functions
virtual-type-lisp-type: Private ordinary functions
virtual-type-name: Private ordinary functions
virtual-type-p: Private ordinary functions
virtual-type-reader: Private ordinary functions
virtual-type-stream-required: Private ordinary functions
virtual-type-writer: Private ordinary functions

W
with-buffered-output: Public macros
with-file-position: Public macros
with-letf-bindings: Private macros
with-local-pointer-resolving-context: Public macros
with-open-binary-file: Public macros
with-wrapped-in-bit-stream: Public macros
with-wrapped-in-reverse-stream: Public macros
wrap-in-bit-stream: Public generic functions
wrap-in-bit-stream: Public generic functions
wrap-in-reverse-stream: Public generic functions
wrap-in-reverse-stream: Public generic functions
write-binary: Public generic functions
write-binary-type: Public ordinary functions
write-bits: Public ordinary functions
write-bytes: Public generic functions
write-bytes: Public generic functions
write-bytes: Public generic functions
write-counted-string: Public ordinary functions
write-enum: Public ordinary functions
write-float: Public macros
write-integer: Public ordinary functions
write-terminated-string: Public ordinary functions


A.3 Variables

Jump to:   *   +   -  
A   B   C   D   E   I   L   N   O   P   Q   R   S   T   V   W  
Index Entry  Section

*
*8-bit-lookup-table*: Private special variables
*always-produce-byte-count*: Private special variables
*base-pointer-tags*: Private special variables
*byte-order*: Public special variables
*debug*: Private special variables
*denormals*: Private special variables
*enum-definitions*: Private special variables
*format-table*: Private special variables
*ignore-eval-type-bitstream-issue*: Private special variables
*ignore-on-write*: Private special variables
*known-defbinary-types*: Private special variables
*last-f*: Private special variables
*outer-stream-file-position*: Private special variables
*queued-pointers*: Private special variables
*type-expanders*: Private special variables
*type-info-objects*: Private special variables
*virtual-types*: Private special variables

+
+inf: Public special variables

-
-inf: Public special variables

A
align: Private classes

B
bad-value: Public conditions
base-pointer: Public classes
bind-index-to: Private classes
bit-stream-id: Private structures
bits-left: Public classes
byte-count-name: Private classes
byte-order: Public classes
byte-order: Private structures
byte-order: Private classes

C
can-be-in-bit-field: Private structures
closure: Private structures

D
data-to-store: Private structures
debug-data: Private special variables
defbinary-type: Private special variables
defstruct-field: Private structures

E
element-align: Private classes
element-bits: Public classes
element-bits: Public classes
enum-name: Public conditions
estimated-total-bits: Private structures

I
input-string: Public conditions
integer-value: Public conditions

L
lambda-list: Private structures
last-byte: Public classes
last-op: Public classes
lisp-type: Private structures
lookup-table: Public classes

N
name: Private structures
name: Private structures
name: Private structures
name: Private classes

O
offset: Public classes
offset-byte-order: Private structures
offset-position: Private structures
offset-signedness: Private structures
offset-size/bytes: Private structures

P
pointer: Public special variables
previous-defs-symbol: Private classes

Q
quiet-nan: Public special variables

R
read-form: Private structures
reader: Private structures
reader: Private structures
reader: Private classes
real-stream: Public classes
real-stream: Public classes
required-value: Public conditions

S
signalling-nan: Public special variables
signed: Private structures
signed-representation: Private structures
size: Private structures
Slot, align: Private classes
Slot, bad-value: Public conditions
Slot, base-pointer: Public classes
Slot, bind-index-to: Private classes
Slot, bit-stream-id: Private structures
Slot, bits-left: Public classes
Slot, byte-count-name: Private classes
Slot, byte-order: Public classes
Slot, byte-order: Private structures
Slot, byte-order: Private classes
Slot, can-be-in-bit-field: Private structures
Slot, closure: Private structures
Slot, data-to-store: Private structures
Slot, defstruct-field: Private structures
Slot, element-align: Private classes
Slot, element-bits: Public classes
Slot, element-bits: Public classes
Slot, enum-name: Public conditions
Slot, estimated-total-bits: Private structures
Slot, input-string: Public conditions
Slot, integer-value: Public conditions
Slot, lambda-list: Private structures
Slot, last-byte: Public classes
Slot, last-op: Public classes
Slot, lisp-type: Private structures
Slot, lookup-table: Public classes
Slot, name: Private structures
Slot, name: Private structures
Slot, name: Private structures
Slot, name: Private classes
Slot, offset: Public classes
Slot, offset-byte-order: Private structures
Slot, offset-position: Private structures
Slot, offset-signedness: Private structures
Slot, offset-size/bytes: Private structures
Slot, previous-defs-symbol: Private classes
Slot, read-form: Private structures
Slot, reader: Private structures
Slot, reader: Private structures
Slot, reader: Private classes
Slot, real-stream: Public classes
Slot, real-stream: Public classes
Slot, required-value: Public conditions
Slot, signed: Private structures
Slot, signed-representation: Private structures
Slot, size: Private structures
Slot, stream: Public classes
Slot, stream-required: Private structures
Slot, stream-symbol: Private classes
Slot, symbol-value: Public conditions
Slot, type: Public classes
Slot, type: Private structures
Slot, type: Private classes
Slot, variables: Private structures
Slot, write-form: Private structures
Slot, writer: Private structures
Slot, writer: Private structures
Slot, writer: Private classes
Special Variable, *8-bit-lookup-table*: Private special variables
Special Variable, *always-produce-byte-count*: Private special variables
Special Variable, *base-pointer-tags*: Private special variables
Special Variable, *byte-order*: Public special variables
Special Variable, *debug*: Private special variables
Special Variable, *denormals*: Private special variables
Special Variable, *enum-definitions*: Private special variables
Special Variable, *format-table*: Private special variables
Special Variable, *ignore-eval-type-bitstream-issue*: Private special variables
Special Variable, *ignore-on-write*: Private special variables
Special Variable, *known-defbinary-types*: Private special variables
Special Variable, *last-f*: Private special variables
Special Variable, *outer-stream-file-position*: Private special variables
Special Variable, *queued-pointers*: Private special variables
Special Variable, *type-expanders*: Private special variables
Special Variable, *type-info-objects*: Private special variables
Special Variable, *virtual-types*: Private special variables
Special Variable, +inf: Public special variables
Special Variable, -inf: Public special variables
Special Variable, debug-data: Private special variables
Special Variable, defbinary-type: Private special variables
Special Variable, pointer: Public special variables
Special Variable, quiet-nan: Public special variables
Special Variable, signalling-nan: Public special variables
stream: Public classes
stream-required: Private structures
stream-symbol: Private classes
symbol-value: Public conditions

T
type: Public classes
type: Private structures
type: Private classes

V
variables: Private structures

W
write-form: Private structures
writer: Private structures
writer: Private structures
writer: Private classes


A.4 Data types

Jump to:   B   C   D   E   F   I   L   N   O   P   R   S   T   U   V  
Index Entry  Section

B
bad-enum-value: Public conditions
bad-magic-value: Public conditions
binary-1.lisp: The lisp-binary/binary-1․lisp file
binary-2.lisp: The lisp-binary/binary-2․lisp file
binary-field: Private structures
bit-stream: Public classes

C
Class, bit-stream: Public classes
Class, defbinary-type: Private classes
Class, pointer: Public classes
Class, reverse-stream: Public classes
Condition, bad-enum-value: Public conditions
Condition, bad-magic-value: Public conditions
Condition, input-string-too-long: Public conditions
Condition, no-destructuring-match: Public conditions
Condition, unknown-type-size: Private conditions
Condition, unspecified-type-error: Private conditions

D
defbinary-type: Private classes

E
enum-definition: Private structures

F
File, binary-1.lisp: The lisp-binary/binary-1․lisp file
File, binary-2.lisp: The lisp-binary/binary-2․lisp file
File, float.lisp: The lisp-binary/float․lisp file
File, integer.lisp: The lisp-binary/integer․lisp file
File, lisp-binary.asd: The lisp-binary/lisp-binary․asd file
File, reverse-stream.lisp: The lisp-binary/reverse-stream․lisp file
File, simple-bit-stream.lisp: The lisp-binary/simple-bit-stream․lisp file
File, types.lisp: The lisp-binary/types․lisp file
File, utils.lisp: The lisp-binary/utils․lisp file
float.lisp: The lisp-binary/float․lisp file

I
input-string-too-long: Public conditions
integer.lisp: The lisp-binary/integer․lisp file

L
lisp-binary: The lisp-binary system
lisp-binary: The lisp-binary package
lisp-binary-utils: The lisp-binary-utils package
lisp-binary.asd: The lisp-binary/lisp-binary․asd file
lisp-binary/float: The lisp-binary/float package
lisp-binary/integer: The lisp-binary/integer package

N
no-destructuring-match: Public conditions

O
out-pointer: Private structures

P
Package, lisp-binary: The lisp-binary package
Package, lisp-binary-utils: The lisp-binary-utils package
Package, lisp-binary/float: The lisp-binary/float package
Package, lisp-binary/integer: The lisp-binary/integer package
Package, reverse-stream: The reverse-stream package
Package, simple-bit-stream: The simple-bit-stream package
pointer: Public classes

R
reverse-stream: The reverse-stream package
reverse-stream: Public classes
reverse-stream.lisp: The lisp-binary/reverse-stream․lisp file

S
simple-bit-stream: The simple-bit-stream package
simple-bit-stream.lisp: The lisp-binary/simple-bit-stream․lisp file
Structure, binary-field: Private structures
Structure, enum-definition: Private structures
Structure, out-pointer: Private structures
Structure, virtual-type: Private structures
System, lisp-binary: The lisp-binary system

T
types.lisp: The lisp-binary/types․lisp file

U
unknown-type-size: Private conditions
unspecified-type-error: Private conditions
utils.lisp: The lisp-binary/utils․lisp file

V
virtual-type: Private structures