-
Notifications
You must be signed in to change notification settings - Fork 15
Arrays
(read-binary-type '(simple-array element-type (length) &key bind-index-to) stream &key (byte-order :little-endian) align element-align)
Simple arrays are denoted with the standard Common Lisp notation. There is a difference in that LISP-BINARY
only
supports one-dimensional arrays.
The element-type
can be any type supported by the library. If you use the EVAL Type Specifier here, the type-generating expression will be evaluated once for each element of the array.
If the :bind-index-to
key is used and the element-type
is a CUSTOM type, then the specified variable will be bound to the array index in the environment enclosed by the :reader
and :writer
closures.
(read-binary-type '(counted-array count-length element-type &key bind-index-to) stream &key (byte-order :little-endian) align element-align)
Counted arrays are like simple-arrays
, except a count of count-length
bytes is first read from the file, and that determines how many elements will be read. The :byte-order
key determines the byte order of this count. Within a DEFBINARY
definition, it defaults to whatever :byte-order
was chosen for that struct, while everywhere else it defaults to :little-endian
.