Overview
Comment: | Further changes towards aouto creation of lbl files. Prettified lbl files |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
98cc4a6dc499263ed3dc5dce3a2173cb |
User & Date: | gawthrop@users.sourceforge.net on 2001-06-13 10:41:06 |
Other Links: | branch diff | manifest | tags |
Context
2001-06-13
| ||
14:50:15 | Operator ^ now ok in args in abg and/or lbl check-in: a45ac8a4e9 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
10:41:06 |
Further changes towards aouto creation of lbl files. Prettified lbl files check-in: 98cc4a6dc4 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
10:39:51 |
Zeros output matices in csex and cseo just in case some elements are actually zero and not set in code. Works for m and oct. check-in: 9036150852 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/trans/abg2lbl_fig2txt from [9dabba8c1b] to [2aec5bf1c2].
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # Acausal bond graph to causal bond graph: mfile format ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.15 2001/06/11 16:53:49 gawthrop ## Now uses abg2sympar_m2txt to get the arguments ## ## Revision 1.14 2001/06/11 15:06:58 gawthrop ## Now handles user-defined components ## ## Revision 1.13 2001/06/04 08:13:37 gawthrop | > > > > > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Acausal bond graph to causal bond graph: mfile format ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.16 2001/06/11 19:43:49 gawthrop ## MTT is now much more sophisticated in generating lbl files ## Labels can contain maths ## Repetative components are now broken ## ## Revision 1.15 2001/06/11 16:53:49 gawthrop ## Now uses abg2sympar_m2txt to get the arguments ## ## Revision 1.14 2001/06/11 15:06:58 gawthrop ## Now handles user-defined components ## ## Revision 1.13 2001/06/04 08:13:37 gawthrop |
︙ | ︙ | |||
68 69 70 71 72 73 74 75 76 77 78 79 80 81 | # P.J.Gawthrop March 1997 # Copyright (c) P.J.Gawthrop, 1997 infofile='mtt_info.txt' typefile="$1_type.sh" sensitivity=$2; # Remove the old log file rm -f abg2lbl_fig2txt.log rm -f $1_cbg.m rm -f $typefile rm -f $infofile rm -f mtt_junk* | > > < | | > | > > > | > | < > | > | > | | | | | | | | | > > | > | | < | 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 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 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 | # P.J.Gawthrop March 1997 # Copyright (c) P.J.Gawthrop, 1997 infofile='mtt_info.txt' typefile="$1_type.sh" sensitivity=$2; system=$1 outfile=$1_lbl.txt # Remove the old log file rm -f abg2lbl_fig2txt.log rm -f $1_cbg.m rm -f $typefile rm -f $infofile rm -f mtt_junk* ## Create lbl files beneath this one mtt -q -u -l 1 $1 sub sh # Create the list sh $1_sub.sh "abg2lbl_fig2txt " if [ -f "$1_lbl.txt" ]; then ##echo "$1_lbl.txt exists in `pwd` - no action taken" exit ##else ##echo "$1_lbl.txt dosn not exist in `pwd` " fi #Inform user if [ -n "$sensitivity" ]; then echo "Creating ${outfile} (sensitivity version)" else echo "Creating ${outfile}" fi write_header() { cat<<EOF ## System ${system}, representation lbl, language txt ## File ${system}_lbl.txt ## Generated by MTT on `date` EOF cat $MTT_DOC/mtt_version.sh } write_blurb() { cat <<EOF ## Each line should be of one of the following forms: ## a comment (ie starting with #) ## component-name cr_name arg1,arg2,..argn ## blank ## ---- Component labels ---- EOF } create_lbl_body() { awk '/:/ {print $NF}' $1_abg.fig | \ sed 's/\\001//' | \ sort | \ tee $1_raw_list | \ sort -u> $1_unique_raw_list #Write out non-unique names #echo 'Non-unique names (if any):' #diff $1_unique_raw_list $1_raw_list | grep '>' | sed 's/>/ /' #Write out the outline lbl file grep -v '\[[0-9]*\]' $1_unique_raw_list | \ awk --field-separator ':' ' BEGIN { OldComponent="None"; } { Component = $1; Name = $2; Arg = $3; ##Aliases if (Component == "SS") { port_alias[++j] = Name; } else { alias[++i] = Name; |
︙ | ︙ | |||
181 182 183 184 185 186 187 188 189 | cr["AF"] = "lin"; arg["AF"] = sprintf("%s%s", Name, s_arg); cr["CDx"] = "lin"; arg["CDx"] = sprintf("%s%s", Name, s_arg); cr["RS"] = lin; arg["RS"] = sprintf("flow,%s%s", Name, s_arg); ## Heading | > > > > > > > > | | | | | | | | > | | | | | > > | > > > > > > > > > | 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 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | cr["AF"] = "lin"; arg["AF"] = sprintf("%s%s", Name, s_arg); cr["CDx"] = "lin"; arg["CDx"] = sprintf("%s%s", Name, s_arg); cr["RS"] = lin; arg["RS"] = sprintf("flow,%s%s", Name, s_arg); ## Put in the explicit arguments if (length(Arg)>0) { arg[Component] = Arg; if (match(Arg,"=")>0) # Its an equation type cr cr[Component] = "cr" else # assume a linear cr cr[Component] = "lin"; } ## Heading if (Component !~ OldComponent) print "\n## Component type", Component ## Component printf("\t%s\t", Name); if (Component in cr) printf("%s\t\t", cr[Component]) else printf("none\t\t"); if (Component in arg) printf("%s\t\t\n", arg[Component]) else { print "lbl2args_txt2out", Component | "/bin/sh"; close("/bin/sh") } OldComponent=Component; } END{ print "\n## Port aliases" >> "mtt_junk_alias.txt"; for (k=1;k<=j;k++){ if (port_alias[k] ~ "\\["){ # Only do ports port_name = substr(port_alias[k],2,length(port_alias[k])-2); if (length(sensitivity)==0) print "#ALIAS\t" port_name "\t" port_name >> "mtt_junk_alias.txt"; else print "#ALIAS\t" port_name "\t" port_name "_1," port_name "_2" >> "mtt_junk_alias.txt"; } } # print "\n% Argument aliases" >> "mtt_junk_alias.txt"; # for (k=1;k<=i;k++){ # print "%ALIAS\t\$" k "\t" alias[k] >> "mtt_junk_alias.txt"; # } }' sensitivity=$sensitivity } create_args() { cat <<EOF ## Argument aliases EOF abg2sympar_m2txt $1 "" use_label_file |\ awk '{printf("#ALIAS\t$%i\t%s\n", ++i, $1)}' } ## Main create_lbl_body $1> mtt_junk_lbl.txt write_header > ${outfile} cat mtt_junk_alias.txt >> ${outfile} create_args mtt_junk >> ${outfile} write_blurb >> ${outfile} cat mtt_junk_lbl.txt >> ${outfile} ## Clean up rm -f mtt_junk* |
Modified mttroot/mtt/bin/trans/awk/rbg_fig2m.awk from [783f4be4b3] to [5b5894f0e2].
︙ | ︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.39 2001/05/09 08:50:02 gawthrop ## Uses _art.fig to transmit the art work to the cbg.fig rep. ## ## Revision 1.38 2001/03/23 14:57:31 gawthrop ## Now puts space after header fields + writes _port.fig ## ## Revision 1.37 2000/09/14 08:43:32 peterg | > > > > > | 8 9 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.40 2001/06/11 19:43:50 gawthrop ## MTT is now much more sophisticated in generating lbl files ## Labels can contain maths ## Repetative components are now broken ## ## Revision 1.39 2001/05/09 08:50:02 gawthrop ## Uses _art.fig to transmit the art work to the cbg.fig rep. ## ## Revision 1.38 2001/03/23 14:57:31 gawthrop ## Now puts space after header fields + writes _port.fig ## ## Revision 1.37 2000/09/14 08:43:32 peterg |
︙ | ︙ | |||
269 270 271 272 273 274 275 | # The depth is field 4 (for strings) depth = modulo10($4); # It is terminated by \001 - so delete this termination str = substr(str,1,length(str)-4); # Zap maths | | > > > > > > > | 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | # The depth is field 4 (for strings) depth = modulo10($4); # It is terminated by \001 - so delete this termination str = substr(str,1,length(str)-4); # Zap maths ##gsub(/[()-+*/]/,"",str); # Loose the cr stuff (if present) if (depth==0) { N=split(str,a,delimiter); if (N==3) str=sprintf("%s%s%s", a[1],delimiter,a[2]); } # A component string contains only alphanumeric _ and : isa_plain_component = match(str, component_regexp)==0; # It must also be specified at depth 0 (modulo 10) isa_plain_component = isa_plain_component && (depth==0); # A port is a string within [] |
︙ | ︙ |