Artifact abbcf4831fc2c6556b6b9297c6ce5123aac13f748e57dc3f19efdba7587a624f:


#! /bin/sh

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

# Bourne shell script: cmp2sub_m2sh

# Copyright (c) P.J.Gawthrop 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.8  2000/10/03 11:34:29  peterg
## Put in correct $MTT_LIB
##
## Revision 1.7  2000/01/18 14:22:58  peterg
## Now exits if file already exists
##
## Revision 1.6  1999/08/25 21:20:07  peterg
## Don't list components starting with 0 ot 1
##
## Revision 1.5  1996/11/09 21:09:43  peterg
## Added lib path.
##
# Revision 1.4  1996/11/03  21:19:55  peterg
# Generates generic commands in form $1name$2.
#
## Revision 1.3  1996/11/01 12:48:21  peterg
## Run mtt in quiet mode.
##
## Revision 1.2  1996/10/20 19:22:41  peterg
## Cleans up after itself.
##
## Revision 1.1  1996/10/20 19:19:50  peterg
## Initial revision
##
###############################################################

if [ -f "$1_sub.sh" ]; then
    echo Using "$1_sub.sh"
    exit
else
    #Inform user
    echo Creating $1_sub.sh    
fi


echo '# Commands to generate subsystem representations'>  $1_sub.sh
echo "# File $1_sub.sh"			>> $1_sub.sh
echo "# Generated by MTT on `date`."	>> $1_sub.sh
echo					>> $1_sub.sh

# Get a list of all components for the _cmp file
gawk '/comp_type = / {print substr($3,2,length($3)-3)}' $1_cmp.m |\
sort -u > mtt_tmp1

# Remove all components starting with 0 or 1
grep -v '^[01]' < mtt_tmp1 > mtt_tmp4

# Get a list of all standard simple components
ls $MTT_LIB/comp/simple |\
  gawk '/_cause.m/{split($1,a,"_");print(a[1])}'  >mtt_tmp2

# Get a list of all standard compound components
#ls $MTTPATH/comp/compound |\
#  gawk '/_abg.m/{split($1,a,"_");print(a[1])}'  >> mtt_tmp2

# Sorted combined list
cat mtt_tmp2 | \
  sed  's/^zero$/0/' |\
  sed  's/^one$/1/' |\
  sort -u >mtt_tmp3

# Print the non-standard components
comm mtt_tmp4 mtt_tmp3 |\
  gawk 'BEGIN{FS="\t"}{if (length($1)>0) print "$1" $1 "$2"}' \
  >>$1_sub.sh

# Clean up mtt_tmp files
#rm -f mtt_tmp?










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