aboutsummaryrefslogtreecommitdiffstats
path: root/main/project/attributes/makeGpxIdArray.sh
blob: f348771d048c42e4ae96550a39c7cd3a39b5f2b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash

require () {
    hash $1 2>&- || { echo >&2 "I require $1 but it's not installed.  Aborting."; exit 1; }
}

require sed

echo "private final int[] CACHE_ATTRIBUTES = {"

cat iconlist.txt | grep -v "^#" \
        | cut -d "|" -f 1,2 \
        | sed "s/ *$//" \
        | grep "[0-9]$" \
        | sort -nk 3 \
        | sed "s/^\([^ ]*\)[ \|]*\([0-9]*\)$/    R.string.attribute_\1_yes, \/\/ GPX-ID \2/" \
        > $0.tmp

maxid=`tail -n 1 $0.tmp | sed "s/^.* \([0-9]*\)$/\1/"`

for n in `seq 0 $maxid`; do
    l=`grep " $n$" $0.tmp`
    if [ -z "$l" ]; then
        echo "    -1, // GPX-ID $n"
    else
        echo "$l"
    fi
done

echo "};"