summaryrefslogtreecommitdiffstats
path: root/conf/gen_keywords.m4
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-11-15 12:35:41 +0100
committerMartin Mares <mj@ucw.cz>1999-11-15 12:35:41 +0100
commit944f008af7a46144e38f963097e8e4cce493e2a7 (patch)
treeb6821d20d592a846477dccef76608f7c135bab5a /conf/gen_keywords.m4
parentcbc31830079fb5e49c14c3de446b10ed8da99ce0 (diff)
downloadbird-944f008af7a46144e38f963097e8e4cce493e2a7.tar
bird-944f008af7a46144e38f963097e8e4cce493e2a7.zip
Defined CF_ENUM.
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([[,]])