Index: mttroot/mtt/bin/trans/abg2lbl_fig2txt ================================================================== --- mttroot/mtt/bin/trans/abg2lbl_fig2txt +++ mttroot/mtt/bin/trans/abg2lbl_fig2txt @@ -11,10 +11,15 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.21 2001/07/06 00:46:50 gawthrop +## Added -cr option -- forces cr to be loaded before the ese.r file +## This avoids causality problems when using multi-port Rs to represent +## arbitary equations +## ## Revision 1.20 2001/07/04 05:19:57 gawthrop ## Added RT & CT to list ## ## Revision 1.19 2001/07/03 23:51:10 gawthrop ## Now puts outline #Summary and #Description lines at top of lbl file @@ -98,11 +103,11 @@ sys="-s ${system}" else sys=${system} fi -# Remove the old log file +# Remove unwanted files rm -f abg2lbl_fig2txt.log rm -f $1_cbg.m rm -f $typefile rm -f $infofile rm -f mtt_junk* @@ -155,10 +160,12 @@ EOF } create_lbl_body() { + +## Find names aof all components awk '/:/ {print $NF}' $1_abg.fig | \ sed 's/\\001//' | \ sort | \ tee $1_raw_list | \ sort -u> $1_unique_raw_list @@ -188,15 +195,17 @@ alias[++i] = Name; if (length(sensitivity)>0) { s_arg = sprintf("%ss",Name); alias[++i] = s_arg; s_arg = sprintf(";%s",s_arg); + Component_type = Component; Component = substr(Component,2); lin = "slin" } else { - lin = "lin" + Component_type = Component; + lin = "lin"; } } ## Table of components @@ -236,24 +245,24 @@ cr[Component] = "cr" else # assume a linear cr cr[Component] = "lin"; } - ## Heading - if (Component !~ OldComponent) print "\n## Component type", Component + ## Print component header + if (Component !~ OldComponent) print "\n## Component type", Component_type - ## Component + ## Print Component printf("\t%s\t", Name); if (Component in cr) printf("%s\t\t", cr[Component]) else - printf("%s\t\t",default_cr); + printf("%s\t\t", default_cr); if (Component in arg) printf("%s\t\t\n", arg[Component]) else { - print "lbl2args_txt2out", Component | "/bin/sh"; close("/bin/sh") + print "lbl2args_txt2out", Component_type | "/bin/sh"; close("/bin/sh") } OldComponent=Component; delete arg[Component]; # Zap the element delete cr[Component]; # Zap the element @@ -275,32 +284,37 @@ # print "%ALIAS\t\$" k "\t" alias[k] >> "mtt_junk_alias.txt"; # } }' sensitivity=$sensitivity } -create_args() +create_arg_aliases() { cat < mtt_junk_lbl.txt +create_lbl_body $1> $1_lbl.txt +create_arg_aliases > mtt_args.txt # using $1_lbl.txt +mv $1_lbl.txt mtt_junk_lbl.txt write_header > ${outfile} cat mtt_junk_alias.txt >> ${outfile} -create_args mtt_junk >> ${outfile} +cat mtt_args.txt >> ${outfile} write_blurb >> ${outfile} cat mtt_junk_lbl.txt >> ${outfile} ## Put a blank line at end cat >> ${outfile} < mtt_stripped_file else ## Take input from _abg.m cat $1_abg.m | grep "arg =" | tr $SEPS $REPS > mtt_stripped_file fi + rm -f mtt_error # This is the main transformation using gawk cat mtt_stripped_file | \ awk ' function exact_match(name1, name2) {