headers/bsd: Add sys/queue.h.
[haiku.git] / src / tests / add-ons / print / pcl6 / enum.sh
blob63c8f0dd63807bb6f6f513bb1e9411834a7e40c6
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 #};
12 startFound=false
13 firstLine=false
14 while read line ; do
15 start=$(echo "$line" | cut -d' ' -f 1)
16 if [ "$start" = "/*" ] ; then
17 if [ $startFound = true ] ; then
18 echo
19 echo \}\;
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"\"\}
36 done
37 if [ $startFound = true ] ; then
38 echo
39 echo \}\;