Index: mttroot/mtt/bin/mtt ================================================================== --- mttroot/mtt/bin/mtt +++ mttroot/mtt/bin/mtt @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Header$ ## $Log$ +## Revision 1.117 1998/02/04 16:50:50 peterg +## Introduced the tidy (-t and -T) options +## ## Revision 1.116 1998/02/04 11:00:04 peterg ## Added view of subsystems. ## ## Revision 1.115 1998/01/29 19:37:31 peterg ## Fixed spurious call to X server bug @@ -420,12 +423,12 @@ switches=0 #By default, don't print the environment variables print=''; -# By default, make it untidy -tidy=untidy; +# By default, make it tidy +tidy=tidy; #Initialise list mtt_switches=''; @@ -446,11 +449,10 @@ dae_is_ode=1 ;; -s ) mtt_switches="$mtt_switches $1"; switches=1 ;; -d ) - mtt_switches="$mtt_switches $1"; directory=$2; cd $directory; shift ;; -D ) mtt_switches="$mtt_switches $1"; debug=debug ;; -t ) @@ -489,28 +491,10 @@ # Exit if just printing paths if [ "$print" != "" ]; then exit fi -# Tidy mode - operate in the directory MTT-work -if [ "$tidy" = "tidy" ]; then - mkdir -p MTT_work - cp -u *_*.* MTT_work - cd MTT_work - mtt -u -q $mtt_switches $1 $2 $3 $4 - if [ "$3" != "view" ]; then - cp -f MTT_work/$1_$2.$3 . - fi - - # Remove the MTT_work directory if very tidy - if [ "$verytidy" = "verytidy" ]; then - echo Removing all working files - rm -rf ../MTT_work - fi -exit -fi - if [ -z "$1" ]; then if [ -z "$print" ]; then echo 'Usage: mtt help -- mtt on-line help' echo ' mtt info -- info-based manual' echo ' mtt info topic' @@ -631,10 +615,21 @@ rm -f $1_unique_raw_list $1_raw_list rm -f mtt_error.txt mtt_info.txt a.out rm -fR $1_rep MTT_work exit fi + +if [ "$2" = "rep" ]; then + documenttype=article + # See if we are making a book -- ie representation rep on a directory + isdirectory=`file $1 | awk '{print $2}' | grep directory` + if [ -n "$isdirectory" ]; then + documenttype=book + fi +else + documenttype=section +fi #SUMMARY abg acausal bond graph (fig) #SUMMARY abg acausal bond graph (ps) #SUMMARY abg acausal bond graph (view) # Invoke explicit requests for modification @@ -733,10 +728,30 @@ echo Copying CR $2 to here from $3 find $path_name -name "$2.cr" -exec cp {} . \; fi exit fi + +# Tidy mode - operate in the directory MTT-work +if [ "$tidy" = "tidy" ]; then + mkdir -p MTT_work + cp -u *_*.* MTT_work + cd MTT_work + mtt -u -q $mtt_switches $1 $2 $3 $4 + if [ "$3" != "view" ]; then + cp -f $1_$2.$3 .. + fi + + # Remove the MTT_work directory if very tidy + if [ "$verytidy" = "verytidy" ]; then + echo Removing all working files + rm -rf ../MTT_work + fi +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 @@ -829,20 +844,11 @@ exit ;; esac fi -if [ "$2" = "rep" ]; then - documenttype=article - # See if we are making a book -- ie representation rep on a directory - isdirectory=`file $1 | awk '{print $2}' | grep directory` - if [ -n "$isdirectory" ]; then - documenttype=book - fi -else - documenttype=section -fi + ################################ # This is the main mtt programme ################################ @@ -853,11 +859,11 @@ %.dvi: %.tex # If level>0, try and get subsystem files ifneq ("$level","0") $1_abg.fig: - mtt -q compcopy $1 + mtt -q -u compcopy $1 endif # Create an arg file if it doesn't exist $1_args.m: @@ -877,11 +883,11 @@ else \ cat $1_cr.txt >> MTT_cr.txt; \ fi sh $1_sub.sh "rm -f " '_cr.txt' # Remove the txt.cr files - sh $1_sub.sh "mtt -q -l $level+1 " ' cr txt' #Create new ones + sh $1_sub.sh "mtt $mtt_switches -q -u -l $level+1 " ' cr txt' #Create new ones if [ "$level" = "0" ]; then \ sort -u MTT_cr.txt> $1_cr.txt; \ fi @@ -901,11 +907,11 @@ else \ cat $1_sympar.txt >> MTT_sympar.txt; \ fi sh $1_sub.sh "rm -f " '_sympar.txt' # Delete sympar files - sh $1_sub.sh "mtt -q -l $level+1 " ' sympar txt' # and recreate them + sh $1_sub.sh "mtt $mtt_switches -q -u -l $level+1 " ' sympar txt' # and recreate them if [ "$level" = "0" ]; then \ sort -u +1 +0 MTT_sympar.txt> $1_sympar.txt; \ fi endif @@ -918,11 +924,11 @@ else \ cat $1_sympar.txt >> MTT_sympar.txt; \ fi sh $1_sub.sh "rm -f " '_sympar.txt' # Delete sympar files - sh $1_sub.sh "mtt -q -l $level+1 " ' sympar txt' # and recreate them + sh $1_sub.sh "mtt $mtt_switches -q -u -l $level+1 " ' sympar txt' # and recreate them if [ "$level" = "0" ]; then \ sort -u +1 +0 MTT_sympar.txt> $1_sympar.txt1; \ struc2switch_txt $1; \ echo "Appending switch declarations"; \ @@ -966,11 +972,13 @@ echo 'END;'; \ )> $1_simp.r #SUMMARY numpar numerical parameter declaration (txt) -- default $1_numpar.txt: - mtt -q $1 sympar txt; mtt -q $1 struc txt; sympar2numpar_txt2txt $1 + mtt $mtt_switches -q -u $1 sympar txt; + mtt $mtt_switches -q -u $1 struc txt; + sympar2numpar_txt2txt $1 #SUMMARY numpar numerical parameter declaration (m) $1_numpar.m: $1_numpar.txt $1_sympar.txt numpar_txt2m $1 @@ -979,15 +987,17 @@ numpar_txt2c $1 #SUMMARY input numerical input declaration (txt) -- default ifeq ($switches,0) $1_input.txt: - mtt $1 struc txt; struc2input_txt2txt $1 + mtt $mtt_switches $1 struc txt; struc2input_txt2txt $1 endif ifeq ($switches,1) $1_input.txt: - mtt -q $1 struc txt; mtt -q $1 switch txt; struc2input_txt2txt -s $1 + mtt $mtt_switches -q -u $1 struc txt; + mtt $mtt_switches -q -u $1 switch txt; + struc2input_txt2txt -s $1 endif #SUMMARY input numerical input declaration (m) $1_input.m: $1_input.txt $1_sympar.txt input_txt2m $1 @@ -1100,11 +1110,11 @@ endif #SUMMARY abg acausal bond graph (m) #Raw bond graph to acausal bond graph: mfile $1_abg.m: $1_rbg.m $1_sub.sh - sh $1_sub.sh "mtt -q -l $level+1 " ' abg m' + sh $1_sub.sh "mtt $mtt_switches -q -u -l $level+1 " ' abg m' rbg2abg_m $1 #SUMMARY cbg causal bond graph (m) #Acausal bond graph to causal bond graph: mfile