File mttroot/mtt/cc/sympar_txt2h.sh artifact 9a054e0600 part of check-in 1766067043


#! /bin/sh
# $Id$
# $Log$
# Revision 1.5  2002/04/28 18:58:06  geraint
# Fixed [ 549658 ] awk should be gawk.
# Replaced calls to awk with call to gawk.
#
# Revision 1.4  2001/08/24 21:41:04  geraint
# Fixed problem with declaration when there are no numerical parameters.
#
# Revision 1.3  2001/03/19 02:28:53  geraint
# Branch merge: merging-ode2odes-exe back to MAIN.
#
# Revision 1.2.2.1  2001/03/16 03:56:54  geraint
# Convert variable names to lower case.
#
# Revision 1.2  2001/02/05 13:03:19  geraint
# Restrict scope of variables to file (static).
# Warn GCC that variables may be unused.
#
# Revision 1.7  2001/01/09 15:43:50  geraint
# Warn gcc that variables may be unused.
#
# Revision 1.6  2001/01/08 05:47:56  geraint
# Restrict scope of variables to file (static)
#
# Revision 1.5  2000/12/05 12:44:55  peterg
# Changed $() to ``
#
# Revision 1.4  2000/12/05 12:16:02  peterg
# Changed function name to name()
#
# Revision 1.3  2000/12/04 11:05:01  peterg
# Removed () -- geraint
#
# Revision 1.2  2000/11/07 17:29:27  peterg
# Changed echo
#
# Revision 1.1  2000/11/07 17:28:53  peterg
# Initial revision
#
# Revision 1.1  2000/10/31 04:32:02  geraint
# Initial revision
#

SYS=$1

if [ $# -gt 1 ]
then
  NUM_OF_TMP_VAR=$2;
  shift; shift;
else
  NUM_OF_TMP_VAR=500
  shift;
fi
TMP_VAR_NAMES="mtt_tmp mtt_o $*"

IN=${SYS}_sympar.txt
OUT=${SYS}_sympar.h

declare_sys_param ()
{
cat ${IN} | gawk '(NF>0){printf ("static double %s MTT_UNUSED;\t/* %s\t*/\n", tolower($1), $2)}'
}

declare_temp_vars ()
{
for name in ${TMP_VAR_NAMES}
do
    echo ""
    i=0
    while [ ${i} -le ${NUM_OF_TMP_VAR} ]
    do
	echo "static double ${name}${i} MTT_UNUSED;"
	i=`expr ${i} + 1`
    done
done
}

echo Creating ${OUT}
cat <<EOF > ${OUT}
#ifndef MTT_UNUSED
#ifdef __GNUC__
#define MTT_UNUSED __attribute__ ((__unused__))
#else
#define MTT_UNUSED
#endif
#endif

EOF

declare_sys_param	>> ${OUT}
declare_temp_vars	>> ${OUT}



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