diff --git a/proto/ei-proto.h.tmpl b/proto/ei-proto.h.tmpl index cd0af45..e86bd59 100644 --- a/proto/ei-proto.h.tmpl +++ b/proto/ei-proto.h.tmpl @@ -61,6 +61,10 @@ enum {{enum.fqdn}} { {{enum.fqdn.upper()}}_{{entry.name.upper()}} = {{entry.value}}, {% endfor %} }; + +{% for entry in enum.entries %} +#define {{enum.fqdn.upper()}}_{{entry.name.upper()}}_SINCE_VERSION {{entry.since}} +{% endfor %} {% endfor %} /* Message sender functions */ diff --git a/proto/scanner.py b/proto/scanner.py index 83ac6d1..3aaccfb 100755 --- a/proto/scanner.py +++ b/proto/scanner.py @@ -221,10 +221,13 @@ class Entry: name: str = attr.ib() value: int = attr.ib() summary: str = attr.ib() + since: int = attr.ib() @classmethod - def create(cls, name: str, value: int, summary: str = "") -> "Entry": - return cls(name=name, value=value, summary=summary) + def create( + cls, name: str, value: int, summary: str = "", since: int = 1 + ) -> "Entry": + return cls(name=name, value=value, summary=summary, since=since) @attr.s @@ -549,7 +552,8 @@ class Protocol(xml.sax.handler.ContentHandler): name = attrs["name"] value = int(attrs["value"]) summary = attrs.get("summary", "") - entry = Entry.create(name=name, value=value, summary=summary) + since = int(attrs.get("since", 1)) + entry = Entry.create(name=name, value=value, summary=summary, since=since) try: self.current_message.add_entry(entry) except ValueError as e: