Index: mttroot/mtt/bin/trans/rbg2abg_m ================================================================== --- mttroot/mtt/bin/trans/rbg2abg_m +++ mttroot/mtt/bin/trans/rbg2abg_m @@ -9,10 +9,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.18 2001/03/30 15:13:58 gawthrop +## Rationalised simulation modes to each return mtt_data +## ## Revision 1.17 2000/12/05 12:04:03 peterg ## Changed function name to name() ## ## Revision 1.16 2000/12/05 09:04:08 peterg ## Fixed function () compatibility problem. @@ -161,11 +164,11 @@ test_units() { grep '^[\s]*[#|%]UNITS' < ${lbl_file} >/dev/null if [ $? = "0" ]; then grep '^[\s]*[#|%]UNITS' < ${lbl_file} |\ - awk '{ + gawk '{ printf("mtt_units.sh %s %s %s %s %s\n", sys, $2, $3, $4, $5) }' sys=${sys} | sh | grep ERROR if [ $? = "0" ]; then echo " " *MTT_ERRROR: domains and units are not OK - exiting exit 1 @@ -177,11 +180,11 @@ fi } check_ports_exist() { - declared_ports=`grep '^[\s]*[#|%]UNITS' < ${lbl_file} | awk '{print $2}'` + declared_ports=`grep '^[\s]*[#|%]UNITS' < ${lbl_file} | gawk '{print $2}'` for declared_port in $declared_ports; do grep "${sys}\.ports\.${declared_port}\.type" ${abg_file} >/dev/null if [ $? = "1" ]; then echo "*MTT_ERRROR: Units declared for non-existent port ${declared_port}" exit 1 @@ -190,11 +193,11 @@ } set_units() { grep '^[\s]*[#|%]UNITS' < ${lbl_file} |\ - awk '{ + gawk '{ printf(" %s.ports.%s.domain = \"%s\";\n", sys, $2, $3); printf(" %s.ports.%s.units.effort = \"%s\";\n", sys, $2, $4); printf(" %s.ports.%s.units.flow = \"%s\";\n", sys, $2, $5); }' sys=${sys} } Index: mttroot/mtt/bin/trans/rbg_fig2m ================================================================== --- mttroot/mtt/bin/trans/rbg_fig2m +++ mttroot/mtt/bin/trans/rbg_fig2m @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.9 2002/01/11 03:44:19 geraint +## Breaks compounds objects into individual components. Eliminates "incorrect object code error" in cbg.ps when component is not causally complete. +## ## Revision 1.8 2001/10/15 14:25:44 gawthrop ## Now handles white space at the end of component names ## Converts ports lables [1:5] into [1,2,3,4,5] ## ## Revision 1.7 2001/07/24 22:42:59 geraint @@ -74,11 +77,11 @@ # and break compound objects sed 's/[ ]*\\001/\\001/' < $1_abg.fig |\ grep -v "^6 [0-9 ]*" | grep -v "^-6$" >$1_abg.mtt1 # Replace [1:5] with [1,2,3,4,5] -awk '{ +gawk '{ if (match($14, /\[1:[0-9]*\]/)){ range = substr($14,2,length($14)-6); split(range,a,":"); str = "1"; for (i=2;i<=a[2];i++) str = sprintf("%s,%i", str, i); @@ -92,11 +95,11 @@ # this is because I can't get sed to recognise tabs even if FS=" ". echo "" > $1_abg.mtt3 sed 's/ /---- /'<$1_abg.mtt2 >> $1_abg.mtt3 # This is the main transformation using awk -cat $1_lbl.txt $1_abg.mtt3 | awk -f $MTTPATH/trans/awk/rbg_fig2m.awk $1 +cat $1_lbl.txt $1_abg.mtt3 | gawk -f $MTTPATH/trans/awk/rbg_fig2m.awk $1 rm -f $1_abg.mtt #Create the stripped abg file cat $1_head.fig $1_bnd.fig $1_cmp.fig> $1_sabg.fig Index: mttroot/mtt/bin/trans/rep_txt2sh ================================================================== --- mttroot/mtt/bin/trans/rep_txt2sh +++ mttroot/mtt/bin/trans/rep_txt2sh @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.5 2000/11/27 10:13:25 peterg +## Now passes though options as second argument +## ## Revision 1.4 1998/04/14 18:17:15 peterg ## More messages about Makefile ## ## Revision 1.3 1998/04/14 18:01:04 peterg ## Now executes a Makefile (if it exists) @@ -48,11 +51,11 @@ if [ "$mtt_count" = "0" ]; then echo 'Hmm .. seems to be an old format. creating new file' echo "Old version saved as $1_rep.txt.SAVE" mv $1_rep.txt $1_rep.txt.SAVE strip_comments < $1_rep.txt.SAVE |\ - awk '{print "mtt", sys, $1, $2}' sys="$1" >$1_rep.txt + gawk '{print "mtt", sys, $1, $2}' sys="$1" >$1_rep.txt fi # Execute the commands - quietly and untidily! # But use switches strip_comments< $1_rep.txt | sed "s/mtt /mtt -q -u $mtt_switches /" | tee -a JUNK | sh Index: mttroot/mtt/bin/trans/rep_txt2tex ================================================================== --- mttroot/mtt/bin/trans/rep_txt2tex +++ mttroot/mtt/bin/trans/rep_txt2tex @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.1 2000/12/27 15:57:31 peterg +## Initial revision +## ## Revision 1.15 2000/04/06 10:57:12 peterg ## Removed debug line ## ## Revision 1.14 2000/04/06 10:51:14 peterg ## replaces $PWD by `pwd` for sh compatibility @@ -67,11 +70,11 @@ if [ "$documenttype" = "book" ]; then # do book version # Inform user echo "Creating $1_rep.tex (directory version)" strip_comments < $1_rep.txt|\ - awk ' + gawk ' BEGIN{ oldpart = "" } { # Find directory name. @@ -104,11 +107,11 @@ # Inform user echo "Creating $1_rep.tex" # Create the LaTeX file strip_comments <$1_rep.txt |\ -awk ' +gawk ' { ## Count the switches (noting that -i has an argument) Switches=0; for (i=2;i<=NF;i++) { if (match($i,"-")==1) Switches++; Index: mttroot/mtt/bin/trans/reps_txt2tk ================================================================== --- mttroot/mtt/bin/trans/reps_txt2tk +++ mttroot/mtt/bin/trans/reps_txt2tk @@ -11,10 +11,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.5 2000/12/28 12:39:34 peterg +## Put under RCS +## ## Revision 1.4 2000/04/05 07:37:27 peterg ## *** empty log message *** ## ## Revision 1.3 1999/08/18 06:15:48 peterg ## Stripped down to just representations menu - see mtt_make_menu @@ -28,11 +31,11 @@ ############################################################### sep='|'; # Separates the languages from the rest. # Create reps menu -awk --field-separator=$sep '{ +gawk --field-separator=$sep '{ # Find the rep and the title split($1,REP," "); rep=REP[1]; # find the languages Index: mttroot/mtt/bin/trans/simpar_txt2h ================================================================== --- mttroot/mtt/bin/trans/simpar_txt2h +++ mttroot/mtt/bin/trans/simpar_txt2h @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.1 1998/05/13 08:56:28 peterg +## Initial revision +## ############################################################### system=$1 @@ -36,12 +39,12 @@ echo >> $1_simpar.h # Now do the parameters sed 's/ //g' $1_simpar.txt |\ - awk -F '=' '/=/ {print "#define", $1, $2}' >> $1_simpar.h + gawk -F '=' '/=/ {print "#define", $1, $2}' >> $1_simpar.h Index: mttroot/mtt/bin/trans/sort_sympar ================================================================== --- mttroot/mtt/bin/trans/sort_sympar +++ mttroot/mtt/bin/trans/sort_sympar @@ -12,19 +12,22 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.1 1998/03/07 15:15:53 peterg +## Initial revision +## ############################################################### # Step 1: sort by variable name # Step 2: put all varables with same name on same line sort -k 1,1 | \ -awk '{ +gawk '{ var = $1; sys = $2; if (var==oldvar) { oldsys=sprintf("%s,%s",oldsys,sys) } else{ Index: mttroot/mtt/bin/trans/strip_comments ================================================================== --- mttroot/mtt/bin/trans/strip_comments +++ mttroot/mtt/bin/trans/strip_comments @@ -13,12 +13,15 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.2 1998/11/18 11:30:19 peterg +## Now strips blank lines as well +## ############################################################### sed 's/%/#/' |\ -awk --field-separator '#' '{if (length($1)>0) print $1}' |\ -awk '{if (NF>0) print $0}' +gawk --field-separator '#' '{if (length($1)>0) print $1}' |\ +gawk '{if (NF>0) print $0}' Index: mttroot/mtt/bin/trans/strip_notvars.sh ================================================================== --- mttroot/mtt/bin/trans/strip_notvars.sh +++ mttroot/mtt/bin/trans/strip_notvars.sh @@ -4,8 +4,8 @@ name=$2 file=$3 notvar="[%|#]NOT[V|P]AR" grep ${notvar} ${type}_lbl.txt |\ - awk '{ printf ("%s\t%s\n", $2, name) }' name=${name} \ + gawk '{ printf ("%s\t%s\n", $2, name) }' name=${name} \ >> ${file} Index: mttroot/mtt/bin/trans/strip_pars.sh ================================================================== --- mttroot/mtt/bin/trans/strip_pars.sh +++ mttroot/mtt/bin/trans/strip_pars.sh @@ -4,7 +4,7 @@ var="[%|#][V|P]AR" grep ${var} ${infile} |\ - awk '{ printf ("%s\t%s\n", $2, name) }' name=${name} \ + gawk '{ printf ("%s\t%s\n", $2, name) }' name=${name} \ Index: mttroot/mtt/bin/trans/struc2gnuplot_txt2wish ================================================================== --- mttroot/mtt/bin/trans/struc2gnuplot_txt2wish +++ mttroot/mtt/bin/trans/struc2gnuplot_txt2wish @@ -89,11 +89,11 @@ } EOF ## create states and outputs lists -awk ' +gawk ' ($1 == "state") { printf "lappend xl state:%s\n", $4 } ($1 == "output") { printf "lappend yl output:%s\n", $4 @@ -128,11 +128,11 @@ ## map names to column numbers EOF -awk ' +gawk ' BEGIN { print "proc \"plot\" \"title\" {"; } ($1 == "state") { printf "if (\"%s\"==\"state:%s\") { plot_var \"%s\" %d }\n", Title, $4, $4, $2+2+Ny; Index: mttroot/mtt/bin/trans/struc2input_txt2txt ================================================================== --- mttroot/mtt/bin/trans/struc2input_txt2txt +++ mttroot/mtt/bin/trans/struc2input_txt2txt @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.15 2000/12/28 12:44:31 peterg +## *** empty log message *** +## ## Revision 1.14 2000/10/16 08:28:56 peterg ## Tidied up: ## SS broken due to incorrect ss.r file ## Switches?? ## @@ -87,11 +90,11 @@ # Compute inputs from ss.r file # Inform user echo Creating $1_input.txt - compute from steady-state information cat $1_ss.r $1_struc.txt | sed 's/\$//' |\ -awk '{ +gawk '{ if(match($1,"MTTu")>0) { j++ split($0,a,"="); u[j]=a[2]; } @@ -105,11 +108,11 @@ }' >> $1_input.txt else #Write out the defaults -- unit inputs echo Creating $1_input.txt - using defaults -awk '{ +gawk '{ if ($1=="input") { if ($2==1) printf("%s = \t%s; # MTT initial value\n", $4, default) else printf("%s = \t%s; # MTT initial value\n", $4, "0.0") @@ -119,9 +122,9 @@ #Set some switches # echo >> $1_input.txt # echo "# Set the switches" >> $1_input.txt # strip_comments<$1_switch.txt |\ -# awk '{if (length($1)>0) print tolower($1) "= (t>=0);"}' >> $1_input.txt +# gawk '{if (length($1)>0) print tolower($1) "= (t>=0);"}' >> $1_input.txt Index: mttroot/mtt/bin/trans/struc2sspar_txt2r ================================================================== --- mttroot/mtt/bin/trans/struc2sspar_txt2r +++ mttroot/mtt/bin/trans/struc2sspar_txt2r @@ -21,19 +21,19 @@ cat $MTTPATH/trans/rcs_header.m >> $1_sspar.r echo >> $1_sspar.r echo "% Steady-state states" >> $1_sspar.r -awk '{ +gawk '{ if ($1=="state") print "MTTX" $2 " := \t0; % " $4 " (" $3 ")" }' \ $1_struc.txt >> $1_sspar.r echo "% Steady-state inputs" >> $1_sspar.r -awk '{ +gawk '{ if ($1=="input") print "MTTU" $2 " := \t0; % " $4 " (" $3 ")" }' \ $1_struc.txt >> $1_sspar.r Index: mttroot/mtt/bin/trans/struc2state_txt2txt ================================================================== --- mttroot/mtt/bin/trans/struc2state_txt2txt +++ mttroot/mtt/bin/trans/struc2state_txt2txt @@ -13,10 +13,14 @@ # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # %% Version control history # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # %% $Id$ # %% $Log$ +# %% Revision 1.10 2000/10/16 08:20:23 peterg +# %% New version with direct naming. +# %% Note ss version is broken - ss.r file in wrong format +# %% # %% Revision 1.9 2000/10/10 21:03:06 peterg # %% *** empty log message *** # %% # %% Revision 1.8 1998/08/10 13:57:33 peterg # %% Removed debugging lines @@ -71,11 +75,11 @@ # Compute state from ss.r file # Inform user echo Creating $1_state.txt - compute from steady-state information cat $1_ss.r $1_struc.txt | sed 's/\$//' |\ -awk '{ +gawk '{ if(match($1,"MTTx")>0) { j++ split($0,a,"="); x[j]=a[2]; } @@ -89,12 +93,12 @@ else # Set states to zero # Inform user echo Creating $1_state.txt - default states to $default -awk '{ +gawk '{ if ($1=="state") printf("%s \t= %s; # MTT initial value\n", $4, default) }' default=$default <$1_struc.txt >> $1_state.txt fi Index: mttroot/mtt/bin/trans/struc2switch_txt ================================================================== --- mttroot/mtt/bin/trans/struc2switch_txt +++ mttroot/mtt/bin/trans/struc2switch_txt @@ -13,10 +13,15 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.6 2001/08/02 03:01:08 geraint +## Stopped initialisation of mttopen from over-writing logic.txt contents. +## - comment removed from "sort" input (which put it last) because +## initialisation is inserted in place of the comment by switch_txt2m. +## ## Revision 1.5 2000/10/17 09:20:00 peterg ## *** empty log message *** ## ## Revision 1.4 1998/07/26 10:28:30 peterg ## Added a header line to avoid empty file and to trigger @@ -41,21 +46,21 @@ rm -f $1_switch.txt echo "# These are the switches deduced from ISW and CSW components"\ > $1_switch.txt # This is the main transformation using awk -awk '{ +gawk '{ if ($1=="state") {i++; if ($3=="MTT_SWITCH") print tolower($4) "\t" i}; } END{ } ' < $1_struc.txt| sort >> $1_switch.txt -strip_comments < $1_switch.txt | wc -l | awk '{print $1 " switches found"}' +strip_comments < $1_switch.txt | wc -l | gawk '{print $1 " switches found"}' Index: mttroot/mtt/bin/trans/struc_txt2m ================================================================== --- mttroot/mtt/bin/trans/struc_txt2m +++ mttroot/mtt/bin/trans/struc_txt2m @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.3 2001/10/15 14:20:27 gawthrop +## Now handles the cases where ny or nx or nu are zero +## ## Revision 1.2 2001/03/19 02:28:52 geraint ## Branch merge: merging-ode2odes-exe back to MAIN. ## ## Revision 1.1.2.1 2001/03/06 03:52:15 geraint ## Put back struc_txt2m - required by mtt2sys. @@ -44,11 +47,11 @@ EOF # This is the main transformation using awk -awk ' +gawk ' function header(what){ print what "_name = ["; } function footer(what){ Index: mttroot/mtt/bin/trans/struc_txt2tex ================================================================== --- mttroot/mtt/bin/trans/struc_txt2tex +++ mttroot/mtt/bin/trans/struc_txt2tex @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.4 2000/12/28 12:46:59 peterg +## Put under RCS +## # Revision 1.3 1997/12/06 19:10:41 peterg # Reverted to tabular --- from supertabular # # Revision 1.2 1997/04/15 11:17:58 peterg # Uses supertabular for long tables. @@ -35,11 +38,11 @@ #Write some file headers echo "%% Structure file ($1_struc.txt)" > $1_struc.tex echo "%% Generated by MTT at `date`" >> $1_struc.tex # This is the main transformation using awk -sed 's/_/\\_/g' < $1_struc.txt | awk ' +sed 's/_/\\_/g' < $1_struc.txt | gawk ' function header(what){ print " \\centering"; print " \\tablefirsthead{\\hline %"; print " \\multicolumn{4}{|c|}{\\bf List of " what "s for system " SYSTEM "} \\\\"; print " \\hline"; Index: mttroot/mtt/bin/trans/switch_txt2m ================================================================== --- mttroot/mtt/bin/trans/switch_txt2m +++ mttroot/mtt/bin/trans/switch_txt2m @@ -14,10 +14,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.15 2000/12/04 08:23:25 peterg +## Put logic in-line - avoids the if statements +## ## Revision 1.14 2000/11/09 10:29:21 peterg ## open --> mtt_open ## ## Revision 1.13 2000/11/09 10:19:12 peterg ## Explicitly write out the open switches .... @@ -60,11 +63,11 @@ #Write some file headers #lang_header $1 switch m 'mttx' '[mttx]' > $1_switch.m #echo Creating $1_switch.m # Set states to zero -# awk '{ +# gawk '{ # if ($1=="#"){ # printf("#== Switches set element of state vector to zero ==#\n") # } # else{ # printf("\n#== Switch: %s ==#\n",$1) @@ -93,11 +96,11 @@ #EOF #cat $1_logic.txt >> $1_switchopen.m # Set states to zero -awk '{ +gawk '{ if ($1=="#"){ printf("#== mttopen - boolean vector of open switches ==#\n") for (i=1;i<=Nx;i++) printf("mttopen(%i) = 0; # Default to not open\n", i); } @@ -119,11 +122,11 @@ #echo Creating $1_switcha.m # Implicit integration version #Write some file headers # lang_header $1 switcha m 'mttAA,mttx' '[mttAA]' > $1_switcha.m -# awk '{ +# gawk '{ # if ($1=="#"){ # printf("#== Switches set row and column of A matrix to zero ==#\n") # } # else{ # printf("#== Switch: %s ==#\n",$1) Index: mttroot/mtt/bin/trans/sympar2global_txt2lang ================================================================== --- mttroot/mtt/bin/trans/sympar2global_txt2lang +++ mttroot/mtt/bin/trans/sympar2global_txt2lang @@ -14,10 +14,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.6 1998/11/18 11:55:51 peterg +## Now uses sympar2global_txt2m for the m bit +## ## Revision 1.5 1998/07/26 11:00:18 peterg ## Put in exits-- this all needs a good clean ## ## Revision 1.4 1998/07/26 10:50:30 peterg ## Corrected bug. @@ -64,11 +67,11 @@ exit fi if [ "$language" = "c" ]; then strip_comments <$1_sympars.txt |\ - awk '{ + gawk '{ i++; print "extern double", tolower($1) ";"; }' exit fi @@ -76,11 +79,11 @@ cat <0)) { printf ("global"); globals_exist=1 } Index: mttroot/mtt/bin/trans/sympar2numpar_txt2txt ================================================================== --- mttroot/mtt/bin/trans/sympar2numpar_txt2txt +++ mttroot/mtt/bin/trans/sympar2numpar_txt2txt @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.13 2000/10/16 08:09:25 peterg +## Tidied up. +## ## Revision 1.12 1999/03/02 22:01:21 peterg ## *** empty log message *** ## ## Revision 1.11 1998/06/15 15:14:46 peterg ## Don't print if blank line @@ -65,21 +68,21 @@ cat $MTTPATH/trans/rcs_header.txt >> $1_numpar.txt #Write out the variables echo "# Parameters" >> $1_numpar.txt strip_comments <$1_sympar.txt |\ -awk '{i++; if (NF>0) print tolower($1) " = \t1.0; \# " $2}'\ +gawk '{i++; if (NF>0) print tolower($1) " = \t1.0; \# " $2}'\ >> $1_numpar.txt #Write out the initial states #echo >> $1_numpar.txt #echo "# Initial states" >> $1_numpar.txt -#awk '{ +#gawk '{ # if ($1=="state") # print "x(" $2 ") = \t0.0; \# " $4 " (" $3 ")" #}' \ # $1_struc.txt >> $1_numpar.txt Index: mttroot/mtt/bin/trans/sympar2par_txt2m ================================================================== --- mttroot/mtt/bin/trans/sympar2par_txt2m +++ mttroot/mtt/bin/trans/sympar2par_txt2m @@ -11,23 +11,23 @@ # Copyright (C) 2000 by Peter J. Gawthrop case $2 in zero) strip_comments <$1_sympar.txt |\ - awk '{ + gawk '{ i++; printf(" %s %s = 0.0;\n", tolower($1)); }' ;; set) strip_comments <$1_sympar.txt |\ - awk '{ + gawk '{ i++; printf(" %s mttpar(%i) \t= %s;\n", i, tolower($1)); }' ;; *) strip_comments <$1_sympar.txt |\ - awk '{ + gawk '{ i++; printf(" %s %s \t= mttpar(%i%s);\n", decl, tolower($1), i, minusone); }' decl="$3" minusone="$4" ;; esac Index: mttroot/mtt/bin/trans/sympar2params_txt2c ================================================================== --- mttroot/mtt/bin/trans/sympar2params_txt2c +++ mttroot/mtt/bin/trans/sympar2params_txt2c @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.2 1997/03/20 15:17:45 peterg +## All variables are in lower case. +## # Revision 1.1 1997/03/20 10:25:55 peterg # Initial revision # ############################################################### @@ -44,12 +47,12 @@ echo "#include \"$1_sympar.c\"" >> $1_params.c echo "$1_params()" >> $1_params.c echo '{' >> $1_params.c #Write out the variables in c format. -awk '{i++; print tolower($1) " = \t1.0;"}' $1_sympar.txt >> $1_params.c +gawk '{i++; print tolower($1) " = \t1.0;"}' $1_sympar.txt >> $1_params.c echo '}' >> $1_params.c # Now invoke the standard error handling. # mtt_error mtt_error.txt Index: mttroot/mtt/bin/trans/sympar2params_txt2m ================================================================== --- mttroot/mtt/bin/trans/sympar2params_txt2m +++ mttroot/mtt/bin/trans/sympar2params_txt2m @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.3 1997/04/17 11:18:34 peterg +## Write out the RCS header first! +## # Revision 1.2 1997/04/16 11:40:31 peterg # Added global variables. # # Revision 1.1 1997/04/16 11:31:41 peterg # Initial revision @@ -44,11 +47,11 @@ #Write out the global variables sympar2global_txt2m $1 >> $1_params.m #Write out the variables in c format. -awk '{i++; print tolower($1) " = \t1.0;"}' $1_sympar.txt >> $1_params.m +gawk '{i++; print tolower($1) " = \t1.0;"}' $1_sympar.txt >> $1_params.m # Now invoke the standard error handling. # mtt_error mtt_error.txt Index: mttroot/mtt/bin/trans/sympar_txt2c ================================================================== --- mttroot/mtt/bin/trans/sympar_txt2c +++ mttroot/mtt/bin/trans/sympar_txt2c @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.3 1997/05/15 07:19:56 peterg +## Put back "tolower" +## # Revision 1.2 1997/05/15 07:10:56 peterg # removed "tolower" function # # Revision 1.1 1997/05/15 07:10:09 peterg # Initial revision @@ -42,13 +45,13 @@ echo '*/' >> $1_sympar.c echo >> $1_sympar.c #Write out the variables in c format. -awk '{i++; print "extern double", tolower($1) ";"}' $1_sympar.txt \ +gawk '{i++; print "extern double", tolower($1) ";"}' $1_sympar.txt \ >> $1_sympar.c # Now invoke the standard error handling. # mtt_error mtt_error.txt Index: mttroot/mtt/bin/trans/sympar_txt2declare ================================================================== --- mttroot/mtt/bin/trans/sympar_txt2declare +++ mttroot/mtt/bin/trans/sympar_txt2declare @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.1 2000/10/11 09:08:20 peterg +## Initial revision +## ############################################################### sys=$1 language=$2 @@ -34,11 +37,11 @@ cat<> $1_sympar.h echo >> $1_sympar.h #Write out the variables in c format. -awk '{i++; print "double", tolower($1) ";"}' $1_sympar.txt >> $1_sympar.h +gawk '{i++; print "double", tolower($1) ";"}' $1_sympar.txt >> $1_sympar.h # Now invoke the standard error handling. # mtt_error mtt_error.txt Index: mttroot/mtt/bin/trans/sympar_txt2m ================================================================== --- mttroot/mtt/bin/trans/sympar_txt2m +++ mttroot/mtt/bin/trans/sympar_txt2m @@ -11,8 +11,8 @@ echo Creating $1_sympar.m lang_header -noglobals $1 sympar m "" sympar > $1_sympar.m -awk '{ +gawk '{ printf(" sympar.%s \t= %i; # %s\n", $1, ++i, $2); }' < $1_sympar.txt >> $1_sympar.m Index: mttroot/mtt/bin/trans/sympar_txt2r ================================================================== --- mttroot/mtt/bin/trans/sympar_txt2r +++ mttroot/mtt/bin/trans/sympar_txt2r @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.6 1998/02/17 17:03:54 peterg +## Fixed bug in writing out matrix declaration +## ## Revision 1.5 1998/02/16 12:14:21 peterg ## Corrected writing out of MTTVAR matrix - now does this id non-zero ## number of variables - not vv! ## ## Revision 1.4 1997/05/09 14:20:49 peterg @@ -49,13 +52,13 @@ fi echo "MTTNVAR := $lines;" >> $1_sympar.r echo >> $1_sympar.r #Write out the variables in reduce format. -awk '{i++; print "MTTVAR(" i ",1) := " $1 ";"}' $1_sympar.txt >> $1_sympar.r +gawk '{i++; print "MTTVAR(" i ",1) := " $1 ";"}' $1_sympar.txt >> $1_sympar.r echo 'END;' >> $1_sympar.r # Now invoke the standard error handling. # mtt_error mtt_error.txt Index: mttroot/mtt/bin/trans/sympar_txt2tex ================================================================== --- mttroot/mtt/bin/trans/sympar_txt2tex +++ mttroot/mtt/bin/trans/sympar_txt2tex @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.1 2000/12/27 16:04:46 peterg +## Initial revision +## ## Revision 1.2 1998/01/19 14:17:26 peterg ## Modified struc_txt2tex to make this. ## ## Revision 1.1 1998/01/19 14:16:39 peterg ## Initial revision @@ -41,11 +44,11 @@ #Write some file headers echo "%% Parameter file ($1_sympar.txt)" > $1_sympar.tex echo "%% Generated by MTT at `date`" >> $1_sympar.tex # This is the main transformation using awk -sed 's/_/\\_/g' < $1_sympar.txt | awk ' +sed 's/_/\\_/g' < $1_sympar.txt | gawk ' #function header(what){ # print " \\centering"; # print " \\tablefirsthead{\\hline %"; # print " \\multicolumn{4}{|c|}{\\bf List of " what "s for system " SYSTEM "} \\\\"; # print " \\hline"; Index: mttroot/mtt/bin/trans/tex2doc ================================================================== --- mttroot/mtt/bin/trans/tex2doc +++ mttroot/mtt/bin/trans/tex2doc @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.3 2000/12/28 12:48:53 peterg +## Put under RCS +## # Revision 1.2 1996/08/30 10:19:11 peter # New path for awk script. # ## Revision 1.1 1996/08/18 20:00:20 peter ## Initial revision @@ -25,8 +28,8 @@ # Inform user echo "Creating $1_$2.doc" # This is the main transformation using awk -awk -f $MTTPATH/trans/awk/tex2doc.awk \ +gawk -f $MTTPATH/trans/awk/tex2doc.awk \ system_name=$1 representation=$2 > $1_$2.doc Index: mttroot/mtt/cc/def_m2h.sh ================================================================== --- mttroot/mtt/cc/def_m2h.sh +++ mttroot/mtt/cc/def_m2h.sh @@ -1,8 +1,11 @@ #! /bin/sh # $Id$ # $Log$ +# Revision 1.1 2000/12/28 09:46:05 peterg +# put under RCS +# # Revision 1.3 2000/12/05 12:13:52 peterg # Changed function name to name() # # Revision 1.2 2000/12/04 12:04:46 peterg # Changed $() to `` for sh compatibility -- geraint @@ -20,21 +23,21 @@ OUT=${SYS}_def.h get_array_size () { vec=$1 -awk -v vec=${vec} '($1 == vec && $2 == "=") { print $3 }' | sed s/\;// +gawk -v vec=${vec} '($1 == vec && $2 == "=") { print $3 }' | sed s/\;// } echo "// ${SYS}_def.h, generated by MTT on `date`" > ${OUT} echo "" >> ${OUT} echo "const int MTTNU = `cat ${IN} | get_array_size nu`;" >> ${OUT} echo "const int MTTNX = `cat ${IN} | get_array_size nx`;" >> ${OUT} echo "const int MTTNY = `cat ${IN} | get_array_size ny`;" >> ${OUT} echo "const int MTTNZ = `cat ${IN} | get_array_size nz`;" >> ${OUT} echo "const int MTTNYZ = `cat ${IN} | get_array_size nyz`;" >> ${OUT} - echo "const int MTTNPAR = `wc -l ${SYM} | awk '{ print $1 }'`;" >> ${OUT} + echo "const int MTTNPAR = `wc -l ${SYM} | gawk '{ print $1 }'`;" >> ${OUT} cat <> ${OUT} // typedefs won't work because it is illegal to initialise ColumnVector in typedef // use "ColumnVector mttx (MTTNX);" until the proper classes are ready Index: mttroot/mtt/cc/mtt_m2cc.sh ================================================================== --- mttroot/mtt/cc/mtt_m2cc.sh +++ mttroot/mtt/cc/mtt_m2cc.sh @@ -54,12 +54,12 @@ find_code () { file_in=${1:-${IN}} portion=${2:-"body"} - head=`cat ${file_in} | awk '($2 == "BEGIN" && $3 == "Code") { print NR }'` - foot=`cat ${file_in} | awk '($2 == "END" && $3 == "Code") { print NR }'` + head=`cat ${file_in} | gawk '($2 == "BEGIN" && $3 == "Code") { print NR }'` + foot=`cat ${file_in} | gawk '($2 == "END" && $3 == "Code") { print NR }'` case ${portion} in head) start=0 end=${head} ;; @@ -75,11 +75,11 @@ echo "Error in find_code: portion unknown" return -1 ;; esac cat ${file_in} |\ - awk --assign start=${start} --assign end=${end} ' + gawk --assign start=${start} --assign end=${end} ' (start < NR && NR < end) { print $0 }' }; strip_junk () Index: mttroot/mtt/cc/sympar_txt2h.sh ================================================================== --- mttroot/mtt/cc/sympar_txt2h.sh +++ mttroot/mtt/cc/sympar_txt2h.sh @@ -1,8 +1,11 @@ #! /bin/sh # $Id$ # $Log$ +# Revision 1.4 2001/08/24 21:41:04 geraint +# Fixed problem with declaration when there are no numerical parameters. +# # Revision 1.3 2001/03/19 02:28:53 geraint # Branch merge: merging-ode2odes-exe back to MAIN. # # Revision 1.2.2.1 2001/03/16 03:56:54 geraint # Convert variable names to lower case. @@ -51,11 +54,11 @@ IN=${SYS}_sympar.txt OUT=${SYS}_sympar.h declare_sys_param () { -cat ${IN} | awk '(NF>0){printf ("static double %s MTT_UNUSED;\t// %s\n", tolower($1), $2)}' +cat ${IN} | gawk '(NF>0){printf ("static double %s MTT_UNUSED;\t// %s\n", tolower($1), $2)}' } declare_temp_vars () { for name in ${TMP_VAR_NAMES} Index: mttroot/mtt/debian/control ================================================================== --- mttroot/mtt/debian/control +++ mttroot/mtt/debian/control @@ -8,11 +8,10 @@ Package: mtt Architecture: all Depends: gawk, octave, xfig Recommends: blas-dev, fftw-dev, c-compiler, g++, gnuplot, info-browser, lapack-dev, latex2html, libkpathsea-dev, libncurses5-dev, libreadline4-dev, pdf-viewer, postscript-viewer, octave-headers, octave-info, octave-sp, p2c, transfig, xterm, www-browser, wish Suggests: scigraphica -Conflicts: mawk Description: Model Transformation Tools. A set of tools for modelling dynamic physical systems using the bond-graph methodology and transforming these models into representations suitable for analysis, control and simulation. These tools use, and generate m files for, GNU Octave. Index: mttroot/mtt/lib/examples/Simulation/BigHeatedRod/Run ================================================================== --- mttroot/mtt/lib/examples/Simulation/BigHeatedRod/Run +++ mttroot/mtt/lib/examples/Simulation/BigHeatedRod/Run @@ -6,10 +6,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.3 1998/08/17 09:42:26 peterg +## Third argument gives the desired methods. +## ## Revision 1.2 1998/08/15 14:07:11 peterg ## Don't do ImplicitL ## ## Revision 1.1 1998/08/15 13:58:27 peterg ## Initial revision @@ -81,11 +84,11 @@ HR$1_numpar; A=HR$1_sm; Max_Eig=max(eig(-A)) STEPFACTOR=ceil( Max_Eig*$DT/2 ) EOF - MinSTEPFACTOR=`awk '{if ($1=="STEPFACTOR") print $3}' HR$1.tmp1` + MinSTEPFACTOR=`gawk '{if ($1=="STEPFACTOR") print $3}' HR$1.tmp1` STEPFACTOR=$MinSTEPFACTOR ;; ImplicitS) # What is the empirical step size for sparse method? octave -q <HR$1.tmp1 @@ -93,11 +96,11 @@ SparseSTEPFACTOR=10*$n else SparseSTEPFACTOR=5*$n endif EOF - SparseSTEPFACTOR=`awk '{if ($1=="SparseSTEPFACTOR") print $3}' HR$1.tmp1` + SparseSTEPFACTOR=`gawk '{if ($1=="SparseSTEPFACTOR") print $3}' HR$1.tmp1` STEPFACTOR=$SparseSTEPFACTOR ;; *) STEPFACTOR=1 @@ -112,15 +115,15 @@ echo "STEPFACTOR = $STEPFACTOR; # Added automatically" >>HR$1_simpar.txt echo "METHOD = $METHOD; # Added automatically" >>HR$1_simpar.txt echo "DT = $DT; # Added automatically" >>HR$1_simpar.txt mtt -q -c -o HR$1 odeso ps > junk 2>>junk #HR$1_$METHOD.tmp grep user junk |\ - awk '{print System " &\t" METHOD " &\t" DT " &\t" STEPFACTOR " &\t" $2 "\\\\"}'\ + gawk '{print System " &\t" METHOD " &\t" DT " &\t" STEPFACTOR " &\t" $2 "\\\\"}'\ METHOD=$METHOD STEPFACTOR=$STEPFACTOR System=HR$1 DT=$DT >> HR$1_table.txt cp HR$1_odeso.ps HR$1.$METHOD.$DT.ps done cat HR$1_table.txt Index: mttroot/mtt/lib/reduce/reserved_words.make ================================================================== --- mttroot/mtt/lib/reduce/reserved_words.make +++ mttroot/mtt/lib/reduce/reserved_words.make @@ -8,8 +8,8 @@ sed 's/\\\_/_/g' |\ sed 's/\\tt\ \([A-Za-z0-9_]*\)/\"\1\"/g' |\ tr " " "\n" |\ sed 's/\{//g' |\ sed 's/\}//g' |\ - awk -F\" '(NF==3) { printf "%s\n",$2 }' |\ + gawk -F\" '(NF==3) { printf "%s\n",$2 }' |\ sort -u \ > $output