add bfin ice
[ICEs.git] / doit
1 #!/bin/bash -ex
2
3 eval $(grep ^FILE= reduce-ice)
4
5 [[ -z ${FILE} ]] && echo unable to find FILE && exit 1
6
7 if ! ./reduce-ice ; then
8 echo "ERROR: compiling code did not find string!?"
9 exit 1
10 fi
11
12 echo "initial whitespace/preproc filter"
13 cp ${FILE} ${FILE}.unfiltered
14 sed -i \
15 -e '/^$/d' \
16 -e '/^#/d' \
17 -e 's:[[:space:]]*::' \
18 ${FILE}
19 if cmp -s ${FILE} ${FILE}.unfiltered ; then
20 rm -f ${FILE}.unfiltered
21 elif ! ./reduce-ice ; then
22 echo "ERROR: filtered version breaks things !?"
23 exit 1
24 fi
25
26 for x in ${@:-0 0 1 1 2 2 5 5 10 10} ; do
27 multidelta -level=$x ./reduce-ice $FILE
28 done
29
30 case $FILE in
31 *.i|*.ii|*.c|*.cxx) Lindent $FILE;;
32 *) exit 0
33 esac
34 if ! ./reduce-ice ; then
35 echo "ERROR: lindent fucked it up!"
36 mv "${FILE}~" "${FILE}"
37 exit 1
38 fi