File mtt/bin/trans/sympar_txt2r artifact 48a0e2e4e2 part of check-in 4683e9435a


#! /bin/sh

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

# Bourne shell script: sympar_txt2r

# Label file to symbolic parameters conversion
# P.J.Gawthrop March 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.6  1998/02/17 17:03:54  peterg
## Fixed bug in writing out matrix declaration
##
## Revision 1.5  1998/02/16 12:14:21  peterg
## Corrected writing out of MTTVAR matrix - now does this id non-zero
## number of variables - not vv!
##
## Revision 1.4  1997/05/09 14:20:49  peterg
## Dont declare MTTVAR array when there are no variables.
##
# Revision 1.3  1997/03/19  16:39:12  peterg
# Put in the correct date.
#
# Revision 1.2  1997/03/18  17:56:35  peterg
# Cosmetic changes.
#
###############################################################


# Inform user
echo "Creating $1_sympar.r"

rm -f mtt_error

#Write some file headers
echo "%% Symbolic parameter file ($1_sympar.r)"  > $1_sympar.r
echo "%% Generated by MTT at `date`"  >> $1_sympar.r
echo  >> $1_sympar.r

#Count the lines in the file
lines=`grep -c  '.' $1_sympar.txt`

if [ "$lines" != "0" ]; then
    echo "MATRIX MTTVAR($lines,1);"   >> $1_sympar.r
fi
echo "MTTNVAR := $lines;"   >> $1_sympar.r
echo   >> $1_sympar.r

#Write out the variables in reduce format.
gawk '{i++; print "MTTVAR(" i ",1) := " $1 ";"}' $1_sympar.txt  >> $1_sympar.r

echo 'END;'  >> $1_sympar.r

# Now invoke the standard error handling.
# mtt_error mtt_error.txt




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