bin/isatool
author wenzelm
Sun Jun 10 21:06:59 2007 +0200 (2007-06-10)
changeset 23301 4c7e6d295980
parent 15967 f9163c6f69d6
permissions -rwxr-xr-x
disabled theories MIR and ReflectedFerrack for smlnj (temporarily);
wenzelm@10555
     1
#!/usr/bin/env bash
wenzelm@2293
     2
#
wenzelm@2307
     3
# $Id$
wenzelm@9786
     4
# Author: Markus Wenzel, TU Muenchen
wenzelm@2307
     5
#
wenzelm@15967
     6
# Isabelle tool starter.
wenzelm@2293
     7
wenzelm@15843
     8
if [ -L "$0" ]; then
wenzelm@15843
     9
  TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
wenzelm@15967
    10
  exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@"
wenzelm@15843
    11
fi
wenzelm@15843
    12
wenzelm@2293
    13
wenzelm@2293
    14
## settings
wenzelm@2293
    15
wenzelm@10511
    16
PRG="$(basename "$0")"
wenzelm@2703
    17
wenzelm@15967
    18
ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
wenzelm@15967
    19
source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2
wenzelm@2293
    20
wenzelm@2293
    21
wenzelm@2293
    22
## diagnostics
wenzelm@2293
    23
wenzelm@2293
    24
function usage()
wenzelm@2293
    25
{
wenzelm@2293
    26
  echo
wenzelm@2293
    27
  echo "Usage: $PRG TOOL [ARGS ...]"
wenzelm@2293
    28
  echo
wenzelm@2434
    29
  echo "  Start Isabelle utility program TOOL with ARGS. Pass \"-?\" to TOOL"
wenzelm@2787
    30
  echo "  for more specific help."
wenzelm@2293
    31
  echo
wenzelm@3276
    32
  echo "  Available tools are:"
wenzelm@2293
    33
  (
wenzelm@9786
    34
    ORIG_IFS="$IFS"
wenzelm@9786
    35
    IFS=":"
wenzelm@9786
    36
    for DIR in $ISABELLE_TOOLS
wenzelm@2293
    37
    do
wenzelm@9786
    38
      cd "$DIR"
wenzelm@2787
    39
      for T in *
wenzelm@2787
    40
      do
wenzelm@2787
    41
        if [ -f "$T" -a -x "$T" ]; then
wenzelm@11044
    42
          DESCRLINE=$(fgrep DESCRIPTION: "$T" | sed -e 's/^.*DESCRIPTION: *//')
wenzelm@2787
    43
          echo "    $T - $DESCRLINE"
wenzelm@2787
    44
        fi
wenzelm@2787
    45
      done
wenzelm@2293
    46
    done
wenzelm@9786
    47
    IFS="$ORIG_IFS"
wenzelm@2293
    48
  )
wenzelm@2293
    49
  exit 1
wenzelm@2293
    50
}
wenzelm@2293
    51
wenzelm@2293
    52
function fail()
wenzelm@2293
    53
{
wenzelm@2344
    54
  echo "$1" >&2
wenzelm@2293
    55
  exit 2
wenzelm@2293
    56
}
wenzelm@2293
    57
wenzelm@2293
    58
wenzelm@2787
    59
## args
wenzelm@2293
    60
wenzelm@9786
    61
[ "$#" -lt 1 -o "$1" = "-?" ] && usage
wenzelm@2293
    62
wenzelm@2787
    63
TOOLNAME="$1"
wenzelm@2293
    64
shift
wenzelm@2293
    65
wenzelm@2787
    66
wenzelm@2787
    67
## main
wenzelm@2293
    68
wenzelm@9786
    69
ORIG_IFS="$IFS"
wenzelm@9786
    70
IFS=":"
wenzelm@9786
    71
for DIR in $ISABELLE_TOOLS
wenzelm@2787
    72
do
wenzelm@9786
    73
  TOOL="$DIR/$TOOLNAME"
wenzelm@2787
    74
  [ -f "$TOOL" -a -x "$TOOL" ] && exec "$TOOL" "$@"
wenzelm@2787
    75
done
wenzelm@9786
    76
IFS="$ORIG_IFS"
wenzelm@2787
    77
wenzelm@7971
    78
fail "Unknown Isabelle tool: $TOOLNAME"