#!/bin/sh
######################################
##### Model Transformation Tools #####
######################################
# Bourne shell script: mtt_make_sympar
# Makes the sympar.txt file
# Copyright (C) 2000 by Peter J. Gawthrop
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.4 2000/11/02 18:53:46 peterg
## Added NOPAR words to unwanted list.
##
## Revision 1.3 2000/10/16 09:41:29 peterg
## Fixed bug with printing a blank line.
##
## Revision 1.2 2000/10/16 09:10:08 peterg
## Now strips out "unwanted" bits frome the _aliased.txt file
##
## Revision 1.1 2000/10/12 19:24:28 peterg
## Initial revision
##
##
###############################################################
sys=$1 # System name
filename=$1_sympar.txt
# Inform user
echo Creating $filename
# Create list of all sympars including those that are aliased
sh $1_type.sh 'echo ' ' ' ' ' |\
awk '{print "abg2sympar_m2txt " $1, $2}' |\
sh | sort -u > mtt_all_sympar.txt
# Sort the aliased list
mtt_strip_args < $1_aliased.txt | sort -u > mtt_aliased_sort.txt
# Create list of unwanted stuff
cat mtt_aliased_sort.txt> mtt_unwanted.txt
notvar="[%|#]NOT[V|P]AR";
grep $notvar $1_lbl.txt | awk '{printf("%s\t%s\n", $2,sys)'} sys=$1 >>mtt_unwanted.txt
sort -u mtt_unwanted.txt > mtt_unwanted_sort.txt
# Compare it with the aliased list and show the differences
diff mtt_all_sympar.txt mtt_unwanted_sort.txt |\
awk '{if ($1=="<") printf("%s\t%s\n", $2,$3)}' > mtt_sympar.txt
# Assume same name in different system is the same
awk '{
if ($1==name){
sysname[i++]=$2
}
if ($1!=name){
if (length(name)>0){
printf("%s\t",name)
comma="";
for (j=1;j<=i;j++){
printf("%s%s", comma, sysname[j]);
comma=",";
}
printf("\n")
}
i=1;
sysname[1]=$2;
}
name = $1
}
END{
printf("%s\t",name)
comma="";
for (j=1;j<=i;j++){
printf("%s%s", comma, sysname[j]);
comma=",";
}
printf("\n")
}' < mtt_sympar.txt >$filename