tools/lemon-0.x-to-1.x.sh
changeset 345 9c2a532aa5ef
parent 310 a9e8f310507f
child 355 956a29f30887
equal deleted inserted replaced
0:df386e57d366 1:ec1730b476cf
     1 #!/bin/bash
     1 #!/bin/bash
     2 
     2 
     3 set -e
     3 set -e
     4 
     4 
     5 if [ $# -eq 0 -o x$1 = "x-h" -o x$1 = "x-help" -o x$1 = "x--help" ]; then
     5 if [ $# -eq 0 -o x$1 = "x-h" -o x$1 = "x-help" -o x$1 = "x--help" ]; then
     6 	echo "Usage:"
     6     echo "Usage:"
     7 	echo "  $0 source-file"
     7     echo "  $0 source-file(s)"
     8 	exit
     8     exit
     9 fi
     9 fi
    10 
    10 
    11 TMP=`mktemp`
    11 for i in $@
    12 
    12 do
    13 sed	-e "s/undirected graph/_gr_aph_label_/g"\
    13     echo Update $i...
    14 	-e "s/undirected edge/_ed_ge_label_/g"\
    14     TMP=`mktemp`
    15 	-e "s/graph_/_gr_aph_label__/g"\
    15     sed -e "s/undirected graph/_gr_aph_label_/g"\
    16 	-e "s/_graph/__gr_aph_label_/g"\
    16         -e "s/undirected edge/_ed_ge_label_/g"\
    17 	-e "s/UGraph/_Gr_aph_label_/g"\
    17         -e "s/graph_/_gr_aph_label__/g"\
    18 	-e "s/uGraph/_gr_aph_label_/g"\
    18         -e "s/_graph/__gr_aph_label_/g"\
    19 	-e "s/ugraph/_gr_aph_label_/g"\
    19         -e "s/UGraph/_Gr_aph_label_/g"\
    20 	-e "s/Graph/_Digr_aph_label_/g"\
    20         -e "s/uGraph/_gr_aph_label_/g"\
    21 	-e "s/graph/_digr_aph_label_/g"\
    21         -e "s/ugraph/_gr_aph_label_/g"\
    22 	-e "s/UEdge/_Ed_ge_label_/g"\
    22         -e "s/Graph/_Digr_aph_label_/g"\
    23 	-e "s/uEdge/_ed_ge_label_/g"\
    23         -e "s/graph/_digr_aph_label_/g"\
    24 	-e "s/uedge/_ed_ge_label_/g"\
    24         -e "s/UEdge/_Ed_ge_label_/g"\
    25 	-e "s/IncEdgeIt/_In_cEd_geIt_label_/g"\
    25         -e "s/uEdge/_ed_ge_label_/g"\
    26 	-e "s/Edge/_Ar_c_label_/g"\
    26         -e "s/uedge/_ed_ge_label_/g"\
    27 	-e "s/edge/_ar_c_label_/g"\
    27         -e "s/IncEdgeIt/_In_cEd_geIt_label_/g"\
    28 	-e "s/ANode/_Re_d_label_/g"\
    28         -e "s/Edge/_Ar_c_label_/g"\
    29 	-e "s/BNode/_Blu_e_label_/g"\
    29         -e "s/edge/_ar_c_label_/g"\
    30 	-e "s/A-Node/_Re_d_label_/g"\
    30         -e "s/ANode/_Re_d_label_/g"\
    31 	-e "s/B-Node/_Blu_e_label_/g"\
    31         -e "s/BNode/_Blu_e_label_/g"\
    32 	-e "s/anode/_re_d_label_/g"\
    32         -e "s/A-Node/_Re_d_label_/g"\
    33 	-e "s/bnode/_blu_e_label_/g"\
    33         -e "s/B-Node/_Blu_e_label_/g"\
    34 	-e "s/aNode/_re_d_label_/g"\
    34         -e "s/anode/_re_d_label_/g"\
    35 	-e "s/bNode/_blu_e_label_/g"\
    35         -e "s/bnode/_blu_e_label_/g"\
    36 	-e "s/_Digr_aph_label_/Digraph/g"\
    36         -e "s/aNode/_re_d_label_/g"\
    37 	-e "s/_digr_aph_label_/digraph/g"\
    37         -e "s/bNode/_blu_e_label_/g"\
    38 	-e "s/_Gr_aph_label_/Graph/g"\
    38         -e "s/_Digr_aph_label_/Digraph/g"\
    39 	-e "s/_gr_aph_label_/graph/g"\
    39         -e "s/_digr_aph_label_/digraph/g"\
    40 	-e "s/_Ar_c_label_/Arc/g"\
    40         -e "s/_Gr_aph_label_/Graph/g"\
    41 	-e "s/_ar_c_label_/arc/g"\
    41         -e "s/_gr_aph_label_/graph/g"\
    42 	-e "s/_Ed_ge_label_/Edge/g"\
    42         -e "s/_Ar_c_label_/Arc/g"\
    43 	-e "s/_ed_ge_label_/edge/g"\
    43         -e "s/_ar_c_label_/arc/g"\
    44 	-e "s/_In_cEd_geIt_label_/IncEdgeIt/g"\
    44         -e "s/_Ed_ge_label_/Edge/g"\
    45 	-e "s/_Re_d_label_/Red/g"\
    45         -e "s/_ed_ge_label_/edge/g"\
    46 	-e "s/_Blu_e_label_/Blue/g"\
    46         -e "s/_In_cEd_geIt_label_/IncEdgeIt/g"\
    47 	-e "s/_re_d_label_/red/g"\
    47         -e "s/_Re_d_label_/Red/g"\
    48 	-e "s/_blu_e_label_/blue/g"\
    48         -e "s/_Blu_e_label_/Blue/g"\
    49 	-e "s/\(\W\)DefPredMap\(\W\)/\1SetPredMap\2/g"\
    49         -e "s/_re_d_label_/red/g"\
    50 	-e "s/\(\W\)DefPredMap$/\1SetPredMap/g"\
    50         -e "s/_blu_e_label_/blue/g"\
    51 	-e "s/^DefPredMap\(\W\)/SetPredMap\1/g"\
    51         -e "s/\<DefPredMap\>/SetPredMap/g"\
    52 	-e "s/^DefPredMap$/SetPredMap/g"\
    52         -e "s/\<DefDistMap\>/SetDistMap/g"\
    53 	-e "s/\(\W\)DefDistMap\(\W\)/\1SetDistMap\2/g"\
    53         -e "s/\<DefReachedMap\>/SetReachedMap/g"\
    54 	-e "s/\(\W\)DefDistMap$/\1SetDistMap/g"\
    54         -e "s/\<DefProcessedMap\>/SetProcessedMap/g"\
    55 	-e "s/^DefDistMap\(\W\)/SetDistMap\1/g"\
    55         -e "s/\<DefHeap\>/SetHeap/g"\
    56 	-e "s/^DefDistMap$/SetDistMap/g"\
    56         -e "s/\<DefStandardHeap\>/SetStandradHeap/g"\
    57 	-e "s/\(\W\)DefReachedMap\(\W\)/\1SetReachedMap\2/g"\
    57         -e "s/\<DefOperationTraits\>/SetOperationTraits/g"\
    58 	-e "s/\(\W\)DefReachedMap$/\1SetReachedMap/g"\
    58         -e "s/\<DefProcessedMapToBeDefaultMap\>/SetStandardProcessedMap/g"\
    59 	-e "s/^DefReachedMap\(\W\)/SetReachedMap\1/g"\
    59         -e "s/\<copyGraph\>/graphCopy/g"\
    60 	-e "s/^DefReachedMap$/SetReachedMap/g"\
    60         -e "s/\<copyDigraph\>/digraphCopy/g"\
    61 	-e "s/\(\W\)DefProcessedMap\(\W\)/\1SetProcessedMap\2/g"\
    61         -e "s/\<IntegerMap\>/RangeMap/g"\
    62 	-e "s/\(\W\)DefProcessedMap$/\1SetProcessedMap/g"\
    62         -e "s/\<integerMap\>/rangeMap/g"\
    63 	-e "s/^DefProcessedMap\(\W\)/SetProcessedMap\1/g"\
    63         -e "s/\<\([sS]\)tdMap\>/\1parseMap/g"\
    64 	-e "s/^DefProcessedMap$/SetProcessedMap/g"\
    64         -e "s/\<\([Ff]\)unctorMap\>/\1unctorToMap/g"\
    65 	-e "s/\(\W\)DefHeap\(\W\)/\1SetHeap\2/g"\
    65         -e "s/\<\([Mm]\)apFunctor\>/\1apToFunctor/g"\
    66 	-e "s/\(\W\)DefHeap$/\1SetHeap/g"\
    66         -e "s/\<\([Ff]\)orkWriteMap\>/\1orkMap/g"\
    67 	-e "s/^DefHeap\(\W\)/SetHeap\1/g"\
    67         -e "s/\<StoreBoolMap\>/LoggerBoolMap/g"\
    68 	-e "s/^DefHeap$/SetHeap/g"\
    68         -e "s/\<storeBoolMap\>/loggerBoolMap/g"\
    69 	-e "s/\(\W\)DefStandardHeap\(\W\)/\1SetStandradHeap\2/g"\
    69         -e "s/\<BoundingBox\>/Box/g"\
    70 	-e "s/\(\W\)DefStandardHeap$/\1SetStandradHeap/g"\
    70     <$i > $TMP
    71 	-e "s/^DefStandardHeap\(\W\)/SetStandradHeap\1/g"\
    71     mv $TMP $i
    72 	-e "s/^DefStandardHeap$/SetStandradHeap/g"\
    72 done
    73 	-e "s/\(\W\)DefOperationTraits\(\W\)/\1SetOperationTraits\2/g"\
       
    74 	-e "s/\(\W\)DefOperationTraits$/\1SetOperationTraits/g"\
       
    75 	-e "s/^DefOperationTraits\(\W\)/SetOperationTraits\1/g"\
       
    76 	-e "s/^DefOperationTraits$/SetOperationTraits/g"\
       
    77 	-e "s/\(\W\)DefProcessedMapToBeDefaultMap\(\W\)/\1SetStandardProcessedMap\2/g"\
       
    78 	-e "s/\(\W\)DefProcessedMapToBeDefaultMap$/\1SetStandardProcessedMap/g"\
       
    79 	-e "s/^DefProcessedMapToBeDefaultMap\(\W\)/SetStandardProcessedMap\1/g"\
       
    80 	-e "s/^DefProcessedMapToBeDefaultMap$/SetStandardProcessedMap/g"\
       
    81 	-e "s/\(\W\)IntegerMap\(\W\)/\1RangeMap\2/g"\
       
    82 	-e "s/\(\W\)IntegerMap$/\1RangeMap/g"\
       
    83 	-e "s/^IntegerMap\(\W\)/RangeMap\1/g"\
       
    84 	-e "s/^IntegerMap$/RangeMap/g"\
       
    85 	-e "s/\(\W\)integerMap\(\W\)/\1rangeMap\2/g"\
       
    86 	-e "s/\(\W\)integerMap$/\1rangeMap/g"\
       
    87 	-e "s/^integerMap\(\W\)/rangeMap\1/g"\
       
    88 	-e "s/^integerMap$/rangeMap/g"\
       
    89 	-e "s/\(\W\)copyGraph\(\W\)/\1graphCopy\2/g"\
       
    90 	-e "s/\(\W\)copyGraph$/\1graphCopy/g"\
       
    91 	-e "s/^copyGraph\(\W\)/graphCopy\1/g"\
       
    92 	-e "s/^copyGraph$/graphCopy/g"\
       
    93 	-e "s/\(\W\)copyDigraph\(\W\)/\1digraphCopy\2/g"\
       
    94 	-e "s/\(\W\)copyDigraph$/\1digraphCopy/g"\
       
    95 	-e "s/^copyDigraph\(\W\)/digraphCopy\1/g"\
       
    96 	-e "s/^copyDigraph$/digraphCopy/g"\
       
    97 	-e "s/\(\W\)\([sS]\)tdMap\(\W\)/\1\2parseMap\3/g"\
       
    98 	-e "s/\(\W\)\([sS]\)tdMap$/\1\2parseMap/g"\
       
    99 	-e "s/^\([sS]\)tdMap\(\W\)/\1parseMap\2/g"\
       
   100 	-e "s/^\([sS]\)tdMap$/\1parseMap/g"\
       
   101 	-e "s/\(\W\)\([Ff]\)unctorMap\(\W\)/\1\2unctorToMap\3/g"\
       
   102 	-e "s/\(\W\)\([Ff]\)unctorMap$/\1\2unctorToMap/g"\
       
   103 	-e "s/^\([Ff]\)unctorMap\(\W\)/\1unctorToMap\2/g"\
       
   104 	-e "s/^\([Ff]\)unctorMap$/\1unctorToMap/g"\
       
   105 	-e "s/\(\W\)\([Mm]\)apFunctor\(\W\)/\1\2apToFunctor\3/g"\
       
   106 	-e "s/\(\W\)\([Mm]\)apFunctor$/\1\2apToFunctor/g"\
       
   107 	-e "s/^\([Mm]\)apFunctor\(\W\)/\1apToFunctor\2/g"\
       
   108 	-e "s/^\([Mm]\)apFunctor$/\1apToFunctor/g"\
       
   109 	-e "s/\(\W\)\([Ff]\)orkWriteMap\(\W\)/\1\2orkMap\3/g"\
       
   110 	-e "s/\(\W\)\([Ff]\)orkWriteMap$/\1\2orkMap/g"\
       
   111 	-e "s/^\([Ff]\)orkWriteMap\(\W\)/\1orkMap\2/g"\
       
   112 	-e "s/^\([Ff]\)orkWriteMap$/\1orkMap/g"\
       
   113 	-e "s/\(\W\)StoreBoolMap\(\W\)/\1LoggerBoolMap\2/g"\
       
   114 	-e "s/\(\W\)StoreBoolMap$/\1LoggerBoolMap/g"\
       
   115 	-e "s/^StoreBoolMap\(\W\)/LoggerBoolMap\1/g"\
       
   116 	-e "s/^StoreBoolMap$/LoggerBoolMap/g"\
       
   117 	-e "s/\(\W\)storeBoolMap\(\W\)/\1loggerBoolMap\2/g"\
       
   118 	-e "s/\(\W\)storeBoolMap$/\1loggerBoolMap/g"\
       
   119 	-e "s/^storeBoolMap\(\W\)/loggerBoolMap\1/g"\
       
   120 	-e "s/^storeBoolMap$/loggerBoolMap/g"\
       
   121 	-e "s/\(\W\)BoundingBox\(\W\)/\1Box\2/g"\
       
   122 	-e "s/\(\W\)BoundingBox$/\1Box/g"\
       
   123 	-e "s/^BoundingBox\(\W\)/Box\1/g"\
       
   124 	-e "s/^BoundingBox$/Box/g"\
       
   125 <$1 > $TMP
       
   126 
       
   127 mv $TMP $1