Index: mttroot/mtt/bin/trans/txt2m ================================================================== --- mttroot/mtt/bin/trans/txt2m +++ mttroot/mtt/bin/trans/txt2m @@ -13,10 +13,13 @@ # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # %% Version control history # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # %% $Id$ # %% $Log$ +# %% Revision 1.12 1998/08/14 10:47:31 peterg +# %% Put ImplicitS sub before Implicit!! +# %% # %% Revision 1.11 1998/08/14 10:43:44 peterg # %% Added ImplicitS - sparse integration # %% # %% Revision 1.10 1998/08/11 13:27:51 peterg # %% Lowercase mttLAST etc @@ -71,25 +74,35 @@ fi # Inform user echo Creating $1_$2.m - -if [ "$representation" != "simpar" ]; then - #Create the $2 file complete with headers. - echo "function $name = $1_$2$arg" > $1_$2.m - echo "%% $2 file ($1_$2.m)" >> $1_$2.m - echo "%% Generated by MTT at `date`" >> $1_$2.m - echo "% Global variable list" >> $1_$2.m - sympar2global_txt2m $1 >> $1_$2.m -else - echo "% Script file $1_$2.m" > $1_$2.m - echo '% Dummy globals' >> $1_$2.m - echo 'global ...' >> $1_$2.m - echo 'mtt_dummy_global;' >> $1_$2.m -fi - +#Create the $2 file complete with headers. +case $representation in + simpar) + echo "% Script file $1_$2.m" > $1_$2.m + echo "%% $2 file ($1_$2.m)" >> $1_$2.m + echo "%% Generated by MTT at `date`" >> $1_$2.m + echo '% Dummy globals' >> $1_$2.m + echo 'global ...' >> $1_$2.m + echo 'mtt_dummy_global;' >> $1_$2.m + ;; + numpar) + echo "% Script file $1_$2.m" > $1_$2.m + echo "%% $2 file ($1_$2.m)" >> $1_$2.m + echo "%% Generated by MTT at `date`" >> $1_$2.m + echo "% Global variable list" >> $1_$2.m + sympar2global_txt2m $1 >> $1_$2.m + ;; + *) + echo "function $name = $1_$2$arg" > $1_$2.m + echo "%% $2 file ($1_$2.m)" >> $1_$2.m + echo "%% Generated by MTT at `date`" >> $1_$2.m + echo "% Global variable list" >> $1_$2.m + sympar2global_txt2m $1 >> $1_$2.m + ;; +esac #Write out the variables in m format. cat $1_$2.txt |\ awk -F# 'BEGIN{ quote = "\047"; @@ -109,19 +122,20 @@ sub(/^WMAX/, "mttWMAX", LHS); sub(/^WSTEPS/, "mttWSTEPS", LHS); LHS = tolower(LHS); RHS = tolower(RHS); sub(/["]*euler["]*/, 1, RHS); - sub(/["]*implicitl["]*/, 2, RHS); - sub(/["]*implicits["]*/, 4, RHS); - sub(/["]*implicit["]*/, 3, RHS); + sub(/["]*implicit["]*/, 2, RHS); statement = sprintf("%s= %s",LHS,RHS); if ( (match(statement,";")==0)&&\ ((match(statement,"if ")==0))&&\ ((match(statement,"for ")==0)) ) statement = sprintf("%s;", statement); } + else if (match($1,"global")==1) { + statement = tolower($1); # Lower case globals as well + } else statement = $1; if (NF<2) print statement if (NF>1) print statement " # " $2 @@ -129,10 +143,11 @@ -e 's/\[\([0-9]*\)\]/(\1)/g' \ -e 's/\([^a-zA-Z_]\)t\([^a-zA-Z_]\)/\1mttt\2/g' \ -e 's/x(/mttx(/g' \ -e 's/u(/mttu(/g' \ -e 's/mttmtt/mtt/g' \ + -e 's/#/%/g' \ >> $1_$2.m