Overview
Comment:Component aliases implemented.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 3db90b2a2451214008b5e4268a6df7ccf5f597a6a8e0dde28d972b84f91f8515
User & Date: gawthrop@users.sourceforge.net on 1998-07-17 19:45:58
Other Links: branch diff | manifest | tags
Context
1998-07-17
19:46:44
Included component alias. check-in: d25a7dca7a user: gawthrop@users.sourceforge.net tags: origin/master, trunk
19:45:58
Component aliases implemented. check-in: 3db90b2a24 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
17:04:50
Initial revision check-in: 70ca28cbad user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/mtt from [db4545c326] to [8e6cdb815d].

10
11
12
13
14
15
16



17
18
19
20
21
22
23
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993, 1994, 1995, 1996.

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$



## Revision 1.162  1998/07/16 16:14:27  peterg
## Now stops if a transformation forces error.
##
## Revision 1.161  1998/07/08 11:21:32  peterg
## Added -I switch
##
## Revision 1.160  1998/07/04 11:38:51  peterg







>
>
>







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.163  1998/07/17 08:27:33  peterg
## Added find target
##
## Revision 1.162  1998/07/16 16:14:27  peterg
## Now stops if a transformation forces error.
##
## Revision 1.161  1998/07/08 11:21:32  peterg
## Added -I switch
##
## Revision 1.160  1998/07/04 11:38:51  peterg
618
619
620
621
622
623
624

625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
		directory=$2;  shift;;
	-D )
                mtt_switches="$mtt_switches $1";
		debug=debug ;;
	-v )
                mtt_switches="$mtt_switches $1";
		info_switch='-I';

		verbose=' -w ' ;;
	-I )
                mtt_switches="$mtt_switches $1";
		info_switch='-I' ;;
	-t )
		tidy=tidy ;;
	-T )
		tidy=tidy;
                verytidy=verytidy ;;
	-u )
		tidy=untidy ;;
	-l )
                mtt_switches="$mtt_switches $1";
		level=$2; shift ;;
	-A )
                mtt_switches="$mtt_switches $1";
                Solving='Solving';;
        --version)                
                echo MTT $version; exit;;
        --versions)                







>












|







621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
		directory=$2;  shift;;
	-D )
                mtt_switches="$mtt_switches $1";
		debug=debug ;;
	-v )
                mtt_switches="$mtt_switches $1";
		info_switch='-I';
                Verbose='verbose';
		verbose=' -w ' ;;
	-I )
                mtt_switches="$mtt_switches $1";
		info_switch='-I' ;;
	-t )
		tidy=tidy ;;
	-T )
		tidy=tidy;
                verytidy=verytidy ;;
	-u )
		tidy=untidy ;;
	-l )
                mtt_switches="$mtt_switches $1 $2";
		level=$2; shift ;;
	-A )
                mtt_switches="$mtt_switches $1";
                Solving='Solving';;
        --version)                
                echo MTT $version; exit;;
        --versions)                
659
660
661
662
663
664
665





666
667
668
669
670
671
672
  echo
  # Print current directory if in -d mode
  if [ -n "$directory" ]; then
    echo Using directory $directory
    echo
  fi
fi






#Check the principle paths
mtt_check_vars $print

# Exit if just printing paths
if [ "$print" != "" ]; then
  exit







>
>
>
>
>







663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
  echo
  # Print current directory if in -d mode
  if [ -n "$directory" ]; then
    echo Using directory $directory
    echo
  fi
fi

#Print what's going on if in verbose mode
if [ -n "$Verbose" ]; then
    echo  Starting  mtt  $mtt_switches  $1 $2 $3 $4
fi

#Check the principle paths
mtt_check_vars $print

# Exit if just printing paths
if [ "$print" != "" ]; then
  exit
894
895
896
897
898
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
931
932
933
934
    find $source -name "$2" -exec cp -rf {} . \; 
  fi
  exit
fi

# Copy components from the library
if [ "$1" = "compcopy" ]; then




   #set up source and destination dirs
    source=$3
    if [ -z "$source" ]; then
      source=$MTTPATH/lib/comp/compound
    fi
    destination=$4
    if [ -z "$destination" ]; then
      destination='.'
    fi   

  # check that its not here already
  file_exists=`ls $destination/$2_abg.fig 2> /dev/null`
  if [ -n "$file_exists" ]; then
    if [ "$quiet" != "quiet" ]; then    
      echo $destination/$2_abg.fig exists already - no action taken
    fi
  else
    if [ -z "$source" ]; then
      source=$MTTPATH/lib/comp/compound
    fi
    # if [ "$quiet" != "quiet" ]; then    
      echo Copying component $2 from $source to  $destination
    # fi
    if [ $source = "." ]; then
      cp -u *_*.* $destination
    else


      find $source -name "$2_*.*" -exec cp {} $destination \;












    fi
  fi
  exit
fi

