Index: mttroot/mtt/bin/trans/cse2smx_lang ================================================================== --- mttroot/mtt/bin/trans/cse2smx_lang +++ mttroot/mtt/bin/trans/cse2smx_lang @@ -23,10 +23,14 @@ parameters='-parameters'; ;; -matrix) matrix='yes'; ;; + -optimise) + optimise='LOAD SCOPE; ON GENTRANOPT;'; + iname='INAME mtt_o;'; + ;; *) echo $1 is an unknown option exit;; esac shift @@ -72,11 +76,15 @@ exit;; esac # Inform user -echo Creating $1_$rep.$lang $blurb +if [ -n "$optimise" ]; then + blurbopt=' using code optimisation' +fi + +echo Creating $1_$rep.$lang $blurb $blurbopt #echo Creating $1_smxx.$lang #echo Creating $1_smxtx.$lang # Remove the old log file rm -f cse2smx_r.log @@ -99,22 +107,39 @@ OFF Echo; % Load the general translator package LOAD GENTRAN; -LOAD SCOPE; GENTRANLANG!* := 'Pascal; ON GENTRANSEG; % Segmentation -ON GENTRANOPT; % Code optimise using scope + OFF GENDECS; % No declarations MAXEXPPRINTLEN!* := 80; TEMPVARNUM!* := 1; TEMPVARNAME!* := 'mtt_s; +%% ' +% Optimise +$optimise + + +ON GETDECS; % Create decrarations automatically +DEFTYPE!* := 'REAL; % and default to real -% Matrix output function -%in"$MTTPATH/trans/lang_matrix.r"; +%%% The following is a bug fix from ZIB to fix +%%% segmentation violation problem +symbolic procedure maxtype type; +% ------------------------------------------------------------------- ; +% A type may be a pair (l u) wher l is the minimum type for a variable; +% and u is the maximum type. This procedure returns the maximum type.; +% ------------------------------------------------------------------- ; + if atom type + then type + else if pairp cdr type then cadr type else car type; +% This fix handles the case that the type is a list with ONE entry. +% Should never happen ?? W.N. +%%%%%% End of bug fix %Set up output according to the language. OFF NAT; GENTRANOUT "$1_$rep.body"; @@ -139,25 +164,25 @@ aa_ij := MTTE(i,j) - mttt*a_ij; IF (aa_ij NEQ 0) THEN IF ($nmatrix EQ 1) THEN BEGIN %% Write a with full indexing - INAME(mtt_o); % Set temp name + $iname GENTRAN mtta(i,j) ::=: aa_ij; END; IF (($nmatrix EQ 0) AND ($nrep EQ 1)) THEN BEGIN %% Write a with vector indexing - INAME(mtt_o); % Set temp name + $iname GENTRAN mtta(ij) ::=: aa_ij; END; mttAAx_i := mttAAx_i + aa_ij*xj; END; IF (mttAAx_i NEQ 0) THEN IF (($nrep EQ 0) OR ($nrep EQ 2)) THEN BEGIN - INAME(mtt_o); % Set temp name + $iname GENTRAN mttax(i) ::=: mttAAx_i; END; END; %Shut the output according to the language. Index: mttroot/mtt/bin/trans/mtt_r2m ================================================================== --- mttroot/mtt/bin/trans/mtt_r2m +++ mttroot/mtt/bin/trans/mtt_r2m @@ -14,10 +14,14 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.20 2000/08/30 10:43:17 peterg +## Simplified version using GENTRAN matrix :=: matrix +## lang_matrix is no longer used at all +## ## 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 ## @@ -87,10 +91,15 @@ ;; -parameters) parameters='-parameters'; par='mttpar' ;; + -optimise) + optimise='LOAD SCOPE; ON GENTRANOPT;'; + iname='INAME mtt_o;'; + ;; + *) echo $1 is an unknown option exit;; esac shift @@ -114,22 +123,24 @@ cat <mtt_setreduce.r % Set up the code generator % Load the general translator package LOAD GENTRAN; -LOAD SCOPE; -GENTRANLANG!* := '$codegenerator; -ON GENTRANSEG; % Segmentation -ON GENTRANOPT; % Code optimise using scope +GENTRANLANG!* := '$codegenerator; %' +ON GENTRANSEG; % Segmentation +% Optimise +$optimise ON GETDECS; % Create decrarations automatically -DEFTYPE!* := 'REAL; % and default to real +DEFTYPE!* := 'REAL; % and default to real ' OFF GENDECS; % No declarations MAXEXPPRINTLEN!* := 80; TEMPVARNUM!* := 1; -TEMPVARNAME!* := 'mtt_s; -INAME(mtt_o); +TEMPVARNAME!* := 'mtt_s; % ' + +$iname + % Matrix output function %in"$MTTPATH/trans/lang_matrix.r"; %Read the reduce definitions file in "$1_def.r"; @@ -158,11 +169,14 @@ END; EOF #Inform user -echo Creating $outfile.m +if [ -n "$optimise" ]; then + blurb=' using code optimisation' +fi +echo Creating $outfile.m $blurb # Remove the old log file rm -f mtt_r2m.log @@ -169,11 +183,11 @@ if [ "$rep" = "ode" ]||[ "$rep" = "cse" ]; then #echo Creating $1_odea.$ext outfileo=$outfile"o" - echo Creating $outfileo.m + echo Creating $outfileo.m $blurb #rm -f $1_odea.$ext.1; #Header lang_header $noglobals $parameters $1 $rep $ext 'mttx,mttu,mttt,mttpar' mttdx > $1_$2.pas