#!/bin/bash -ex eval $(grep ^FILE= reduce-ice) [[ -z ${FILE} ]] && echo unable to find FILE && exit 1 if ! ./reduce-ice ; then echo "ERROR: compiling code did not find string!?" exit 1 fi if false ; then echo "initial whitespace/preproc filter" cp ${FILE} ${FILE}.unfiltered sed -i \ -e 's:[[:space:]]*::' \ -e '/^$/d' \ -e '/^#/d' \ ${FILE} if cmp -s ${FILE} ${FILE}.unfiltered ; then rm -f ${FILE}.unfiltered elif ! ./reduce-ice ; then echo "ERROR: filtered version breaks things !?" exit 1 fi fi dir=$(mktemp -d -t reduce-ice.XXXXXX) cp $FILE $dir/ ln -s $PWD/reduce-ice $dir/ pushd $dir for x in ${@:-0 0 1 1 2 2 5 5 10 10} ; do multidelta -level=$x ./reduce-ice $FILE done popd cp $dir/$FILE $FILE rm -rf $dir case $FILE in *.i|*.ii|*.c|*.cxx) Lindent $FILE;; *) exit 0 esac if ! ./reduce-ice ; then echo "ERROR: lindent fucked it up!" mv "${FILE}~" "${FILE}" exit 1 fi