Admin/MacOS/script
changeset 29136 de5b29c25af9
child 29149 eae45c2a6811
equal deleted inserted replaced
29131:fd8bb7527f7b 29136:de5b29c25af9
       
     1 #!/bin/bash
       
     2 #
       
     3 # Author: Makarius
       
     4 #
       
     5 # Isabelle application wrapper
       
     6 
       
     7 THIS="$(cd "$(dirname "$0")"; pwd)"
       
     8 
       
     9 
       
    10 # global defaults
       
    11 ISABELLE_TOOL=""
       
    12 ISABELLE_INTERFACE="emacs"
       
    13 #ISABELLE_INTERFACE="jedit"
       
    14 
       
    15 
       
    16 # sane environment defaults
       
    17 PATH="$PATH:/opt/local/bin"
       
    18 cd "$HOME"
       
    19 
       
    20 
       
    21 # Isabelle location
       
    22 
       
    23 if [ -z "$ISABELLE_TOOL" ]; then
       
    24   if [ -e "$THIS/Isabelle/bin/isabelle" ]; then
       
    25     ISABELLE_TOOL="$THIS/Isabelle/bin/isabelle"
       
    26   elif [ -e "$HOME/bin/isabelle" ]; then
       
    27     ISABELLE_TOOL="$HOME/bin/isabelle"
       
    28   else
       
    29     ISABELLE_TOOL=isabelle
       
    30   fi
       
    31 fi
       
    32 
       
    33 
       
    34 # run interface
       
    35 
       
    36 OUTPUT="/tmp/isabelle$$.out"
       
    37 
       
    38 ( "$HOME/bin/isabelle" "$ISABELLE_INTERFACE" "$@" ) > "$OUTPUT" 2>&1
       
    39 RC=$?
       
    40 
       
    41 if [ "$RC" != 0 ]; then
       
    42   echo >> "$OUTPUT"
       
    43   echo "Return code: $RC" >> "$OUTPUT"
       
    44 fi
       
    45 
       
    46 
       
    47 # error feedback
       
    48 
       
    49 if [ -n "$OUTPUT" ]; then
       
    50   "$THIS/CocoaDialog.app/Contents/MacOS/CocoaDialog" textbox \
       
    51     --title "Isabelle" \
       
    52     --informative-text "Isabelle output" \
       
    53     --text-from-file "$OUTPUT" \
       
    54     --button1 "OK"
       
    55 fi
       
    56 
       
    57 rm -f "$OUTPUT"
       
    58 
       
    59 exit "$RC"