Hi!
I’m new to UAVCAN and Nunavut, and for the past few hours I’ve been trying to generate C-headers.
I installed Nunavut using pip, and was using the ff. command in cli to generate my headers:
nnvg -e c ../my_dsdl_root_namespace/sirius_cyber_corp/ --template c
_jinja/
I’m using the following sample code from the Github README.md as my Jinja template (because other templates are not available):
/*
* UAVCAN data structure definition
*
* Auto-generated, do not edit.
*
* Source file: {{T.source_file_path}}
*/
#ifndef {{T.full_name | c.macrofy}}
#define {{T.full_name | c.macrofy}}
{%- for constant in T.constants %}
#define {{ T | c.macrofy }}_{{ constant.name | c.macrofy }} {{ constant | constant_value }}
{%- endfor %}
typedef struct
{
/*
Note that we're not handling union types properly in this simplified example.
Unions take a bit more logic to generate correctly.
*/
{%- for field in T.fields %}
{%- if field is not padding %}
{{ field.data_type | declaration }} {{ field | id }}
{%- if field.data_type is ArrayType -%}
[{{ field.data_type.capacity }}]
{%- endif -%};
{%- if field is VariableLengthArrayType %}
{{ typename_unsigned_length }} {{ field | id }}_length;
{%- endif -%}
{%- endif -%}
{%- endfor %}
...
} {{ composite_type | full_reference_name }};
#endif // {{T.full_name | c.macrofy}}
I’m getting a no filter named 'declaration'
error, as well as for ‘constant_value’.
I know that my understanding of how the library works is still limited, but I would really appreciate it if you guys can share some working sample Python codes with c jinja templates against the latest Nunavut release? It can serve as a baseline for learning the library, and I think it would really help beginners (like me) to understand what the library can do.
Thanks and keep up the good work!