summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/beast/tools/make_field.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/beast/tools/make_field.sh')
-rwxr-xr-xsrc/boost/libs/beast/tools/make_field.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/boost/libs/beast/tools/make_field.sh b/src/boost/libs/beast/tools/make_field.sh
new file mode 100755
index 000000000..8e54c1372
--- /dev/null
+++ b/src/boost/libs/beast/tools/make_field.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+export LC_COLLATE=C
+
+echo "// string constants"
+echo ' "<unknown-field>",'
+cat $1 | sort -f | uniq | sed 's/^/ \"/; s/$/\",/'
+echo
+
+echo "enum class field : unsigned short"
+echo "{"
+echo " unknown = 0,"
+echo
+#cat $1 | uniq | sort -f | sed 's/./\L&/g; s/^/\t/; s/$/,/'
+cat $1 | sort -f | uniq | sed 's/\(.*\)/ \L\1,/; s/-/_/g'
+echo "};"
+echo
+
+echo "// pairs"
+#cat $1 | uniq | sort -f | sed 's/\(.*\)/\tmatch\(field::\L\1, \"\E\1\"\);/; s/-/_/'
+cat $1 | sort -f | uniq | perl -nE 'chomp; $a=lc($_); $a=~s/-/_/g; say " match(field::$a, \"$_\");";' | tr -d "\015"
+