Line | |
---|
1 | #include "muscle.h" |
---|
2 | #include <stdio.h> |
---|
3 | |
---|
4 | static char szMsg[64]; |
---|
5 | |
---|
6 | // Define XXXToStr(XXX x) functions for each enum type XXX. |
---|
7 | #define s(t) const char *t##ToStr(t x) { switch (x) { case t##_Undefined: return "Undefined"; |
---|
8 | #define c(t, x) case t##_##x: return #x; |
---|
9 | #define e(t) } sprintf(szMsg, #t "_%d", x); return szMsg; } |
---|
10 | #include "enums.h" |
---|
11 | |
---|
12 | // Define StrToXXX(const char *Str) functions for each enum type XXX. |
---|
13 | #define s(t) t StrTo##t(const char *Str) { if (0) ; |
---|
14 | #define c(t, x) else if (0 == stricmp(#x, Str)) return t##_##x; |
---|
15 | #define e(t) Quit("Invalid value %s for type %s", Str, #t); return t##_Undefined; } |
---|
16 | #include "enums.h" |
---|
Note: See
TracBrowser
for help on using the repository browser.