Changeset 12262


Ignore:
Timestamp:
05/17/12 10:00:11 (13 years ago)
Author:
Mathieu Morlighem
Message:

Simplified Synchronize

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/EnumDefinitions/Synchronize.sh

    r12261 r12262  
    22#Synchronize EnumToStringx.cpp and StringToEnumx.cpp and matlab Enums
    33
    4 #Get all lines of EnumDefinitions2.h which hold Enum | remove all comas | add line number in the first column > 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" | awk '{ printf "%s %s\n", NR, $0 }' > temp
     4#Get all lines of EnumDefinitions2.h which hold Enum | remove all comas > put everything in file temp
     5cat EnumDefinitions.h | grep -e "[0-9]Enum," -e "[a-zA-Z]Enum," | grep -v include | sed -e "s/,//g" > temp
    66
    77#Removed existing files
     
    1313NUMENUMS=$(wc -l temp | awk '{printf("%s",$1);}');
    1414
    15 #Build EnumToStringx.cpp {{{1
     15#Build EnumToStringx.cpp {{{
    1616#Header
    1717cat <<END >  $ISSM_DIR/src/c/modules/EnumToStringx/EnumToStringx.cpp
     
    3535END
    3636#core
    37 cat temp |  awk '{print "\t\t" "case " $2" : return \"" substr($2,1,length($2)-4) "\";"}' >> $ISSM_DIR/src/c/modules/EnumToStringx/EnumToStringx.cpp
     37cat temp |  awk '{print "\t\t" "case " $1" : return \"" substr($1,1,length($1)-4) "\";"}' >> $ISSM_DIR/src/c/modules/EnumToStringx/EnumToStringx.cpp
    3838#Footer
    3939cat <<END >> $ISSM_DIR/src/c/modules/EnumToStringx/EnumToStringx.cpp
     
    8383        echo "   if(stage==$i){" >> $ISSM_DIR//src/c/modules/StringToEnumx/StringToEnumx.cpp
    8484        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.cpp
     85        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
    8686        echo "         else stage=$(($i+1));" >> $ISSM_DIR//src/c/modules/StringToEnumx/StringToEnumx.cpp
    8787        echo "   }" >> $ISSM_DIR//src/c/modules/StringToEnumx/StringToEnumx.cpp
     
    104104
    105105        #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);}');
    107107        NAME=$(echo $NAMEENUM | sed -e "s/Enum//g")
    108108        ENUM=$i;
     
    156156
    157157macro=$(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 }' \
    159159                | grep "MaximumNumberOfEnums" | awk '{print $1}');
    160160END
Note: See TracChangeset for help on using the changeset viewer.