#!/bin/sh

PREP=no

rm -f TXTRN.ERR TXPP.ERR

if [ x$1 = x-P ]; then
	PREP=yes
	shift
fi

if [ x$1 = x ]; then
	echo "Usage: tc file"
	exit 1
fi

name=`basename $1 .t`

if [ $PREP = yes ]; then
	../compiler/txx ../compiler/txpp.tcode <$1 >${name}.tpp
	if [ -f TXTRN.ERR ]; then
		rm TXTRN.ERR ${name}.tpp
		exit 1
	fi
	../compiler/txx ../build/txtrn.tcode <${name}.tpp >${name}.tcode
	rm ${name}.tpp
else
	../compiler/txx ../build/txtrn.tcode <$1 >${name}.tcode
fi

if [ -f TXTRN.ERR ]; then
	rm TXTRN.ERR ${name}.tcode
	exit 1
fi

