File mttroot/mtt/bin/trans/sympar2numpar_r2m artifact 187b2808c4 part of check-in a580330cb6


#! /bin/sh

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

# Bourne shell script: mknumpar
# Creates the deafault numerical parameters file for the system

# Copyright (c) P.J.Gawthrop 1996

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.4  1996/08/15 12:46:59  peter
## Removed a spuriuos echo.
##
## Revision 1.3  1996/08/12 20:20:59  peter
## Explicit parameters via out put list.
## Parameter conversion stuff deleted.
##
## Revision 1.2  1996/08/11 10:41:52  peter
## Fixed various bugs.
##
## Revision 1.1  1996/08/11 08:48:07  peter
## Initial revision
##
###############################################################

# Inform user
echo Creating $1_numpar.m

# Remove the old log file
rm -f mknumpar.log

# Use reduce to accomplish the transformation
reduce >mknumpar.log << EOF

%Set up the number of argument variables to zero in case the user has forgotten
MTTNVar := 0;

%Read the symbolic parameters file
IN "$1_sympar.r";

OUT "$1_numpar.m";


IF MTTNvar>0 THEN
BEGIN
  write "function [ ...;;";
  FOR i := 1:MTTNvar DO
  BEGIN
     IF i<MTTNvar THEN write MTTVar(i,1), ",..."
                  ELSE write MTTVar(i,1), "] = $1_numpar;;";
  END
END; 

if MTTNVar=0 THEN
  write "function foo=$1_numpar;;";


write "% function [par_list] = $1_numpar;";
write "% Created by MTT";

IF MTTNvar>0 THEN
BEGIN
  FOR i := 1:MTTNvar DO
  BEGIN
    write MTTVar(i,1), "  = 1;	% Default value";
  END;
END;

if MTTNVar=0 THEN
  write "foo=0";


SHUT "$1_numpar.m";



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