bin/isabelle
author krauss
Fri Feb 25 16:57:43 2011 +0100 (2011-02-25)
changeset 41844 b933142e02d0
parent 33915 44a10fe6bd10
child 42077 96c50a4210a2
permissions -rwxr-xr-x
generalize find_theorems filters to work on raw propositions, too
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@32390
    20
splitarray ":" "$ISABELLE_TOOLS"; TOOLS=("${SPLITARRAY[@]}")
wenzelm@32322
    21
wenzelm@28504
    22
wenzelm@28504
    23
## diagnostics
wenzelm@2292
    24
wenzelm@28504
    25
function usage()
wenzelm@28504
    26
{
wenzelm@28504
    27
  echo
wenzelm@28506
    28
  echo "Usage: $PRG NAME [ARGS ...]"
wenzelm@28504
    29
  echo
wenzelm@28506
    30
  echo "  Start Isabelle tool NAME with ARGS; pass \"-?\" for tool specific help."
wenzelm@28504
    31
  echo
wenzelm@28504
    32
  echo "  Available tools are:"
wenzelm@33915
    33
  for DIR in "${TOOLS[@]}"
wenzelm@32322
    34
  do
wenzelm@32322
    35
    if [ -d "$DIR" ]; then
wenzelm@32322
    36
      for TOOL in "$DIR"/*
wenzelm@32322
    37
      do
wenzelm@32322
    38
        if [ -f "$TOOL" -a -x "$TOOL" ]; then
wenzelm@32322
    39
          NAME="$(basename "$TOOL")"
wenzelm@32322
    40
          DESCRLINE="$(fgrep DESCRIPTION: "$TOOL" | sed -e 's/^.*DESCRIPTION: *//')"
wenzelm@32322
    41
          echo "    $NAME - $DESCRLINE"
wenzelm@32322
    42
        fi
wenzelm@32322
    43
      done
wenzelm@32322
    44
    fi
wenzelm@32322
    45
  done
wenzelm@28504
    46
  exit 1
wenzelm@28504
    47
}
wenzelm@9786
    48
wenzelm@28504
    49
function fail()
wenzelm@28504
    50
{
wenzelm@28504
    51
  echo "$1" >&2
wenzelm@28504
    52
  exit 2
wenzelm@28504
    53
}
wenzelm@28504
    54
wenzelm@28504
    55
wenzelm@28504
    56
## args
wenzelm@28504
    57
wenzelm@28504
    58
[ "$#" -lt 1 -o "$1" = "-?" ] && usage
wenzelm@28504
    59
wenzelm@28504
    60
TOOLNAME="$1"
wenzelm@28504
    61
shift
wenzelm@28504
    62
wenzelm@28504
    63
wenzelm@28504
    64
## main
wenzelm@28504
    65
wenzelm@32322
    66
for DIR in "${TOOLS[@]}"
wenzelm@28504
    67
do
wenzelm@28504
    68
  TOOL="$DIR/$TOOLNAME"
wenzelm@28504
    69
  [ -f "$TOOL" -a -x "$TOOL" ] && exec "$TOOL" "$@"
wenzelm@28504
    70
done
wenzelm@28504
    71
wenzelm@28504
    72
fail "Unknown Isabelle tool: $TOOLNAME"