#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
# Bourne shell script: def_r2m
# transforms definitions from reduce to m file.
# Copyright (c) P.J.Gawthrop 1996
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1 1998/07/25 07:10:41 peterg
## Initial revision
##
###############################################################
#Inform user
echo Creating $1_def.m
# Remove the old log file
rm -f def_r2m.log
# Header
cat <<EOF > $1_def.m
function [nx,ny,nu,nz,nyz] = $1_def;
% function [nx,ny,nu,nz,nyz] = $1_def;
% System $1, representation def, language m
% File $1_def.m;
% Generated by MTT on `date`;
%
EOF
# Constants
Nx=`grep "MTTNx " <$1_def.r | awk '{print $3}' | sed 's/;//'`
Ny=`grep "MTTNy " <$1_def.r | awk '{print $3}' | sed 's/;//'`
Nu=`grep "MTTNu " <$1_def.r | awk '{print $3}' | sed 's/;//'`
Nz=`grep "MTTNz " <$1_def.r | awk '{print $3}' | sed 's/;//'`
Nyz=`grep "MTTNyz " <$1_def.r | awk '{print $3}' | sed 's/;//'`
cat<<EOF >> $1_def.m
nx = $Nx;
ny = $Ny;
nu = $Nu;
nz = $Nz;
nyz = $Nyz;
EOF