lib/scripts/fixsome.pl
author kleing
Mon, 21 Jun 2004 10:25:57 +0200
changeset 14981 e73f8140af78
parent 9996 dede9cf1bd2a
permissions -rw-r--r--
Merged in license change from Isabelle2004

#
# $Id$
# Author: Markus Wenzel, TU Muenchen
#
# fixsome.pl - fix theorem names related to SOME (Eps) in HOL
#

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

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

    $_ = $text;

    s/select_equality/some_equality/g;
    s/select_eq_Ex/some_eq_ex/g;
    s/selectI2EX/someI2_ex/g;
    s/selectI2/someI2/g;
    s/selectI/someI/g;
    s/select1_equality/some1_equality/g;
    s/Eps_sym_eq/some_sym_eq_trivial/g;
    s/Eps_eq/some_eq_trivial/g;

    $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 { &fixsome($file); };
  if ($@) { print STDERR "*** fixsome $file: ", $@, "\n"; }
}