File mttroot/mtt/bin/trans/sympar2global_txt2lang artifact d0a4142906 part of check-in e408b99c7f


#! /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.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

awk '
BEGIN{
  var = "foobar";
  print "global ..."
}
{i++; print tolower($1), "..."; var = $1}
END{
  print var ";" # Repeat the last variable to avoid the trailing ...
}' $1_sympars.txt

fi

if [ "$language" = "c" ]; then
    awk '{
      i++; print "extern double", tolower($1) ";";
    }' $1_sympar.txt
 fi

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


echo

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




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