tools/lemon-0.x-to-1.x.sh
author Peter Kovacs <kpeter@inf.elte.hu>
Sat, 18 Oct 2008 11:46:25 +0200
changeset 323 94b832d461f7
parent 310 a9e8f310507f
child 343 956a29f30887
permissions -rwxr-xr-x
Improve the 0.x->1.x converter script (ticket #157)

- Support updating more files at once.
- Much better regexp solution for "whole words only" replacements.
     1 #!/bin/bash
     2 
     3 set -e
     4 
     5 if [ $# -eq 0 -o x$1 = "x-h" -o x$1 = "x-help" -o x$1 = "x--help" ]; then
     6     echo "Usage:"
     7     echo "  $0 source-file(s)"
     8     exit
     9 fi
    10 
    11 for i in $@
    12 do
    13     echo Update $i...
    14     TMP=`mktemp`
    15     sed -e "s/undirected graph/_gr_aph_label_/g"\
    16         -e "s/undirected edge/_ed_ge_label_/g"\
    17         -e "s/graph_/_gr_aph_label__/g"\
    18         -e "s/_graph/__gr_aph_label_/g"\
    19         -e "s/UGraph/_Gr_aph_label_/g"\
    20         -e "s/uGraph/_gr_aph_label_/g"\
    21         -e "s/ugraph/_gr_aph_label_/g"\
    22         -e "s/Graph/_Digr_aph_label_/g"\
    23         -e "s/graph/_digr_aph_label_/g"\
    24         -e "s/UEdge/_Ed_ge_label_/g"\
    25         -e "s/uEdge/_ed_ge_label_/g"\
    26         -e "s/uedge/_ed_ge_label_/g"\
    27         -e "s/IncEdgeIt/_In_cEd_geIt_label_/g"\
    28         -e "s/Edge/_Ar_c_label_/g"\
    29         -e "s/edge/_ar_c_label_/g"\
    30         -e "s/ANode/_Re_d_label_/g"\
    31         -e "s/BNode/_Blu_e_label_/g"\
    32         -e "s/A-Node/_Re_d_label_/g"\
    33         -e "s/B-Node/_Blu_e_label_/g"\
    34         -e "s/anode/_re_d_label_/g"\
    35         -e "s/bnode/_blu_e_label_/g"\
    36         -e "s/aNode/_re_d_label_/g"\
    37         -e "s/bNode/_blu_e_label_/g"\
    38         -e "s/_Digr_aph_label_/Digraph/g"\
    39         -e "s/_digr_aph_label_/digraph/g"\
    40         -e "s/_Gr_aph_label_/Graph/g"\
    41         -e "s/_gr_aph_label_/graph/g"\
    42         -e "s/_Ar_c_label_/Arc/g"\
    43         -e "s/_ar_c_label_/arc/g"\
    44         -e "s/_Ed_ge_label_/Edge/g"\
    45         -e "s/_ed_ge_label_/edge/g"\
    46         -e "s/_In_cEd_geIt_label_/IncEdgeIt/g"\
    47         -e "s/_Re_d_label_/Red/g"\
    48         -e "s/_Blu_e_label_/Blue/g"\
    49         -e "s/_re_d_label_/red/g"\
    50         -e "s/_blu_e_label_/blue/g"\
    51         -e "s/\<DefPredMap\>/SetPredMap/g"\
    52         -e "s/\<DefDistMap\>/SetDistMap/g"\
    53         -e "s/\<DefReachedMap\>/SetReachedMap/g"\
    54         -e "s/\<DefProcessedMap\>/SetProcessedMap/g"\
    55         -e "s/\<DefHeap\>/SetHeap/g"\
    56         -e "s/\<DefStandardHeap\>/SetStandradHeap/g"\
    57         -e "s/\<DefOperationTraits\>/SetOperationTraits/g"\
    58         -e "s/\<DefProcessedMapToBeDefaultMap\>/SetStandardProcessedMap/g"\
    59         -e "s/\<copyGraph\>/graphCopy/g"\
    60         -e "s/\<copyDigraph\>/digraphCopy/g"\
    61         -e "s/\<IntegerMap\>/RangeMap/g"\
    62         -e "s/\<integerMap\>/rangeMap/g"\
    63         -e "s/\<\([sS]\)tdMap\>/\1parseMap/g"\
    64         -e "s/\<\([Ff]\)unctorMap\>/\1unctorToMap/g"\
    65         -e "s/\<\([Mm]\)apFunctor\>/\1apToFunctor/g"\
    66         -e "s/\<\([Ff]\)orkWriteMap\>/\1orkMap/g"\
    67         -e "s/\<StoreBoolMap\>/LoggerBoolMap/g"\
    68         -e "s/\<storeBoolMap\>/loggerBoolMap/g"\
    69         -e "s/\<BoundingBox\>/Box/g"\
    70     <$i > $TMP
    71     mv $TMP $i
    72 done