diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-08-22 12:15:44 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-08-22 12:22:51 -0400 |
commit | 7d014933cea167043b0347e8d49f0fa36762c45a (patch) | |
tree | 1c56047fd5f4eba010ca322095fbfa066015b607 | |
parent | 84fd89b8cfb1c4f4bedd94d8f50ab402f878267a (diff) | |
download | kutter-7d014933cea167043b0347e8d49f0fa36762c45a.tar.gz kutter-7d014933cea167043b0347e8d49f0fa36762c45a.tar.xz kutter-7d014933cea167043b0347e8d49f0fa36762c45a.zip |
command: Allow count parameter of DECL_ENUMERATION_RANGE() to be an expression
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | scripts/buildcommands.py | 9 | ||||
-rw-r--r-- | src/command.h | 4 |
2 files changed, 5 insertions, 8 deletions
diff --git a/scripts/buildcommands.py b/scripts/buildcommands.py index 87bc297d..956554b2 100644 --- a/scripts/buildcommands.py +++ b/scripts/buildcommands.py @@ -86,12 +86,9 @@ class HandleEnumerations: enum, name, value = req.split()[1:] self.add_enumeration(enum, name, decode_integer(value)) def decl_enumeration_range(self, req): - enum, name, count, value = req.split()[1:] - try: - count = int(count, 0) - except ValueError as e: - error("Invalid enumeration count in '%s'" % (req,)) - self.add_enumeration(enum, name, (decode_integer(value), count)) + enum, name, value, count = req.split()[1:] + vc = (decode_integer(value), decode_integer(count)) + self.add_enumeration(enum, name, vc) def decl_static_str(self, req): msg = req.split(None, 1)[1] if msg not in self.static_strings: diff --git a/src/command.h b/src/command.h index 1edf7c5a..892d1aad 100644 --- a/src/command.h +++ b/src/command.h @@ -25,8 +25,8 @@ #define DECL_ENUMERATION(ENUM, NAME, VALUE) \ DECL_CTR_INT("_DECL_ENUMERATION " ENUM " " NAME, 1, CTR_INT(VALUE)) #define DECL_ENUMERATION_RANGE(ENUM, NAME, VALUE, COUNT) \ - DECL_CTR_INT("_DECL_ENUMERATION_RANGE " ENUM " " NAME \ - " " __stringify(COUNT), 1, CTR_INT(VALUE)) + DECL_CTR_INT("_DECL_ENUMERATION_RANGE " ENUM " " NAME, \ + 2, CTR_INT(VALUE), CTR_INT(COUNT)) // Send an output message (and declare a static message type for it) #define output(FMT, args...) \ |