Admin/MacOS/App1/script
changeset 56013 d64a4ef26edb
parent 56012 cfb21e03fe2a
parent 56008 30666a281ae3
child 56014 748778ac0ab8
     1.1 --- a/Admin/MacOS/App1/script	Thu Dec 05 17:52:12 2013 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,82 +0,0 @@
     1.4 -#!/usr/bin/env bash
     1.5 -#
     1.6 -# Author: Makarius
     1.7 -#
     1.8 -# Isabelle application wrapper
     1.9 -
    1.10 -THIS="$(cd "$(dirname "$0")"; pwd)"
    1.11 -THIS_APP="$(cd "$THIS/../.."; pwd)"
    1.12 -SUPER_APP="$(cd "$THIS/../../.."; pwd)"
    1.13 -
    1.14 -
    1.15 -# global defaults
    1.16 -
    1.17 -ISABELLE_TOOL="$THIS/Isabelle/bin/isabelle"
    1.18 -PROOFGENERAL_EMACS="$THIS/Aquamacs.app/Contents/MacOS/Aquamacs"
    1.19 -
    1.20 -
    1.21 -# environment
    1.22 -
    1.23 -cd "$HOME"
    1.24 -if [ -x /usr/libexec/path_helper ]; then
    1.25 -  eval $(/usr/libexec/path_helper -s)
    1.26 -fi
    1.27 -
    1.28 -[ -z "$LANG" ] && export LANG=en_US.UTF-8
    1.29 -
    1.30 -
    1.31 -# run interface with error feedback
    1.32 -
    1.33 -ISABELLE_INTERFACE_CHOICE="$("$ISABELLE_TOOL" getenv -b ISABELLE_INTERFACE_CHOICE)"
    1.34 -if [ "$ISABELLE_INTERFACE_CHOICE" != emacs -a "$ISABELLE_INTERFACE_CHOICE" != jedit ]
    1.35 -then
    1.36 -  declare -a CHOICE
    1.37 -  CHOICE=($("$THIS/CocoaDialog.app/Contents/MacOS/CocoaDialog" dropdown \
    1.38 -    --title Isabelle \
    1.39 -    --text "Which Isabelle interface?" \
    1.40 -    --items "Isabelle/jEdit PIDE" "Emacs / Proof General" \
    1.41 -    --button2 "OK, do not ask again" --button1 "OK"))
    1.42 -  if [ "${CHOICE[1]}" = 0 ]; then
    1.43 -    ISABELLE_INTERFACE_CHOICE=jedit
    1.44 -  else
    1.45 -    ISABELLE_INTERFACE_CHOICE=emacs
    1.46 -  fi
    1.47 -  if [ "${CHOICE[0]}" = 2 ]; then
    1.48 -    ISABELLE_HOME_USER="$("$ISABELLE_TOOL" getenv -b ISABELLE_HOME_USER)"
    1.49 -    mkdir -p "$ISABELLE_HOME_USER/etc"
    1.50 -    ( echo; echo "ISABELLE_INTERFACE_CHOICE=$ISABELLE_INTERFACE_CHOICE"; ) \
    1.51 -      >> "$ISABELLE_HOME_USER/etc/settings"
    1.52 -    "$THIS/CocoaDialog.app/Contents/MacOS/CocoaDialog" ok-msgbox \
    1.53 -      --title Isabelle \
    1.54 -      --text Note \
    1.55 -      --informative-text "ISABELLE_INTERFACE_CHOICE stored in $ISABELLE_HOME_USER/etc/settings" \
    1.56 -      --no-cancel
    1.57 -  fi
    1.58 -fi
    1.59 -
    1.60 -OUTPUT="/tmp/isabelle$$.out"
    1.61 -
    1.62 -if [ "$ISABELLE_INTERFACE_CHOICE" = emacs ]; then
    1.63 -  ( "$ISABELLE_TOOL" emacs -p "$PROOFGENERAL_EMACS" "$@" ) > "$OUTPUT" 2>&1
    1.64 -  RC=$?
    1.65 -else
    1.66 -  ( "$ISABELLE_TOOL" jedit -s "$@" ) > "$OUTPUT" 2>&1
    1.67 -  RC=$?
    1.68 -fi
    1.69 -
    1.70 -if [ "$RC" != 0 ]; then
    1.71 -  echo >> "$OUTPUT"
    1.72 -  echo "Return code: $RC" >> "$OUTPUT"
    1.73 -fi
    1.74 -
    1.75 -if [ $(stat -f "%z" "$OUTPUT") != 0 ]; then
    1.76 -  "$THIS/CocoaDialog.app/Contents/MacOS/CocoaDialog" textbox \
    1.77 -    --title "Isabelle" \
    1.78 -    --informative-text "Isabelle output" \
    1.79 -    --text-from-file "$OUTPUT" \
    1.80 -    --button1 "OK"
    1.81 -fi
    1.82 -
    1.83 -rm -f "$OUTPUT"
    1.84 -
    1.85 -exit "$RC"