bin/isabelle
author wenzelm
Wed, 14 Feb 2024 14:41:18 +0100
changeset 79604 0e8ac7db1f4d
parent 74038 b4f57bfe82e7
permissions -rwxr-xr-x
clarified num_processors: follow Poly/ML (with its inaccuracies);

#!/usr/bin/env bash
#
# Author: Markus Wenzel, TU Muenchen
#
# Isabelle tool wrapper.

unset CDPATH

if [ -L "$0" ]; then
  TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
  exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@"
fi


## settings

PRG="$(basename "$0")"

ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2


## external tool (shell script)

if [ "$#" -ge 1 -a "$1" != "-?" ]
then
  TOOL_NAME="$1"

  splitarray ":" "$ISABELLE_TOOLS"; TOOLS=("${SPLITARRAY[@]}")
  for DIR in "${TOOLS[@]}"
  do
    TOOL="$DIR/$TOOL_NAME"
    case "$TOOL" in
      *~ | *.orig) ;;
      *)
        if [ -f "$TOOL" -a -x "$TOOL" ]; then
          shift
          exec "$TOOL" "$@"
        fi
        ;;
    esac
  done
fi


## internal tool or usage (Scala)

"$ISABELLE_HOME/lib/Tools/scala_build" || exit $?

eval "declare -a JAVA_ARGS=($ISABELLE_TOOL_JAVA_OPTIONS)"
exec isabelle java "${JAVA_ARGS[@]}" isabelle.Isabelle_Tool "$@"