bin/isabelle
author berghofe
Tue Oct 21 21:22:02 2008 +0200 (2008-10-21)
changeset 28655 2822c56dd1cf
parent 28506 3ab515ee4e6f
child 28934 801098c96f59
permissions -rwxr-xr-x
Example for using the generalized version of nominal_inductive.
     1 #!/usr/bin/env bash
     2 #
     3 # $Id$
     4 # Author: Markus Wenzel, TU Muenchen
     5 #
     6 # Isabelle tool wrapper.
     7 
     8 if [ -L "$0" ]; then
     9   TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
    10   exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@"
    11 fi
    12 
    13 
    14 ## settings
    15 
    16 PRG="$(basename "$0")"
    17 
    18 ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
    19 source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2
    20 
    21 
    22 ## diagnostics
    23 
    24 function usage()
    25 {
    26   echo
    27   echo "Usage: $PRG NAME [ARGS ...]"
    28   echo
    29   echo "  Start Isabelle tool NAME with ARGS; pass \"-?\" for tool specific help."
    30   echo
    31   echo "  Available tools are:"
    32   (
    33     ORIG_IFS="$IFS"
    34     IFS=":"
    35     for DIR in $ISABELLE_TOOLS
    36     do
    37       cd "$DIR"
    38       for T in *
    39       do
    40         if [ -f "$T" -a -x "$T" ]; then
    41           DESCRLINE=$(fgrep DESCRIPTION: "$T" | sed -e 's/^.*DESCRIPTION: *//')
    42           echo "    $T - $DESCRLINE"
    43         fi
    44       done
    45     done
    46     IFS="$ORIG_IFS"
    47   )
    48   exit 1
    49 }
    50 
    51 function fail()
    52 {
    53   echo "$1" >&2
    54   exit 2
    55 }
    56 
    57 
    58 ## args
    59 
    60 [ "$#" -lt 1 -o "$1" = "-?" ] && usage
    61 
    62 TOOLNAME="$1"
    63 shift
    64 
    65 
    66 ## main
    67 
    68 ORIG_IFS="$IFS"
    69 IFS=":"
    70 for DIR in $ISABELLE_TOOLS
    71 do
    72   TOOL="$DIR/$TOOLNAME"
    73   [ -f "$TOOL" -a -x "$TOOL" ] && exec "$TOOL" "$@"
    74 done
    75 IFS="$ORIG_IFS"
    76 
    77 fail "Unknown Isabelle tool: $TOOLNAME"