After a long period of silence, Kaitai project is happy to announce release of new major version of Kaitai Struct, declarative markup language to describe various binary data structures — binary file formats, network stream packets, etc.
The basic idea of Kaitai Struct is that a particular format can be
described using Kaitai Struct language (in a .ksy file), which then
can be compiled using kaitai-struct-compiler into source files in
one of the supported programming languages. These modules will include
a generated code for a parser that can read described data structure
from a file / stream and provide access to its contents in a nice,
easy-to-comprehend API.
This release celebrates 1000 stars achieved by Kaitai Struct at GitHub, and sports a brand new logo designed by Verneri Kontto. Thanks for all our users, and many thanks to Verneri for designing it!
Also, with this release we’re happy to announce collaboration between Kaitai Struct and Construct, Python declarative parser/builder.
meta/endian can now contain a
switch-like structure (with switch-on and cases), akin to
switchable types
(docs).type: my_type(arg1,
arg2, arg3) to pass arguments into user type
(docs).process:
my_process_name(arg1, arg2, arg3) to invoke custom processing
routine, implemented in imperative language
(docs)._index in expressions
(docs).meta/xref key can be used for adding cross-references of a
format specifications (like relevant RFC entries, Wikidata
entries, ISO / IEEE / JIS / DIN / GOST standard numbers, PRONOM
identifiers, etc).--python-packagefromFile(...)
using --java-from-file-class.to_imin, maxKS_STR_ENCODING_ICONV or
KS_STR_ENCODING_NONE to be defined to know how to handle string
encodingsKaitaiStream is now an interface, and there are two
distinct classes which implement it:
ByteBufferKaitaiStream provides KaitaiStream backed
ByteBuffer (and thus using memory-mapped files)RandomAccessFileKaitaiStream provides KaitaiStream backed by
RandomAccessFile (and thus uses normal OS read calls, as it
was done in older KaitaiStruct circa v0.5)KaitaiStream and
were renamed in the following way: KaitaiUnexpectedDataError ->
KaitaiStream.UnexpectedDataError.repeat-*if-based
implementations for languages which do not support switching over
all possible types.