aboutsummaryrefslogtreecommitdiffstats
path: root/main/project/attributes/makeEnums.sh
diff options
context:
space:
mode:
Diffstat (limited to 'main/project/attributes/makeEnums.sh')
-rwxr-xr-xmain/project/attributes/makeEnums.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/main/project/attributes/makeEnums.sh b/main/project/attributes/makeEnums.sh
new file mode 100755
index 0000000..c877ce0
--- /dev/null
+++ b/main/project/attributes/makeEnums.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+#
+# creates Enums from iconslist.txt
+#
+# structure:
+# UNKNOWN(0, 0, "unknown", R.drawable.attribute_unknown, R.string.attribute_unknown_yes, R.string.attribute_unknown_no),
+
+require () {
+ hash $1 2>&- || { echo >&2 "I require $1 but it's not installed. Aborting."; exit 1; }
+}
+
+require sed
+require cut
+
+cat iconlist.txt | grep -v "^#" | while read l; do
+ name=`echo $l | cut -d "|" -f 1 | sed "s/ *//g"`
+ gcid=`echo $l | cut -d "|" -f 2 | sed "s/ *//g"`
+ ocid=`echo $l | cut -d "|" -f 3 | sed "s/ *//g"`
+ enum=`echo $name | tr a-z A-Z`
+ yes=R.string.attribute_${name}_yes
+ no=R.string.attribute_${name}_no
+
+ [ -z "$gcid" ] && gcid=-1
+ [ -z "$ocid" ] && ocid=-1
+
+ echo " ${enum}($gcid, $ocid, \"$name\", R.drawable.attribute_$name, $yes, $no),"
+done