buildcommands: Match DECL_X names to the actual C macro names

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-08-22 13:26:30 -04:00
parent caeb610bb9
commit 8f5c15d4dc
2 changed files with 12 additions and 11 deletions

View File

@ -73,8 +73,8 @@ class HandleEnumerations:
self.enumerations = {} self.enumerations = {}
self.ctr_dispatch = { self.ctr_dispatch = {
'_DECL_STATIC_STR': self.decl_static_str, '_DECL_STATIC_STR': self.decl_static_str,
'_DECL_ENUMERATION': self.decl_enumeration, 'DECL_ENUMERATION': self.decl_enumeration,
'_DECL_ENUMERATION_RANGE': self.decl_enumeration_range 'DECL_ENUMERATION_RANGE': self.decl_enumeration_range
} }
def add_enumeration(self, enum, name, value): def add_enumeration(self, enum, name, value):
enums = self.enumerations.setdefault(enum, {}) enums = self.enumerations.setdefault(enum, {})
@ -124,8 +124,8 @@ class HandleConstants:
def __init__(self): def __init__(self):
self.constants = {} self.constants = {}
self.ctr_dispatch = { self.ctr_dispatch = {
'_DECL_CONSTANT': self.decl_constant, 'DECL_CONSTANT': self.decl_constant,
'_DECL_CONSTANT_STR': self.decl_constant_str, 'DECL_CONSTANT_STR': self.decl_constant_str,
} }
def set_value(self, name, value): def set_value(self, name, value):
if name in self.constants and self.constants[name] != value: if name in self.constants and self.constants[name] != value:
@ -253,7 +253,7 @@ class HandleCommandGeneration:
self.messages_by_name = { m.split()[0]: m for m in self.msg_to_id } self.messages_by_name = { m.split()[0]: m for m in self.msg_to_id }
self.all_param_types = {} self.all_param_types = {}
self.ctr_dispatch = { self.ctr_dispatch = {
'_DECL_COMMAND': self.decl_command, 'DECL_COMMAND_FLAGS': self.decl_command,
'_DECL_ENCODER': self.decl_encoder, '_DECL_ENCODER': self.decl_encoder,
'_DECL_OUTPUT': self.decl_output '_DECL_OUTPUT': self.decl_output
} }

View File

@ -8,7 +8,8 @@
// Declare a function to run when the specified command is received // Declare a function to run when the specified command is received
#define DECL_COMMAND_FLAGS(FUNC, FLAGS, MSG) \ #define DECL_COMMAND_FLAGS(FUNC, FLAGS, MSG) \
DECL_CTR("_DECL_COMMAND " __stringify(FUNC) " " __stringify(FLAGS) " " MSG) DECL_CTR("DECL_COMMAND_FLAGS " __stringify(FUNC) " " \
__stringify(FLAGS) " " MSG)
#define DECL_COMMAND(FUNC, MSG) \ #define DECL_COMMAND(FUNC, MSG) \
DECL_COMMAND_FLAGS(FUNC, 0, MSG) DECL_COMMAND_FLAGS(FUNC, 0, MSG)
@ -17,15 +18,15 @@
// Declare a constant exported to the host // Declare a constant exported to the host
#define DECL_CONSTANT(NAME, VALUE) \ #define DECL_CONSTANT(NAME, VALUE) \
DECL_CTR_INT("_DECL_CONSTANT " NAME, 1, CTR_INT(VALUE)) DECL_CTR_INT("DECL_CONSTANT " NAME, 1, CTR_INT(VALUE))
#define DECL_CONSTANT_STR(NAME, VALUE) \ #define DECL_CONSTANT_STR(NAME, VALUE) \
DECL_CTR("_DECL_CONSTANT_STR " NAME " " VALUE) DECL_CTR("DECL_CONSTANT_STR " NAME " " VALUE)
// Declare an enumeration // Declare an enumeration
#define DECL_ENUMERATION(ENUM, NAME, VALUE) \ #define DECL_ENUMERATION(ENUM, NAME, VALUE) \
DECL_CTR_INT("_DECL_ENUMERATION " ENUM " " NAME, 1, CTR_INT(VALUE)) DECL_CTR_INT("DECL_ENUMERATION " ENUM " " NAME, 1, CTR_INT(VALUE))
#define DECL_ENUMERATION_RANGE(ENUM, NAME, VALUE, COUNT) \ #define DECL_ENUMERATION_RANGE(ENUM, NAME, VALUE, COUNT) \
DECL_CTR_INT("_DECL_ENUMERATION_RANGE " ENUM " " NAME, \ DECL_CTR_INT("DECL_ENUMERATION_RANGE " ENUM " " NAME, \
2, CTR_INT(VALUE), CTR_INT(COUNT)) 2, CTR_INT(VALUE), CTR_INT(COUNT))
// Send an output message (and declare a static message type for it) // Send an output message (and declare a static message type for it)