bin/isabelle
author wenzelm
Wed Mar 23 20:51:36 2011 +0100 (2011-03-23)
changeset 42077 96c50a4210a2
parent 33915 44a10fe6bd10
child 42124 7519c7c33017
permissions -rwxr-xr-x
list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
exclude backup files;
wenzelm@10555
     1
#!/usr/bin/env bash
wenzelm@2292
     2
#
wenzelm@9786
     3
# Author: Markus Wenzel, TU Muenchen
wenzelm@2308
     4
#
wenzelm@28504
     5
# Isabelle tool wrapper.
wenzelm@2292
     6
wenzelm@15843
     7
if [ -L "$0" ]; then
wenzelm@15843
     8
  TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
wenzelm@15967
     9
  exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@"
wenzelm@15843
    10
fi
wenzelm@15843
    11
wenzelm@28504
    12
wenzelm@28504
    13
## settings
wenzelm@28504
    14
wenzelm@28504
    15
PRG="$(basename "$0")"
wenzelm@28504
    16
wenzelm@28504
    17
ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
wenzelm@28504
    18
source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2
wenzelm@28504
    19
wenzelm@28504
    20
wenzelm@28504
    21
## diagnostics
wenzelm@2292
    22
wenzelm@28504
    23
function usage()
wenzelm@28504
    24
{
wenzelm@28504
    25
  echo
wenzelm@28506
    26
  echo "Usage: $PRG NAME [ARGS ...]"
wenzelm@28504
    27
  echo
wenzelm@28506
    28
  echo "  Start Isabelle tool NAME with ARGS; pass \"-?\" for tool specific help."
wenzelm@28504
    29
  echo
wenzelm@28504
    30
  echo "  Available tools are:"
wenzelm@42077
    31
  perl -w "$ISABELLE_HOME/lib/scripts/tools.pl"
wenzelm@28504
    32
  exit 1
wenzelm@28504
    33
}
wenzelm@9786
    34
wenzelm@28504
    35
function fail()
wenzelm@28504
    36
{
wenzelm@28504
    37
  echo "$1" >&2
wenzelm@28504
    38
  exit 2
wenzelm@28504
    39
}
wenzelm@28504
    40
wenzelm@28504
    41
wenzelm@28504
    42
## args
wenzelm@28504
    43
wenzelm@28504
    44
[ "$#" -lt 1 -o "$1" = "-?" ] && usage
wenzelm@28504
    45
wenzelm@28504
    46
TOOLNAME="$1"
wenzelm@28504
    47
shift
wenzelm@28504
    48
wenzelm@28504
    49
wenzelm@28504
    50
## main
wenzelm@28504
    51
wenzelm@42077
    52
splitarray ":" "$ISABELLE_TOOLS"; TOOLS=("${SPLITARRAY[@]}")
wenzelm@42077
    53
wenzelm@32322
    54
for DIR in "${TOOLS[@]}"
wenzelm@28504
    55
do
wenzelm@28504
    56
  TOOL="$DIR/$TOOLNAME"
wenzelm@42077
    57
  case "$TOOL" in
wenzelm@42077
    58
    *~) ;;
wenzelm@42077
    59
    *) [ -f "$TOOL" -a -x "$TOOL" ] && exec "$TOOL" "$@" ;;
wenzelm@42077
    60
  esac
wenzelm@28504
    61
done
wenzelm@28504
    62
wenzelm@28504
    63
fail "Unknown Isabelle tool: $TOOLNAME"