--- a/bin/isabelle Sat Oct 04 16:19:49 2008 +0200
+++ b/bin/isabelle Sat Oct 04 17:40:56 2008 +0200
@@ -3,23 +3,76 @@
# $Id$
# Author: Markus Wenzel, TU Muenchen
#
-# Smart selection of isabelle-process versus isabelle-interface.
+# Isabelle tool wrapper.
if [ -L "$0" ]; then
TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@"
fi
-THIS=$(cd "$(dirname "$0")"; pwd -P)
-NAME="$(basename "$0")"
+
+## settings
+
+PRG="$(basename "$0")"
+
+ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
+source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2
+
+
+## diagnostics
-case "$NAME" in
- I*)
- PRG=isabelle-interface
- ;;
- i*)
- PRG=isabelle-process
- ;;
-esac
+function usage()
+{
+ echo
+ echo "Usage: $PRG TOOL [ARGS ...]"
+ echo
+ echo " Start Isabelle utility program TOOL with ARGS. Pass \"-?\" to TOOL"
+ echo " for more specific help."
+ echo
+ echo " Available tools are:"
+ (
+ ORIG_IFS="$IFS"
+ IFS=":"
+ for DIR in $ISABELLE_TOOLS
+ do
+ cd "$DIR"
+ for T in *
+ do
+ if [ -f "$T" -a -x "$T" ]; then
+ DESCRLINE=$(fgrep DESCRIPTION: "$T" | sed -e 's/^.*DESCRIPTION: *//')
+ echo " $T - $DESCRLINE"
+ fi
+ done
+ done
+ IFS="$ORIG_IFS"
+ )
+ exit 1
+}
-exec "$THIS/$PRG" "$@"
+function fail()
+{
+ echo "$1" >&2
+ exit 2
+}
+
+
+## args
+
+[ "$#" -lt 1 -o "$1" = "-?" ] && usage
+
+TOOLNAME="$1"
+shift
+
+
+## main
+
+ORIG_IFS="$IFS"
+IFS=":"
+for DIR in $ISABELLE_TOOLS
+do
+ TOOL="$DIR/$TOOLNAME"
+ [ -f "$TOOL" -a -x "$TOOL" ] && exec "$TOOL" "$@"
+done
+IFS="$ORIG_IFS"
+
+fail "Unknown Isabelle tool: $TOOLNAME"