bin/isabelle
author wenzelm
Sat Oct 04 17:40:56 2008 +0200 (2008-10-04)
changeset 28504 7ad7d7d6df47
parent 15967 f9163c6f69d6
child 28506 3ab515ee4e6f
permissions -rwxr-xr-x
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm@10555
     1
#!/usr/bin/env bash
wenzelm@2292
     2
#
wenzelm@2308
     3
# $Id$
wenzelm@9786
     4
# Author: Markus Wenzel, TU Muenchen
wenzelm@2308
     5
#
wenzelm@28504
     6
# Isabelle tool wrapper.
wenzelm@2292
     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@28504
    13
wenzelm@28504
    14
## settings
wenzelm@28504
    15
wenzelm@28504
    16
PRG="$(basename "$0")"
wenzelm@28504
    17
wenzelm@28504
    18
ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
wenzelm@28504
    19
source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2
wenzelm@28504
    20
wenzelm@28504
    21
wenzelm@28504
    22
## diagnostics
wenzelm@2292
    23
wenzelm@28504
    24
function usage()
wenzelm@28504
    25
{
wenzelm@28504
    26
  echo
wenzelm@28504
    27
  echo "Usage: $PRG TOOL [ARGS ...]"
wenzelm@28504
    28
  echo
wenzelm@28504
    29
  echo "  Start Isabelle utility program TOOL with ARGS. Pass \"-?\" to TOOL"
wenzelm@28504
    30
  echo "  for more specific help."
wenzelm@28504
    31
  echo
wenzelm@28504
    32
  echo "  Available tools are:"
wenzelm@28504
    33
  (
wenzelm@28504
    34
    ORIG_IFS="$IFS"
wenzelm@28504
    35
    IFS=":"
wenzelm@28504
    36
    for DIR in $ISABELLE_TOOLS
wenzelm@28504
    37
    do
wenzelm@28504
    38
      cd "$DIR"
wenzelm@28504
    39
      for T in *
wenzelm@28504
    40
      do
wenzelm@28504
    41
        if [ -f "$T" -a -x "$T" ]; then
wenzelm@28504
    42
          DESCRLINE=$(fgrep DESCRIPTION: "$T" | sed -e 's/^.*DESCRIPTION: *//')
wenzelm@28504
    43
          echo "    $T - $DESCRLINE"
wenzelm@28504
    44
        fi
wenzelm@28504
    45
      done
wenzelm@28504
    46
    done
wenzelm@28504
    47
    IFS="$ORIG_IFS"
wenzelm@28504
    48
  )
wenzelm@28504
    49
  exit 1
wenzelm@28504
    50
}
wenzelm@9786
    51
wenzelm@28504
    52
function fail()
wenzelm@28504
    53
{
wenzelm@28504
    54
  echo "$1" >&2
wenzelm@28504
    55
  exit 2
wenzelm@28504
    56
}
wenzelm@28504
    57
wenzelm@28504
    58
wenzelm@28504
    59
## args
wenzelm@28504
    60
wenzelm@28504
    61
[ "$#" -lt 1 -o "$1" = "-?" ] && usage
wenzelm@28504
    62
wenzelm@28504
    63
TOOLNAME="$1"
wenzelm@28504
    64
shift
wenzelm@28504
    65
wenzelm@28504
    66
wenzelm@28504
    67
## main
wenzelm@28504
    68
wenzelm@28504
    69
ORIG_IFS="$IFS"
wenzelm@28504
    70
IFS=":"
wenzelm@28504
    71
for DIR in $ISABELLE_TOOLS
wenzelm@28504
    72
do
wenzelm@28504
    73
  TOOL="$DIR/$TOOLNAME"
wenzelm@28504
    74
  [ -f "$TOOL" -a -x "$TOOL" ] && exec "$TOOL" "$@"
wenzelm@28504
    75
done
wenzelm@28504
    76
IFS="$ORIG_IFS"
wenzelm@28504
    77
wenzelm@28504
    78
fail "Unknown Isabelle tool: $TOOLNAME"