Closed alexander982 closed 2 years ago
Yes. The fact that "type: u1" and "size" do not work together was a surprise for me.
@alexander982:
Yes. The fact that "type: u1" and "size" do not work together was a surprise for me.
There is no need for type: u1
here, size
alone is enough to create a byte array - see https://doc.kaitai.io/user_guide.html#fixed-size-struct:
With that out of the way, we use a
seq
element with an array (ordered sequence of elements) in it to describe which attributes this structure consists of. Every attribute includes several keys, namely:
id
is used to give the attribute a nametype
designates the attribute type:
- no type means that we’re dealing with just a raw byte array;
size
is to be used to designate number of bytes in this array
There is actually a semantic difference between what you get using
size
: a raw byte array or byte string in some languages, i.e. the same data type that you can use to feed raw data to a Kaitai Struct parser at the beginning; target languages have often built-in methods to convert native types, e.g. numbers and character strings, exactly to/from this byte array or byte string data type (such methods are often called from_bytes
/fromBytes
and to_bytes
/toBytes
);type: u1
+ repeat: expr
: this is a list/collection of 0-255 integers, something meaningful in this final form, i.e. each such integer value would be meaningful on its own (every number can be for example an array index, a number of objects of some kind, etc.)Thanks. It is more clear for me now
More flexible and detailed dbf file parser/analyser. Do not tested on ksc - only in Web IDE