summaryrefslogtreecommitdiff
path: root/src/gen_message_list.sed
diff options
context:
space:
mode:
Diffstat (limited to 'src/gen_message_list.sed')
-rw-r--r--src/gen_message_list.sed24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gen_message_list.sed b/src/gen_message_list.sed
new file mode 100644
index 0000000..e1ffbeb
--- /dev/null
+++ b/src/gen_message_list.sed
@@ -0,0 +1,24 @@
+1 {
+i\
+#ifndef _MESSAGE_LIST_H_ \
+#define _MESSAGE_LIST_H_ \
+\
+#define MUMBLE_MSGS \\
+}
+
+# Backup original message name
+h
+# Prefix uppercase characters that follow a lowercase one
+s/\([a-z]\)\([A-Z]\)/\1_\2/g
+# Lowercase uppercase characters
+y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
+# Append backup to lowercase underscored message
+G
+# Put template macro around (delete newline between both msgs, swap order)
+s/^\(.*\)\n\(.*\)$/\tMUMBLE_MSG(\2, \1) \\/
+
+$ {
+a\
+\
+#endif /* _MESSAGE_LIST_H_ */
+}