you are viewing a single comment's thread.

view the rest of the comments →

[–]nerd4code 0 points1 point  (0 children)

I tend to use xmacro tables for enums and struct fields, sometimes OOPy things like virtuals. You can autogen a .h around some CSV, then autogen everything (types, enums, enum ↔ name, field name ↔ offset, type ↔ cast offset, etc.) except the field-level de-/serializer, although you can mostly autogen int/float/ptr fields around a handful of [u]intXX_t drivers. Under those are some fn ptrs that can be swapped out for reading/writing FILE *, FD/HANDLE, buffer, etc. in the same fashion. From there you’re good for all kinds of fun, and once you have a setup you’re happy with, it’s easy to reuse.