Add `common.j2` template
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 27 Aug 2020 17:37:30 +0000 (13:37 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 27 Aug 2020 19:50:48 +0000 (15:50 -0400)
This file can contain common variables and macros.

It is to be imported by other templates, for example by `bitfield.h.j2`
in this patch.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
barectf/templates/bitfield.h.j2
barectf/templates/common.j2 [new file with mode: 0644]

index 8cb46ba1669f273253e66f92ccc06609af33cad1..51ea797a6e04e62a82e7a0439b54558179f1a8bc 100644 (file)
@@ -1,5 +1,6 @@
-{% set prefix = cfg.options.code_generation_options.identifier_prefix %}
-{% set ucprefix = prefix | upper %}
+{% import 'common.j2' as common %}
+{% set prefix = common.prefix %}
+{% set ucprefix = common.ucprefix %}
 #ifndef _{{ ucprefix }}BITFIELD_H
 #define _{{ ucprefix }}BITFIELD_H
 
diff --git a/barectf/templates/common.j2 b/barectf/templates/common.j2
new file mode 100644 (file)
index 0000000..c346ffa
--- /dev/null
@@ -0,0 +1,7 @@
+{#
+ # Common variables and macros.
+ #}
+
+{# identifier prefix and its uppercase equivalent #}
+{% set prefix = cfg.options.code_generation_options.identifier_prefix %}
+{% set ucprefix = prefix | upper %}
This page took 0.023715 seconds and 4 git commands to generate.