Artifact e00c7a936e91e5a47e5070166c390d84632dd7f82f05d52462702b7ce8becf59:


#! /bin/sh
# $Id$
# $Log$
# Revision 1.3  2002/05/15 14:22:25  geraint
# Code for Simulink S-function target written direct to sfun.cc instead of
# calling .mexglx files. This eliminates the sfun dependency on Octave
# ColumnVectors. sys_sfun.cc should build directly on a MS Windows machine
# (can't test this yet).
#
# added sfun.zip target to create source code to export.
#
# Revision 1.2  2002/04/28 18:58:06  geraint
# Fixed [ 549658 ] awk should be gawk.
# Replaced calls to awk with call to gawk.
#
# Revision 1.1  2000/12/28 09:46:05  peterg
# put under RCS
#
# Revision 1.3  2000/12/05 12:13:52  peterg
# Changed function name to name()
#
# Revision 1.2  2000/12/04 12:04:46  peterg
# Changed $() to `` for sh compatibility -- geraint
#
# Revision 1.1  2000/12/04 12:02:23  peterg
# Initial revision
#
# Revision 1.1  2000/10/31 04:32:28  geraint
# Initial revision
#

SYS=$1
IN=${SYS}_def.m
SYM=${SYS}_sympar.txt
OUT=${SYS}_def.h

get_array_size ()
{
vec=$1
gawk -v vec=${vec} '($1 == vec && $2 == "=") { print $3 }' | sed s/\;//
}

 echo "/* ${SYS}_def.h, generated by MTT on `date` */"			>  ${OUT}
 echo ""								>> ${OUT}
 echo "#ifndef HAVE_${SYS}_DEF_H"					>> ${OUT}
 echo "#define HAVE_${SYS}_DEF_H"					>> ${OUT}
 echo ""								>> ${OUT}
 echo "const int MTTNU   = `cat ${IN} | get_array_size nu`;"		>> ${OUT}
 echo "const int MTTNX   = `cat ${IN} | get_array_size nx`;"		>> ${OUT}
 echo "const int MTTNY   = `cat ${IN} | get_array_size ny`;"		>> ${OUT}
 echo "const int MTTNZ   = `cat ${IN} | get_array_size nz`;"		>> ${OUT}
 echo "const int MTTNYZ  = `cat ${IN} | get_array_size nyz`;"		>> ${OUT}
 echo "const int MTTNPAR = `wc -l ${SYM} | gawk '{ print $1 }'`;"      	>> ${OUT}
 echo ""								>> ${OUT}
 echo "static int mttnu, mttnx, mttny, mttnyz, mttnz;"		       	>> ${OUT}
 echo ""								>> ${OUT}
 echo "#endif"								>> ${OUT}





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