Start of TAGGED_ARRAY() infrastructure.

This lets you have struct arrays with a string as the first member, ala:

  struct {char *name; int x, y} blah thingy[] = TAGGED_ARRAY(BLAH,
    {"one", 1, 2}, {"two", 3, 4}, {"three", 5, 6}
  );

And it produces #defines for the array index of each, ala:

  #define BLAH_one   0
  #define BLAH_two   1
  #define BLAH_three 2

So you can use thingy[BLAH_two].x and still reorder the elements at will.

Note: if you screw up the array initializers, temporarily replace
TAGGED_ARRAY(BLAH, with { and the ); with }; and the compiler will give you
better error messages. (With the macro the compiler reports errors on the
TAGGED_ARRAY line, not where the comma is missing in its contents.)

Currently the TAGGED_ARRAY( and ); must be on their own lines, and the
{ and start of each attached string must be on the same line.
3 files changed