| author | huffman | 
| Tue, 02 Jun 2009 18:59:50 -0700 | |
| changeset 31396 | f7c7bf82b12f | 
| parent 30893 | b310beb36645 | 
| permissions | -rwxr-xr-x | 
| 29136 | 1 | #!/bin/bash | 
| 2 | # | |
| 3 | # Author: Makarius | |
| 4 | # | |
| 5 | # Isabelle application wrapper | |
| 6 | ||
| 7 | THIS="$(cd "$(dirname "$0")"; pwd)" | |
| 29149 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 8 | THIS_APP="$(cd "$THIS/../.."; pwd)" | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 9 | SUPER_APP="$(cd "$THIS/../../.."; pwd)" | 
| 29136 | 10 | |
| 29173 
c14c9a41f1ac
PATH: /opt/local/bin is back again (required for latex etc.);
 wenzelm parents: 
29149diff
changeset | 11 | |
| 
c14c9a41f1ac
PATH: /opt/local/bin is back again (required for latex etc.);
 wenzelm parents: 
29149diff
changeset | 12 | # sane environment defaults | 
| 29136 | 13 | cd "$HOME" | 
| 29173 
c14c9a41f1ac
PATH: /opt/local/bin is back again (required for latex etc.);
 wenzelm parents: 
29149diff
changeset | 14 | PATH="$PATH:/opt/local/bin" | 
| 29136 | 15 | |
| 16 | ||
| 29149 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 17 | # settings support | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 18 | |
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 19 | function choosefrom () | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 20 | {
 | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 21 | local RESULT="" | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 22 | local FILE="" | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 23 | |
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 24 | for FILE in "$@" | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 25 | do | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 26 | [ -z "$RESULT" -a -e "$FILE" ] && RESULT="$FILE" | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 27 | done | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 28 | |
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 29 | [ -z "$RESULT" ] && RESULT="$FILE" | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 30 | echo "$RESULT" | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 31 | } | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 32 | |
| 29136 | 33 | |
| 29149 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 34 | # Isabelle | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 35 | |
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 36 | ISABELLE_TOOL="$(choosefrom \ | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 37 | "$THIS/Isabelle/bin/isabelle" \ | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 38 | "$SUPER_APP/Isabelle/bin/isabelle" \ | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 39 | "$HOME/bin/isabelle" \ | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 40 | isabelle)" | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 41 | |
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 42 | |
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 43 | # Proof General / Emacs | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 44 | |
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 45 | PROOFGENERAL_EMACS="$(choosefrom \ | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 46 | "$THIS/Emacs.app/Contents/MacOS/Emacs" \ | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 47 | "$SUPER_APP/Emacs.app/Contents/MacOS/Emacs" \ | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 48 | /Applications/Emacs.app/Contents/MacOS/Emacs \ | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 49 | "")" | 
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 50 | |
| 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 51 | if [ -n "$PROOFGENERAL_EMACS" ]; then | 
| 30893 
b310beb36645
more robust handling of emacs options -- this is not necessarily an Isabelle process environment yet;
 wenzelm parents: 
30891diff
changeset | 52 | EMACS_OPTIONS="-p $PROOFGENERAL_EMACS" | 
| 29136 | 53 | fi | 
| 54 | ||
| 55 | ||
| 29149 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 56 | # run interface with error feedback | 
| 29136 | 57 | |
| 58 | OUTPUT="/tmp/isabelle$$.out" | |
| 59 | ||
| 30893 
b310beb36645
more robust handling of emacs options -- this is not necessarily an Isabelle process environment yet;
 wenzelm parents: 
30891diff
changeset | 60 | ( "$ISABELLE_TOOL" emacs $EMACS_OPTIONS "$@" ) > "$OUTPUT" 2>&1 | 
| 29136 | 61 | RC=$? | 
| 62 | ||
| 63 | if [ "$RC" != 0 ]; then | |
| 64 | echo >> "$OUTPUT" | |
| 65 | echo "Return code: $RC" >> "$OUTPUT" | |
| 66 | fi | |
| 67 | ||
| 29149 
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
 wenzelm parents: 
29136diff
changeset | 68 | if [ $(stat -f "%z" "$OUTPUT") != 0 ]; then | 
| 29136 | 69 | "$THIS/CocoaDialog.app/Contents/MacOS/CocoaDialog" textbox \ | 
| 70 | --title "Isabelle" \ | |
| 71 | --informative-text "Isabelle output" \ | |
| 72 | --text-from-file "$OUTPUT" \ | |
| 73 | --button1 "OK" | |
| 74 | fi | |
| 75 | ||
| 76 | rm -f "$OUTPUT" | |
| 77 | ||
| 78 | exit "$RC" |