mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-01-10 01:00:17 +01:00
scanner: handle since tags in enum values
This commit is contained in:
parent
8c85b8fc1f
commit
ea8df6402a
2 changed files with 11 additions and 3 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue