4268
|
1 |
#
|
|
2 |
# $Id$
|
9789
|
3 |
# Author: Markus Wenzel, TU Muenchen
|
|
4 |
# License: GPL (GNU GENERAL PUBLIC LICENSE)
|
4268
|
5 |
#
|
|
6 |
# fixseq.pl - fix references to obsolete Pure/Sequence structure
|
|
7 |
#
|
|
8 |
|
|
9 |
sub fixseq {
|
|
10 |
my ($file) = @_;
|
|
11 |
|
|
12 |
open (FILE, $file) || die $!;
|
|
13 |
undef $/; $text = <FILE>; $/ = "\n"; # slurp whole file
|
|
14 |
close FILE || die $!;
|
|
15 |
|
|
16 |
$_ = $text;
|
|
17 |
|
|
18 |
|
|
19 |
s/Sequence\.tl/Seq.tl/sg;
|
|
20 |
s/Sequence\.single/Seq.single/sg;
|
|
21 |
s/Sequence\.seqof/Seq.make/sg;
|
|
22 |
s/Sequence\.seq/Seq.seq/sg;
|
|
23 |
s/Sequence\.s_of_list/Seq.of_list/sg;
|
|
24 |
s/Sequence\.pull/Seq.pull/sg;
|
|
25 |
s/Sequence\.prints/Seq.print/sg;
|
|
26 |
s/Sequence\.null/Seq.empty/sg;
|
|
27 |
s/Sequence\.maps/Seq.map/sg;
|
|
28 |
s/Sequence\.mapp/Seq.mapp/sg;
|
|
29 |
s/Sequence\.list_of_s/Seq.list_of/sg;
|
|
30 |
s/Sequence\.its_right/Seq.it_right/sg;
|
|
31 |
s/Sequence\.interleave/Seq.interleave/sg;
|
|
32 |
s/Sequence\.hd/Seq.hd/sg;
|
|
33 |
s/Sequence\.flats/Seq.flat/sg;
|
|
34 |
s/Sequence\.filters/Seq.filter/sg;
|
|
35 |
s/Sequence\.cons/Seq.cons/sg;
|
|
36 |
s/Sequence\.chop/Seq.chop/sg;
|
|
37 |
s/Sequence\.append/Seq.append/sg;
|
|
38 |
|
|
39 |
|
|
40 |
$result = $_;
|
|
41 |
|
|
42 |
if ($text ne $result) {
|
|
43 |
print STDERR "fixing $file\n";
|
|
44 |
if (! -f "$file~~") {
|
|
45 |
rename $file, "$file~~" || die $!;
|
|
46 |
}
|
|
47 |
open (FILE, "> $file") || die $!;
|
|
48 |
print FILE $result;
|
|
49 |
close FILE || die $!;
|
|
50 |
}
|
|
51 |
}
|
|
52 |
|
|
53 |
|
|
54 |
## main
|
|
55 |
|
|
56 |
foreach $file (@ARGV) {
|
|
57 |
eval { &fixseq($file); };
|
|
58 |
if ($@) { print STDERR "*** fixseq $file: ", $@, "\n"; }
|
|
59 |
}
|