#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
# Bourne shell script: cmp2sub_m2sh
# Copyright (c) P.J.Gawthrop 1996.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################
#Inform user
echo Creating $1_sub.sh
echo '# Commands to generate subsystems'> $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
awk '/comp_type = / {print substr($3,2,length($3)-3)}' $1_cmp.m |\
sort -u > tmp1
# Get a list of all simple components
ls $MTTPATH/comp/simple |\
awk '/_cause.m/{split($1,a,"_");print(a[1])}' |\
sed 's/^zero$/0/' |\
sed 's/^one$/1/' |\
sort -u >tmp2
# Print the non-standard components
comm tmp1 tmp2 |\
awk 'BEGIN{FS="\t"}{if (length($1)>0) print "mtt", $1, "abg m"}' \
>>$1_sub.sh