Changeset 12262
- Timestamp:
- 05/17/12 10:00:11 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/EnumDefinitions/Synchronize.sh
r12261 r12262 2 2 #Synchronize EnumToStringx.cpp and StringToEnumx.cpp and matlab Enums 3 3 4 #Get all lines of EnumDefinitions2.h which hold Enum | remove all comas | add line number in the first column> put everything in file temp5 cat EnumDefinitions.h | grep -e "[0-9]Enum," -e "[a-zA-Z]Enum," | grep -v include | sed -e "s/,//g" | awk '{ printf "%s %s\n", NR, $0 }'> temp4 #Get all lines of EnumDefinitions2.h which hold Enum | remove all comas > put everything in file temp 5 cat EnumDefinitions.h | grep -e "[0-9]Enum," -e "[a-zA-Z]Enum," | grep -v include | sed -e "s/,//g" > temp 6 6 7 7 #Removed existing files … … 13 13 NUMENUMS=$(wc -l temp | awk '{printf("%s",$1);}'); 14 14 15 #Build EnumToStringx.cpp {{{ 115 #Build EnumToStringx.cpp {{{ 16 16 #Header 17 17 cat <<END > $ISSM_DIR/src/c/modules/EnumToStringx/EnumToStringx.cpp … … 35 35 END 36 36 #core 37 cat temp | awk '{print "\t\t" "case " $ 2" : return \"" substr($2,1,length($2)-4) "\";"}' >> $ISSM_DIR/src/c/modules/EnumToStringx/EnumToStringx.cpp37 cat temp | awk '{print "\t\t" "case " $1" : return \"" substr($1,1,length($1)-4) "\";"}' >> $ISSM_DIR/src/c/modules/EnumToStringx/EnumToStringx.cpp 38 38 #Footer 39 39 cat <<END >> $ISSM_DIR/src/c/modules/EnumToStringx/EnumToStringx.cpp … … 83 83 echo " if(stage==$i){" >> $ISSM_DIR//src/c/modules/StringToEnumx/StringToEnumx.cpp 84 84 awk -v i1=$i1 -v i2=$i2 '{if(NR>=i1 && NR<=i2) print $0 }' temp | 85 awk '{print "\t" ((NR==1)?" if":" else if") " (strcmp(name,\"" substr($ 2,1,length($2)-4) "\")==0) return " $2";"}' >> $ISSM_DIR//src/c/modules/StringToEnumx/StringToEnumx.cpp85 awk '{print "\t" ((NR==1)?" if":" else if") " (strcmp(name,\"" substr($1,1,length($1)-4) "\")==0) return " $1 ";"}' >> $ISSM_DIR//src/c/modules/StringToEnumx/StringToEnumx.cpp 86 86 echo " else stage=$(($i+1));" >> $ISSM_DIR//src/c/modules/StringToEnumx/StringToEnumx.cpp 87 87 echo " }" >> $ISSM_DIR//src/c/modules/StringToEnumx/StringToEnumx.cpp … … 104 104 105 105 #Get name and enum of the line i 106 NAMEENUM=$(cat temp | grep "^[ ]*$i " | awk '{printf("%s",$ 2);}');106 NAMEENUM=$(cat temp | grep "^[ ]*$i " | awk '{printf("%s",$1);}'); 107 107 NAME=$(echo $NAMEENUM | sed -e "s/Enum//g") 108 108 ENUM=$i; … … 156 156 157 157 macro=$(cat EnumDefinitions.h | grep -e "[0-9]Enum" -e "[a-zA-Z]Enum" | grep -v include \ 158 | awk '{ printf "%s %s\n", NR , $0 }' \158 | awk '{ printf "%s %s\n", NR-1, $0 }' \ 159 159 | grep "MaximumNumberOfEnums" | awk '{print $1}'); 160 160 END
Note:
See TracChangeset
for help on using the changeset viewer.