class MyStruct(Struct): int_a = integer(signed=False, endianness=Big) empty_space = empty(size=3) bits = bitfield( empty(), bit(), empty(size=5), bit(), ) bit_a, bit_b = bits.expand() embedded = embed(EmbeddedStruct, default=EmbeddedStruct(2, 3, 4, 5))
class ComplexSwitchStruct(Struct): value = one_of(embed(EmbeddedSwitchStruct1), embed(EmbeddedSwitchStruct2))
class EmbedStruct(Struct): struct_a = embed(IntStruct) int_b = integer(signed=False, endianness=Big)
class ValidStruct(Struct): int_a = integer(signed=False, endianness=Big, validate=lambda x: x < 50) int_b = integer(signed=False, endianness=Big, validate=lambda x: x > 50) embedded = embed(IntStruct, default=IntStruct(signature=1234))
class EXSParam(Struct): object_header = embed( EXSObjectHeader, validate=lambda header: header.type_signature in (0x04000101,)) unknown = empty(472 - EXSObjectHeader.min_size())
class EXSSample(Struct): object_header = embed( EXSObjectHeader, validate=lambda header: header.type_signature in (0x03000101,)) unknown = empty(676 - EXSObjectHeader.min_size())
class EXSGroup(Struct): object_header = embed( EXSObjectHeader, validate=lambda header: header.type_signature in (0x02000101,)) unknown = empty(216 - EXSObjectHeader.min_size())