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