File mttroot/mtt/bin/trans/struc2switch_txt artifact 05163357ae part of check-in b6a47212b3


#! /bin/sh

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

# Bourne shell script: struc2switch_txt

# Structure file - generate a file for switching on states
# P.J.Gawthrop May 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.6  2001/08/02 03:01:08  geraint
## Stopped initialisation of mttopen from over-writing logic.txt contents.
##  - comment removed from "sort" input (which put it last) because
## initialisation is inserted in place of the comment by switch_txt2m.
##
## Revision 1.5  2000/10/17 09:20:00  peterg
## *** empty log message ***
##
## Revision 1.4  1998/07/26 10:28:30  peterg
## Added a header line to avoid empty file and to trigger
## switch_txt2m to write initial stuff.
##
## Revision 1.3  1998/07/25 18:50:53  peterg
## Lower case names
##
## Revision 1.2  1997/06/03 15:17:09  peterg
## Changed label to MTT_SWITCH
##
# Revision 1.1  1997/05/13  16:58:59  peterg
# Initial revision
#
###############################################################




echo Creating  $1_switch.txt

rm -f $1_switch.txt
echo "# These are the switches deduced from ISW and CSW components"\
 > $1_switch.txt

# This is the main transformation using awk
gawk '{ 
   if ($1=="state") {i++; if ($3=="MTT_SWITCH")  print tolower($4) "\t" i};
}
END{
}
' < $1_struc.txt| sort >> $1_switch.txt

strip_comments < $1_switch.txt | wc -l | gawk '{print $1 " switches found"}'










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