Index: mttroot/mtt/bin/mtt
==================================================================
--- mttroot/mtt/bin/mtt
+++ mttroot/mtt/bin/mtt
@@ -12,10 +12,13 @@
###############################################################
## Version control history
###############################################################
## $Header$
## $Log$
+## Revision 1.100 1997/12/06 12:14:39 peterg
+## Put a conditional around the PS data rep to check for set arguments.
+##
## Revision 1.99 1997/12/04 22:06:53 peterg
## Added view arguments for graph plotting
##
## Revision 1.98 1997/12/04 10:58:15 peterg
## Tidied up switches
@@ -367,23 +370,30 @@
#Initialise list
mtt_switches='';
#Look for a command line argument
while [ -n "`echo $1 | grep '-'`" ]; do
- mtt_switches="$mtt_switches $1"
case $1 in
-q )
- quiet=quiet ;;
+ mtt_switches="$mtt_switches $1";
+ quiet=quiet;;
-p )
+ mtt_switches="$mtt_switches $1";
print='-p';;
-c )
+ mtt_switches="$mtt_switches $1";
computation=c ;;
-o )
+ mtt_switches="$mtt_switches $1";
dae_is_ode=1 ;;
-s )
+ mtt_switches="$mtt_switches $1";
switches=1 ;;
+ -d )
+ directory=$2; cd $directory; shift ;;
-l )
+ mtt_switches="$mtt_switches $1";
level=$2; shift ;;
*)
echo "$1 is an invalid argument - ignoring" ;;
esac
shift
@@ -423,10 +433,11 @@
echo 'Options: -q quiet mode'
echo ' -p print environment variables'
echo ' -c c-code generation'
echo ' -o ode and dae are the same'
echo ' -s use switch (ISW and CSW) components'
+ echo ' -d
use directory '
exit
fi
fi
@@ -596,10 +607,11 @@
exit
fi
# Save up the argument list in a file; but only if argument has changed
ARGS=$4; _ARGS=_$4
+
#DIFF doesn't like empty files - so put a blank if empty
if [ -z "$ARGS" ]; then
ARGS=' ';
_ARGS='';
fi
@@ -686,12 +698,22 @@
echo Version control is not appropriate for representation $2
exit ;;
esac
fi
+# See if we are making a book -- ie representation rep on a directory
+if [ "$2" = "rep" ]; then
+ book=`file $1 | awk '{print $2}' | grep directory`
+ if [ -n "$book" ]; then
+ book=book
+ fi
+fi
+################################
# This is the main mtt programme
+################################
+
$MAKE -s -f - $1_$2.$3 << EOF
# Cancel implicit rules I don't want
%.dvi: %.tex
@@ -893,21 +915,28 @@
)> $1_sspar.r
#SUMMARY rep report (txt)
#SUMMARY rep report (tex)
#SUMMARY rep report (view)
+
+
+ifeq ($book,book)
+$1_rep.txt:
+ dir2rep $1;
+else
$1_rep.txt:
- echo Creating $1_rep.txt
+ echo Creating $1_rep.txt;
( \
echo "# Outline report file for system $1 ($1_rep.txt)"; \
cat $MTTPATH/trans/m/rcs_header.txt; \
echo "mtt $1 abg tex"; \
echo "mtt $1 struc tex"; \
echo "mtt $1 dae tex"; \
echo "mtt $1 dm tex"; \
echo "mtt $1 lmfr ps"; \
)> $1_rep.txt
+endif
#SUMMARY rbg raw bond graph (m)
#Raw bond graph: fig file to mfile
$1_rbg.m: $1_abg.fig $1_lbl.txt
rbg_fig2m $1
@@ -1281,11 +1310,11 @@
#Generic conversion of Latex to latex document
mtt.sty:
echo Copying mtt.sty to here
cp $MTTPATH/trans/mtt.sty .
$1_$2.doc: $1_$2.tex
- makedoc "$mtt_switches" "$1" "$2" "$3" "$4"
+ makedoc "$mtt_switches" "$1" "$2" "$3" "$4" "$book"
#Generic conversion of LaTeX doc to dvi
$1_$2.dvi: $1_$2.doc
echo Creating $1_$2.dvi
latex $1_$2.doc > /dev/null; \
@@ -1373,11 +1402,11 @@
make_reps:
rep_txt2sh $1; touch $1_rep.txt
$1_rep.tex: $1_rep.txt make_reps
- rep_txt2tex $1;
+ rep_txt2tex $1 "$book" "$directory";
#SUMMARY abg Acausal bond graph report (tex)
$1_abg.tex: $1_sub.sh
abg2tex $1
@@ -1399,5 +1428,12 @@
nrutil.h:
echo Copying nrutil.h; cp $MTTPATH/trans/c/nrutil.h .
sign.c:
echo Copying sign.c; cp $MTTPATH/trans/c/sign.c .
EOF
+
+# Tidy up.
+# echo Removing log files and other garbage
+ rm -f *_unique_raw_list *_raw_list
+ rm -f mtt_error.txt mtt_info.txt a.out
+ rm -f *.log mtt_info.txt warning.txt
+ rm -f *_*.idx *_*.ind *_*.ilg *_*.dvi *_*.aux *_*.lof *_*.toc