Overview
Comment: | Ignore if and endif |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
1742a246cbd6dc47a0de253da5d48467 |
User & Date: | gawthrop@users.sourceforge.net on 2003-08-14 10:33:46 |
Other Links: | branch diff | manifest | tags |
Context
2003-08-14
| ||
20:18:06 | Tidy up minor bugs check-in: f06043ac50 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
10:33:46 | Ignore if and endif check-in: 1742a246cb user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
09:59:17 | These should not be here. check-in: 76475393d7 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/trans/mtt_update from [e1bcb5489f] to [d0d93f3d1d].
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # Copyright (C) 2000 by Peter J. Gawthrop ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.19 2003/08/05 15:29:36 gawthrop ## Now handles ss.r files with implicit zero values ## ## Revision 1.18 2003/08/04 09:10:30 gawthrop ## Now handles steady-state computation for _state.txt. ## ## Revision 1.17 2002/04/28 18:41:27 geraint | > > > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # Copyright (C) 2000 by Peter J. Gawthrop ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.20 2003/08/13 15:49:39 gawthrop ## Don't sort the states when defaulting - leave in implied order ## ## Revision 1.19 2003/08/05 15:29:36 gawthrop ## Now handles ss.r files with implicit zero values ## ## Revision 1.18 2003/08/04 09:10:30 gawthrop ## Now handles steady-state computation for _state.txt. ## ## Revision 1.17 2002/04/28 18:41:27 geraint |
︙ | ︙ | |||
103 104 105 106 107 108 109 | value=${default} fi else value=${default} fi } | > > > > > > > > > > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > | 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 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 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 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | value=${default} fi else value=${default} fi } ## Remove if, end and endif from list remove_if() { file=$1 tmpfile="$1_tmp" mv ${file} ${tmpfile} grep -v 'if[ (]\|endif;' <${tmpfile} > ${file} ## Delete empty file size=`ls -s ${file} | awk '{print $1}'` if [ "${size}" = "0" ]; then rm $file fi } rm -f mtt_empty touch mtt_empty case $rep in numpar) lang=txt textfile=$1_$2.$lang infofile=$1_sympar.$lang moreinfofile=$infofile default='1.0' ;; input) lang=txt textfile=$1_$2.$lang infofile=mtt_list.$lang moreinfofile=mtt_list_numpar.$lang gawk '{if ($1==rep) printf("%s\n", $4)}' rep=$2 \ <$1_struc.txt >$infofile cat $infofile $1_sympar.$lang> $moreinfofile default='1.0' ;; state) lang=txt textfile=$1_$2.$lang infofile=mtt_list.$lang moreinfofile=mtt_list_numpar.$lang gawk '{if ($1==rep) printf("%s\n", $4)}' rep=$2 \ <$1_struc.txt >$infofile cat $infofile $1_sympar.$lang> $moreinfofile default='0.0' ;; logic) lang=txt textfile=$1_$2.$lang infofile=mtt_list.$lang moreinfofile=mtt_list_numpar.$lang gawk '{if ($3=="MTT_SWITCH") printf("%s_logic\n", $4)}' rep=$2 \ <$1_struc.txt >$infofile cat $infofile $1_sympar.$lang> $moreinfofile default='1.0' ;; *) echo Representation $rep not implemented exit esac # Create a string containing the variables if [ -f "$textfile" ]; then # Inform User echo Checking $textfile else echo Creating $textfile mtt_header $sys $rep $lang > $textfile if [ "${rep}" = "state" ]; then info=`cut -f1 $infofile` # No sort else info=`cut -f1 $infofile | sort` # Sort fi i=0; for new in $info; do let i=$i+1; initial_value $i ${default} echo $new $value |\ gawk '{printf("%s\t= %s; # Default\n",$1,$2)}' >> $textfile done exit fi # Remove tmp files rm -f mtt_in_text mtt_in_info # Strip files strip_comments <$textfile | tr 'A-Z' 'a-z' >mtt_text strip_comments <$infofile | tr 'A-Z' 'a-z' >mtt_info strip_comments <$moreinfofile | tr 'A-Z' 'a-z' >mtt_moreinfo # Use awk to check file gawk '{ if (FILENAME=="mtt_text") { gsub("[\t ]" ,""); # Remove whitespace split($0,a,"="); text[a[1]] = a[2]; } if (FILENAME=="mtt_info"){ info[$1] = default; } if (FILENAME=="mtt_moreinfo"){ moreinfo[$1] = default; } } END{ # for (iname in info) print iname for (tname in text) { if (!(tname in moreinfo)) print tname >> "mtt_in_text" } for (iname in info) { if (!(iname in text)) print iname >> "mtt_in_info" } }' default=$default mtt_text mtt_info mtt_moreinfo ## Remove if, end and endif from list remove_if mtt_in_text if [ -z "$update" ]; then if [ -f "mtt_in_text" ]; then echo "The following variables are defined in $textfile, but do not exist:" sort mtt_in_text | gawk '{printf("\t%s\n",$1)}' echo Use mtt $sys $rep $lang to update fi |
︙ | ︙ |