]> git.wh0rd.org - ICEs.git/blob - doit
more
[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 if false ; then
13 echo "initial whitespace/preproc filter"
14 cp ${FILE} ${FILE}.unfiltered
15 sed -i \
16 -e 's:[[:space:]]*::' \
17 -e '/^$/d' \
18 -e '/^#/d' \
19 ${FILE}
20 if cmp -s ${FILE} ${FILE}.unfiltered ; then
21 rm -f ${FILE}.unfiltered
22 elif ! ./reduce-ice ; then
23 echo "ERROR: filtered version breaks things !?"
24 exit 1
25 fi
26 fi
27
28 dir=$(mktemp -d -t reduce-ice.XXXXXX)
29 cp $FILE $dir/
30 ln -s $PWD/reduce-ice $dir/
31 pushd $dir
32 for x in ${@:-0 0 1 1 2 2 5 5 10 10} ; do
33 multidelta -level=$x ./reduce-ice $FILE
34 done
35 popd
36 cp $dir/$FILE $FILE
37 rm -rf $dir
38
39 case $FILE in
40 *.i|*.ii|*.c|*.cxx) Lindent $FILE;;
41 *) exit 0
42 esac
43 if ! ./reduce-ice ; then
44 echo "ERROR: lindent fucked it up!"
45 mv "${FILE}~" "${FILE}"
46 exit 1
47 fi