Index: mttroot/mtt/bin/trans/mtt_r2m ================================================================== --- mttroot/mtt/bin/trans/mtt_r2m +++ mttroot/mtt/bin/trans/mtt_r2m @@ -14,10 +14,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.17 2000/05/20 15:23:56 peterg +## Paramererised version of sm etc etc (using -parameter switch) +## ## Revision 1.16 2000/04/18 11:14:18 peterg ## Put in the -parameters option ## ## Revision 1.15 2000/02/10 14:58:57 peterg ## *** empty log message *** @@ -102,15 +105,22 @@ #Set up gentran cat <mtt_setreduce.r % Set up the code generator % Load the general translator package LOAD GENTRAN; +LOAD SCOPE; GENTRANLANG!* := '$codegenerator; -ON GENTRANSEG; +ON GENTRANSEG; % Segmentation +ON GENTRANOPT; % Code optimise using scope +OFF GENDECS; % No declarations MAXEXPPRINTLEN!* := 80; TEMPVARNUM!* := 1; -TEMPVARNAME!* := 'mtt_t; +TEMPVARNAME!* := 'mtt_s; + +% Output control +ON DIV; +ON EXP; % Matrix output function in"$MTTPATH/trans/lang_matrix.r"; @@ -141,12 +151,12 @@ echo Creating $outfileo.m #rm -f $1_odea.$ext.1; #Header - lang_header $noglobals $parameters $1 $rep $ext 'mttx,mttu,mttt,mttpar' mttdx > $1_$2.p - lang_header $noglobals $parameters $1 $2o $ext 'mttx,mttu,mttt,mttpar' mtty > $1_$2o.p + lang_header $noglobals $parameters $1 $rep $ext 'mttx,mttu,mttt,mttpar' mttdx > $1_$2.pas + lang_header $noglobals $parameters $1 $2o $ext 'mttx,mttu,mttt,mttpar' mtty > $1_$2o.pas rm -f mtt_ode mtt_odeo # Use reduce to accomplish the transformation $SYMBOLIC > mtt_r2m.log <> $1_$2.p -#sed 's/mtt_matrix/mtte/' > $1_$2.p -sed 's/mtt_matrix/mtty/' > $1_$2o.p +sed 's/mtt_matrix/mttdx/' > $1_$2.pas +#sed 's/mtt_matrix/mtte/' > $1_$2.pas +sed 's/mtt_matrix/mtty/' > $1_$2o.pas -rm -f mtt_odeo mtt_ode #mtt_odee +#rm -f mtt_odeo mtt_ode #mtt_odee # Convert from Pascal syntax to Octave syntax - mtt_p2m<$1_$2o.p > $1_$2o.m + mtt_p2m<$1_$2o.pas > $1_$2o.m - rm -f $1_odeo.p + rm -f $1_odeo.pas fi if [ "$rep" = "sm" ]||[ "$rep" = "ssm" ]||[ "$rep" = "dm" ]||\ [ "$rep" = "csm" ]||[ "$rep" = "obs" ]; then if [ "$rep" = "sm" ]||[ "$rep" = "ssm" ]; then #Header - lang_header $noglobals $parameters $1 $rep $ext "$par" [mtta,mttb,mttc,mttd] > $outfile.p + lang_header $noglobals $parameters $1 $rep $ext "$par" [mtta,mttb,mttc,mttd] > $outfile.pas Symbols='a b c d' fi if [ "$rep" = "dm" ]||[ "$rep" = "csm" ]; then #Header - lang_header $noglobals $parameters $1 $rep $ext "$par" [mtta,mttb,mttc,mttd,mtte] > $outfile.p + lang_header $noglobals $parameters $1 $rep $ext "$par" [mtta,mttb,mttc,mttd,mtte] > $outfile.pas Symbols='a b c d e' fi if [ "$rep" = "obs" ]; then # Is the system affine (look in the _obs.r file affine=`grep 'affine :=' $1_obs.r | awk '{print $3}' | sed 's/;//'` echo 'affine = ' $affine #Header if [ "$affine" = "1" ]; then - lang_header $noglobals $parameters $1 obs m mttx [mttobs_o,mttobs_h] > $outfile.p + lang_header $noglobals $parameters $1 obs m mttx [mttobs_o,mttobs_h] > $outfile.pas else - lang_header $noglobals $parameters $1 obs m mttx,mttu mttyy > $outfile.p + lang_header $noglobals $parameters $1 obs m mttx,mttu mttyy > $outfile.pas fi Symbols='obs_o obs_h' fi for Symbol in $Symbols; do @@ -329,27 +339,27 @@ lang_matrix(); GENTRANSHUT "$outfile.1"; EOF -echo "%$Symbol matrix#" >> $outfile.p -cat mtt_zero.m >> $outfile.p +echo "%$Symbol matrix#" >> $outfile.pas +cat mtt_zero.m >> $outfile.pas sed "s/mtt_matrix/mtt$Symbol/" < $outfile.1 |\ -grep -v '=0\.0;' >> $outfile.p +grep -v '=0\.0;' >> $outfile.pas done fi # Convert from Pascal syntax to Octave syntax - mtt_p2m <$outfile.p > $outfile.m + mtt_p2m <$outfile.pas > $outfile.m -rm -f $outfile.p +rm -f $outfile.pas rm -f mtt_zero.m rm -f $outfile.1