author | wenzelm |
Mon, 22 Dec 2008 14:40:27 +0100 | |
changeset 29149 | eae45c2a6811 |
parent 29136 | de5b29c25af9 |
child 29173 | c14c9a41f1ac |
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 |
|
11 |
cd "$HOME" |
|
12 |
||
13 |
||
29149
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
14 |
# settings support |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
15 |
|
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
16 |
function choosefrom () |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
17 |
{ |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
18 |
local RESULT="" |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
19 |
local FILE="" |
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 |
for FILE in "$@" |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
22 |
do |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
23 |
[ -z "$RESULT" -a -e "$FILE" ] && RESULT="$FILE" |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
24 |
done |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
25 |
|
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
26 |
[ -z "$RESULT" ] && RESULT="$FILE" |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
27 |
echo "$RESULT" |
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 |
|
29136 | 30 |
|
29149
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
31 |
# Isabelle |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
32 |
|
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
33 |
ISABELLE_TOOL="$(choosefrom \ |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
34 |
"$THIS/Isabelle/bin/isabelle" \ |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
35 |
"$SUPER_APP/Isabelle/bin/isabelle" \ |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
36 |
"$HOME/bin/isabelle" \ |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
37 |
isabelle)" |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
38 |
|
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
39 |
|
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
40 |
# Proof General / Emacs |
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 |
PROOFGENERAL_EMACS="$(choosefrom \ |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
43 |
"$THIS/Emacs.app/Contents/MacOS/Emacs" \ |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
44 |
"$SUPER_APP/Emacs.app/Contents/MacOS/Emacs" \ |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
45 |
/Applications/Emacs.app/Contents/MacOS/Emacs \ |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
46 |
"")" |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
47 |
|
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
48 |
if [ -n "$PROOFGENERAL_EMACS" ]; then |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
49 |
PROOFGENERAL_OPTIONS="-p $PROOFGENERAL_EMACS $PROOFGENERAL_OPTIONS" |
29136 | 50 |
fi |
51 |
||
52 |
||
29149
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
53 |
# run interface with error feedback |
29136 | 54 |
|
55 |
OUTPUT="/tmp/isabelle$$.out" |
|
56 |
||
29149
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
57 |
( "$HOME/bin/isabelle" emacs "$@" ) > "$OUTPUT" 2>&1 |
29136 | 58 |
RC=$? |
59 |
||
60 |
if [ "$RC" != 0 ]; then |
|
61 |
echo >> "$OUTPUT" |
|
62 |
echo "Return code: $RC" >> "$OUTPUT" |
|
63 |
fi |
|
64 |
||
29149
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
65 |
if [ $(stat -f "%z" "$OUTPUT") != 0 ]; then |
29136 | 66 |
"$THIS/CocoaDialog.app/Contents/MacOS/CocoaDialog" textbox \ |
67 |
--title "Isabelle" \ |
|
68 |
--informative-text "Isabelle output" \ |
|
69 |
--text-from-file "$OUTPUT" \ |
|
70 |
--button1 "OK" |
|
71 |
fi |
|
72 |
||
73 |
rm -f "$OUTPUT" |
|
74 |
||
75 |
exit "$RC" |