# Copy CRs from the library
if [ "$1" = "crcopy" ]; then







>
>
>
>



|







|


|


<
<
<
<
<
<



>
>
|
>
>
>
>
>
>
>
>
>
>
>
>







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






931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
    find $source -name "$2" -exec cp -rf {} . \; 
  fi
  exit
fi

# Copy components from the library
if [ "$1" = "compcopy" ]; then

   #Pull out the base name (we may have a library as well)
   name=`basename $2`

   #set up source and destination dirs
    source=$3
    if [ -z "$source" ]; then
      source=$MTT_COMPONENTS
    fi
    destination=$4
    if [ -z "$destination" ]; then
      destination='.'
    fi   

  # check that its not here already
  file_exists=`ls $destination/"$name"_lbl.txt 2> /dev/null`
  if [ -n "$file_exists" ]; then
    if [ "$quiet" != "quiet" ]; then    
      echo Component $name exists already - no action taken
    fi
  else






    if [ $source = "." ]; then
      cp -u *_*.* $destination
    else
      comp_path=`mtt_find $source $2 path_only`
      n_found=`echo $comp_path | wc | awk '{print $2}'`

      if [ "$n_found" = "1" ]; then
         echo Copying $2 from $comp_path to $destination
         cp $comp_path/*_*.* $destination
         exit 0
      elif [ "$n_found" = "0" ]; then
         echo Component $2 not found - is MTT_COMPONENTS set correctly?
         exit 1
      elif [ "$n_found" > "1" ]; then
         echo "Multiple versions of $2 found (see below) - use a more explicit alias"
         mtt -q find $2
         exit 2
      fi
    fi
  fi
  exit
fi

# Copy CRs from the library
if [ "$1" = "crcopy" ]; then
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
   fi

     mtt -u -q  $mtt_switches -S "$Directory"  $1 $2 $3 $4
     mtt_status=$?

   # Exit on failure
   if [ "$mtt_status" != "0" ]; then
     echo Exiting mtt with status $mtt_status
     exit 1
   fi

   if [ "$3" != "view" ]; then
    if [ "$3" != "hview" ]; then
      echo Copying  $1_$2.$3
      cp -u -p $1_$2.$3 ..







|







1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
   fi

     mtt -u -q  $mtt_switches -S "$Directory"  $1 $2 $3 $4
     mtt_status=$?

   # Exit on failure
   if [ "$mtt_status" != "0" ]; then
     echo Exiting MTT with error $mtt_status
     exit 1
   fi

   if [ "$3" != "view" ]; then
    if [ "$3" != "hview" ]; then
      echo Copying  $1_$2.$3
      cp -u -p $1_$2.$3 ..
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131

# 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 -u compcopy $1 
endif


# Create an arg file if it doesn't exist
$1_args.m:
	touch $1_args.m








|







1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152

# 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 -u $mtt_switches compcopy $1 || exit 1 
endif


# Create an arg file if it doesn't exist
$1_args.m:
	touch $1_args.m

1454
1455
1456
1457
1458
1459
1460
1461

1462
1463
1464
1465
1466
1467
1468
1469
	sub_sh2tex $1
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_alias.m $1_sub.sh 

	sh $1_sub.sh "mtt $mtt_switches -q -u -l $level+1 " ' abg m'
	rbg2abg_m $info_switch $1


#SUMMARY cbg	causal bond graph (m)
#Acausal bond graph to causal bond graph: mfile
$1_cbg.m: $1_abg.m
	abg2cbg_m $1







|
>
|







1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
	sub_sh2tex $1
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_alias.m $1_sub.sh
	lbl2component $1 | sh || exit 1
	(sh $1_sub.sh "mtt $mtt_switches -q -u -l $level+1 " ' abg m null  || exit 1') || exit 1
	rbg2abg_m $info_switch $1


#SUMMARY cbg	causal bond graph (m)
#Acausal bond graph to causal bond graph: mfile
$1_cbg.m: $1_abg.m
	abg2cbg_m $1
2032
2033
2034
2035
2036
2037
2038
2039





2040

2041
2042


if [ "$debug" != "debug" ]; then
  rm -f *.log
else
  echo Debugging - log files retained in LOGFILES  
  mkdir -p LOGFILES
  mv -f *.log LOGFILES
fi






if [ "$make_status" != "0" ]; then

    exit 2
fi










>
>
>
>
>

>
|

>
>
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
if [ "$debug" != "debug" ]; then
  rm -f *.log
else
  echo Debugging - log files retained in LOGFILES  
  mkdir -p LOGFILES
  mv -f *.log LOGFILES
fi

#Print what's going on if in verbose mode
if [ -n "$Verbose" ]; then
    echo Finishing mtt  $mtt_switches  $1 $2 $3 $4
fi

if [ "$make_status" != "0" ]; then
    echo Exiting MTT with error $make_status
    exit 1
fi



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