tools/lemon-0.x-to-1.x.sh
author Peter Kovacs <kpeter@inf.elte.hu>
Tue, 28 Oct 2008 21:35:06 +0100
changeset 356 236b1902e5cc
parent 355 956a29f30887
child 371 0eec1736ff1d
child 377 a12eef1f82b2
permissions -rwxr-xr-x
More improvement in the migration script

- Rename (U)GRAPH_TYPEDEFS.
- Rename "directed graph" to "digraph".
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@335
     6
    echo "Usage:"
kpeter@335
     7
    echo "  $0 source-file(s)"
kpeter@335
     8
    exit
alpar@305
     9
fi
alpar@305
    10
kpeter@335
    11
for i in $@
kpeter@335
    12
do
kpeter@335
    13
    echo Update $i...
kpeter@335
    14
    TMP=`mktemp`
kpeter@356
    15
    sed -e "s/\<undirected graph\>/_gr_aph_label_/g"\
kpeter@356
    16
        -e "s/\<undirected graphs\>/_gr_aph_label_s/g"\
kpeter@356
    17
        -e "s/\<undirected edge\>/_ed_ge_label_/g"\
kpeter@356
    18
        -e "s/\<undirected edges\>/_ed_ge_label_s/g"\
kpeter@356
    19
        -e "s/\<directed graph\>/_digr_aph_label_/g"\
kpeter@356
    20
        -e "s/\<directed graphs\>/_digr_aph_label_s/g"\
kpeter@356
    21
        -e "s/\<directed edge\>/_ar_c_label_/g"\
kpeter@356
    22
        -e "s/\<directed edges\>/_ar_c_label_s/g"\
kpeter@335
    23
        -e "s/UGraph/_Gr_aph_label_/g"\
kpeter@355
    24
        -e "s/u[Gg]raph/_gr_aph_label_/g"\
kpeter@355
    25
        -e "s/\<Graph\>/_Digr_aph_label_/g"\
kpeter@355
    26
        -e "s/\<graph\>/_digr_aph_label_/g"\
kpeter@355
    27
        -e "s/\<Graphs\>/_Digr_aph_label_s/g"\
kpeter@355
    28
        -e "s/\<graphs\>/_digr_aph_label_s/g"\
kpeter@355
    29
        -e "s/_Graph/__Gr_aph_label_/g"\
kpeter@355
    30
        -e "s/\([Gg]\)raph\([a-z_]\)/_\1r_aph_label_\2/g"\
kpeter@355
    31
        -e "s/\([a-z_]\)graph/\1_gr_aph_label_/g"\
kpeter@335
    32
        -e "s/Graph/_Digr_aph_label_/g"\
kpeter@335
    33
        -e "s/graph/_digr_aph_label_/g"\
kpeter@335
    34
        -e "s/UEdge/_Ed_ge_label_/g"\
kpeter@355
    35
        -e "s/u[Ee]dge/_ed_ge_label_/g"\
kpeter@335
    36
        -e "s/IncEdgeIt/_In_cEd_geIt_label_/g"\
kpeter@355
    37
        -e "s/\<Edge\>/_Ar_c_label_/g"\
kpeter@355
    38
        -e "s/\<edge\>/_ar_c_label_/g"\
kpeter@355
    39
        -e "s/\<Edges\>/_Ar_c_label_s/g"\
kpeter@355
    40
        -e "s/\<edges\>/_ar_c_label_s/g"\
kpeter@355
    41
        -e "s/_Edge/__Ed_ge_label_/g"\
kpeter@355
    42
        -e "s/Edge\([a-z_]\)/_Ed_ge_label_\1/g"\
kpeter@355
    43
        -e "s/edge\([a-z_]\)/_ed_ge_label_\1/g"\
kpeter@355
    44
        -e "s/\([a-z_]\)edge/\1_ed_ge_label_/g"\
kpeter@335
    45
        -e "s/Edge/_Ar_c_label_/g"\
kpeter@335
    46
        -e "s/edge/_ar_c_label_/g"\
kpeter@355
    47
        -e "s/A[Nn]ode/_Re_d_label_/g"\
kpeter@355
    48
        -e "s/B[Nn]ode/_Blu_e_label_/g"\
kpeter@355
    49
        -e "s/A-[Nn]ode/_Re_d_label_/g"\
kpeter@355
    50
        -e "s/B-[Nn]ode/_Blu_e_label_/g"\
kpeter@355
    51
        -e "s/a[Nn]ode/_re_d_label_/g"\
