xC-gen-proto: reduce enums to single bytes

That's already way more than we can possibly use.
This commit is contained in:
2022-09-10 14:39:23 +02:00
parent 8c8e06b015
commit f3cc137342
3 changed files with 11 additions and 11 deletions

View File

@@ -15,7 +15,7 @@
# Booleans are one byte each.
# Strings must be valid UTF-8, use u8<> to lift that restriction.
# String and array lengths are encoded as u32.
# Enumeration values automatically start at 1, and are encoded as i32.
# Enumeration values automatically start at 1, and are encoded as i8.
# Any struct or union field may be a variable-length array.
#
# Message framing is done externally, but also happens to prefix u32 lengths.
@@ -189,6 +189,8 @@ function defenum( name, ident, value, cg) {
value = readnumber()
if (!value)
fatal("enumeration values cannot be zero")
if (value < -128 || value > 127)
fatal("enumeration value out of range")
expect(accept(","))
append(EnumValues, name, SUBSEP ident)
if (EnumValues[name, ident]++)