Changeset 1642


Ignore:
Timestamp:
08/11/09 11:53:16 (16 years ago)
Author:
Mathieu Morlighem
Message:

Added AnalysisTypeAsEnum.m function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/EnumDefinitions/SynchronizeMatlabEnum.sh

    r1296 r1642  
    77echo "Synchronizong with Matlab's Enums..."
    88cat EnumDefinitions.cpp | grep "return" | grep "int" | awk '{ printf "line%so %s\n", NR, $0 }' | sed -e "s/(void){//"  > temp
     9cat <<END > AnalysisTypeAsEnum.m
     10function string=AnalysisTypeAsEnum(enum)
     11%ANALYSISASENUM - get analysis type from Enum
     12%
     13%   file generated by src/c/SynchronizeMatlabEnum
     14%   to be synchronized with the corresponding C Enum
     15%   located in src/c/EnumDefinitions
     16%
     17%   Usage:
     18%      string=AnalysisTypeAsEnum(enum)
     19END
    920
    1021#get number of lines in temp
     
    2031
    2132        #write corresponding Matlab file
    22         cat <<END > `echo $NAME.m`
     33        cat <<END > $(echo $NAME.m)
    2334function macro=$(echo $NAME)()
    2435%$(echo `echo $NAME | sed -e "s/[a-z]/\U&/g"`) - Enum of $(echo `echo $NAME | sed -e "s/Enum//"`)
    2536%
     37%   file generated by src/c/SynchronizeMatlabEnum
    2638%   to be synchronized with the corresponding C Enum
    2739%   located in src/c/EnumDefinitions
    2840%
    2941%   Usage:
    30 %      macro=$(echo $NAME)()
     42%      macro=$NAME()
    3143
    32 macro=$(echo $ENUM)
     44macro=$ENUM
     45END
     46
     47        #update AnalysisTypeAsEnum
     48        cat <<END >> AnalysisTypeAsEnum.m
     49
     50if enum==$NAME(),
     51        string='$(echo `echo $NAME | sed -e "s/AnalysisEnum//g" | awk {'print tolower($_)'}`)';
     52end
    3353END
    3454
     
    3959
    4060#clean up
     61mv AnalysisTypeAsEnum.m $ISSM_DIR/src/m/shared/
    4162rm temp
Note: See TracChangeset for help on using the changeset viewer.