summaryrefslogtreecommitdiff
path: root/src/gen_messages.sed
diff options
context:
space:
mode:
Diffstat (limited to 'src/gen_messages.sed')
-rw-r--r--src/gen_messages.sed25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/gen_messages.sed b/src/gen_messages.sed
new file mode 100644
index 0000000..0bc51f1
--- /dev/null
+++ b/src/gen_messages.sed
@@ -0,0 +1,25 @@
+1 {
+i\
+#ifndef _MESSAGES_H_ \
+#define _MESSAGES_H_ \
+\
+#define MUMBLE_MSGS \\
+}
+
+# Duplicate & Seperate with ","
+s/^.*$/\0, \0/
+
+# Lowercase and prefix uppercase characters that follow a lowercase one
+:a; s/^\([^,]*, .*[a-z]\)\([A-Z]\)/\1_\L\2\E/g; ta
+
+# Lowercase remaining uppercase characters
+s/\([^,]*, [a-z_]*\)\([A-Z]*\)/\1\L\2\E/g
+
+# Put template macro around
+s/^.*$/\tMUMBLE_MSG(\0) \\/
+
+$ {
+a\
+\
+#endif /* _MESSAGES_H_ */
+}