kpeter@355
    52
        -e "s/b[Nn]ode/_blu_e_label_/g"\
kpeter@356
    53
        -e "s/\<UGRAPH_TYPEDEFS\([ \t]*([ \t]*\)typename[ \t]/TEMPLATE__GR_APH_TY_PEDE_FS_label_\1/g"\
kpeter@356
    54
        -e "s/\<GRAPH_TYPEDEFS\([ \t]*([ \t]*\)typename[ \t]/TEMPLATE__DIGR_APH_TY_PEDE_FS_label_\1/g"\
kpeter@356
    55
        -e "s/\<UGRAPH_TYPEDEFS\>/_GR_APH_TY_PEDE_FS_label_/g"\
kpeter@356
    56
        -e "s/\<GRAPH_TYPEDEFS\>/_DIGR_APH_TY_PEDE_FS_label_/g"\
kpeter@335
    57
        -e "s/_Digr_aph_label_/Digraph/g"\
kpeter@335
    58
        -e "s/_digr_aph_label_/digraph/g"\
kpeter@335
    59
        -e "s/_Gr_aph_label_/Graph/g"\
kpeter@335
    60
        -e "s/_gr_aph_label_/graph/g"\
kpeter@335
    61
        -e "s/_Ar_c_label_/Arc/g"\
kpeter@335
    62
        -e "s/_ar_c_label_/arc/g"\
kpeter@335
    63
        -e "s/_Ed_ge_label_/Edge/g"\
kpeter@335
    64
        -e "s/_ed_ge_label_/edge/g"\
kpeter@335
    65
        -e "s/_In_cEd_geIt_label_/IncEdgeIt/g"\
kpeter@335
    66
        -e "s/_Re_d_label_/Red/g"\
kpeter@335
    67
        -e "s/_Blu_e_label_/Blue/g"\
kpeter@335
    68
        -e "s/_re_d_label_/red/g"\
kpeter@335
    69
        -e "s/_blu_e_label_/blue/g"\
kpeter@356
    70
        -e "s/_GR_APH_TY_PEDE_FS_label_/GRAPH_TYPEDEFS/g"\
kpeter@356
    71
        -e "s/_DIGR_APH_TY_PEDE_FS_label_/DIGRAPH_TYPEDEFS/g"\
kpeter@355
    72
        -e "s/DigraphToEps/GraphToEps/g"\
kpeter@355
    73
        -e "s/digraphToEps/graphToEps/g"\
kpeter@335
    74
        -e "s/\<DefPredMap\>/SetPredMap/g"\
kpeter@335
    75
        -e "s/\<DefDistMap\>/SetDistMap/g"\
kpeter@335
    76
        -e "s/\<DefReachedMap\>/SetReachedMap/g"\
kpeter@335
    77
        -e "s/\<DefProcessedMap\>/SetProcessedMap/g"\
kpeter@335
    78
        -e "s/\<DefHeap\>/SetHeap/g"\
kpeter@335
    79
        -e "s/\<DefStandardHeap\>/SetStandradHeap/g"\
kpeter@335
    80
        -e "s/\<DefOperationTraits\>/SetOperationTraits/g"\
kpeter@335
    81
        -e "s/\<DefProcessedMapToBeDefaultMap\>/SetStandardProcessedMap/g"\
kpeter@335
    82
        -e "s/\<copyGraph\>/graphCopy/g"\
kpeter@335
    83
        -e "s/\<copyDigraph\>/digraphCopy/g"\
kpeter@335
    84
        -e "s/\<IntegerMap\>/RangeMap/g"\
kpeter@335
    85
        -e "s/\<integerMap\>/rangeMap/g"\
kpeter@335
    86
        -e "s/\<\([sS]\)tdMap\>/\1parseMap/g"\
kpeter@335
    87
        -e "s/\<\([Ff]\)unctorMap\>/\1unctorToMap/g"\
kpeter@335
    88
        -e "s/\<\([Mm]\)apFunctor\>/\1apToFunctor/g"\
kpeter@335
    89
        -e "s/\<\([Ff]\)orkWriteMap\>/\1orkMap/g"\
kpeter@335
    90
        -e "s/\<StoreBoolMap\>/LoggerBoolMap/g"\
kpeter@335
    91
        -e "s/\<storeBoolMap\>/loggerBoolMap/g"\
kpeter@335
    92
        -e "s/\<BoundingBox\>/Box/g"\
kpeter@335
    93
    <$i > $TMP
kpeter@335
    94
    mv $TMP $i
kpeter@335
    95
done