#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_getsize

# Gets array sizes for the def.r file
# P.J.Gawthrop Feb 2000
# Copyright (C) 2000 by Peter J. Gawthrop

    #$Id$	

while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
	-internal )
                internal=yes;
		;;
	-external )
                external=yes;
		;;
	*)
		echo "$1 is an invalid argument - ignoring";
                exit ;;
  esac
  shift
done

if [ -n "$internal" ]; then
    name=MTT$2"[0-9]"; # echo $name
    grep -i "$name" $1_ese.r | wc -l
    exit
fi

if [ -n "$external" ]; then
    name="^MTT"$2"("; #echo $name
    grep -i "$name" $1_ese.r | wc -l
    exit
fi

## The original version for external sizes.
if [ "$2" = "xx" ]; then
  n=`mtt_getsize $1 x`
  N=`echo "$n * $n" | bc` 
else
  N=`grep "MTTN$2 " <$1_def.r | gawk '{print $3}' | sed 's/;//'`
fi

echo $N
