File mttroot/mtt/bin/trans/sympar2global_txt2lang artifact 3d88bdddde part of check-in 2a56bcb441


#! /bin/sh

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

# Bourne shell script: sympar2global_txt2lang

# Symbolic parameters to default paramers in computer language
# P.J.Gawthrop March 1997
# Copyright (c) P.J.Gawthrop, 1997.


###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.6  1998/11/18 11:55:51  peterg
## Now uses sympar2global_txt2m for the m bit
##
## Revision 1.5  1998/07/26 11:00:18  peterg
## Put in exits-- this all needs a good clean
##
## Revision 1.4  1998/07/26 10:50:30  peterg
## Corrected bug.
##
## Revision 1.3  1998/07/26 10:48:18  peterg
## Now strips comments
##
## Revision 1.2  1998/07/25 18:49:00  peterg
## Now uses extended sympars -- sympar + switches
##
## Revision 1.1  1998/06/15 15:24:33  peterg
## Initial revision
##
###############################################################

# Set up language stuff.
language=$2

case $language in
    m)
	Lc='#';
	Rc='#';
	;;
    c)
	Lc='/*';
	Rc='*/';
	;;
    java)
	Lc='/*';
	Rc='*/';
	;;
    *)
	echo Language $2 not supported - sorry; exit 1
esac

cat <<EOF

$Lc====== Set up the global variables ======$Rc
EOF
# Matlab bit
#Write out the variables in matlab global format
if [ "$language" = "m" ]; then
  sympar2global_txt2m $1
exit
fi

if [ "$language" = "c" ]; then
  strip_comments <$1_sympars.txt  |\
    gawk '{
      i++; print "extern double", tolower($1) ";";
    }'
exit
fi

if [ "$language" = "java" ]; then
cat <<EOF
    $1_numpar p;
    private p = new $1_numpar();
EOF 
  strip_comments <$1_sympars.txt  |\
      gawk '{
        i++; print "  float " tolower($1) " = p." tolower($1) ";";
      }'
fi

echo

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




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