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