2 # Common variables and macros (for C templates).
5 {% import 'common.j2' as common %}
8 # Generates the name of a tracing function for the stream type
9 # `stream_type` and the event type `ev_type`.
11 {% macro trace_func_name(stream_type, ev_type) -%}
12 {{ common.prefix }}{{ stream_type.name }}_trace_{{ ev_type.name }}
16 # Generates the name of a single function parameter named `name` for
17 # the field type `ft`.
19 {% macro func_param(name, ft) -%}
20 {{ ft | ft_c_type }} {{ name }}
24 # Generates a list of parameters for the members of a given structure
25 # field type `struct_ft`.
27 # Each parameter has the prefix `name_prefix` and starts with an
28 # immediate comma followed with a newline and a tab. For example:
34 # This macro does not generate a parameter line for a member name which
35 # is part of `exclude_list`.
37 {% macro func_params(struct_ft, name_prefix, exclude_list) -%}
38 {% for name, member in struct_ft.members.items() if name not in exclude_list -%}
40 {{ func_param(name_prefix + name, member.field_type) }}