summaryrefslogtreecommitdiffstats
path: root/conf/gen_keywords.m4
diff options
context:
space:
mode:
Diffstat (limited to 'conf/gen_keywords.m4')
-rw-r--r--conf/gen_keywords.m45
1 files changed, 5 insertions, 0 deletions
diff --git a/conf/gen_keywords.m4 b/conf/gen_keywords.m4
index 37b882b..1c77cd5 100644
--- a/conf/gen_keywords.m4
+++ b/conf/gen_keywords.m4
@@ -22,6 +22,11 @@ m4_define(CF_KEYWORDS, `m4_define([[CF_toks]],[[]])CF_iterate([[CF_keywd]], [[$@
m4_define(CF_CLI, `CF_KEYWORDS(m4_translit($1, [[ ]], [[,]]))
')
+# Enums are translated to C initializers: use CF_ENUM(typename, prefix, values)
+m4_define(CF_enum, `m4_divert(0){ "CF_enum_prefix[[]]$1", -((CF_enum_type<<16) | CF_enum_prefix[[]]$1) },
+m4_divert(-1)')
+m4_define(CF_ENUM, `m4_define([[CF_enum_type]],$1)m4_define([[CF_enum_prefix]],$2)CF_iterate([[CF_enum]], [[m4_shift(m4_shift($@))]])DNL')
+
# As we are processing C source, we must access all M4 primitives via
# m4_* and also set different quoting convention: `[[' and ']]'
m4_changequote([[,]])