--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/Tools/fixgoal Thu Jun 18 10:48:21 1998 +0200
@@ -0,0 +1,35 @@
+#!/bin/bash
+#
+# $Id$
+#
+# DESCRIPTION: replace goal(w) commands by implicit versions Goal(w)
+
+
+## diagnostics
+
+PRG=$(basename $0)
+
+function usage()
+{
+ echo
+ echo "Usage: $PRG [FILES|DIRS...]"
+ echo
+ echo " Recursively find .ML files, replacing goal(w)"
+ echo " commands by implicit versions Goal(w)"
+ echo
+ echo " Renames old versions of FILES by appending \"~~\"."
+ echo
+ exit 1
+}
+
+
+## process command line
+
+[ $# -eq 0 -o "$1" = "-?" ] && usage
+
+SPECS="$@"; shift $#
+
+
+## main
+
+find $SPECS -name \*.ML -print | xargs perl -w $ISABELLE_HOME/lib/scripts/fixgoal.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/scripts/fixgoal.pl Thu Jun 18 10:48:21 1998 +0200
@@ -0,0 +1,44 @@
+#
+# $Id$
+#
+# fixgoal.pl - replace goal(w) commands by implicit versions Goal(w)
+#
+
+sub fixgoal {
+ my ($file) = @_;
+
+ open (FILE, $file) || die $!;
+ undef $/; $text = <FILE>; $/ = "\n"; # slurp whole file
+ close FILE || die $!;
+
+ $thy = "";
+ ($path, $thy, $ext) = ($file =~ m,^(.*/)?(\w+)(\.\w+)?$,);
+
+ $_ = $text;
+
+ s/^\s*goalw\b\s*\bthy\b/Goalw/mg;
+ s/^\s*goalw\b\s*\b$thy\.thy\b/Goalw/mg;
+ s/^\s*goal\b\s*\bthy\b/Goal/mg;
+ s/^\s*goal\b\s*\b$thy\.thy\b/Goal/mg;
+
+
+ $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 { &fixgoal($file); };
+ if ($@) { print STDERR "*** fixgoal $file: ", $@, "\n"; }
+}