|
@@ -2,15 +2,21 @@
|
|
|
|
|
|
|
|
echo "/* Generated by $0 */"
|
|
echo "/* Generated by $0 */"
|
|
|
needcomma=0
|
|
needcomma=0
|
|
|
|
|
+printedtype=0
|
|
|
while read -r line; do
|
|
while read -r line; do
|
|
|
[ -z "${line%%#*}" ] && continue # skip comments
|
|
[ -z "${line%%#*}" ] && continue # skip comments
|
|
|
|
|
+ # :type/:end
|
|
|
if [ -n "${line}" -a -z "${line%%:*}" ]; then
|
|
if [ -n "${line}" -a -z "${line%%:*}" ]; then
|
|
|
- [ ${needcomma} -eq 1 ] && printf "\"\n\n"
|
|
|
|
|
|
|
+ # Close out the last type.
|
|
|
|
|
+ [ ${printedtype} -eq 1 ] && printf "%c\n\n" '"'
|
|
|
type="${line#:}"
|
|
type="${line#:}"
|
|
|
[ "${type}" = "end" ] && break
|
|
[ "${type}" = "end" ] && break
|
|
|
printf "#define DEFAULT_%s \"%c\n" $(echo "${type}" | tr '[:lower:]' '[:upper:]') '\'
|
|
printf "#define DEFAULT_%s \"%c\n" $(echo "${type}" | tr '[:lower:]' '[:upper:]') '\'
|
|
|
needcomma=0
|
|
needcomma=0
|
|
|
|
|
+ printedtype=1
|
|
|
else
|
|
else
|
|
|
|
|
+ # entry
|
|
|
|
|
+ # Comma-separate the last entry.
|
|
|
[ ${needcomma} -eq 1 ] && printf ",%c\n" '\'
|
|
[ ${needcomma} -eq 1 ] && printf ",%c\n" '\'
|
|
|
printf "%s" "${line}"
|
|
printf "%s" "${line}"
|
|
|
needcomma=1
|
|
needcomma=1
|