|
|
@@ -4,6 +4,7 @@ from collections import namedtuple
|
|
|
from enum import IntFlag, IntEnum
|
|
|
from struct import Struct
|
|
|
|
|
|
+
|
|
|
{% macro gen_struct(name, members, fmt) -%}
|
|
|
class {{ name }}(namedtuple('{{ name }}', '{{ members }}')):
|
|
|
fmt = Struct('{{ fmt }}')
|
|
|
@@ -31,16 +32,16 @@ class {{ name }}(namedtuple('{{ name }}', '{{ members }}')):
|
|
|
{% for item in type_definitions -%}{{ gen_struct(item.name, item.members, item.fmt) }}{% endfor -%}
|
|
|
|
|
|
# Spec structs
|
|
|
-{%- for item in xap.routes.values() recursive -%}
|
|
|
+{% for item in xap.routes.values() recursive %}
|
|
|
{%- if item.routes -%}
|
|
|
{{ loop(item.routes.values()) }}
|
|
|
{%- endif -%}
|
|
|
- {% if item.request_struct_members %}
|
|
|
+ {%- if item.request_struct_members %}
|
|
|
# TODO: gen inbound object for {{ item.define | to_snake }}
|
|
|
- {%- endif -%}
|
|
|
- {% if item.return_struct_members %}
|
|
|
+ {% endif -%}
|
|
|
+ {%- if item.return_struct_members %}
|
|
|
# TODO: gen outbound object for {{ item.define | to_snake }}
|
|
|
- {%- endif -%}
|
|
|
+ {% endif %}
|
|
|
{%- endfor %}
|
|
|
|
|
|
|
|
|
@@ -51,14 +52,16 @@ class XAPSecureStatus(IntEnum):
|
|
|
|
|
|
|
|
|
class XAPEventType(IntEnum):
|
|
|
-{%- for id, message in xap.broadcast_messages.messages | dictsort %}
|
|
|
+{% for id, message in xap.broadcast_messages.messages | dictsort %}
|
|
|
{{ message.define }} = {{ id }}
|
|
|
-{%- endfor %}
|
|
|
+{% endfor %}
|
|
|
|
|
|
|
|
|
class XAPFlags(IntFlag):
|
|
|
-{%- for bitnum, bitinfo in xap.response_flags.bits | dictsort %}
|
|
|
-{%- if bitinfo.define != "-" %}
|
|
|
+{% for bitnum, bitinfo in xap.response_flags.bits | dictsort %}
|
|
|
+{% if bitinfo.define != "-" %}
|
|
|
{{ bitinfo.define }} = 1 << {{ bitnum }}
|
|
|
-{%- endif %}
|
|
|
-{%- endfor %}
|
|
|
+{% endif %}
|
|
|
+{% endfor %}
|
|
|
+
|
|
|
+# noqa: W391
|