google / emboss

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

Support Overlay Files #85

Open reventlov opened 1 year ago

reventlov commented 1 year ago

The Emboss attribute system was originally designed to allow overlay files, which would allow attributes to be specified without editing the original .emb file -- this is particularly useful in cases where the .emb file is provided by a third party, which is the main reason it has not yet been implemented.

The basic idea is that, given an .emb like:

struct Foo:
  0 [+1]  UInt  foo_field

enum Bar:
  BAR_VALUE = 1

You would be able to write a .emboverlay file like:

[$default (cpp) enum_translation: "kCamelCase"]
[(cpp) namespace: "xyz"]
struct Foo:
  [(cpp) name: "Foo_"]
  foo_field:
    [(cpp) name: "foo_field_"]

enum Bar:
  BAR_VALUE
    [(cpp) name: "kBarValue_"]

The exact details need to be ironed out.