author | wenzelm |
Tue, 09 Mar 2010 23:29:04 +0100 | |
changeset 35680 | 897740382442 |
parent 33912 | a5e6e849a0d8 |
child 41610 | 9f99196ebd9f |
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:
29136
diff
changeset
|
8 |
THIS_APP="$(cd "$THIS/../.."; pwd)" |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
9 |
SUPER_APP="$(cd "$THIS/../../.."; pwd)" |
29136 | 10 |
|
29173
c14c9a41f1ac
PATH: /opt/local/bin is back again (required for latex etc.);
wenzelm
parents:
29149
diff
changeset
|
11 |
|
c14c9a41f1ac
PATH: /opt/local/bin is back again (required for latex etc.);
wenzelm
parents:
29149
diff
changeset
|
12 |
# sane environment defaults |
29136 | 13 |
cd "$HOME" |
29173
c14c9a41f1ac
PATH: /opt/local/bin is back again (required for latex etc.);
wenzelm
parents:
29149
diff
changeset
|
14 |
PATH="$PATH:/opt/local/bin" |
29136 | 15 |
|
16 |
||
29149
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
17 |
# settings support |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
18 |
|
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
19 |
function choosefrom () |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
20 |
{ |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
21 |
local RESULT="" |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
22 |
local FILE="" |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
23 |
|
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
24 |
for FILE in "$@" |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
25 |
do |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
26 |
[ -z "$RESULT" -a -e "$FILE" ] && RESULT="$FILE" |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
27 |
done |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
28 |
|
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
29 |
[ -z "$RESULT" ] && RESULT="$FILE" |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
30 |
echo "$RESULT" |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
31 |
} |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
32 |
|
29136 | 33 |
|
29149
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
34 |
# Isabelle |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
35 |
|
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
36 |
ISABELLE_TOOL="$(choosefrom \ |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
37 |
"$THIS/Isabelle/bin/isabelle" \ |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
38 |
"$SUPER_APP/Isabelle/bin/isabelle" \ |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
39 |
"$HOME/bin/isabelle" \ |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
40 |
isabelle)" |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
41 |
|
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
42 |
|
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
43 |
# Proof General / Emacs |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
44 |
|
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
45 |
PROOFGENERAL_EMACS="$(choosefrom \ |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
46 |
"$THIS/Emacs.app/Contents/MacOS/Emacs" \ |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
47 |
"$SUPER_APP/Emacs.app/Contents/MacOS/Emacs" \ |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
48 |
/Applications/Emacs.app/Contents/MacOS/Emacs \ |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
49 |
"")" |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
50 |
|
33912 | 51 |
declare -a EMACS_OPTIONS=() |
29149
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
52 |
if [ -n "$PROOFGENERAL_EMACS" ]; then |
33912 | 53 |
EMACS_OPTIONS=(-p "$PROOFGENERAL_EMACS") |
29136 | 54 |
fi |
55 |
||
56 |
||
29149
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
57 |
# run interface with error feedback |
29136 | 58 |
|
59 |
OUTPUT="/tmp/isabelle$$.out" |
|
60 |
||
33912 | 61 |
( "$ISABELLE_TOOL" emacs "${EMACS_OPTIONS[@]}" "$@" ) > "$OUTPUT" 2>&1 |
29136 | 62 |
RC=$? |
63 |
||
64 |
if [ "$RC" != 0 ]; then |
|
65 |
echo >> "$OUTPUT" |
|
66 |
echo "Return code: $RC" >> "$OUTPUT" |
|
67 |
fi |
|
68 |
||
29149
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
69 |
if [ $(stat -f "%z" "$OUTPUT") != 0 ]; then |
29136 | 70 |
"$THIS/CocoaDialog.app/Contents/MacOS/CocoaDialog" textbox \ |
71 |
--title "Isabelle" \ |
|
72 |
--informative-text "Isabelle output" \ |
|
73 |
--text-from-file "$OUTPUT" \ |
|
74 |
--button1 "OK" |
|
75 |
fi |
|
76 |
||
77 |
rm -f "$OUTPUT" |
|
78 |
||
79 |
exit "$RC" |