Index: mttroot/mtt/bin/trans/mtt_r2m ================================================================== --- mttroot/mtt/bin/trans/mtt_r2m +++ mttroot/mtt/bin/trans/mtt_r2m @@ -14,10 +14,15 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.19 2000/08/28 20:17:59 peterg +## Put in Winfried Neun's bug fix +## -- prevents segmentation violation using optimised gentran when matrix +## comtains a number +## ## Revision 1.18 2000/08/24 17:11:40 peterg ## Now optimises as well as segmenting - uses the SCOPE package ## ## Revision 1.17 2000/05/20 15:23:56 peterg ## Paramererised version of sm etc etc (using -parameter switch) @@ -113,17 +118,20 @@ LOAD GENTRAN; LOAD SCOPE; GENTRANLANG!* := '$codegenerator; ON GENTRANSEG; % Segmentation ON GENTRANOPT; % Code optimise using scope + +ON GETDECS; % Create decrarations automatically +DEFTYPE!* := 'REAL; % and default to real OFF GENDECS; % No declarations MAXEXPPRINTLEN!* := 80; TEMPVARNUM!* := 1; TEMPVARNAME!* := 'mtt_s; - +INAME(mtt_o); % Matrix output function -in"$MTTPATH/trans/lang_matrix.r"; +%in"$MTTPATH/trans/lang_matrix.r"; %Read the reduce definitions file in "$1_def.r"; %Read the reduce $REP file @@ -179,50 +187,55 @@ in"mtt_setreduce.r"; % The body of the odeo function GENTRANOUT "mtt_odeo"; - mtt_matrix := MTTy$ - mtt_matrix_n := MTTNy$ - mtt_matrix_m := 1$ - lang_matrix(); - GENTRANSHUT "mtt_odeo"; + %mtt_matrix := MTTy$ + %mtt_matrix_n := MTTNy$ + %mtt_matrix_m := 1$ + %lang_matrix(); + GENTRAN MTT_matrix :=: MTTy$ + GENTRANSHUT "mtt_odeo"; END;; EOF +mtt_vectorise mtt_odeo; # Its really a vector if [ "$rep" = "ode" ]; then # Use reduce to accomplish the transformation $SYMBOLIC >> mtt_r2m.log <> mtt_r2m.log <> $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.pas > $1_$2o.m rm -f $1_odeo.pas @@ -346,13 +359,14 @@ write "mtt$Symbol = zeros(", $N, ",", $M , ");" ; SHUT "mtt_zero.m"; GENTRANOUT "$outfile.1"; mtt_matrix := MTT$Symbol; - mtt_matrix_n := $N; - mtt_matrix_m := $M; - lang_matrix(); + %mtt_matrix_n := $N; + %mtt_matrix_m := $M; + %lang_matrix(); + GENTRAN mtt_matrix :=: mtt_matrix; GENTRANSHUT "$outfile.1"; END; EOF @@ -372,13 +386,13 @@ # Convert from Pascal syntax to Octave syntax mtt_p2m <$outfile.pas > $outfile.m rm -f $outfile.pas rm -f mtt_zero.m -#rm -f $outfile.1 +rm -f $outfile.1 # Now invoke the standard error handling. mtt_error_r mtt_r2m.log