
:	TNIX/Unix Version
:	Keyshell Version Number 2	*/


: getHLL

: This is a shell command subroutine that determines whether a user will
: be using any Tektronix HLL debuggers, and which ones.
: The list of all valid HLL debuggers in the variable 'validHLL' is passed in
: from the calling routine, kshoptions.  A valid HLL debugger is one that 
: exists on the system for the $micro variable previously chosen by the
: user.
: The number of valid debuggers is determined.  If there is one valid debugger,
: the user is queried as to its inclusion.  If there is more than one, the
: list is printed and the user is asked to specify which ones to include.

: External variables
: 	$micro - the microprocessor being used
: 	$kshconfig - the file that holds the configuration description
:	$kppdefs - the file that holds "#defines" for the kpp build
:	$setTEK - the file that holds the initialization commands
:	$shelltype - Bourne or cshell
:	$validHLL - The list of HLL debuggers that exist for $micro uP

: Expand the names in the validcomp list
HLLnames=
for i in $validHLL
do
	case $i in
	pdb)
		HLLnames="$HLLnames pascal"
		;;
	cdb)
		HLLnames="$HLLnames c"
		;;
	*)
		HLLnames="$HLLnames $i"
		;;
	esac
done

count=`echo $validHLL | wc -w | tr -d ' '`




if test $count -lt 1 ; then
	CONTINUE=no
elif test $count -eq 1 ; then
	CONTINUE=yes
elif test $count -gt 1 ; then
	CONTINUE=yes
	echo
	echo "The following HLL debuggers are available:"
	echo
	for i in $HLLnames ; do
		echo "	$i"
	done
fi
if test $CONTINUE = yes ; then
	CHOSEN=
	for I in $HLLnames ; do
	VALID=no
	while test $VALID = no ;do
		echo
		echo -n "Do you wish to use the $I HLL debugger ('y' or 'n')?: "
		read INPUT
		case $INPUT in
		'y' | 'Y')
			VALID=yes
			CHOSEN="$CHOSEN $I"
			;;
		'n' | 'N')
			VALID=yes
			;;
	 	*)	echo "Invalid input: Please enter 'y' or 'n'";;
		esac
	done
	done

	
	count=`echo $CHOSEN | wc -w | tr -d ' '`
	if test $count -ge 1 ; then


		echo "#define _hlldebug $count" >>$kppdefs
		for i in $CHOSEN ; do
			echo " o  The $i debugger and related utilities are included."  >>$kshconfig
			case $i in
			pascal)
				HLLtype=pdb
				;;
			c | C)
				HLLtype=cdb
				;;
			*)
				HLLtype=$i
				;;
			esac
			echo "#define _$HLLtype 1" >>$kppdefs
		done
	fi
fi
