You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to define a structure where the first field is the count (let's call it n) followed by array of n items of some smaller structure followed by the rest of structure.
In pseudo-c++
structa{
//.....
};
structb{
size_t count;
a data[count];
//rest of structure
}
Also variants are needed, where the type of field depends on combinational function of bit flags. For example if we process network packets, their content depends on the header. This can be japped to the language using polymophism.
The text was updated successfully, but these errors were encountered:
Yeah, it's possible right now using repeat. The rough translation of your example in .ksy would be:
types:
a:
# .....b:
seq:
- id: counttype: u4# or whatever size_t maps to
- id: datatype: arepeat: exprrepeat-expr: count
Conditionals are also supported. if is available in v0.5 (stable release, as of now), newer versions would include switch to avoid writing lots of ifs.
Is it possible to define a structure where the first field is the count (let's call it
n
) followed by array ofn
items of some smaller structure followed by the rest of structure.In pseudo-c++
Also variants are needed, where the type of field depends on combinational function of bit flags. For example if we process network packets, their content depends on the header. This can be japped to the language using polymophism.
The text was updated successfully, but these errors were encountered: