msgproto: Convert static strings to a more generic enumeration system

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2019-03-05 12:42:35 -05:00
committed by KevinOConnor
parent 7d73a35805
commit db6e2d4c9e
5 changed files with 116 additions and 39 deletions

View File

@@ -21,6 +21,13 @@
#define DECL_CONSTANT_STR(NAME, VALUE) \
DECL_CTR("_DECL_CONSTANT_STR " NAME " " VALUE)
// Declare an enumeration
#define DECL_ENUMERATION(ENUM, NAME, VALUE) \
DECL_CTR_INT("_DECL_ENUMERATION " ENUM " " NAME, (VALUE))
#define DECL_ENUMERATION_RANGE(ENUM, NAME, VALUE, COUNT) \
DECL_CTR_INT("_DECL_ENUMERATION_RANGE " ENUM " " NAME \
" " __stringify(COUNT), (VALUE))
// Send an output message (and declare a static message type for it)
#define output(FMT, args...) \
command_sendf(_DECL_OUTPUT(FMT) , ##args )