[m-rev.] diff: update of cleanint

Zoltan Somogyi zs at cs.mu.OZ.AU
Sun May 12 02:38:04 AEST 2002


tools/cleanint:
	Rewrite this script to handle nested modules better.

Zoltan.

#!/bin/sh
#
# Check whether there are any Mercury-compiler generated files in this
# directory that do not belong to Mercury modules in this directory.
# Report their names.
#
# The script assumes that the source for a module mod1.mod2.mod3 is stored
# in a file whose name is either fully qualified (e.g. mod1.mod2.mod3.m),
# or not qualified at all (e.g. mod3.m).

prefix=
while getopts p: flag
do
	case $flag in
	p)	prefix="$OPTARG/"
		;;
	*)	echo "usage: cleanint [-p prefix]"
		exit 1
		;;
	esac
done

shift `expr $OPTIND - 1`
if test $# -gt 0
then
	echo "usage: cleanint [-p prefix]"
	exit 1
fi

for suffix in d dep int int2 int3 date date3 opt optdate trans_opt trans_opt_date err
do
	for file in *.$suffix
	do
		# If there are no files with a given suffix,
		# then avoid the ill-formed call to basename.

		if test -f "$file"
		then
			base=`basename $file .$suffix`
			if test ! -f "$base.m"
			then
				basebase=`echo $base | sed -e 's/.*\.//'`
				if test ! -f "$basebase.m"
				then
					echo $prefix$file
				fi
			fi
		fi
	done
done

exit 0
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list