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 reaching 3000 stars on GitHub. It doesn’t bring new language features, but improves a number of existing aspects to provide a better experience when using Kaitai Struct in your projects.
my_enum::unknown_member
(8dcd1be)params
are unique and don’t collide with seq
fields or instances
within a type (#923)type: ' nested :: type ( 1 + 2 , data ) '
now works (#792)len_
+ subject) and repeat count fields (should use num_
+ subject) — see style guide
kaitai-struct-compiler
on the JVM platform (not in the Web IDE or in the JavaScript build at npm)--ksc-json-output
: add warnings
at the same level as errors
, don’t use octal escapes (e.g. “\274
\u00bc
”) in string values (invalid in JSON)kstream::to_string
now works for all integer types up to 64 bits (not just int
as before), has better performance and portability (cpp_stl#50)ReadBitsInt{Be,Le}
now accept the number of bits as uint8
int
(go@a5c5c1e)readBytesTerm
, processXor
now accept a single byte value as int
byte
readBitsInt{Be,Le}
now throw Error
RangeError
when trying to read more than 32 bitsprocess: zlib
BaseException
Exception
for easier catching (python#53)API_VERSION
tuple used by generated modules to check their compatibility with the runtime library (python#49)read_bits_int_{be,le}
for reading bit integers reliable (fix all bugs) and faster (#949)repeat-expr
entries, which could cause excessive memory allocations in invalid files (f5fe28e)valid
(and contents
) on unnamed seq
fields (for contents
, this was a 0.9 regression: #825)encoding: UTF-16{BE,LE}
valid/expr
(#435)instances
on Java 7 and 8 when using prebuilt io.kaitai:kaitai-struct-runtime:0.9
from Maven Central (java#34)terminator
values from 0x80
to 0xff
(java#35)type: b1
to boolean to match Kaitai Struct design (see docs)process: zlib
(see Installation section of Lua runtime for how to enable zlib
support)encoding: ASCII
on Windows (#960)substring
and str.to_i(2)
methodspkg_resources
, which caused performance and usability issues (#804) — the runtime library API version check now compares tuples insteadread_bytes
checks if a large read request (8 MiB or more) can be satisfied, even before any bytes are read (python#61)2**63 = 0x8000_0000_0000_0000
to 2**64 - 1 = 0xffff_ffff_ffff_ffff
(fd7f308, Lua: #837)
-2**63 = -0x8000_0000_0000_0000
(e33828a)repeat: until
fieldreturn
statements in instance getters