--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/Tools/fixclasimp Mon Nov 03 11:48:56 1997 +0100
@@ -0,0 +1,42 @@
+#!/bin/bash
+#
+# $Id$
+#
+# DESCRIPTION: fix references to implicit claset and simpset
+
+
+## diagnostics
+
+PRG=$(basename $0)
+
+function usage()
+{
+ echo
+ echo "Usage: $PRG [FILES|DIRS...]"
+ echo
+ echo " Recursively find .ML files, fixing references to"
+ echo " implicit claset and simpset:"
+ echo
+ echo " FIXME"
+ echo
+ echo " Renames old versions of FILES by appending \"~~\"."
+ echo
+ exit 1
+}
+
+
+## process command line
+
+[ $# -eq 0 -o "$1" = "-?" ] && usage
+
+SPECS="$@"; shift $#
+
+
+## main
+
+PERL=$(type -path perl)
+if [ -z $PERL ]; then
+ echo "$PRG fatal error: no perl!?"
+else
+ find $SPECS -name \*.ML -print | xargs $PERL $ISABELLE_HOME/lib/scripts/fixclasimp.pl
+fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/scripts/fixclasimp.pl Mon Nov 03 11:48:56 1997 +0100
@@ -0,0 +1,46 @@
+#
+# $Id$
+#
+# fixclasimp.pl - fix references to implicit claset and simpset
+#
+
+sub fixclasimp {
+ my ($file) = @_;
+
+ open (FILE, $file) || die $!;
+ undef $/; $text = <FILE>; $/ = "\n"; # slurp whole file
+ close FILE || die $!;
+
+ $_ = $text;
+
+ s/set_current_thy\s"([^"]*)"/context $1.thy/sg;
+
+ s/!\s*simpset/simpset()/sg;
+ s/simpset\s*:=/simpset_ref() :=/sg;
+ s/simpset_of\s*"([^"]*)"/simpset_of $1.thy/sg;
+
+ s/!\s*claset/claset()/sg;
+ s/claset\s*:=/claset_ref() :=/sg;
+ s/claset_of\s*"([^"]*)"/claset_of $1.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 { &fixclasimp($file); };
+ if ($@) { print STDERR "*** fixclasimp $file: ", $@, "\n"; }
+}