Comment: | Fixed [ 549658 ] awk should be gawk. Replaced calls to awk with call to gawk. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
79687d9c64a267545db7d7757605eacc |
User & Date: | geraint@users.sourceforge.net on 2002-04-28 18:58:07 |
Other Links: | branch diff | manifest | tags |
2002-04-30
| ||
23:27:00 |
Replaced octave_map with columnvector in simpar.cc. Not quite as descriptive but standardises the interfaces somewhat and reduces the dependency on liboctinterp (and thus libreadline, libkpathsea, libncurses, etc). check-in: 629d24e5d5 user: geraint@users.sourceforge.net tags: origin/master, trunk | |
2002-04-28
| ||
18:58:07 |
Fixed [ 549658 ] awk should be gawk. Replaced calls to awk with call to gawk. check-in: 79687d9c64 user: geraint@users.sourceforge.net tags: origin/master, trunk | |
18:41:27 |
Fixed [ 549658 ] awk should be gawk. Replaced calls to awk with call to gawk. check-in: ad35120331 user: geraint@users.sourceforge.net tags: origin/master, trunk | |
Modified mttroot/mtt/bin/trans/rbg2abg_m from [dfb39a93d4] to [4cb8efbc5f].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### # Bourne shell script: rbg2abg_m # ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## 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. ## ## Revision 1.15 2000/11/03 14:53:33 peterg | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### # Bourne shell script: rbg2abg_m # ############################################################### ## 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. ## ## Revision 1.15 2000/11/03 14:53:33 peterg |
︙ | ︙ | |||
159 160 161 162 163 164 165 | ## Sets the units for the abg file test_units() { grep '^[\s]*[#|%]UNITS' < ${lbl_file} >/dev/null if [ $? = "0" ]; then grep '^[\s]*[#|%]UNITS' < ${lbl_file} |\ | | | | | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | ## Sets the units for the abg file test_units() { grep '^[\s]*[#|%]UNITS' < ${lbl_file} >/dev/null if [ $? = "0" ]; then grep '^[\s]*[#|%]UNITS' < ${lbl_file} |\ 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 else echo " " domains and units are OK fi else echo " no domains or units declared" fi } check_ports_exist() { 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 fi done } set_units() { grep '^[\s]*[#|%]UNITS' < ${lbl_file} |\ 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} } if [ -z "$units" ]; then |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/rbg_fig2m from [cca83822e8] to [0298389683].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## 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 ## Fixes problem when lbl.txt does not end with newline. ## | > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## 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 ## Fixes problem when lbl.txt does not end with newline. ## |
︙ | ︙ | |||
72 73 74 75 76 77 78 | # Deletes trailing white space in component names # 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] | | | | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | # Deletes trailing white space in component names # 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] 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); sub(/1:[0-9]*/, str, $14); } print $0 }' < $1_abg.mtt1 > $1_abg.mtt2 # The following horrible sed thing is to replace tab by ---- # 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 | 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 |
Modified mttroot/mtt/bin/trans/rep_txt2sh from [03dd3f0d6b] to [fe70dda0ea].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## 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) ## # Revision 1.2 1997/12/06 14:27:53 peterg | > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## 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) ## # Revision 1.2 1997/12/06 14:27:53 peterg |
︙ | ︙ | |||
46 47 48 49 50 51 52 | # Check for old (2 arg) version and update if necessary mtt_count=`strip_comments < $1_rep.txt | grep -c 'mtt '` 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 |\ | | | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | # Check for old (2 arg) version and update if necessary mtt_count=`strip_comments < $1_rep.txt | grep -c 'mtt '` 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 |\ 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 echo "Done creating representations for $1_rep.tex" |
Modified mttroot/mtt/bin/trans/rep_txt2tex from [d29f0048ba] to [4ac80571a4].
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## 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 ## ## Revision 1.13 1999/10/19 23:47:27 peterg | > > > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## 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 ## ## Revision 1.13 1999/10/19 23:47:27 peterg |
︙ | ︙ | |||
65 66 67 68 69 70 71 | documenttype=$2; if [ "$documenttype" = "book" ]; then # do book version # Inform user echo "Creating $1_rep.tex (directory version)" strip_comments < $1_rep.txt|\ | | | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | documenttype=$2; if [ "$documenttype" = "book" ]; then # do book version # Inform user echo "Creating $1_rep.tex (directory version)" strip_comments < $1_rep.txt|\ gawk ' BEGIN{ oldpart = "" } { # Find directory name. for (i=1;i<NF;i++){ if ($i=="-d") |
︙ | ︙ | |||
102 103 104 105 106 107 108 | fi # Inform user echo "Creating $1_rep.tex" # Create the LaTeX file strip_comments <$1_rep.txt |\ | | | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | fi # Inform user echo "Creating $1_rep.tex" # Create the LaTeX file strip_comments <$1_rep.txt |\ gawk ' { ## Count the switches (noting that -i has an argument) Switches=0; for (i=2;i<=NF;i++) { if (match($i,"-")==1) Switches++; if (match($i,"-i")==1) Switches++; } |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/reps_txt2tk from [3e47e7c9bc] to [05813b0e5a].
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # Copyright (c) P.J.Gawthrop, 1998 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## 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 ## ## Revision 1.2 1999/03/09 00:03:19 peterg ## Revisions for xmtt ## ## Revision 1.1 1998/10/20 08:13:14 peterg ## Initial revision ## ############################################################### sep='|'; # Separates the languages from the rest. # Create reps menu | > > > | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | # Copyright (c) P.J.Gawthrop, 1998 ############################################################### ## 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 ## ## Revision 1.2 1999/03/09 00:03:19 peterg ## Revisions for xmtt ## ## Revision 1.1 1998/10/20 08:13:14 peterg ## Initial revision ## ############################################################### sep='|'; # Separates the languages from the rest. # Create reps menu gawk --field-separator=$sep '{ # Find the rep and the title split($1,REP," "); rep=REP[1]; # find the languages N=split($2,LANG," "); |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/simpar_txt2h from [a1e5b7a064] to [fe5f9ab6b8].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ############################################################### system=$1 # Inform user | > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.1 1998/05/13 08:56:28 peterg ## Initial revision ## ############################################################### system=$1 # Inform user |
︙ | ︙ | |||
34 35 36 37 38 39 40 | echo "from $1_simpar.txt" >> $1_simpar.h echo '*/' >> $1_simpar.h echo >> $1_simpar.h # Now do the parameters sed 's/ //g' $1_simpar.txt |\ | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | echo "from $1_simpar.txt" >> $1_simpar.h echo '*/' >> $1_simpar.h echo >> $1_simpar.h # Now do the parameters sed 's/ //g' $1_simpar.txt |\ gawk -F '=' '/=/ {print "#define", $1, $2}' >> $1_simpar.h |
Modified mttroot/mtt/bin/trans/sort_sympar from [883628776a] to [7f751591a5].
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (c) P.J.Gawthrop, 1998. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ############################################################### # Step 1: sort by variable name # Step 2: put all varables with same name on same line sort -k 1,1 | \ | > > > | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | # Copyright (c) P.J.Gawthrop, 1998. ############################################################### ## 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 | \ gawk '{ var = $1; sys = $2; if (var==oldvar) { oldsys=sprintf("%s,%s",oldsys,sys) } else{ if (length(oldvar)>0) print oldvar "\t" oldsys; oldvar=var; oldsys=sys |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/strip_comments from [8b2e61fa07] to [429b584b4b].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ############################################################### sed 's/%/#/' |\ | > > > | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.2 1998/11/18 11:30:19 peterg ## Now strips blank lines as well ## ############################################################### sed 's/%/#/' |\ gawk --field-separator '#' '{if (length($1)>0) print $1}' |\ gawk '{if (NF>0) print $0}' |
Modified mttroot/mtt/bin/trans/strip_notvars.sh from [e9c68eb700] to [45d48c9630].
1 2 3 4 5 6 7 8 | #! /bin/sh type=$1 name=$2 file=$3 notvar="[%|#]NOT[V|P]AR" grep ${notvar} ${type}_lbl.txt |\ | | | 1 2 3 4 5 6 7 8 9 10 11 | #! /bin/sh type=$1 name=$2 file=$3 notvar="[%|#]NOT[V|P]AR" grep ${notvar} ${type}_lbl.txt |\ gawk '{ printf ("%s\t%s\n", $2, name) }' name=${name} \ >> ${file} |
Modified mttroot/mtt/bin/trans/strip_pars.sh from [981c8a73a2] to [7d64e8b718].
1 2 3 4 5 6 7 8 | #! /bin/sh infile=$1 name=$2 var="[%|#][V|P]AR" grep ${var} ${infile} |\ | | | 1 2 3 4 5 6 7 8 9 10 | #! /bin/sh infile=$1 name=$2 var="[%|#][V|P]AR" grep ${var} ${infile} |\ gawk '{ printf ("%s\t%s\n", $2, name) }' name=${name} \ |
Modified mttroot/mtt/bin/trans/struc2gnuplot_txt2wish from [9db213a0b1] to [3601be40d3].
︙ | ︙ | |||
87 88 89 90 91 92 93 | return [reverse_sort \$list] } } EOF ## create states and outputs lists | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | return [reverse_sort \$list] } } EOF ## create states and outputs lists gawk ' ($1 == "state") { printf "lappend xl state:%s\n", $4 } ($1 == "output") { printf "lappend yl output:%s\n", $4 }' ${struc} >> ${out} |
︙ | ︙ | |||
126 127 128 129 130 131 132 | pack .quit -expand false -fill x -side right pack .print -expand false -fill x -side right ## map names to column numbers EOF | | | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | pack .quit -expand false -fill x -side right pack .print -expand false -fill x -side right ## map names to column numbers EOF gawk ' BEGIN { print "proc \"plot\" \"title\" {"; } ($1 == "state") { printf "if (\"%s\"==\"state:%s\") { plot_var \"%s\" %d }\n", Title, $4, $4, $2+2+Ny; } ($1 == "output") { |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/struc2input_txt2txt from [280b194479] to [016a2f4250].
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Copyright (c) P.J.Gawthrop 1997 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.14 2000/10/16 08:28:56 peterg ## Tidied up: ## SS broken due to incorrect ss.r file ## Switches?? ## ## Revision 1.13 2000/03/03 11:33:19 peterg ## *** empty log message *** | > > > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # Copyright (c) P.J.Gawthrop 1997 ############################################################### ## 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?? ## ## Revision 1.13 2000/03/03 11:33:19 peterg ## *** empty log message *** |
︙ | ︙ | |||
85 86 87 88 89 90 91 | if [ -n "$steadystate_computation" ]; then # 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/\$//' |\ | | | | | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | if [ -n "$steadystate_computation" ]; then # 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/\$//' |\ gawk '{ if(match($1,"MTTu")>0) { j++ split($0,a,"="); u[j]=a[2]; } if($1=="input") { i++; if (length(u[i])==0) u[i]="0.0;"; # print "u(" i ") =\t", u[i], " \# " $4 " (" $3 ")" printf("%s =\t%s # MTT initial value from steady state\n", $4, u[i]); } }' >> $1_input.txt else #Write out the defaults -- unit inputs echo Creating $1_input.txt - using defaults 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") } }' Nu=$Nu default=$default <$1_struc.txt >> $1_input.txt fi #Set some switches # echo >> $1_input.txt # echo "# Set the switches" >> $1_input.txt # strip_comments<$1_switch.txt |\ # gawk '{if (length($1)>0) print tolower($1) "= (t>=0);"}' >> $1_input.txt |
Modified mttroot/mtt/bin/trans/struc2sspar_txt2r from [48a2db67a9] to [81e9931607].
︙ | ︙ | |||
19 20 21 22 23 24 25 | echo "% Steady-state parameter file ($1_sspar.r)" > $1_sspar.r echo "% Generated by MTT at `date`" >> $1_sspar.r cat $MTTPATH/trans/rcs_header.m >> $1_sspar.r echo >> $1_sspar.r echo "% Steady-state states" >> $1_sspar.r | | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | echo "% Steady-state parameter file ($1_sspar.r)" > $1_sspar.r echo "% Generated by MTT at `date`" >> $1_sspar.r cat $MTTPATH/trans/rcs_header.m >> $1_sspar.r echo >> $1_sspar.r echo "% Steady-state states" >> $1_sspar.r gawk '{ if ($1=="state") print "MTTX" $2 " := \t0; % " $4 " (" $3 ")" }' \ $1_struc.txt >> $1_sspar.r echo "% Steady-state inputs" >> $1_sspar.r gawk '{ if ($1=="input") print "MTTU" $2 " := \t0; % " $4 " (" $3 ")" }' \ $1_struc.txt >> $1_sspar.r echo ";;END;" >> $1_sspar.r |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/struc2state_txt2txt from [fd9c2c8fdf] to [5418171295].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # %% Version control history # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # %% $Id$ # %% $Log$ # %% 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 # %% # %% Revision 1.7 1998/08/10 13:55:11 peterg | > > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # %% 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 # %% # %% Revision 1.7 1998/08/10 13:55:11 peterg |
︙ | ︙ | |||
69 70 71 72 73 74 75 | if [ -n "$steadystate_computation" ]; then # 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/\$//' |\ | | | | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | if [ -n "$steadystate_computation" ]; then # 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/\$//' |\ gawk '{ if(match($1,"MTTx")>0) { j++ split($0,a,"="); x[j]=a[2]; } if($1=="state") { i++; # print "x(" i ") =\t", x[i], " \# " $4 " (" $3 ")" printf("%s =\t%s; # MTT initial value\n", $4, x[i]); } }' >> $1_state.txt else # Set states to zero # Inform user echo Creating $1_state.txt - default states to $default gawk '{ if ($1=="state") printf("%s \t= %s; # MTT initial value\n", $4, default) }' default=$default <$1_struc.txt >> $1_state.txt fi |
Modified mttroot/mtt/bin/trans/struc2switch_txt from [178de24ab3] to [05163357ae].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## 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 ## switch_txt2m to write initial stuff. ## | > > > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## 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 ## switch_txt2m to write initial stuff. ## |
︙ | ︙ | |||
39 40 41 42 43 44 45 | echo Creating $1_switch.txt 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 | | | | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | echo Creating $1_switch.txt 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 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 | gawk '{print $1 " switches found"}' |
Modified mttroot/mtt/bin/trans/struc_txt2m from [8e5a3e29dd] to [6d59673a1d].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## 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. ## ############################################################### | > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## 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. ## ############################################################### |
︙ | ︙ | |||
42 43 44 45 46 47 48 | output_name = ""; state_name = ""; EOF # This is the main transformation using awk | | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | output_name = ""; state_name = ""; EOF # This is the main transformation using awk gawk ' function header(what){ print what "_name = ["; } function footer(what){ print "];"; } |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/struc_txt2tex from [6003f8f14a] to [d8af09e179].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ # 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. # # Revision 1.1 1997/04/15 09:49:04 peterg | > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## 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. # # Revision 1.1 1997/04/15 09:49:04 peterg |
︙ | ︙ | |||
33 34 35 36 37 38 39 | rm -f mtt_error #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 | | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | rm -f mtt_error #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 | gawk ' function header(what){ print " \\centering"; print " \\tablefirsthead{\\hline %"; print " \\multicolumn{4}{|c|}{\\bf List of " what "s for system " SYSTEM "} \\\\"; print " \\hline"; print " & Component & System & Repetition \\\\"; print " \\hline}"; |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/switch_txt2m from [ac9707fae1] to [1b58ea9614].
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## 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 .... ## ## Revision 1.12 2000/11/09 09:52:07 peterg | > > > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ############################################################### ## 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 .... ## ## Revision 1.12 2000/11/09 09:52:07 peterg |
︙ | ︙ | |||
58 59 60 61 62 63 64 | Nx=`mtt_getsize $1 x` # States #Write some file headers #lang_header $1 switch m 'mttx' '[mttx]' > $1_switch.m #echo Creating $1_switch.m # Set states to zero | | | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | Nx=`mtt_getsize $1 x` # States #Write some file headers #lang_header $1 switch m 'mttx' '[mttx]' > $1_switch.m #echo Creating $1_switch.m # Set states to zero # gawk '{ # if ($1=="#"){ # printf("#== Switches set element of state vector to zero ==#\n") # } # else{ # printf("\n#== Switch: %s ==#\n",$1) # printf("if (%s==0.0) \n", $1); # printf(" mttx(%s)=0.0;\n", $2); |
︙ | ︙ | |||
91 92 93 94 95 96 97 | ## User defined logic (from $1_logic.m) #EOF #cat $1_logic.txt >> $1_switchopen.m # Set states to zero | | | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | ## User defined logic (from $1_logic.m) #EOF #cat $1_logic.txt >> $1_switchopen.m # Set states to zero 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); } else{ printf("\n#== Switch: %s ==#\n",$1) |
︙ | ︙ | |||
117 118 119 120 121 122 123 | }' Nx=$Nx < $1_switch.txt #>> $1_switchopen.m #echo Creating $1_switcha.m # Implicit integration version #Write some file headers # lang_header $1 switcha m 'mttAA,mttx' '[mttAA]' > $1_switcha.m | | | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | }' Nx=$Nx < $1_switch.txt #>> $1_switchopen.m #echo Creating $1_switcha.m # Implicit integration version #Write some file headers # lang_header $1 switcha m 'mttAA,mttx' '[mttAA]' > $1_switcha.m # gawk '{ # if ($1=="#"){ # printf("#== Switches set row and column of A matrix to zero ==#\n") # } # else{ # printf("#== Switch: %s ==#\n",$1) # printf("if (%s==0.0) \n", $1); # printf(" for MTTi=1:%s\n",Nx) |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/sympar2global_txt2lang from [bc073c2291] to [3d88bdddde].
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## 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. ## ## Revision 1.3 1998/07/26 10:48:18 peterg | > > > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ############################################################### ## 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. ## ## Revision 1.3 1998/07/26 10:48:18 peterg |
︙ | ︙ | |||
62 63 64 65 66 67 68 | if [ "$language" = "m" ]; then sympar2global_txt2m $1 exit fi if [ "$language" = "c" ]; then strip_comments <$1_sympars.txt |\ | | | | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | if [ "$language" = "m" ]; then sympar2global_txt2m $1 exit fi if [ "$language" = "c" ]; then strip_comments <$1_sympars.txt |\ gawk '{ i++; print "extern double", tolower($1) ";"; }' exit fi if [ "$language" = "java" ]; then cat <<EOF $1_numpar p; private p = new $1_numpar(); EOF strip_comments <$1_sympars.txt |\ gawk '{ i++; print " float " tolower($1) " = p." tolower($1) ";"; }' fi echo # Now invoke the standard error handling. # mtt_error mtt_error.txt |
Modified mttroot/mtt/bin/trans/sympar2global_txt2m from [cef2e8e876] to [e8df2e195f].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.5 1998/11/18 11:34:24 peterg ## Cleaned up to: ## work properly for no globals ## no need to repeat las global ## ## Revision 1.4 1998/07/26 10:44:08 peterg ## Now strips comment lines first | > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.6 1998/11/18 15:07:37 peterg ## Space after all globals ## ## Revision 1.5 1998/11/18 11:34:24 peterg ## Cleaned up to: ## work properly for no globals ## no need to repeat las global ## ## Revision 1.4 1998/07/26 10:44:08 peterg ## Now strips comment lines first |
︙ | ︙ | |||
33 34 35 36 37 38 39 | # Initial revision # ############################################################### #Write out the variables in matlab global format strip_comments <$1_sympars.txt |\ | | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | # Initial revision # ############################################################### #Write out the variables in matlab global format strip_comments <$1_sympars.txt |\ gawk ' {i++; if ((i==1)&&(NF>0)) { printf ("global"); globals_exist=1 } if (NF>0) printf (" ...\n %s", tolower($1)); |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/sympar2numpar_txt2txt from [1cce4350bc] to [6787c03295].
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Copyright (c) P.J.Gawthrop 1996 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## 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 ## ## Revision 1.10 1998/03/07 15:27:20 peterg | > > > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # Copyright (c) P.J.Gawthrop 1996 ############################################################### ## 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 ## ## Revision 1.10 1998/03/07 15:27:20 peterg |
︙ | ︙ | |||
63 64 65 66 67 68 69 | echo "# Numerical parameter file ($1_numpar.txt)" >> $1_numpar.txt echo "# Generated by MTT at `date`" >> $1_numpar.txt cat $MTTPATH/trans/rcs_header.txt >> $1_numpar.txt #Write out the variables echo "# Parameters" >> $1_numpar.txt strip_comments <$1_sympar.txt |\ | | | | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | echo "# Numerical parameter file ($1_numpar.txt)" >> $1_numpar.txt echo "# Generated by MTT at `date`" >> $1_numpar.txt cat $MTTPATH/trans/rcs_header.txt >> $1_numpar.txt #Write out the variables echo "# Parameters" >> $1_numpar.txt strip_comments <$1_sympar.txt |\ 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 #gawk '{ # if ($1=="state") # print "x(" $2 ") = \t0.0; \# " $4 " (" $3 ")" #}' \ # $1_struc.txt >> $1_numpar.txt |
Modified mttroot/mtt/bin/trans/sympar2par_txt2m from [62092b15cb] to [c3e5676656].
︙ | ︙ | |||
9 10 11 12 13 14 15 | # Symbolic parameters parameter conversion # Used in lang_header # Copyright (C) 2000 by Peter J. Gawthrop case $2 in zero) strip_comments <$1_sympar.txt |\ | | | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | # Symbolic parameters parameter conversion # Used in lang_header # Copyright (C) 2000 by Peter J. Gawthrop case $2 in zero) strip_comments <$1_sympar.txt |\ gawk '{ i++; printf(" %s %s = 0.0;\n", tolower($1)); }' ;; set) strip_comments <$1_sympar.txt |\ gawk '{ i++; printf(" %s mttpar(%i) \t= %s;\n", i, tolower($1)); }' ;; *) strip_comments <$1_sympar.txt |\ gawk '{ i++; printf(" %s %s \t= mttpar(%i%s);\n", decl, tolower($1), i, minusone); }' decl="$3" minusone="$4" ;; esac |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/sympar2params_txt2c from [ed3554c783] to [b4d5f24a4d].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ # Revision 1.1 1997/03/20 10:25:55 peterg # Initial revision # ############################################################### | > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## 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 # ############################################################### |
︙ | ︙ | |||
42 43 44 45 46 47 48 | 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. | | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | 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. 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 |
Modified mttroot/mtt/bin/trans/sympar2params_txt2m from [7416ea5275] to [cb4bac324f].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ # 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 # ############################################################### | > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## 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 # ############################################################### |
︙ | ︙ | |||
42 43 44 45 46 47 48 | #Write out the global variables sympar2global_txt2m $1 >> $1_params.m #Write out the variables in c format. | | | 45 46 47 48 49 50 51 52 53 54 55 56 57 | #Write out the global variables sympar2global_txt2m $1 >> $1_params.m #Write out the variables in c format. gawk '{i++; print tolower($1) " = \t1.0;"}' $1_sympar.txt >> $1_params.m # Now invoke the standard error handling. # mtt_error mtt_error.txt |
Modified mttroot/mtt/bin/trans/sympar_txt2c from [8ba82ee2c5] to [8c103e49d4].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ # 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 # # Revision 1.3 1997/03/19 16:39:12 peterg | > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## 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 # # Revision 1.3 1997/03/19 16:39:12 peterg |
︙ | ︙ | |||
40 41 42 43 44 45 46 | echo "Symbolic parameter file ($1_sympar.c)" >> $1_sympar.c echo "Generated by MTT at `date`" >> $1_sympar.c echo '*/' >> $1_sympar.c echo >> $1_sympar.c #Write out the variables in c format. | | | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | echo "Symbolic parameter file ($1_sympar.c)" >> $1_sympar.c echo "Generated by MTT at `date`" >> $1_sympar.c echo '*/' >> $1_sympar.c echo >> $1_sympar.c #Write out the variables in c format. gawk '{i++; print "extern double", tolower($1) ";"}' $1_sympar.txt \ >> $1_sympar.c # Now invoke the standard error handling. # mtt_error mtt_error.txt |
Modified mttroot/mtt/bin/trans/sympar_txt2declare from [cca8092d6c] to [1d77607037].
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Copyright (C) 2000 by Peter J. Gawthrop ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ############################################################### sys=$1 language=$2 case $language in | > > > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # Copyright (C) 2000 by Peter J. Gawthrop ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.1 2000/10/11 09:08:20 peterg ## Initial revision ## ############################################################### sys=$1 language=$2 case $language in |
︙ | ︙ | |||
32 33 34 35 36 37 38 | # Start cat<<EOF $first EOF #Write out the variables strip_comments < $sys"_sympar.txt" |\ | | | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | # Start cat<<EOF $first EOF #Write out the variables strip_comments < $sys"_sympar.txt" |\ gawk '{ i++; var[i] = tolower($1); } END{ n = i; for (i=1; i<n; i++){ printf("%s%s",var[i], delim); |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/sympar_txt2h from [7fc0d6f66f] to [d691280130].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ # Revision 1.5 1997/05/15 07:11:45 peterg # Removed "tolower" function # # Revision 1.4 1997/05/01 13:51:37 peterg # Replaced float by double. # # Revision 1.3 1997/05/01 13:42:43 peterg | > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.6 1997/05/15 07:21:44 peterg ## Put back "tolower" ## # Revision 1.5 1997/05/15 07:11:45 peterg # Removed "tolower" function # # Revision 1.4 1997/05/01 13:51:37 peterg # Replaced float by double. # # Revision 1.3 1997/05/01 13:42:43 peterg |
︙ | ︙ | |||
44 45 46 47 48 49 50 | echo "Symbolic parameter file ($1_sympar.h)" >> $1_sympar.h echo "Generated by MTT at `date`" >> $1_sympar.h echo '*/' >> $1_sympar.h echo >> $1_sympar.h #Write out the variables in c format. | | | 47 48 49 50 51 52 53 54 55 56 57 58 59 | echo "Symbolic parameter file ($1_sympar.h)" >> $1_sympar.h echo "Generated by MTT at `date`" >> $1_sympar.h echo '*/' >> $1_sympar.h echo >> $1_sympar.h #Write out the variables in c format. gawk '{i++; print "double", tolower($1) ";"}' $1_sympar.txt >> $1_sympar.h # Now invoke the standard error handling. # mtt_error mtt_error.txt |
Modified mttroot/mtt/bin/trans/sympar_txt2m from [edc3797ff8] to [c51bec0783].
︙ | ︙ | |||
9 10 11 12 13 14 15 | # Copyright (C) 2000 by Peter J. Gawthrop echo Creating $1_sympar.m lang_header -noglobals $1 sympar m "" sympar > $1_sympar.m | | | 9 10 11 12 13 14 15 16 17 18 | # Copyright (C) 2000 by Peter J. Gawthrop echo Creating $1_sympar.m lang_header -noglobals $1 sympar m "" sympar > $1_sympar.m gawk '{ printf(" sympar.%s \t= %i; # %s\n", $1, ++i, $2); }' < $1_sympar.txt >> $1_sympar.m |
Modified mttroot/mtt/bin/trans/sympar_txt2r from [f66bff96e0] to [48a0e2e4e2].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## 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 ## Dont declare MTTVAR array when there are no variables. ## | > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## 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 ## Dont declare MTTVAR array when there are no variables. ## |
︙ | ︙ | |||
47 48 49 50 51 52 53 | if [ "$lines" != "0" ]; then echo "MATRIX MTTVAR($lines,1);" >> $1_sympar.r fi echo "MTTNVAR := $lines;" >> $1_sympar.r echo >> $1_sympar.r #Write out the variables in reduce format. | | | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | if [ "$lines" != "0" ]; then echo "MATRIX MTTVAR($lines,1);" >> $1_sympar.r fi echo "MTTNVAR := $lines;" >> $1_sympar.r echo >> $1_sympar.r #Write out the variables in reduce format. 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 |
Modified mttroot/mtt/bin/trans/sympar_txt2tex from [9ce2cbef3d] to [937e1d805d].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## 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 ## # Revision 1.3 1997/12/06 19:10:41 peterg | > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## 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 ## # Revision 1.3 1997/12/06 19:10:41 peterg |
︙ | ︙ | |||
39 40 41 42 43 44 45 | rm -f mtt_error #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 | | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | rm -f mtt_error #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 | gawk ' #function header(what){ # print " \\centering"; # print " \\tablefirsthead{\\hline %"; # print " \\multicolumn{4}{|c|}{\\bf List of " what "s for system " SYSTEM "} \\\\"; # print " \\hline"; # print " & Component & System & Repetition \\\\"; # print " \\hline}"; |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/tex2doc from [1616bd5235] to [378ed3e3b7].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ # 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 ## ############################################################### # Inform user echo "Creating $1_$2.doc" # This is the main transformation using awk | > > > | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## 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 ## ############################################################### # Inform user echo "Creating $1_$2.doc" # This is the main transformation using awk gawk -f $MTTPATH/trans/awk/tex2doc.awk \ system_name=$1 representation=$2 > $1_$2.doc |
Modified mttroot/mtt/cc/def_m2h.sh from [48a6557660] to [78c95b87eb].
1 2 3 4 5 6 7 8 9 10 | #! /bin/sh # $Id$ # $Log$ # 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 # # Revision 1.1 2000/12/04 12:02:23 peterg | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 | #! /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 # # Revision 1.1 2000/12/04 12:02:23 peterg |
︙ | ︙ | |||
18 19 20 21 22 23 24 | IN=${SYS}_def.m SYM=${SYS}_sympar.txt OUT=${SYS}_def.h get_array_size () { vec=$1 | | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | IN=${SYS}_def.m SYM=${SYS}_sympar.txt OUT=${SYS}_def.h get_array_size () { vec=$1 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} | gawk '{ print $1 }'`;" >> ${OUT} cat <<EOF >> ${OUT} // typedefs won't work because it is illegal to initialise ColumnVector in typedef // use "ColumnVector mttx (MTTNX);" until the proper classes are ready |
︙ | ︙ |
Modified mttroot/mtt/cc/mtt_m2cc.sh from [235055c333] to [e7f8c97b43].
︙ | ︙ | |||
52 53 54 55 56 57 58 | esac) }; find_code () { file_in=${1:-${IN}} portion=${2:-"body"} | | | | | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | esac) }; find_code () { file_in=${1:-${IN}} portion=${2:-"body"} 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} ;; body) start=${head} end=${foot} ;; foot) start=${foot} end=end ;; *) echo "Error in find_code: portion unknown" return -1 ;; esac cat ${file_in} |\ gawk --assign start=${start} --assign end=${end} ' (start < NR && NR < end) { print $0 }' }; strip_junk () { case ${REP} in |
︙ | ︙ |
Modified mttroot/mtt/cc/sympar_txt2h.sh from [f4dafd0a84] to [f951f86658].
1 2 3 4 5 6 7 8 9 10 | #! /bin/sh # $Id$ # $Log$ # 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. # # Revision 1.2 2001/02/05 13:03:19 geraint | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 | #! /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. # # Revision 1.2 2001/02/05 13:03:19 geraint |
︙ | ︙ | |||
49 50 51 52 53 54 55 | TMP_VAR_NAMES="mtt_tmp mtt_o $*" IN=${SYS}_sympar.txt OUT=${SYS}_sympar.h declare_sys_param () { | | | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | TMP_VAR_NAMES="mtt_tmp mtt_o $*" IN=${SYS}_sympar.txt OUT=${SYS}_sympar.h declare_sys_param () { 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} do echo "" |
︙ | ︙ |
Modified mttroot/mtt/debian/control from [67402cd5ca] to [9e6dc56b5b].
1 2 3 4 5 6 7 8 9 10 11 12 | Source: mtt Section: math Priority: optional Maintainer: Geraint <geraint@users.sf.net> Build-Depends: debhelper (>> 3.0.0) Standards-Version: 3.5.2 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 | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | Source: mtt Section: math Priority: optional Maintainer: Geraint <geraint@users.sf.net> Build-Depends: debhelper (>> 3.0.0) Standards-Version: 3.5.2 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 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. . mtt requires the non-free symbolic algebra tool Reduce to be installed. |
︙ | ︙ |
Modified mttroot/mtt/lib/examples/Simulation/BigHeatedRod/Run from [e9ed9bb08f] to [5d09d2ea7c].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #! /bin/sh # Shell script for running the large HeatedRod systems to compare # four integration methods. # Usage example: Run 100 0.25 runf the 100 segment example at interval 0.25 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## 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 ## ############################################################### | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #! /bin/sh # Shell script for running the large HeatedRod systems to compare # four integration methods. # Usage example: Run 100 0.25 runf the 100 segment example at interval 0.25 ############################################################### ## 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 ## ############################################################### |
︙ | ︙ | |||
79 80 81 82 83 84 85 | mtt -q HR$n sm m octave -q <<EOF >HR$1.tmp1 HR$1_numpar; A=HR$1_sm; Max_Eig=max(eig(-A)) STEPFACTOR=ceil( Max_Eig*$DT/2 ) EOF | | | | | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | mtt -q HR$n sm m octave -q <<EOF >HR$1.tmp1 HR$1_numpar; A=HR$1_sm; Max_Eig=max(eig(-A)) STEPFACTOR=ceil( Max_Eig*$DT/2 ) EOF MinSTEPFACTOR=`gawk '{if ($1=="STEPFACTOR") print $3}' HR$1.tmp1` STEPFACTOR=$MinSTEPFACTOR ;; ImplicitS) # What is the empirical step size for sparse method? octave -q <<EOF >HR$1.tmp1 if $n>100 SparseSTEPFACTOR=10*$n else SparseSTEPFACTOR=5*$n endif EOF SparseSTEPFACTOR=`gawk '{if ($1=="SparseSTEPFACTOR") print $3}' HR$1.tmp1` STEPFACTOR=$SparseSTEPFACTOR ;; *) STEPFACTOR=1 ;; esac echo "Doing HR$1 with DT=$DT using $METHOD (STEPFACTOR = $STEPFACTOR)" # Modify the simpar.txt files grep -v 'STEPFACTOR' HR_simpar.txt | grep -v 'METHOD' | grep -v 'DT' > HR$1_simpar.txt 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 |\ 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 |
Modified mttroot/mtt/lib/reduce/reserved_words.make from [098f123485] to [58b98880d4].
1 2 3 4 5 6 7 8 9 10 11 12 | #! /bin/sh reduce_reserved_word_manual_page=${1:-"/usr/local/reduce/doc/manual/appenda.tex"} output="reserved_words.txt" cat $reduce_reserved_word_manual_page |\ tr "\n" " " |\ sed 's/\\\_/_/g' |\ sed 's/\\tt\ \([A-Za-z0-9_]*\)/\"\1\"/g' |\ tr " " "\n" |\ sed 's/\{//g' |\ sed 's/\}//g' |\ | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #! /bin/sh reduce_reserved_word_manual_page=${1:-"/usr/local/reduce/doc/manual/appenda.tex"} output="reserved_words.txt" cat $reduce_reserved_word_manual_page |\ tr "\n" " " |\ sed 's/\\\_/_/g' |\ sed 's/\\tt\ \([A-Za-z0-9_]*\)/\"\1\"/g' |\ tr " " "\n" |\ sed 's/\{//g' |\ sed 's/\}//g' |\ gawk -F\" '(NF==3) { printf "%s\n",$2 }' |\ sort -u \ > $output |