Format strings are space-separated sequences of type descriptions.
All numbers are understood to be little endian.
The following type descriptions are supported:
u8, u16, u32 - unsigned, 1, 2, and 4 bytes long respectively
i8, i16, i32 - similar, but signed
b - buffer until the end of input (has to be last)
s - similar, but utf-8 encoded string
z - NUL-terminated utf-8 string
b[10] - 10 byte buffer (10 is just an example, here and below)
There is one more token, r:. The type descriptions following it are repeated in order
until the input buffer is exhausted.
When unpacking, fields after r: are repeated as an array of tuples.
In case there's only a single field repeating,
it's also possible to append [] to its type, to get an array of values.
Format strings are space-separated sequences of type descriptions. All numbers are understood to be little endian. The following type descriptions are supported:
u8
,u16
,u32
- unsigned, 1, 2, and 4 bytes long respectivelyi8
,i16
,i32
- similar, but signedb
- buffer until the end of input (has to be last)s
- similar, but utf-8 encoded stringz
- NUL-terminated utf-8 stringb[10]
- 10 byte buffer (10 is just an example, here and below)s[10]
- 10 byte utf-8 string; trailing NUL bytes (if any) are removedx[10]
- 10 bytes of paddingThere is one more token,
r:
. The type descriptions following it are repeated in order until the input buffer is exhausted. When unpacking, fields afterr:
are repeated as an array of tuples.In case there's only a single field repeating, it's also possible to append
[]
to its type, to get an array of values.