Overview
| Comment: | Changed to a one argument version (Sys_rep.lang) for implicit make rules. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | origin/master | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
a1b9f11afd0d3034cfde4e107df7897a |
| User & Date: | gawthrop@users.sourceforge.net on 2000-04-10 10:06:04.000 |
| Other Links: | branch diff | manifest | tags |
Context
|
2000-04-10
| ||
| 10:06:41 | Sorted out implicit rules for p2oct conversion check-in: e6acee580b user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
| 10:06:04 | Changed to a one argument version (Sys_rep.lang) for implicit make rules. check-in: a1b9f11afd user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
| 09:40:13 | Initial revision check-in: 056069352f user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/trans/mtt_p2cc
from [4b2506166d]
to [f3ef493314].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
# Bourne shell script: mtt_p2oct
# Pascal to .oct (octave loadable binary).
# P.J.Gawthrop Feb 2000
# Copyright (C) 2000 by Peter J. Gawthrop
#$Id$
# Find system constants
| > > > > > | | | < < < < < < | | | | | | | | | | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
# Bourne shell script: mtt_p2oct
# Pascal to .oct (octave loadable binary).
# P.J.Gawthrop Feb 2000
# Copyright (C) 2000 by Peter J. Gawthrop
#$Id$
## Extract the system and rep names.
sys=`mtt_sysname $1`
rep=`mtt_repname $1`
sys_rep=$sys"_"$rep
# Find system constants
Nx=`mtt_getsize $sys x` # States
Nu=`mtt_getsize $sys u` # Inputs
Ny=`mtt_getsize $sys y` # Inputs
# Create the representation code
mtt_p2C $sys $rep
# Inform user
echo Creating $sys_rep.cc
# Create the c++ code
# Heading
date=`date`
cat > $sys_rep.cc <<EOF
#include <octave/oct.h>
DEFUN_DLD ($sys_rep, args, ,
"$sys_rep was generated by MTT on $date")
{
ColumnVector mttx = args(0).vector_value ();
ColumnVector mttu = args(1).vector_value ();
double mttt = args(2).double_value ();
ColumnVector mttpar = args(3).vector_value ();
EOF
case "$rep" in
ode)
echo " ColumnVector mttdx ($Nx);" >> $sys_rep.cc
;;
odeo)
echo " ColumnVector mtty ($Ny);" >> $sys_rep.cc
;;
cse)
echo " ColumnVector mttdx ($Nx);" >> $sys_rep.cc
;;
cseo)
echo " ColumnVector mtty ($Ny);" >> $sys_rep.cc
;;
smx | smxa | smxax)
Nxx=`echo "$Nx*$Nx" | bc`
echo " ColumnVector mtta ($Nxx);" >> $sys_rep.cc
echo " ColumnVector mttax ($Nx);" >> $sys_rep.cc
;;
*)
esac
#Extract Type info
echo '/* Types */' >> $sys_rep.cc
grep typedef $sys_rep.C >> $sys_rep.cc
#Extract the rep code and converting [] to () and deleting mtt variables etc
echo "/* Representation $rep information */" >> $sys_rep.cc
awk '{
if ($1=="}") writing=0;
if ( (writing)&&(match($2,"mtt")!=1) ) print $0;
if (match($1,"{")==1) writing=1;
}' <$sys_rep.C |\
sed 's/\[\([0-9]*\)\]/(\1)/g' |\
sed 's/\[\(mmtti\)\]/(\1)/g' >> $sys_rep.cc
# Tail
cat >> $sys_rep.cc <<EOF
EOF
case "$rep" in
ode)
echo "return octave_value (mttdx);" >> $sys_rep.cc;
;;
odeo)
echo "return octave_value (mtty); " >> $sys_rep.cc;
;;
cse)
echo "return octave_value (mttdx);" >> $sys_rep.cc;
;;
cseo)
echo "return octave_value (mtty); " >> $sys_rep.cc;
;;
smxa)
echo "return octave_value (mtta); " >> $sys_rep.cc;
;;
smxax)
echo "return octave_value (mttax); " >> $sys_rep.cc;
;;
*)
esac
# Terminating }
echo "}" >> $sys_rep.cc;
# Convert to octave loadable code
echo Creating $sys_rep.oct
mkoctfile $sys_rep.cc
|