File mttroot/mtt/bin/trans/modpar_txt2r artifact 46d5afca36 part of check-in a0d28fdb76


#! /bin/sh

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

# Bourne shell script: modpar_txt2r
# Creates the reduce code for modulated parameters

# Copyright (C) 2001 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $$Id$
## $Log$
## Revision 1.2  2002/04/16 11:36:03  gawthrop
## These were flagged with M on cvs update
##
## Revision 1.1  2001/04/02 08:19:18  gawthrop
## Translates modulated parameters into reduce
##
###############################################################

# Inform user
echo Creating $1_modpar.r

#Create the modpar file complete with headers.
echo "% Modpar file ($1_modpar.r)" > $1_modpar.r
echo "% Generated by MTT at `date`" >> $1_modpar.r

parameters=`strip_comments < $1_modpar.txt |  cut -f1`
inputs=`strip_comments < $1_modpar.txt |  cut -f2`


for parameter in $parameters; do
    grep $1_${parameter}_ $1_struc.txt |\
    gawk 'BEGIN{
               name["input"] = "u";
               name["output"] = "y";
               name["state"] = "x";
               name["nonstate"] = "z";
	      }
	 {
           printf("%s := mtt%s(%i,1);\n", parameter, name[$1],  $2)
         }' parameter=$parameter >> $1_modpar.r
done


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