Index: mttroot/mtt/bin/mtt ================================================================== --- mttroot/mtt/bin/mtt +++ mttroot/mtt/bin/mtt @@ -15,10 +15,13 @@ ############################################################### ## Version control history ############################################################### ## $Header$ ## $Log$ +## Revision 1.332 2002/04/26 23:19:00 geraint +## Fixed path to info files for "mtt info". +## ## Revision 1.331 2002/04/19 09:24:29 gawthrop ## 2 changes to ode2odes_out generation: only compiles the specified c ## file; outside the computation=c clause ## ## Revision 1.330 2002/04/17 10:03:12 geraint @@ -1534,11 +1537,11 @@ fi # Recursively clean up if [ "$1" = "rclean" ]; then echo 'Removing intermediate files recursively' - dir2paths '.' | awk '{print "mtt -q -d " $1 " clean " $2}' | sh + dir2paths '.' | gawk '{print "mtt -q -d " $1 " clean " $2}' | sh exit fi # The big clean up if [ "$1" = "Clean" ] && [ "$2" = "" ]; then @@ -1621,11 +1624,11 @@ isMTT_work=`pwd | grep 'MTT_work'` if [ -n "$isMTT_work" ]; then dotdot='../' fi - #isdirectory=`file $dotdot$1 | awk '{print $2}' | grep directory` + #isdirectory=`file $dotdot$1 | gawk '{print $2}' | grep directory` if [ -d "$dotdot$1" ]; then documenttype=book fi else documenttype=section @@ -1717,11 +1720,11 @@ else if [ $source = "." ]; then cp -u *_*.* ${destination} else comp_path=`mtt_find $source $2 path_only` - n_found=`echo $comp_path | wc | awk '{print $2}'` + n_found=`echo $comp_path | wc | gawk '{print $2}'` if [ "$n_found" = "1" ]; then echo Copying $2 from $comp_path to ${destination} cp $comp_path/*_*.* ${destination} exit 0 @@ -2032,11 +2035,11 @@ sys_s=`echo $1 | cut -c 2-` sys_abg=${sys_s}_abg fi ## Check octave version -case `$MATRIX --version | awk -F\. '{print $2}'` in +case `$MATRIX --version | gawk -F\. '{print $2}'` in 0) define_octave_dev="";; # stable 1) define_octave_dev="-DOCTAVE_DEV";; # development *) define_octave_dev="-DOCTAVE_DEV";; esac Index: mttroot/mtt/bin/mtt_backup ================================================================== --- mttroot/mtt/bin/mtt_backup +++ mttroot/mtt/bin/mtt_backup @@ -31,15 +31,15 @@ fi ## Create appropriate filename case $format in date) - filename=`date | awk '{printf("%s_%s%s_%s.tgz\n", mtt, $2,$3,$6)}' mtt=$mtt`; + filename=`date | gawk '{printf("%s_%s%s_%s.tgz\n", mtt, $2,$3,$6)}' mtt=$mtt`; shift ;; version) - filename=`mtt --version | awk '{printf("%s-%s.tar.gz\n", mtt, $NF)}' mtt=$mtt`; + filename=`mtt --version | gawk '{printf("%s-%s.tar.gz\n", mtt, $NF)}' mtt=$mtt`; shift ;; *) @@ -57,11 +57,11 @@ # Listing files to ignore #echo Finding irrelevant files #find $dirs -name '*.*' -print |\ # grep 'dvi$\|ps$\|gif$\|log$\|dat$\|MTT_work\|core\|~$' >IGNORE -#wc IGNORE | awk '{print "Ignoring", $1, "files"}' +#wc IGNORE | gawk '{print "Ignoring", $1, "files"}' #echo examples >> IGNORE #Inform user echo Backing up $dirs to $filename Index: mttroot/mtt/bin/mtt_find ================================================================== --- mttroot/mtt/bin/mtt_find +++ mttroot/mtt/bin/mtt_find @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.7 2000/10/03 18:29:57 peterg +## *** empty log message *** +## ## Revision 1.6 1998/07/17 19:47:35 peterg ## Minor changes ## ## Revision 1.5 1998/07/17 07:50:33 peterg ## Now handles library name @@ -100,11 +103,11 @@ done |\ tee mtt_junk fi # Check exit status and return -hits=`wc mtt_junk | awk '{print $1}'` +hits=`wc mtt_junk | gawk '{print $1}'` rm -f mtt_junk if [ $hits = "1" ]; then exit 0 elif [ $hits = "0" ]; then Index: mttroot/mtt/bin/mtt_help ================================================================== --- mttroot/mtt/bin/mtt_help +++ mttroot/mtt/bin/mtt_help @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.14 2000/10/03 18:29:26 peterg +## crs now works after a fashion +## ## Revision 1.13 2000/04/04 15:22:44 peterg ## Major changes: simple components now work ## Single components now work ## ## Revision 1.12 1998/07/21 08:47:59 peterg @@ -148,16 +151,16 @@ ;; crs) echo $comment $blurb find $find_path -name "$name" -print |\ - awk '{print "grep", key, $1}' key=$key | sh |\ + gawk '{print "grep", key, $1}' key=$key | sh |\ sed "s/$key //" | $sort ;; *) - fullnames=`mtt_find $find_path "$name" | awk '{printf("%s/%s\n",$1,$2)}'` + fullnames=`mtt_find $find_path "$name" | gawk '{printf("%s/%s\n",$1,$2)}'` N=`echo $fullnames | wc -w`; if [ -z "$fullnames" ]; then echo $comment No $blurb found. else echo $comment $N $blurb found. @@ -164,11 +167,11 @@ for fullname in $fullnames; do name=`basename $fullname` if [ -n "$other" ]; then cat $fullname | egrep $key else - info=`cat $fullname | egrep $key | awk '{for (i=2;i<=NF;i++) print $i}'` + info=`cat $fullname | egrep $key | gawk '{for (i=2;i<=NF;i++) print $i}'` category=`echo $fullname | sed "s!$find_path/!!" ` category=`dirname $category` echo $category $name $info fi done @@ -175,11 +178,11 @@ fi esac exit - awk '{print "cat " $1 "/" $2}' | sh |\ + gawk '{print "cat " $1 "/" $2}' | sh |\ egrep $key | egrep $regexp |\ sed "s/$summary[ ]*//" |\ sed "s/$description[ ]*/ /" |\ sed "s/$alias[ ]*/ Alias: /" |\ sed "s!$find_path/!!" |\ Index: mttroot/mtt/bin/mtt_versions ================================================================== --- mttroot/mtt/bin/mtt_versions +++ mttroot/mtt/bin/mtt_versions @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.2 2000/11/13 21:40:26 peterg +## Sorted out the non-gnu +## ## Revision 1.1 1998/05/28 09:24:41 peterg ## Initial revision ## ############################################################### @@ -23,11 +26,11 @@ ## gnu standard --version mtt_version mtt echo Doing the GNU components -mtt_version awk +mtt_version gawk mtt_version basename mtt_version cat mtt_version cp mtt_version dirname mtt_version gcc Index: mttroot/mtt/bin/mttrc ================================================================== --- mttroot/mtt/bin/mttrc +++ mttroot/mtt/bin/mttrc @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.26 2002/04/26 16:16:33 geraint +## Removed unnecessary variables PLAT and GCCVERS. +## ## Revision 1.25 2002/04/02 09:16:39 geraint ## Tidied up library search paths, now assumes that system libraries are set up correctly. ## For Debian, this means installing the following: blas-dev, fftw-dev, lapack-dev, libncurses5-dev, libkpathsea-dev, libreadline-dev ## It may also be necessary to run /sbin/ldconfig on the relevant directories (especially Octave's). ## @@ -191,11 +194,11 @@ IOCTAVE="-I${PREFIX}/include/octave/ -I${PREFIX}/include/octave/octave" # library paths - OCTAVEVERS=`octave --version | awk '{ print $4 }'` + OCTAVEVERS=`octave --version | gawk '{ print $4 }'` LOCTAVE="-L${PREFIX}/lib/octave-${OCTAVEVERS} -loctave -lcruft -loctinterp" LSYSTEM="-ldl -lm -lncurses -lkpathsea -lreadline -lblas -llapack -lfftw -lg2c" # compiler options Index: mttroot/mtt/bin/trans/ICD_txt2lang.sh ================================================================== --- mttroot/mtt/bin/trans/ICD_txt2lang.sh +++ mttroot/mtt/bin/trans/ICD_txt2lang.sh @@ -29,26 +29,26 @@ cat <> ${ICD} ${comment} Inputs EOF -for name in `cat ${txt} | awk '($1 == "Input:") { print $3 }'` +for name in `cat ${txt} | gawk '($1 == "Input:") { print $3 }'` do - num=`grep ${name} ${struc} | awk '($1 == "input") { print $2 }'` + num=`grep ${name} ${struc} | gawk '($1 == "input") { print $2 }'` grep ^Input ${txt} |\ - awk '($3 == name) { printf ("\tmttu%c%d%c\t= %s;\n", lb, num-offset, rb, $2) }'\ + gawk '($3 == name) { printf ("\tmttu%c%d%c\t= %s;\n", lb, num-offset, rb, $2) }'\ lb=${lb} rb=${rb} name=${name} num=${num} offset=${offset} >> ${ICD} done cat <> ${ICD} ${comment} Outputs EOF -for name in `cat ${txt} | awk '($1 == "Output:") { print $3 }'` +for name in `cat ${txt} | gawk '($1 == "Output:") { print $3 }'` do - num=`grep ${name} ${struc} | awk '($1 == "output") { print $2 }'` + num=`grep ${name} ${struc} | gawk '($1 == "output") { print $2 }'` grep ^Output ${txt} |\ - awk '($3 == name) { printf ("\t%-30s = mtty%c%d%c;\n", $2, lb, num-offset, rb) }'\ + gawk '($3 == name) { printf ("\t%-30s = mtty%c%d%c;\n", $2, lb, num-offset, rb) }'\ lb=${lb} rb=${rb} name=${name} num=${num} offset=${offset} >> ${ICD} done Index: mttroot/mtt/bin/trans/abg2cr_m2txt ================================================================== --- mttroot/mtt/bin/trans/abg2cr_m2txt +++ mttroot/mtt/bin/trans/abg2cr_m2txt @@ -24,11 +24,11 @@ rm -f mtt_error # This is the main transformation using awk # And remove crs with same name as system -grep 'cr = ' $1_abg.m | awk ' +grep 'cr = ' $1_abg.m | gawk ' BEGIN { # Include lin cr anyway. print "lin" } { Index: mttroot/mtt/bin/trans/abg2lbl_fig2txt ================================================================== --- mttroot/mtt/bin/trans/abg2lbl_fig2txt +++ mttroot/mtt/bin/trans/abg2lbl_fig2txt @@ -11,10 +11,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.25 2001/10/15 14:27:00 gawthrop +## Now handles [1:N] style port labels +## ## Revision 1.24 2001/08/02 03:24:48 geraint ## Replaced mtt_version.sh with mtt_banner.sh - I think this was the intent. ## ## Revision 1.23 2001/07/26 04:08:35 gawthrop ## Removed lines deleting _type.sh and cbg.m @@ -172,11 +175,11 @@ create_lbl_body() { ## Find names of all components grep -v '\[[0-9]*:[0-9]*\]' $1_abg.fig |\ -awk '/:/ {print $NF}' | \ +gawk '/:/ {print $NF}' | \ sed 's/\\001//' | \ sort | \ tee $1_raw_list | \ sort -u> $1_unique_raw_list @@ -185,11 +188,11 @@ #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 ':' ' +gawk --field-separator ':' ' BEGIN { OldComponent="None"; default_cr = "lin"; } { @@ -303,11 +306,11 @@ cat < $1_lbl.txt Index: mttroot/mtt/bin/trans/abg2sabg_fig ================================================================== --- mttroot/mtt/bin/trans/abg2sabg_fig +++ mttroot/mtt/bin/trans/abg2sabg_fig @@ -11,10 +11,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.1 2000/12/28 12:18:40 peterg +## Initial revision +## ############################################################### # P.J.Gawthrop March 1997 # Copyright (c) P.J.Gawthrop, 1997 @@ -30,9 +33,9 @@ #Inform user echo Creating $1_sabg.txt -awk '{\ +gawk '{\ Depth=7;\ print $Depth}' $1_abg.fig Index: mttroot/mtt/bin/trans/abg2sensitivity_fig ================================================================== --- mttroot/mtt/bin/trans/abg2sensitivity_fig +++ mttroot/mtt/bin/trans/abg2sensitivity_fig @@ -20,11 +20,11 @@ fi echo Creating $sfilename -awk ' +gawk ' function modulo10(x) { return x-int(x/10)*10 } { Index: mttroot/mtt/bin/trans/abg2sub_fig2sh ================================================================== --- mttroot/mtt/bin/trans/abg2sub_fig2sh +++ mttroot/mtt/bin/trans/abg2sub_fig2sh @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ + ## Revision 1.4 2002/04/22 10:25:47 gawthrop + ## Handles unnamed components & ingnores artwork + ## ## Revision 1.3 2001/10/15 14:27:34 gawthrop ## Now handles [1:N] style port labels ## ## Revision 1.2 2001/07/23 23:26:23 gawthrop ## Removed some boring user feedback @@ -32,11 +35,11 @@ get_valid_components() { -awk ' +gawk ' function modulo10(x) { return x-int(x/10)*10 } BEGIN{ polyline = 2; @@ -67,34 +70,34 @@ # Get a list of all components from the _abg file get_valid_components $1 |\ grep -v '\[[0-9]*:[0-9]*\]' |\ grep -v '\[.*\]' |\ -awk '{if ($1==4) split($14,a,":"); print a[1]}' |\ +gawk '{if ($1==4) split($14,a,":"); print a[1]}' |\ sed 's/\\001//' |\ sort -u > mtt_tmp1 # Remove all components starting with 0 or 1 grep -v '^[01]' < mtt_tmp1 > mtt_tmp4 # Get a list of all standard simple components ls $MTT_LIB/comp/simple |\ - awk '/_cause.m/{split($1,a,"_");print(a[1])}' >mtt_tmp2 + gawk '/_cause.m/{split($1,a,"_");print(a[1])}' >mtt_tmp2 # Get a list of all standard compound components #ls $MTTPATH/comp/compound |\ -# awk '/_abg.m/{split($1,a,"_");print(a[1])}' >> mtt_tmp2 +# gawk '/_abg.m/{split($1,a,"_");print(a[1])}' >> mtt_tmp2 # Sorted combined list cat mtt_tmp2 | \ sed 's/^zero$/0/' |\ sed 's/^one$/1/' |\ sort -u >mtt_tmp3 # Print the non-standard components comm mtt_tmp4 mtt_tmp3 |\ - awk 'BEGIN{FS="\t"}{if (length($1)>0) print "$1" $1 "$2"}' \ + gawk 'BEGIN{FS="\t"}{if (length($1)>0) print "$1" $1 "$2"}' \ >>$1_sub.sh # Clean up mtt_tmp files #rm -f mtt_tmp? Index: mttroot/mtt/bin/trans/abg2sub_m2sh ================================================================== --- mttroot/mtt/bin/trans/abg2sub_m2sh +++ mttroot/mtt/bin/trans/abg2sub_m2sh @@ -11,10 +11,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.3 2000/10/03 11:34:53 peterg +## Correct $MTT_LIB +## ## Revision 1.2 2000/03/17 09:53:10 peterg ## Removed irritating echo Using "$1_sub.sh" ## ## Revision 1.1 2000/03/15 21:23:20 peterg ## Initial revision @@ -35,34 +38,34 @@ echo "# File $1_sub.sh" >> $1_sub.sh echo "# Generated by MTT on `date`." >> $1_sub.sh echo >> $1_sub.sh # Get a list of all components for the _abg file -awk '/type = / {print substr($3,2,length($3)-3)}' $1_abg.m |\ +gawk '/type = / {print substr($3,2,length($3)-3)}' $1_abg.m |\ sort -u > mtt_tmp1 # Remove all components starting with 0 or 1 grep -v '^[01]' < mtt_tmp1 > mtt_tmp4 # Get a list of all standard simple components echo ls $MTT_LIB/comp/simple ls $MTT_LIB/comp/simple |\ - awk '/_cause.m/{split($1,a,"_");print(a[1])}' >mtt_tmp2 + gawk '/_cause.m/{split($1,a,"_");print(a[1])}' >mtt_tmp2 # Get a list of all standard compound components #ls $MTTPATH/comp/compound |\ -# awk '/_abg.m/{split($1,a,"_");print(a[1])}' >> mtt_tmp2 +# gawk '/_abg.m/{split($1,a,"_");print(a[1])}' >> mtt_tmp2 # Sorted combined list cat mtt_tmp2 | \ sed 's/^zero$/0/' |\ sed 's/^one$/1/' |\ sort -u >mtt_tmp3 # Print the non-standard components comm mtt_tmp4 mtt_tmp3 |\ - awk 'BEGIN{FS="\t"}{if (length($1)>0) print "$1" $1 "$2"}' \ + gawk 'BEGIN{FS="\t"}{if (length($1)>0) print "$1" $1 "$2"}' \ >>$1_sub.sh # Clean up mtt_tmp files #rm -f mtt_tmp? Index: mttroot/mtt/bin/trans/abg2sympar_m2txt ================================================================== --- mttroot/mtt/bin/trans/abg2sympar_m2txt +++ mttroot/mtt/bin/trans/abg2sympar_m2txt @@ -20,19 +20,19 @@ SystemName=$2 UseLabelFile=$3 if [ -n "$UseLabelFile" ]; then ## Take input from lbl.txt strip_comments < $1_lbl.txt | tr $SEPS $REPS |\ - awk '{printf("%s %s \"%s\",\n",$1,$2,$3)}' > mtt_stripped_file + gawk '{printf("%s %s \"%s\",\n",$1,$2,$3)}' > 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 ' +gawk ' function exact_match(name1, name2) { return ((match(name1,name2)>0)&&(length(name1)==length(name2))) } function matches(names, name) { Index: mttroot/mtt/bin/trans/abg2tex ================================================================== --- mttroot/mtt/bin/trans/abg2tex +++ mttroot/mtt/bin/trans/abg2tex @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.3 2001/07/12 04:02:53 gawthrop +## Now fixes multiports for input and output as well as state +## ## Revision 1.2 2000/11/27 17:45:00 peterg ## Removed "System" from heading ## ## Revision 1.1 2000/11/27 15:11:15 peterg ## Initial revision @@ -131,11 +134,11 @@ cat $1_sub.tex >> $filename #Now do the subsystems (if at top level) if [ -z "$2" ]; then sub2subs $1 | sort -u | \ - awk '{print "abg2tex", pdf, $1, filename}' pdf=$pdf filename=$filename | sh + gawk '{print "abg2tex", pdf, $1, filename}' pdf=$pdf filename=$filename | sh fi Index: mttroot/mtt/bin/trans/alias_txt2m ================================================================== --- mttroot/mtt/bin/trans/alias_txt2m +++ mttroot/mtt/bin/trans/alias_txt2m @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.2 1998/07/02 19:16:03 peterg +## Prettyfied output +## ## Revision 1.1 1998/07/02 09:21:55 peterg ## Initial revision ## ############################################################### @@ -27,11 +30,11 @@ echo "function alias = $1_alias" > $1_alias.m echo "%% Alias file ($1_alias.m)" >> $1_alias.m echo "%% Generated by MTT at `date`" >> $1_alias.m #Write out the variables -awk '{ +gawk '{ if (NF==2) {i++; print "alias."$1 "\t = \""$2"\";"} } END{ if (i==0) print "alias = 0;" Index: mttroot/mtt/bin/trans/cbg2ese_m2r ================================================================== --- mttroot/mtt/bin/trans/cbg2ese_m2r +++ mttroot/mtt/bin/trans/cbg2ese_m2r @@ -14,10 +14,13 @@ ## Version control history ############################################################### ## $Id$ ## ## $Log$ +## Revision 1.31 2001/07/13 04:54:04 geraint +## Branch merge: numerical-algebraic-solution back to main. +## ## Revision 1.30 2001/07/12 04:02:53 gawthrop ## Now fixes multiports for input and output as well as state ## ## Revision 1.29.2.1 2001/06/26 22:29:05 geraint ## mtt_xargs.sh eliminates Arg list too long error for large models. @@ -248,11 +251,11 @@ get_indices () { sys=$1 which=$2 - awk '{if ($1==which) print $2}' which=$which < ${sys}_struc.txt + gawk '{if ($1==which) print $2}' which=$which < ${sys}_struc.txt } convert_indices () { sys=$1 @@ -340,11 +343,11 @@ sort -k 1,1 -k 2,2n junk >$structurefile # Relabel states with multiple ports relabel_multiple_definitions(){ mv $structurefile junk - awk ' + gawk ' BEGIN{ var_type_index=1; oldname=""; } { Index: mttroot/mtt/bin/trans/cmp2cmp_m ================================================================== --- mttroot/mtt/bin/trans/cmp2cmp_m +++ mttroot/mtt/bin/trans/cmp2cmp_m @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.1 2000/12/28 12:20:04 peterg +## Initial revision +## ############################################################### # Inform user echo Revising $1_cmp.m @@ -25,11 +28,11 @@ #Create the cmp file complete with headers. #echo "# Component file ($1_cmp.m)" #> $1_cmp.m #echo "# Revised by MTT at `date`" #>> $1_cmp.m #Write out the variables -awk ' +gawk ' BEGIN{ alias_file=1 Parameter_Regexp = "^_Parameter_" Line_Regexp = "cr|arg" quote = "\047" Index: mttroot/mtt/bin/trans/cmp2sub_m2sh ================================================================== --- mttroot/mtt/bin/trans/cmp2sub_m2sh +++ mttroot/mtt/bin/trans/cmp2sub_m2sh @@ -11,10 +11,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.8 2000/10/03 11:34:29 peterg +## Put in correct $MTT_LIB +## ## Revision 1.7 2000/01/18 14:22:58 peterg ## Now exits if file already exists ## ## Revision 1.6 1999/08/25 21:20:07 peterg ## Don't list components starting with 0 ot 1 @@ -49,33 +52,33 @@ echo "# File $1_sub.sh" >> $1_sub.sh echo "# Generated by MTT on `date`." >> $1_sub.sh echo >> $1_sub.sh # Get a list of all components for the _cmp file -awk '/comp_type = / {print substr($3,2,length($3)-3)}' $1_cmp.m |\ +gawk '/comp_type = / {print substr($3,2,length($3)-3)}' $1_cmp.m |\ sort -u > mtt_tmp1 # Remove all components starting with 0 or 1 grep -v '^[01]' < mtt_tmp1 > mtt_tmp4 # Get a list of all standard simple components ls $MTT_LIB/comp/simple |\ - awk '/_cause.m/{split($1,a,"_");print(a[1])}' >mtt_tmp2 + gawk '/_cause.m/{split($1,a,"_");print(a[1])}' >mtt_tmp2 # Get a list of all standard compound components #ls $MTTPATH/comp/compound |\ -# awk '/_abg.m/{split($1,a,"_");print(a[1])}' >> mtt_tmp2 +# gawk '/_abg.m/{split($1,a,"_");print(a[1])}' >> mtt_tmp2 # Sorted combined list cat mtt_tmp2 | \ sed 's/^zero$/0/' |\ sed 's/^one$/1/' |\ sort -u >mtt_tmp3 # Print the non-standard components comm mtt_tmp4 mtt_tmp3 |\ - awk 'BEGIN{FS="\t"}{if (length($1)>0) print "$1" $1 "$2"}' \ + gawk 'BEGIN{FS="\t"}{if (length($1)>0) print "$1" $1 "$2"}' \ >>$1_sub.sh # Clean up mtt_tmp files #rm -f mtt_tmp? Index: mttroot/mtt/bin/trans/cr_txt2r ================================================================== --- mttroot/mtt/bin/trans/cr_txt2r +++ mttroot/mtt/bin/trans/cr_txt2r @@ -14,10 +14,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.12 2002/04/08 17:04:21 geraint +## Removed spurious "\n" from output. +## ## Revision 1.11 2000/08/01 07:34:33 peterg ## Replaced printf by echo ## ## Revision 1.10 2000/02/25 09:10:12 peterg ## Changed -e to -f in if [ -f "$crf" ]; then @@ -91,25 +94,25 @@ # Recursively create subsystem CR files -- at lower level sh $1_sub.sh 'cr_txt2r ' ' _lower' # Include subsystem CR files sh $1_sub.sh 'echo ' "_cr.r" |\ - awk '{ + gawk '{ print "in \"" $1 "\";" }' >> $crfile ## if [ -z "$level" ]; then # Copy .cr files - awk '{ + gawk '{ if (NF>0) { print "mtt -q -u crcopy " $1; } }' $1_cr.txt | sh # Include the .cr files -# awk '{ +# gawk '{ # if (NF>0) { # print "in \"" $1 ".cr\";" # } # }' $1_cr.txt >> $crfile Index: mttroot/mtt/bin/trans/cse2scse_r ================================================================== --- mttroot/mtt/bin/trans/cse2scse_r +++ mttroot/mtt/bin/trans/cse2scse_r @@ -20,11 +20,11 @@ # Parameters n=`echo $2 | sed 's/,/ /g' |wc -w` ## Number of parameters ## Parameter information for reduce. parameters=`echo $2 | sed 's/,/ /g' |\ - awk '{ + gawk '{ for (i=1; i<=NF; i++) { printf("mttpar(%i,1) := %s;\n", i, $i); printf("mttcoef(%i,1) := %ss;\n", i, $i); } }'` @@ -35,11 +35,11 @@ mv $1_sympar.txt mtt_junk grep -v MTT_Sensitivity_Coefficients mtt_junk > $1_sympar.txt # Create the new sens coeffs at end of list. echo $2 | sed 's/,/ /g' |\ -awk '{ +gawk '{ for (i=1; i<=NF; i++) { printf("%ss\tMTT_Sensitivity_Coefficients\n",$i); } }' >> $1_sympar.txt @@ -46,11 +46,11 @@ touch $1_sympar.txt matrix="matrix mttpar("$n",1); matrix mttcoef("$n",1);" # Number of states -Nx=`grep "MTTNx " <$system_def | awk '{print $3}' | sed 's/;//'` +Nx=`grep "MTTNx " <$system_def | gawk '{print $3}' | sed 's/;//'` #Inform user echo Creating $system_scse "(for parameters $2, $Nx states)" # Remove the old log file @@ -231,11 +231,11 @@ ## Now reorganise the states mv -f $system_scse mtt_junk ##echo "Nx = $Nx" -awk '{ +gawk '{ ## Make sure all MTTn variables are followed by a space gsub(/mttx[0-9]*/, "& "); for (i=Nx;i>0;i--) { Index: mttroot/mtt/bin/trans/dae2cse_r ================================================================== --- mttroot/mtt/bin/trans/dae2cse_r +++ mttroot/mtt/bin/trans/dae2cse_r @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.19 2001/10/26 01:01:49 geraint +## fixcc when rdae_is_dae (-cr). +## ## Revision 1.18 2001/10/05 23:37:32 geraint ## Fixed assignment statement in ae.r when RHS=0. ## ## Revision 1.17 2001/07/27 23:29:10 geraint ## Optimises only when requested (-opt). @@ -450,11 +453,11 @@ cat $1_csex.r1 $1_csex.r2 > $1_csex.r cat $1_cseo.r1 $1_cseo.r2 > $1_cseo.r if [ "$solve" = "1" ]; then echo "Setting MTTNyz=0 in $1_def.r and updating other $1_def files" - awk '{ + gawk '{ if ($1=="MTTNyz") print "MTTNyz := 0;" else print $0 }' $1_def.r > mtt_junk # Make sure it preserves the time stamp!! @@ -461,14 +464,14 @@ # and remove dependent reps touch -r $1_def.r mtt_junk mv mtt_junk $1_def.r for file in `ls $1_def.*`; do if [ $file != $1_def.r ]; then - ext=`echo $file|awk -F\. '{print $2}'` + ext=`echo $file|gawk -F\. '{print $2}'` mtt -q $1 def $ext fi done fi # Now invoke the standard error handling. mtt_error_r dae2cse_r.log Index: mttroot/mtt/bin/trans/dat22dat ================================================================== --- mttroot/mtt/bin/trans/dat22dat +++ mttroot/mtt/bin/trans/dat22dat @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.10 2000/10/17 12:24:02 peterg +## Three argument generic version +## ## Revision 1.9 2000/09/27 16:12:50 peterg ## Use expr to evaluate arithmetic - compatible with sh (as opposed to ## bash) ## ## Revision 1.8 2000/09/21 10:07:06 peterg @@ -57,13 +60,13 @@ ;; esac echo Creating $1_$2$3.dat -awk '{ +gawk '{ ## Extract the data if (index($1,"#") != 1){ for (i=First;i<=Last;i++) printf("%s ", $i); printf("\n"); } }' First=$First Last=$Last <$1_$2s.dat2 > $1_$2$3.dat Index: mttroot/mtt/bin/trans/dat22sg.sh ================================================================== --- mttroot/mtt/bin/trans/dat22sg.sh +++ mttroot/mtt/bin/trans/dat22sg.sh @@ -61,11 +61,11 @@ echo '' } write_column_headings () { - awk '{ printf (" \n \n", NR-1,$0) }' + gawk '{ printf (" \n \n", NR-1,$0) }' } write_output_headings () { sys=$1 @@ -125,11 +125,11 @@ file=${sys}_odes.sg NX=`mtt_getsize ${sys} x` NY=`mtt_getsize ${sys} y` -NTMP=`wc -l ${sys}_odes.dat2 | awk '{print $1}'` +NTMP=`wc -l ${sys}_odes.dat2 | gawk '{print $1}'` NROW=`expr ${NTMP} - 4` # 4 comment lines in mtt_data { write_project_header # states Index: mttroot/mtt/bin/trans/dat2gdat ================================================================== --- mttroot/mtt/bin/trans/dat2gdat +++ mttroot/mtt/bin/trans/dat2gdat @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.2 2002/04/16 11:36:03 gawthrop +## These were flagged with M on cvs update +## ## Revision 1.1 2000/12/28 12:26:15 peterg ## Put under RCS ## ## Revision 1.8 1998/09/29 20:01:27 peterg ## 4th argument for nyquist style files - ie differnt x for each y @@ -56,11 +59,11 @@ #Get the desired data index which=`name2index $1 "$3"` echo $1 $3 $which if [ -z "$DifferentX" ]; then -awk ' +gawk ' BEGIN{ row=0; col=0; } { if (row==0) { @@ -96,11 +99,11 @@ } } }' which="$which" <$1_$2.dat > $1_$2.gdat else -awk ' +gawk ' BEGIN{ row=0; col=0; } { row++; cols=NF/2 Index: mttroot/mtt/bin/trans/dat2siag ================================================================== --- mttroot/mtt/bin/trans/dat2siag +++ mttroot/mtt/bin/trans/dat2siag @@ -14,20 +14,23 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.1 2001/04/16 22:22:06 geraint +## *** empty log message *** +## ## Revision 1.1 1999/03/29 03:35:13 peterg ## Initial revision ## ############################################################### # This is the main transformation using awk -awk '{ +gawk '{ i++ for (j=1;j<=NF;j++) data[i,j]=$j; Cols=NF; Rows++; Index: mttroot/mtt/bin/trans/def2write_r ================================================================== --- mttroot/mtt/bin/trans/def2write_r +++ mttroot/mtt/bin/trans/def2write_r @@ -11,10 +11,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.9 2001/07/27 23:29:10 geraint +## Optimises only when requested (-opt). +## ## Revision 1.8 2001/07/13 04:54:04 geraint ## Branch merge: numerical-algebraic-solution back to main. ## ## Revision 1.7.2.1 2001/05/04 04:07:24 geraint ## Numerical solution of algebraic equations. @@ -68,11 +71,11 @@ Nx=`mtt_getsize $sys x` # States Nxx=`mtt_getsize $sys xx` # States x States Nu=`mtt_getsize $sys u` # Inputs Ny=`mtt_getsize $sys y` # Outputs Nyz=`mtt_getsize $sys yz` # Zero outputs -#Npar=`wc -l $sys\_sympar.txt | awk '{print $1}'` +#Npar=`wc -l $sys\_sympar.txt | gawk '{print $1}'` # Set up representation-specific stuff case $rep in cse) matrices='EdX E' Index: mttroot/mtt/bin/trans/def_r2m ================================================================== --- mttroot/mtt/bin/trans/def_r2m +++ mttroot/mtt/bin/trans/def_r2m @@ -11,10 +11,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.2 1998/07/25 10:21:37 peterg +## Entirely rewritten +## ## Revision 1.1 1998/07/25 07:10:41 peterg ## Initial revision ## ############################################################### @@ -34,19 +37,19 @@ % Generated by MTT on `date`; % EOF # Constants -Nx=`grep "MTTNx " <$1_def.r | awk '{print $3}' | sed 's/;//'` -Ny=`grep "MTTNy " <$1_def.r | awk '{print $3}' | sed 's/;//'` -Nu=`grep "MTTNu " <$1_def.r | awk '{print $3}' | sed 's/;//'` -Nz=`grep "MTTNz " <$1_def.r | awk '{print $3}' | sed 's/;//'` -Nyz=`grep "MTTNyz " <$1_def.r | awk '{print $3}' | sed 's/;//'` +Nx=`grep "MTTNx " <$1_def.r | gawk '{print $3}' | sed 's/;//'` +Ny=`grep "MTTNy " <$1_def.r | gawk '{print $3}' | sed 's/;//'` +Nu=`grep "MTTNu " <$1_def.r | gawk '{print $3}' | sed 's/;//'` +Nz=`grep "MTTNz " <$1_def.r | gawk '{print $3}' | sed 's/;//'` +Nyz=`grep "MTTNyz " <$1_def.r | gawk '{print $3}' | sed 's/;//'` cat<> $1_def.m nx = $Nx; ny = $Ny; nu = $Nu; nz = $Nz; nyz = $Nyz; EOF Index: mttroot/mtt/bin/trans/dir2paths ================================================================== --- mttroot/mtt/bin/trans/dir2paths +++ mttroot/mtt/bin/trans/dir2paths @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.2 1998/11/10 17:12:15 peterg +## Removed sorting +## ## Revision 1.1 1998/03/11 10:32:35 peterg ## Initial revision ## ############################################################### @@ -24,15 +27,15 @@ dotdot=$2 # Set to ../ if we are in MTT_work # Create paths for all valid examples - ie dir name is system name find $dotdot$1 -name '*_abg.fig' -print |\ - awk '{ + gawk '{ N=split($1,name,"/"); printf("%s", name[1]); for (i=2;i $1_rep.txt echo "% Generated by MTT on" `date`. >> $1_rep.txt # Create paths for all valid examples - ie dir name is system name dir2paths $1 $2 | sed 's/Introduction/AAAAA/g' | sort | sed 's/AAAAA/Introduction/g' | \ -awk '{ +gawk '{ print "mtt -t -d " $1,$2 " rep tex"; }' >> $1_rep.txt Index: mttroot/mtt/bin/trans/dm2ir_m2dat ================================================================== --- mttroot/mtt/bin/trans/dm2ir_m2dat +++ mttroot/mtt/bin/trans/dm2ir_m2dat @@ -14,10 +14,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.3 1996/08/11 19:48:29 peter +## Parameter passing added. +## ## Revision 1.2 1996/08/11 10:40:00 peter ## Now handles e and NaN numbers. ## ## Revision 1.1 1996/08/10 14:15:03 peter ## Initial revision @@ -33,11 +36,11 @@ else PARAMS=$2; fi -$MATRIX << EOF | awk '$1 !~ /[A-MO-Zb-cf-z]/ && NF>0 {print} ' >$1_ir.dat +$MATRIX << EOF | gawk '$1 !~ /[A-MO-Zb-cf-z]/ && NF>0 {print} ' >$1_ir.dat $PARAMS; [n,m]=size(t); if m>n t=t'; Index: mttroot/mtt/bin/trans/examples_txt2tk ================================================================== --- mttroot/mtt/bin/trans/examples_txt2tk +++ mttroot/mtt/bin/trans/examples_txt2tk @@ -8,11 +8,11 @@ # Creates tk/tcl file for xmtt. # Copyright (c) P.J.Gawthrop, 1998,1999 # Examples menu -awk 'BEGIN{ +gawk 'BEGIN{ basemenu=".exam.exam" oldmenu=basemenu OLDPATH=""; } { Index: mttroot/mtt/bin/trans/icd2ICD_txt22txt.sh ================================================================== --- mttroot/mtt/bin/trans/icd2ICD_txt22txt.sh +++ mttroot/mtt/bin/trans/icd2ICD_txt22txt.sh @@ -21,11 +21,11 @@ EOF cat ${icd} |\ sed 's/[\,\;]/\ /g' |\ - awk ' + gawk ' ($2 != "null" && $6 == "input") { printf ("Input: %-30s %-30s Causality: Effort Units: %s\n", $2, $1, $3) } ($4 != "null" && $7 == "input") { printf ("Input: %-30s %-30s Causality: Flow Units: %s\n", $4, $1, $5) } ($2 != "null" && $6 == "output") { printf ("Output: %-30s %-30s Causality: Effort Units: %s\n", $2, $1, $3) } ($4 != "null" && $7 == "output") { printf ("Output: %-30s %-30s Causality: Flow Units: %s\n", $4, $1, $5) } ' | sort >> ${ICD} Index: mttroot/mtt/bin/trans/icd_txt2m.sh ================================================================== --- mttroot/mtt/bin/trans/icd_txt2m.sh +++ mttroot/mtt/bin/trans/icd_txt2m.sh @@ -7,11 +7,11 @@ echo "function icd = $1_icd" > $1_icd.m echo "%% Component icd file ($1_icd.m)" >> $1_icd.m echo "%% Generated by MTT at `date`" >> $1_icd.m #Write out the variables -awk '{ +gawk '{ if (NF==2) {i++; print "icd."$1 "\t = \""$2"\";"} } END{ if (i==0) print "icd = 0;" Index: mttroot/mtt/bin/trans/lbl2alias_txt ================================================================== --- mttroot/mtt/bin/trans/lbl2alias_txt +++ mttroot/mtt/bin/trans/lbl2alias_txt @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.2 1998/07/02 08:34:00 peterg +## Renamed to lbl2alias_txt2txt +## ## Revision 1.1 1998/07/02 08:14:07 peterg ## Initial revision ## ############################################################### @@ -26,15 +29,15 @@ echo "# Alias file ($1_alias.txt)" > $1_alias.txt echo "# Generated by MTT at `date`" >> $1_alias.txt #Write out the variables grep '[%|#]ALIAS' $1_lbl.txt |\ -awk '{print $2,$3}' >> $1_alias.txt +gawk '{print $2,$3}' >> $1_alias.txt Index: mttroot/mtt/bin/trans/lbl2alias_txt2txt ================================================================== --- mttroot/mtt/bin/trans/lbl2alias_txt2txt +++ mttroot/mtt/bin/trans/lbl2alias_txt2txt @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.6 1998/07/17 19:46:56 peterg +## No change +## ## Revision 1.5 1998/07/17 16:31:37 peterg ## Ignore component aliases (with /) ## ## Revision 1.4 1998/07/03 15:21:26 peterg ## Replace sub by gsub -- need to replace ALL , @@ -44,11 +47,11 @@ echo "# Alias file ($1_alias.txt)" > $1_alias.txt echo "# Generated by MTT at `date`" >> $1_alias.txt #Write out the variables grep '[%|#]ALIAS' $1_lbl.txt |\ - awk '{ + gawk '{ if (match($3,"/")==0){ if (match($2,"\\$")==0){ alias=$2; name =$3 } else{ Index: mttroot/mtt/bin/trans/lbl2args_txt2out ================================================================== --- mttroot/mtt/bin/trans/lbl2args_txt2out +++ mttroot/mtt/bin/trans/lbl2args_txt2out @@ -8,10 +8,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ + ## Revision 1.2 2001/07/03 22:59:08 gawthrop + ## Fixed problems with argument passing for CRs + ## ## Revision 1.1 2001/06/11 15:06:58 gawthrop ## Now handles user-defined components ## ############################################################### @@ -18,11 +21,11 @@ # Copyright (C) 2001 by Peter J. Gawthrop if [ -f "$1_lbl.txt" ]; then grep '[#%]ALIAS' $1_lbl.txt |\ -awk '{ +gawk '{ if (match($2,"\\$[0-9]")==1) ## Test if its a argument alias { i = substr($2,2); arg[i] = $3 N++ Index: mttroot/mtt/bin/trans/lbl2component ================================================================== --- mttroot/mtt/bin/trans/lbl2component +++ mttroot/mtt/bin/trans/lbl2component @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.3 1998/07/28 11:23:31 peterg +## Put / explicitly in awk. +## ## Revision 1.2 1998/07/27 08:38:11 peterg ## Just look for / in the relevant field. ## ## Revision 1.1 1998/07/17 17:04:50 peterg ## Initial revision @@ -24,11 +27,11 @@ # Regexp for an alias alias='^[#%]ALIAS' -grep $alias $1_lbl.txt | awk '{if (match($3,"/")>0) print "mtt -q compcopy " $3}' +grep $alias $1_lbl.txt | gawk '{if (match($3,"/")>0) print "mtt -q compcopy " $3}' Index: mttroot/mtt/bin/trans/lbl2cr_txt2r ================================================================== --- mttroot/mtt/bin/trans/lbl2cr_txt2r +++ mttroot/mtt/bin/trans/lbl2cr_txt2r @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.4 2000/12/28 12:32:06 peterg +## Put under RCS +## # Revision 1.3 1996/11/03 21:11:44 peterg # Removed END; statement # ## Revision 1.2 1996/11/02 10:20:53 peterg ## Created from lbl2sympar @@ -32,12 +35,12 @@ #Write some file headers echo "%% constitutive relationship file ($1_cr.r)" > $1_cr.r echo "%% Generated by MTT at `date`" >> $1_cr.r # This is the main transformation using awk -awk -f $MTTPATH/trans/awk/lbl2cr.awk <$1_lbl.txt 2>mtt_error.txt | \ +gawk -f $MTTPATH/trans/awk/lbl2cr.awk <$1_lbl.txt 2>mtt_error.txt | \ sh >> $1_cr.r # Now invoke the standard error handling. #mtt_error mtt_error.txt Index: mttroot/mtt/bin/trans/lbl2icd_txt2txt.sh ================================================================== --- mttroot/mtt/bin/trans/lbl2icd_txt2txt.sh +++ mttroot/mtt/bin/trans/lbl2icd_txt2txt.sh @@ -20,11 +20,11 @@ echo "# Component ICD file ($1_icd.txt)" > ${icd} echo "# Generated by MTT at `date`" >> ${icd} #Write out the variables grep '[%|#]ICD' ${lbl} |\ - awk '{ + gawk '{ if (match($3,"/")==0){ if (match($2,"\\$")==0){ icd=$2; name =$3 } else{ Index: mttroot/mtt/bin/trans/lbl2modpar_txt ================================================================== --- mttroot/mtt/bin/trans/lbl2modpar_txt +++ mttroot/mtt/bin/trans/lbl2modpar_txt @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $$Id$ ## $Log$ +## Revision 1.1 2001/03/29 19:24:14 gawthrop +## Can now use c representations of crs when using -c option +## ############################################################### # Inform user echo Creating $1_modpar.txt @@ -23,11 +26,11 @@ echo "# Modpar file ($1_modpar.txt)" > $1_modpar.txt echo "# Generated by MTT at `date`" >> $1_modpar.txt #Write out the variables grep '[%|#]MODPAR' $1_lbl.txt |\ -awk '{printf("%s\t%s\n", $2,$3)}' >> $1_modpar.txt +gawk '{printf("%s\t%s\n", $2,$3)}' >> $1_modpar.txt echo "# End of $1_modpar.txt" >> $1_modpar.txt Index: mttroot/mtt/bin/trans/lbl2sympar_txt2r ================================================================== --- mttroot/mtt/bin/trans/lbl2sympar_txt2r +++ mttroot/mtt/bin/trans/lbl2sympar_txt2r @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.7 2000/12/28 12:32:06 peterg +## Put under RCS +## # Revision 1.6 1996/12/07 19:39:51 peterg # Minor debugging. # ## Revision 1.5 1996/09/12 17:18:44 peter ## Don't add an RCS header .. @@ -45,11 +48,11 @@ echo "%% Symbolic parameter file ($1_sympar.r)" > $1_sympar.r echo "%% Generated by MTT at `date`" >> $1_sympar.r # This is the main transformation using awk tr ';' ',' < $1_lbl.txt | \ -awk -f $MTTPATH/trans/awk/lbl2sympar.awk | sort >> $1_sympar.r 2>mtt_error.txt +gawk -f $MTTPATH/trans/awk/lbl2sympar.awk | sort >> $1_sympar.r 2>mtt_error.txt # Now invoke the standard error handling. mtt_error mtt_error.txt Index: mttroot/mtt/bin/trans/lbl_txt2tex ================================================================== --- mttroot/mtt/bin/trans/lbl_txt2tex +++ mttroot/mtt/bin/trans/lbl_txt2tex @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.11 2002/04/19 08:39:45 gawthrop +## Changed \# to # and \% to # to avoid warning in latest gawk version +## ## Revision 1.10 2000/12/28 12:32:06 peterg ## Put under RCS ## ## Revision 1.9 2000/11/16 13:11:06 peterg ## Included PAR and UNITS declarations @@ -54,27 +57,27 @@ echo "% Label summary file ($1_lbl.tex)" > $1_lbl.tex echo "% Generated by MTT at `date`" >> $1_lbl.tex #Write out the Description grep '[%|#]SUMMARY' $1_lbl.txt | sed 's/_/\\_/g' |\ - awk '{ + gawk '{ printf("\\paragraph{System %s:",$2); for (i=3;i<=NF;i++) printf("%s ",$i); print "" print "}" }' >> $1_lbl.tex grep '[%|#]DESCRIPTION' $1_lbl.txt | sed 's/_/\\_/g' |\ - awk '{ + gawk '{ for (i=2;i<=NF;i++) printf("%s ",$i); print "" }' >> $1_lbl.tex #Write out the aliases cat <> $1_lbl.tex \paragraph{Interface information:} \begin{description} EOF grep '[%|#]ALIAS' $1_lbl.txt | sed 's/_/\\_/g' |\ - awk '{ + gawk '{ N=split($2,a,"|"); for (i=1;i<=N;i++){ if (match(a[i],"\\$")>0){ printf("\\item [Parameter \\%s] represents actual parameter ",a[i]) } @@ -100,11 +103,11 @@ cat <> $1_lbl.tex \paragraph{Variable declarations:} \begin{description} EOF grep '[%|#][V|P]AR' $1_lbl.txt | sed 's/_/\\_/g' |\ - awk '{ + gawk '{ printf("\\item %s\n",$2) } END{if (NR==0) print "\\item This component has no PAR declarations" }' | sort >> $1_lbl.tex cat <> $1_lbl.tex @@ -116,11 +119,11 @@ cat <> $1_lbl.tex \paragraph{Units declarations:} \begin{description} EOF grep '[%|#]UNITS' $1_lbl.txt | sed 's/_/\\_/g' |\ - awk '{ + gawk '{ printf("\\item [Port %s] has domain %s\n",$2, $3) printf("\\begin{description}\n") printf("\\item [Effort units] %s\n",$4) printf("\\item [Flow units] %s\n",$5) printf("\\end{description}\n") Index: mttroot/mtt/bin/trans/m2dat ================================================================== --- mttroot/mtt/bin/trans/m2dat +++ mttroot/mtt/bin/trans/m2dat @@ -13,11 +13,14 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.1 1996/08/14 08:36:16 peter +## Initial revision +## ############################################################### echo Creating $1.dat -awk '$1 ~ /[0-9]/ && NF>0 {print} ' <$1.m >$1.dat +gawk '$1 ~ /[0-9]/ && NF>0 {print} ' <$1.m >$1.dat Index: mttroot/mtt/bin/trans/make_ode2odes ================================================================== --- mttroot/mtt/bin/trans/make_ode2odes +++ mttroot/mtt/bin/trans/make_ode2odes @@ -7,10 +7,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.69 2002/04/17 13:46:58 geraint +## #include for -oct as well as -cc. +## ## Revision 1.68 2002/04/15 10:54:31 geraint ## Statically declare outputs and initialise to zero. ## This is necessary to prevent spurious values from being output when no assignments are made (i.e. when "y(i) := 0 for all u" (Reduce:see NERO)). ## ## Revision 1.67 2002/04/09 12:04:21 geraint @@ -393,11 +396,11 @@ } # make_m make_cc() { # get octave version -case `$MATRIX --version | awk -F\. '{print $2}'` in +case `$MATRIX --version | gawk -F\. '{print $2}'` in 0) # stable vector_value=vector_value feval_header=toplev.h save_ascii_data_function=save_ascii_data ;; Index: mttroot/mtt/bin/trans/makesubs ================================================================== --- mttroot/mtt/bin/trans/makesubs +++ mttroot/mtt/bin/trans/makesubs @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.2 2001/05/08 15:18:10 gawthrop +## Added trig and hyperbolic functions to argument exclusion list +## ## Revision 1.1 2000/12/28 09:09:52 peterg ## Initial revision ## ## ############################################################### @@ -47,18 +50,18 @@ % Ordering switch ORDER EOF # Symbolic params first -awk '{ +gawk '{ print $1 "," }' < $1_sympar.txt >> $1_subs.r # Then states Nx=`mtt_getsize $1 x` # States -awk 'END{ +gawk 'END{ for (k=1;k> $1_modpar.r done Index: mttroot/mtt/bin/trans/mtt2reps_txt ================================================================== --- mttroot/mtt/bin/trans/mtt2reps_txt +++ mttroot/mtt/bin/trans/mtt2reps_txt @@ -7,10 +7,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.12 2001/07/24 04:18:32 gawthrop +## Fixed problem with shell expanding * (used as important rep marker) +## ## Revision 1.11 2001/04/28 03:38:36 geraint ## Refined selection of matching patterns - checks for exact match. ## ## Revision 1.10 2000/09/14 07:54:13 peterg ## Removed -e option in echo @@ -49,22 +52,22 @@ ############################################################### sep='|'; # Separates the languages from the rest. ## List of all representations (deleting the *) -representations=`grep '#SUMMARY' $MTTPATH/mtt | awk '{sub("\*","+"); print $2'} | sort -u ` +representations=`grep '#SUMMARY' $MTTPATH/mtt | gawk '{sub("\*","+"); print $2'} | sort -u ` for rep in $representations ; do Rep=`echo $rep | tr '+' '*'` ## Title should be same for all languages -- but extract the first non-empty version title=`grep '#SUMMARY' $MTTPATH/mtt | tr '\t' ' ' | grep "[ *]$Rep[ *]" | \ - awk '{if (NF>2) {for (i=3;i2) {for (i=3;i1) printf("{* %s *}", $2) printf("\n") }' |\ sed "s/$space\[\($non_space\)\]$spaces=$spaces\($fun_name\)(\($args\))/\2(\1,\3)/" |\ sed "s/$space\[\($non_space\)\]$spaces=$spaces\($mttfun_name\)(\($args\))/\2(\1,\3)/" |\ @@ -445,11 +448,11 @@ sed "s/$space\[\($non_space\)\]$spaces=$spaces\($mttfun_name\)/\2(\1)/" |\ sed "s/$space\($non_space\)$spaces=${spaces}zeros(\([0-9]*\),1)/zero_state(\1,\2)/" |\ sed "s/$space\($non_space\)$spaces=$spaces\($fun_name\)(\($args\))/\2(\1,\3)/" |\ sed "s/,)/)/" |\ fix_operators |\ -awk ' +gawk ' function printvar(Name,N) { if (N<1) return; width = 10; kk = 0; for (k=1;k<=N;k++) { Index: mttroot/mtt/bin/trans/mtt_make_menu ================================================================== --- mttroot/mtt/bin/trans/mtt_make_menu +++ mttroot/mtt/bin/trans/mtt_make_menu @@ -75,11 +75,11 @@ for sys in $systems; do echo .sys.sys add radio -label "$sys" -command {set system "$sys"} done # Create the options menu -mtt | awk '{ +mtt | gawk '{ if (Options) { option=substr($1,2); label=""; for (i=2;i<=NF;i++) label = sprintf("%s %s",label,$i); Index: mttroot/mtt/bin/trans/mtt_make_sim ================================================================== --- mttroot/mtt/bin/trans/mtt_make_sim +++ mttroot/mtt/bin/trans/mtt_make_sim @@ -11,10 +11,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.7 2000/05/19 17:47:35 peterg +## Fixed bug in oct version but still needs proper check +## ## Revision 1.6 2000/05/17 17:20:49 peterg ## Fixed bugs with ny>1. Could be made faster by not generating y when ## y_sim >1 ## ## Revision 1.5 2000/05/17 16:01:42 peterg @@ -59,11 +62,11 @@ # Find system constants Nx=`mtt_getsize $Sys x` # States Nu=`mtt_getsize $Sys u` # Inputs Ny=`mtt_getsize $Sys y` # Inputs -Npar=`wc -l $Sys\_sympar.txt | awk '{print $1}'` +Npar=`wc -l $Sys\_sympar.txt | gawk '{print $1}'` # Header lang_header -noglobals $1 sim m 'x0,u,t,par,sensitivities' '[y,ys]' > $1_sim.m cat >> $1_sim.m < mtt_all_sympar.txt # Sort the aliased list mtt_strip_args < $1_aliased.txt | sort -u > mtt_aliased_sort.txt @@ -65,14 +68,14 @@ sort -u mtt_unwanted.txt > mtt_unwanted_sort.txt # Compare it with the aliased list and show the differences diff mtt_all_sympar.txt mtt_unwanted_sort.txt |\ -awk '{if ($1=="<") printf("%s\t%s\n", $2,$3)}' > mtt_sympar.txt +gawk '{if ($1=="<") printf("%s\t%s\n", $2,$3)}' > mtt_sympar.txt # Assume same name in different system is the same -awk '{ +gawk '{ if ($1==name){ sysname[i++]=$2 } if ($1!=name){ @@ -101,16 +104,16 @@ }' < mtt_sympar.txt >$filename reserved_words=`\ cat ${MTT_LIB}/reduce/reserved_words.txt |\ - awk '{printf "%s ", $0}' |\ + gawk '{printf "%s ", $0}' |\ tr [a-z] [A-Z]` sympar_words=`\ cat ${filename} |\ cut -f1 |\ - awk '{printf "%s ", $0}' |\ + gawk '{printf "%s ", $0}' |\ tr [a-z] [A-Z]` flag=0 for reserved_word in ${reserved_words}; do for sympar_word in ${sympar_words}; do if [ ${sympar_word} = ${reserved_word} ]; then Index: mttroot/mtt/bin/trans/mtt_mend_lines ================================================================== --- mttroot/mtt/bin/trans/mtt_mend_lines +++ mttroot/mtt/bin/trans/mtt_mend_lines @@ -4,11 +4,11 @@ # Fixes broken lines from reduce. #sed 's/[^#]\(.*\)[^;]$/\1\\/' -awk '{ +gawk '{ if ((match($1,"#")==0)&&(match($1,"global")==0)&&(match($1,"endfunction")==0)) { if(match($0,";")!=length($0)) printf("%s \\\n",$0) else print $0 Index: mttroot/mtt/bin/trans/mtt_multi ================================================================== --- mttroot/mtt/bin/trans/mtt_multi +++ mttroot/mtt/bin/trans/mtt_multi @@ -6,17 +6,17 @@ system=$2 rep=$3 lang=$4 relative_level=$5 -current_level=`echo $system | awk '{N=split($1,foo,"_"); print N-1}'` +current_level=`echo $system | gawk '{N=split($1,foo,"_"); print N-1}'` if [ -z "$relative_level" ]; then relative_level=0; fi mtt_xargs.sh "ls" "$2*_$3.$4" |\ -awk '{ +gawk '{ level=split($1,foo,"_")-2; maxlevel = current_level + relative_level; if (level<=maxlevel) print command, $0, "&"; '} command=$command relative_level=$relative_level current_level=$current_level Index: mttroot/mtt/bin/trans/mtt_name2array ================================================================== --- mttroot/mtt/bin/trans/mtt_name2array +++ mttroot/mtt/bin/trans/mtt_name2array @@ -15,38 +15,38 @@ name=mttpar cat $1_sympar.txt>mtt_infile ;; state) name=mttx - awk '{if ($1==rep) printf("%s\n", $4)}' rep=$2 \ + gawk '{if ($1==rep) printf("%s\n", $4)}' rep=$2 \ <$1_struc.txt >mtt_infile ;; input) name=mttu - awk '{if ($1==rep) printf("%s\n", $4)}' rep=$2 \ + gawk '{if ($1==rep) printf("%s\n", $4)}' rep=$2 \ <$1_struc.txt >mtt_infile ;; *) echo Repesentation $2 not supported esac case $3 in zero) strip_comments $1_$2.pas echo "TYPE" >>$1_$2.pas echo " StateVector = ARRAY[1..$Nx] OF REAL;" >>$1_$2.pas @@ -38,28 +38,28 @@ echo " ParameterVector = ARRAY[1..$Npar] OF REAL;" >>$1_$2.pas # Create the predefined vars echo "VAR" >>$1_$2.pas -awk '{ +gawk '{ printf("%s,", $1) } END{print "JUNK : REAL;"}'< $1_sympar.txt >>$1_$2.pas if [ "$2" = "ode2odes" ]; then first='PROCEDURE' - awk ' + gawk ' { if (writing) print $0; if (i++==0) writing=1 if (match($1,"PROCEDURE")==1) writing=0; }' < $1_$2.p >>$1_$2.pas else first='BEGIN' # Convert VAR format in the headings - awk 'BEGIN{writing=1} + gawk 'BEGIN{writing=1} { if (match($1,"BEGIN")==1) writing=0; if (writing) print $0; }' < $1_$2.p | \ sed \ @@ -70,30 +70,30 @@ -e 's/ParameterVector);/ParameterVector;/' \ >>$1_$2.pas fi # Write out the actual code until the begining of the procedure -awk 'BEGIN{writing=0} +gawk 'BEGIN{writing=0} { if (match($1,first)==1) writing=1; if (writing) print $0; if (match($1,begin)==1) writing=0; }' begin=$begin first=$first < $1_$2.p >>$1_$2.pas # Write out the parameters echo {Parameters} >>$1_$2.pas -awk '{ +gawk '{ printf(" %s \t:= mttpar[%i];\n", $1, ++i); }'< $1_sympar.txt >>$1_$2.pas # Write out the actual code from the end of the procedure -awk 'BEGIN{writing=0} +gawk 'BEGIN{writing=0} { if (writing) print $0; if (match($1,begin)==1) writing=1; }' begin=$begin < $1_$2.p >>$1_$2.pas #echo "Creating $1_$2.C" p2c -o $1_$2.C $1_$2.pas > mtt_p2C.log 2>> mtt_p2C.log Index: mttroot/mtt/bin/trans/mtt_p2cc ================================================================== --- mttroot/mtt/bin/trans/mtt_p2cc +++ mttroot/mtt/bin/trans/mtt_p2cc @@ -72,11 +72,11 @@ grep typedef $sys_rep.C >> $sys_rep.cc #Extract the rep code converting [] to () and deleting mtt variables etc #The awk part detects the begin and end of the relevant code. echo "/* Representation $rep information */" >> $sys_rep.cc -awk '{ +gawk '{ if ( (match($1,"}")==1)&&(NF>1)) writing=0; if ( (writing) && !(match($2,"mtt[a-z]")==1) ) print $0; if (match($1,"{")==1) writing=1; }' <$sys_rep.C |\ sed 's/\[\([a-z0-9_]*\)\]\[\([a-z0-9_]*\)\]/(\1,\2)/g' |\ Index: mttroot/mtt/bin/trans/mtt_p2m ================================================================== --- mttroot/mtt/bin/trans/mtt_p2m +++ mttroot/mtt/bin/trans/mtt_p2m @@ -7,11 +7,11 @@ sed 's/end;$/;/' |\ sed 's/\[\([0-9,]*\)\]/(\1)/g' |\ sed 's/:=/ = /' |\ sed 's/\*\*/\^/g' |\ sed 's/mtt\([a-z]\)\([a-z]*\)\([0-9]\)\([0-9]*\)/mtt\1\2(\3\4)/g' |\ -awk '{ +gawk '{ sub(/^[\ ]*/, "", $0) sub(/\$$/, ";", $0) if (match($NF,"[;#.%]$")==0){ Previous[++i] = $0 Index: mttroot/mtt/bin/trans/mtt_pinclude ================================================================== --- mttroot/mtt/bin/trans/mtt_pinclude +++ mttroot/mtt/bin/trans/mtt_pinclude @@ -4,15 +4,18 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.1 2000/12/28 11:56:46 peterg +## Put under RCS +## ############################################################### -awk ' { +gawk ' { if ( (match($1,"{\\$I")>0) || (match($1,"\\*\\$I")>0) ) { sub(/}/,"",$2); command=sprintf("mtt_pinclude %s",$2); system(command) } Index: mttroot/mtt/bin/trans/mtt_repname ================================================================== --- mttroot/mtt/bin/trans/mtt_repname +++ mttroot/mtt/bin/trans/mtt_repname @@ -9,6 +9,6 @@ # Returns the representation name from System_rep.lang # P.J.Gawthrop Feb 2000 # Copyright (C) 2000 by Peter J. Gawthrop -echo $1 | tr '.' '_' | awk -F '_' '{print $2}' +echo $1 | tr '.' '_' | gawk -F '_' '{print $2}' Index: mttroot/mtt/bin/trans/mtt_strip_args ================================================================== --- mttroot/mtt/bin/trans/mtt_strip_args +++ mttroot/mtt/bin/trans/mtt_strip_args @@ -9,10 +9,13 @@ # Label file to symbolic parameters conversion # Copyright (C) 2000 by Peter J. Gawthrop ## $Id$ ## ## $Log$ +## Revision 1.6 2001/07/04 06:00:12 gawthrop +## Fixed a funny with tr - changed SEPS and REPS - something to do with ^ +## ## Revision 1.5 2001/06/13 14:50:13 gawthrop ## Operator ^ now ok in args in abg and/or lbl ## ## Revision 1.4 2001/05/08 15:18:10 gawthrop ## Added trig and hyperbolic functions to argument exclusion list @@ -35,11 +38,11 @@ REPS='[,*]' # This is the main transformation using gawk tr $SEPS $REPS | \ -awk ' +gawk ' function exact_match(name1, name2) { return ((match(name1,name2)>0)&&(length(name1)==length(name2))) } function matches(names, name) { Index: mttroot/mtt/bin/trans/mtt_sysname ================================================================== --- mttroot/mtt/bin/trans/mtt_sysname +++ mttroot/mtt/bin/trans/mtt_sysname @@ -9,6 +9,6 @@ # Returns the system name from System_rep.lang # P.J.Gawthrop Feb 2000 # Copyright (C) 2000 by Peter J. Gawthrop -echo $1 | awk -F '_' '{print $1}' +echo $1 | gawk -F '_' '{print $1}' Index: mttroot/mtt/bin/trans/mtt_txt2declare ================================================================== --- mttroot/mtt/bin/trans/mtt_txt2declare +++ mttroot/mtt/bin/trans/mtt_txt2declare @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.2 2000/10/14 09:32:50 peterg +## struc version only does state and input +## ## Revision 1.1 2000/10/14 09:26:48 peterg ## Initial revision ## ## Revision 1.1 2000/10/11 09:08:20 peterg ## Initial revision @@ -37,16 +40,16 @@ echo Language $language not supported - sorry; exit 1 esac case $what in struc) - strip_comments < $sys"_"$what".txt" | awk '{if (($1=="state")||($1=="input")) + strip_comments < $sys"_"$what".txt" | gawk '{if (($1=="state")||($1=="input")) print $4; }' >mtt_names ;; sympar) - strip_comments < $sys"_"$what".txt" | awk '{print $1}' >mtt_names + strip_comments < $sys"_"$what".txt" | gawk '{print $1}' >mtt_names ;; *) echo Argument 2 must be struc or sympar esac @@ -53,11 +56,11 @@ # Start cat<> $outfile echo "## User defined code from $1_$2.txt" >> $outfile cat $1_$2.txt | strip_comments | grep -v METHOD |\ -awk -F# 'BEGIN{ +gawk -F# 'BEGIN{ quote = "\047"; doublequote = "\042"; } { N=split($1,a,"="); Index: mttroot/mtt/bin/trans/mtt_update ================================================================== --- mttroot/mtt/bin/trans/mtt_update +++ mttroot/mtt/bin/trans/mtt_update @@ -11,10 +11,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.16 2000/10/17 13:45:18 peterg +## split up state and input - different defaults +## ## Revision 1.15 2000/10/17 09:53:05 peterg ## More on logic rep ## ## Revision 1.14 2000/10/17 08:36:56 peterg ## Included logic rep. @@ -87,31 +90,31 @@ input) lang=txt textfile=$1_$2.$lang infofile=mtt_list.$lang moreinfofile=mtt_list_numpar.$lang - awk '{if ($1==rep) printf("%s\n", $4)}' rep=$2 \ + 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 - awk '{if ($1==rep) printf("%s\n", $4)}' rep=$2 \ + 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 - awk '{if ($3=="MTT_SWITCH") printf("%s_logic\n", $4)}' rep=$2 \ + 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' ;; *) @@ -127,11 +130,11 @@ echo Creating $textfile mtt_header $sys $rep $lang > $textfile info=`cut -f1 $infofile | sort` for new in $info; do echo $new $default |\ - awk '{printf("%s\t= %s; # Default\n",$1,$2)}' >> $textfile + gawk '{printf("%s\t= %s; # Default\n",$1,$2)}' >> $textfile done exit fi # Remove tmp files @@ -141,11 +144,11 @@ 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 -awk '{ +gawk '{ if (FILENAME=="mtt_text") { gsub("[\t ]" ,""); # Remove whitespace split($0,a,"="); text[a[1]] = a[2]; } @@ -168,25 +171,25 @@ 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 | awk '{printf("\t%s\n",$1)}' + sort mtt_in_text | gawk '{printf("\t%s\n",$1)}' echo Use mtt $sys $rep $lang to update fi if [ -f "mtt_in_info" ]; then echo "The following variables exist, but are not defined in $textfile:" - sort mtt_in_info | awk '{printf("\t%s\n",$1)}' + sort mtt_in_info | gawk '{printf("\t%s\n",$1)}' echo Use mtt $sys $rep $lang to update fi exit fi answered='' if [ -f "mtt_in_text" ]; then in_text=`sort mtt_in_text` echo "The following variables are defined in $textfile, but do not exist:" - sort mtt_in_text | awk '{printf("\t%s\n",$1)}' + sort mtt_in_text | gawk '{printf("\t%s\n",$1)}' while [ -z "$answered" ]; do echo "Update $textfile (y/n)?" read answer < /dev/tty @@ -210,11 +213,11 @@ fi answered='' if [ -f "mtt_in_info" ]; then echo "The following variables exist, but are not defined in $textfile:" - sort mtt_in_info | awk '{printf("\t%s\n",$1)}' + sort mtt_in_info | gawk '{printf("\t%s\n",$1)}' while [ -z "$answered" ]; do echo "Update $textfile (y/n)?" read answer < /dev/tty case $answer in @@ -222,11 +225,11 @@ answered=yes in_info=`sort mtt_in_info` for new in $in_info; do echo Adding $new echo $new $default |\ - awk '{printf("%s\t= %s; # Added by MTT on %s\n",$1,$2,strftime())}'\ + gawk '{printf("%s\t= %s; # Added by MTT on %s\n",$1,$2,strftime())}'\ >> $textfile changed=yes done ;; n) Index: mttroot/mtt/bin/trans/name2index ================================================================== --- mttroot/mtt/bin/trans/name2index +++ mttroot/mtt/bin/trans/name2index @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.5 2000/11/27 18:06:33 peterg +## *** empty log message *** +## ## Revision 1.4 1997/12/04 22:10:18 peterg ## Handles argument list - variable names. ## ## Revision 1.3 1997/05/22 09:42:48 peterg ## Returns 0 if no names. @@ -27,11 +30,11 @@ ## Revision 1.1 1997/05/22 08:48:21 peterg ## Initial revision ## ############################################################### -awk ' +gawk ' { name_index[$4]=$2; } END{ M=split(names,xynames,":"); Index: mttroot/mtt/bin/trans/numpar_txt2c ================================================================== --- mttroot/mtt/bin/trans/numpar_txt2c +++ mttroot/mtt/bin/trans/numpar_txt2c @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.6 2000/12/28 12:52:13 peterg +## *** empty log message *** +## ## Revision 1.5 1997/06/13 09:42:25 peterg ## Auto change of () to [] ## # Revision 1.4 1997/05/15 08:33:07 peterg # Declare state array (x). @@ -53,13 +56,13 @@ echo "$1_numpar()" >> $1_numpar.c echo '{' >> $1_numpar.c #Write out the variables in c format. sed 's/#C-CODE //'< $1_numpar.txt |\ -awk -F# '{ +gawk -F# '{ if (NF<2) print $1 if (NF>1) print $1 "/* " $2 " */" }' | sed 's/(\([0-9]*\))/[\1]/' >> $1_numpar.c echo '}' >> $1_numpar.c Index: mttroot/mtt/bin/trans/numpar_txt2m ================================================================== --- mttroot/mtt/bin/trans/numpar_txt2m +++ mttroot/mtt/bin/trans/numpar_txt2m @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.4 2000/12/28 12:52:22 peterg +## *** empty log message *** +## ## Revision 1.3 1998/07/25 18:26:33 peterg ## *** empty log message *** ## # Revision 1.2 1997/05/01 08:24:38 peterg # Now uses # as the comment symbol in the .txt file @@ -35,12 +38,12 @@ #echo >> $1_numpar.m #echo "# Global variable list" >> $1_numpar.m #sympar2global_txt2m $1 >> $1_numpar.m #Write out the variables in m format. -awk -F# '{ +gawk -F# '{ if (NF==1) print $1 if (NF==2) print $1 "# " $2 }' $1_numpar.txt |\ sed 's/double/global/' >> $1_numpar.m Index: mttroot/mtt/bin/trans/obs_r2m ================================================================== --- mttroot/mtt/bin/trans/obs_r2m +++ mttroot/mtt/bin/trans/obs_r2m @@ -16,11 +16,11 @@ rm -f obs_r2m.log rm -f $1_obs.m? rm -f $1_obsa.m # Is the system affine (look in the _obs.r file -affine=`grep 'affine :=' $1_obs.r | awk '{print $3}' | sed 's/;//'` +affine=`grep 'affine :=' $1_obs.r | gawk '{print $3}' | sed 's/;//'` # Use reduce to accomplish the transformation $SYMBOLIC >obs_r2m.log << EOF