fi
local outname=${outx%.re}.c.temp
local outdiff=${outx%.re}.c.diff
- local typname=${outx%.re}.h.temp
- local typdiff=${outx%.re}.h.diff
local outc="${outx%.re}.c"
local switches=`basename $x | sed -e 's/^[^.]*\.\(.*\)\.re$/-\1/g' -e 's/^[^-].*//g' -e 's/\([^ ]\)--/\1 --/g' -e 's/(\([^)]*\))/ \1/g' -e 's/- //g'`
- local headers=` printf "%s" "$switches" | grep -e '^-[^t -]*t[^ -]\+' | sed -e 's,^-[^t -]*t\([^ -]\+\),'"$test_blddir"'/\1,g'`
+ local outh=` printf "%s" "$switches" | grep -e '^-[^t -]*t[^ -]\+' | sed -e 's,^-[^t -]*t\([^ -]\+\),'"$test_blddir"'/\1,g'`
local switches=`printf "%s" "$switches" | sed -e 's,^-\([^ot-]*[ot]\)\(.*\)$,-\1'"$test_blddir"'/\2,g'`
local switches="$switches -o $outc"
# enable warnings globally
$cmd 2>$outname_stderr
cat $outname_stderr $outc > $outname
rm $outname_stderr $outc
- # don't forget '--skeleton' files
+ # don't forget '-S, --skeleton' files
for f in `find $(dirname $outc) -type f -name "$(basename $outc).line*.input"`
do
cat $f ${f%.input}.keys >> $outname
rm $f ${f%.input}.keys
done
+ # don't forget '-t, --type-header' files
+ [ -n "$outh" ] && cat "$outh" >> $outname && rm "$outh"
LC_ALL=C sed -i $outname \
-e "s,$x,`basename $x`,g" \
-e "s,$outc,<stdout>,g" \
+ -e "s,$outh,`[ -z $outh ] || basename $outh`,g" \
-e 's,/\* Generated by re2c .*\*/,/\* Generated by re2c \*/,g'
if test ! -f ${x%.re}.c
cp -f ${x%.re}.c ${outx%.re}.c
fi
fi
-
- if test -n "$headers"
- then
- cat $headers | sed -e 's,'"$test_blddir"'/,,g' -e 's,/\* Generated by re2c .*\*/,/\* Generated by re2c \*/,g' > $typname
- rm $headers
- if test ! -f ${x%.re}.h
- then
- echo "FAIL missing ${x%.re}.h"
- local errcnt=$(($errcnt + 1))
- cp -f $x $outx
- elif $diff_prog ${x%.re}.h $typname > $typdiff
- then
- echo "OK $x: $switches"
- rm $typname
- else
- echo "FAIL $x: $switches"
- local errcnt=$(($errcnt + 1))
- cp -f $x $outx
- cp -f ${x%.re}.h ${outx%.re}.h
- fi
- fi
test -f $outdiff -a ! -s $outdiff && rm -f $outdiff
- test -f $typdiff -a ! -s $typdiff && rm -f $typdiff
-
fi
done
echo $errcnt > $log