1# enumeration converter 2# Converts enumerations in this form (as defined in jetlib.h): 3# /* enable Enumeration ******************************************************/ 4# #define HP_eOn 0 5# #define HP_eOff 1 6# to 7# static AttrValue gEnableEnum[] = { 8# {HP_eOn, "eOn"}, 9# {HP_eOff, "eOff"} 10#}; 11 12startFound=false 13firstLine=false 14while read line ; do 15 start=$(echo "$line" | cut -d' ' -f 1) 16 if [ "$start" = "/*" ] ; then 17 if [ $startFound = true ] ; then 18 echo 19 echo \}\; 20 fi 21 startFound=true 22 firstLine=true 23 name=$(echo "$line" | cut -d' ' -f 2) 24 echo 25 echo static AttrValue g"$name"Enum[] = \{ 26 elif [ "$start" = "#define" ] ; then 27 attr=$(echo "$line" | cut -d' ' -f 2) 28 const=$(echo "$attr" | cut -b 4-) 29 if [ $firstLine = false ] ; then 30 echo , 31 else 32 firstLine=false 33 fi 34 echo -n $'\t' \{"$attr", \""$const"\"\} 35 fi 36done 37if [ $startFound = true ] ; then 38 echo 39 echo \}\; 40fi 41