Changeset 12670


Ignore:
Timestamp:
07/20/12 12:07:00 (13 years ago)
Author:
jschierm
Message:

Modified Synchronize.sh to combine all enums for python into EnumDefinitions.py.

File:
1 edited

Legend:

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

    r12669 r12670  
    22#Synchronize EnumToStringx.cpp and StringToEnumx.cpp and matlab Enums
    33
    4 #Get all lines of EnumDefinitions2.h which hold Enum | remove all comas > put everything in file temp
     4#Get all lines of EnumDefinitions2.h which hold Enum | remove all commas > put everything in file temp
    55cat EnumDefinitions.h | grep -e "[0-9]Enum," -e "[a-zA-Z]Enum," | grep -v include | sed -e "s/,/ /g" | awk '{print $1}' > temp
    66
    77#Removed existing files
    88rm $ISSM_DIR/src/m/enum/*.m
     9rm $ISSM_DIR/src/m/enum/*.py
    910rm $ISSM_DIR/src/c/modules/EnumToStringx/EnumToStringx.cpp
    1011rm $ISSM_DIR/src/c/modules/StringToEnumx/StringToEnumx.cpp
     
    104105# go through the lines of temp
    105106ENUM=0;
     107#Add header to pythonenum file{{{
     108cat <<END > $ISSM_DIR/src/m/enum/EnumDefinitions.py
     109"""
     110
     111   WARNING: DO NOT MODIFY THIS FILE
     112            this file has been automatically generated by src/c/EnumDefinitions/Synchronize.sh
     113            Please read src/c/EnumDefinitions/README for more information
     114
     115"""
     116
     117END
     118
    106119for NAMEENUM in $(cat temp); do
    107120
     
    143156#}}}
    144157        #Add case to pythonenum file{{{
    145         cat <<END > $ISSM_DIR"/src/m/enum/"$(echo $NAMEENUM".py")
    146 """
    147 $(echo $NAMEENUM | awk {'print toupper($1)'}) - Enum of $(echo $NAME)
    148 
    149    WARNING: DO NOT MODIFY THIS FILE
    150             this file has been automatically generated by src/c/EnumDefinitions/Synchronize.sh
    151             Please read src/c/EnumDefinitions/README for more information
    152 
    153    Usage:
    154       macro=$NAMEENUM()
    155 """
    156 
     158        cat <<END >> $ISSM_DIR/src/m/enum/EnumDefinitions.py
    157159def $(echo $NAMEENUM)():
     160        """
     161        $(echo $NAMEENUM | awk {'print toupper($1)'}) - Enum of $(echo $NAME)
     162
     163           Usage:
     164              macro=$NAMEENUM()
     165        """
    158166
    159167        return StringToEnum('$NAME')
     168
    160169END
    161170#}}}
     
    180189#}}}
    181190#MaximumNumberOfEnums (python){{{
    182 cat <<END > $ISSM_DIR/src/m/enum/MaximumNumberOfEnums.py
    183 """
    184 $(echo "MaximumNumberOfEnums" | awk {'print toupper($1)'}) - Enum of MaximumNumberOfEnums
    185 
    186    WARNING: DO NOT MODIFY THIS FILE
    187             this file has been automatically generated by src/c/EnumDefinitions/Synchronize.sh
    188             Please read src/c/EnumDefinitions/README for more information
    189 
    190    Usage:
    191       macro=MaximumNumberOfEnums()
    192 """
    193 
     191cat <<END >> $ISSM_DIR/src/m/enum/EnumDefinitions.py
    194192def MaximumNumberOfEnums():
     193        """
     194        $(echo "MaximumNumberOfEnums" | awk {'print toupper($1)'}) - Enum of MaximumNumberOfEnums
     195
     196           Usage:
     197              macro=MaximumNumberOfEnums()
     198        """
    195199
    196200        return $(cat EnumDefinitions.h | grep -e "[0-9]Enum" -e "[a-zA-Z]Enum" | grep -v include \
    197201                | awk '{ printf "%s %s\n", NR-1, $0 }' \
    198202                | grep "MaximumNumberOfEnums" | awk '{print $1}')
     203
    199204END
    200205#}}}
Note: See TracChangeset for help on using the changeset viewer.