google / emboss

Emboss is a tool for generating code that reads and writes binary data structures.
Apache License 2.0
71 stars 21 forks source link

Provide support for private Aliases #139

Open studgeek opened 5 months ago

studgeek commented 5 months ago

It would be helpful to support private/local Aliases that are not exposed in the generated code. That way they can be used for computing offsets and sizes, but without polluting the fields shown in the generated code.

For example, something like the following would allow using hdr_size in the struct, but wouldn't add hdr_size to the generated code.

  private let hdr_size = EventHeader.$size_in_bytes
  0       [+hdr_size]  EventHeader  header
  $next   [+1]         UInt         num_hci_command_packets
  $next   [+2]         OpCode       command_opcode_enum
  $next-2 [+2]         OpCodeBits   command_opcode_bits