Overview
Comment:Tidy mode now default.
It seems to work ok but not for book type documents.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 46dbe8c9c6b0c81b9cd5073f50623c4ca874b87454d354be2b1aa347d9fa37b1
User & Date: gawthrop@users.sourceforge.net on 1998-02-05 12:00:11
Other Links: branch diff | manifest | tags
Context
1998-02-05
13:31:25
Initial revision check-in: 04f27f5a87 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
12:00:11
Tidy mode now default.
It seems to work ok but not for book type documents.
check-in: 46dbe8c9c6 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1998-02-04
16:50:50
Introduced the tidy (-t and -T) options check-in: 8ecfc83c2e user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/mtt from [3e0008849a] to [588f35dc70].

10
11
12
13
14
15
16



17
18
19
20
21
22
23
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26







+
+
+







# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993, 1994, 1995, 1996.

###############################################################
## 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
##
## Revision 1.114  1998/01/23 13:38:07  peterg
418
419
420
421
422
423
424
425
426


427
428
429
430
431
432
433
421
422
423
424
425
426
427


428
429
430
431
432
433
434
435
436







-
-
+
+








# By default, don't look for BG switches
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='';


#Look for a command line argument
while [ -n "`echo $1 | grep '^-'`" ]; do
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
447
448
449
450
451
452
453

454
455
456
457
458
459
460







-







	-o )
                mtt_switches="$mtt_switches $1";
		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 )
		tidy=tidy ;;
	-T )
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
489
490
491
492
493
494
495


















496
497
498
499
500
501
502







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







mtt_check_vars $print

# 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'
    echo '       mtt hinfo            -- hypertext manual'
    echo '       mtt manual           -- dvi manual'
629
630
631
632
633
634
635











636
637
638
639
640
641
642
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637







+
+
+
+
+
+
+
+
+
+
+







  rm -f $1_*.doc $1_*.idx $1_*.ind $1_*.ilg $1_*.dvi $1_*.aux $1_*.lof $1_*.toc
  rm -f $1_rep.tex
  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
if [ "$2" = "abg" ] && [ "$3" = "fig" ]; then
  mtt_check_var "$FIG" FIG
731
732
733
734
735
736
737




















738
739
740
741
742
743
744
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







      path_name=$MTTPATH/lib/cr/r
    fi
    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
if [ -z "$ARGS" ]; then
  ARGS=' ';
827
828
829
830
831
832
833
834

835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858

859
860
861
862
863
864
865
842
843
844
845
846
847
848

849









850
851
852
853
854
855
856
857
858
859
860
861
862
863

864
865
866
867
868
869
870
871







-
+
-
-
-
-
-
-
-
-
-














-
+







	*)
		echo Version control is not appropriate for representation $2
		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
################################

$MAKE -s  -f -  $1_$2.$3 << EOF

# Cancel implicit rules I don't want
%.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:
	touch $1_args.m

875
876
877
878
879
880
881
882

883
884
885
886
887
888
889
881
882
883
884
885
886
887

888
889
890
891
892
893
894
895







-
+







	if [ "$level" = "0" ]; then \
	  mv $1_cr.txt MTT_cr.txt; \
	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

#SUMMARY cr	constitutive relationship for each subsystem (r)
899
900
901
902
903
904
905
906

907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923

924
925
926
927
928
929
930
905
906
907
908
909
910
911

912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928

929
930
931
932
933
934
935
936







-
+
















-
+







	if [ "$level" = "0" ]; then \
	  mv $1_sympar.txt MTT_sympar.txt; \
	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
ifeq ($switches,1)
$1_sympar.txt: $1_sub.sh $1_struc.txt
	lbl2sympar_txt2txt $1
 
	if [ "$level" = "0" ]; then \
	  mv $1_sympar.txt MTT_sympar.txt; \
	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"; \
	  cat $1_sympar.txt1 $1_switch.txt> $1_sympar.txt; \
	fi
964
965
966
967
968
969
970


971

972
973
974
975
976
977
978
979
980
981
982
983
984

985
986
987


988

989
990
991
992
993
994
995
970
971
972
973
974
975
976
977
978

979
980
981
982
983
984
985
986
987
988
989
990
991

992
993
994
995
996
997

998
999
1000
1001
1002
1003
1004
1005







+
+
-
+












-
+



+
+
-
+







	echo "%% Reduce comands to simplify output for system $1 ($1_simp.r)"; \
	cat $MTTPATH/trans/m/rcs_header.txt; \
	echo 'END;'; \
        )> $1_simp.r

#SUMMARY numpar	numerical parameter declaration (txt) -- default
$1_numpar.txt:
	mtt $mtt_switches -q -u $1 sympar txt; 
	mtt $mtt_switches -q -u $1 struc txt;
	mtt -q $1 sympar txt; mtt -q $1 struc txt; sympar2numpar_txt2txt $1
	sympar2numpar_txt2txt $1

#SUMMARY numpar	numerical parameter declaration (m) 
$1_numpar.m:  $1_numpar.txt $1_sympar.txt
	numpar_txt2m $1

#SUMMARY numpar	numerical parameter declaration (c) 
$1_numpar.c:  $1_numpar.txt $1_sympar.c
	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 $mtt_switches -q -u $1 struc txt; 
	mtt $mtt_switches -q -u $1 switch txt; 	
	mtt -q $1 struc txt; mtt -q $1 switch txt; struc2input_txt2txt -s $1
	struc2input_txt2txt -s $1
endif
#SUMMARY input	numerical input declaration (m) 
$1_input.m:  $1_input.txt $1_sympar.txt
	input_txt2m $1

#SUMMARY input	numerical input declaration (c) 
ifeq ($switches,0)
1098
1099
1100
1101
1102
1103
1104
1105

1106
1107
1108
1109
1110
1111
1112
1108
1109
1110
1111
1112
1113
1114

1115
1116
1117
1118
1119
1120
1121
1122







-
+







else
	sub_sh2tex -l $1
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
$1_cbg.m: $1_abg.m
	abg2cbg_m $1


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]