adapt theories and ML files to new CPure/Pure arrangement;
authorwenzelm
Thu, 21 Apr 2005 22:10:12 +0200
changeset 15805 1e8017f1e971
parent 15804 3a55e6e26c8a
child 15806 8941300da5a6
adapt theories and ML files to new CPure/Pure arrangement;
lib/scripts/fixcpure.pl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/scripts/fixcpure.pl	Thu Apr 21 22:10:12 2005 +0200
@@ -0,0 +1,40 @@
+#
+# $Id$
+# Author: Makarius
+#
+# fixcpure.pl - adapt theories and ML files to new CPure/Pure arrangement
+#
+
+sub fixcpure {
+    my ($file) = @_;
+
+    open (FILE, $file) || die $!;
+    undef $/; $text = <FILE>; $/ = "\n";         # slurp whole file
+    close FILE || die $!;
+
+    $_ = $text;
+
+    s/\bCPure\.thy\b/-THE-CPURE-THEORY-/sg;
+    s/\bCPure\.([A-Za-z])/Pure.$1/sg;
+    s/-THE-CPURE-THEORY-/CPure.thy/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 { &fixcpure($file); };
+  if ($@) { print STDERR "*** fixcpure $file: ", $@, "\n"; }
+}