lib/scripts/fixseq.pl
author wenzelm
Fri, 13 Mar 1998 18:15:14 +0100
changeset 4744 4469d498cd48
parent 4268 90779455c9a7
child 9789 7e5e6c47c0b5
permissions -rw-r--r--
moved addsplits [expand_if] from HOL_basic_ss to HOL_ss;

#
# $Id$
#
# fixseq.pl - fix references to obsolete Pure/Sequence structure
#

sub fixseq {
    my ($file) = @_;

    open (FILE, $file) || die $!;
    undef $/; $text = <FILE>; $/ = "\n";         # slurp whole file
    close FILE || die $!;

    $_ = $text;


    s/Sequence\.tl/Seq.tl/sg;
    s/Sequence\.single/Seq.single/sg;
    s/Sequence\.seqof/Seq.make/sg;
    s/Sequence\.seq/Seq.seq/sg;
    s/Sequence\.s_of_list/Seq.of_list/sg;
    s/Sequence\.pull/Seq.pull/sg;
    s/Sequence\.prints/Seq.print/sg;
    s/Sequence\.null/Seq.empty/sg;
    s/Sequence\.maps/Seq.map/sg;
    s/Sequence\.mapp/Seq.mapp/sg;
    s/Sequence\.list_of_s/Seq.list_of/sg;
    s/Sequence\.its_right/Seq.it_right/sg;
    s/Sequence\.interleave/Seq.interleave/sg;
    s/Sequence\.hd/Seq.hd/sg;
    s/Sequence\.flats/Seq.flat/sg;
    s/Sequence\.filters/Seq.filter/sg;
    s/Sequence\.cons/Seq.cons/sg;
    s/Sequence\.chop/Seq.chop/sg;
    s/Sequence\.append/Seq.append/sg;


    $result = $_;

    if ($text ne $result) {
	print STDERR "fixing $file\n";
        if (! -f "$file~~") {
	    rename $file, "$file~~" || die $!;
        }
	open (FILE, "> $file") || die $!;
	print FILE $result;
	close FILE || die $!;
    }
}


## main

foreach $file (@ARGV) {
  eval { &fixseq($file); };
  if ($@) { print STDERR "*** fixseq $file: ", $@, "\n"; }
}