#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
# Bourne shell script: sympar_r2c
# Convert symbolic parameters to a c declaration list
# Copyright (c) P.J.Gawthrop 1997.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.1 1997/03/01 11:20:36 peterg
# Initial revision
###############################################################
# Inform user
echo Creating $1_sympar.c
# Remove the old log file
rm -f sympar_r2c.log
# Use reduce to accomplish the transformation
reduce >sympar_r2c.log << EOF
%Read the symbolic parameters file
in "$1_sympar.r";
%Generate the global variable list.
OUT "$1_sympar.c";
%External (global) variable list
write "/* Symbolic paramaters for system $1 */ "$
write "/* Generated by MTT */ "$
write "/* External (global) variable list */ "$
IF MTTNvar>0 THEN
BEGIN
FOR i := 1:MTTNvar DO
IF numberp(MTTVar(i,1))
THEN
BEGIN
% Do nowt
END
ELSE
BEGIN
write "extern double ", MTTVar(i,1), ";"$
END$
END$
SHUT "$1_sympar.c";
EOF