* Indent control structures.
* Do not use whitespace control when not needed.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
enum : {{ ft | int_ft_str }} {
{% for label, mapping in ft.mappings.items() %}
-{% for rg in mapping.ranges %}
- {% if rg.lower == rg.upper %}
- {% set rg_str = rg.lower %}
- {% else %}
- {% set rg_str %}{{ rg.lower }} ... {{ rg.upper }}{% endset %}
- {% endif %}
+ {% for rg in mapping.ranges %}
+ {% if rg.lower == rg.upper %}
+ {% set rg_str = rg.lower %}
+ {% else %}
+ {% set rg_str %}{{ rg.lower }} ... {{ rg.upper }}{% endset %}
+ {% endif %}
"{{ label | escape_dq }}" = {{ rg_str }},
-{% endfor %}
+ {% endfor %}
{% endfor %}
}
align = {{ ft.alignment }};
byte_order = {{ ft.byte_order | bo_str }};
base = {{ ft.preferred_display_base | disp_base_int }};
- {% if ft._mapped_clk_type_name %}
+{% if ft._mapped_clk_type_name %}
map = clock.{{ ft._mapped_clk_type_name }}.value;
- {% endif %}
+{% endif %}
}
# `rft` with all the lines except the first one indented with a single
# tab.
#}
-{% macro root_ft(name, rft) -%}
+{% macro root_ft(name, rft) %}
{{ name }} := {{ rft | ft_str | indent_tab }};
{%- endmacro %}
{% endfor %}
{# stream types and their event types #}
-{%- for stream_type in cfg.trace.type.stream_types | sort %}
+{% for stream_type in cfg.trace.type.stream_types | sort %}
/* Stream type `{{ stream_type.name }}` */
stream {
id = {{ stream_type.id }};
{# stream type's event types #}
{% for ev_type in stream_type.event_types | sort %}
event {
- id = {{ ev_type.id }};
stream_id = {{ stream_type.id }};
+ id = {{ ev_type.id }};
name = "{{ ev_type.name }}";
{% if ev_type.log_level %}
loglevel = {{ ev_type.log_level }};
struct {
{% for name, member in ft.members.items() %}
-{#
- # `chain` is a list of static array field types terminated with a
- # non-array field type (the most nested).
- #}
-{% set chain = ft_chain(member.field_type) %}
+ {#
+ # `chain` is a list of static array field types terminated with a
+ # non-array field type (the most nested).
+ #}
+ {% set chain = ft_chain(member.field_type) %}
{{ chain[-1] | ft_str | indent_tab }} {{ name }}
- {%- for array_ft in chain[:-1] %}[{{ array_ft.length }}]{% endfor %};
+ {%- for array_ft in chain[:-1] -%}
+ [{{ array_ft.length }}]
+ {%- endfor %};
{% endfor %}
} align({{ ft.minimum_alignment }})