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