blob: 46c78a58e13fefb10f6adac0b87794f883f94c3b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
|
#!/usr/bin/env bash
#
# $Id$
#
# Proof General interface wrapper for Isabelle.
## self references
THIS=$(cd "$(dirname "$0")"; pwd)
SUPER=$(cd "$THIS/.."; pwd)
KIND=$(basename "$(dirname "$0")")
if [ "$KIND" = isar ]; then
ISAR=true
else
ISAR=false
fi
## diagnostics
usage()
{
echo
echo "Usage: Isabelle [OPTIONS] [FILES ...]"
echo
echo " Options are:"
echo " -I BOOL use Isabelle/Isar instead of classic Isabelle (default $ISAR)"
echo " -P BOOL actually start Proof General (default true), otherwise"
echo " run plain tty session"
echo " -X BOOL configure the X-Symbol package on startup (default true)"
echo " -g GEOMETRY specify Emacs geometry"
echo " -k NAME use specific isar-keywords for named logic"
echo " -l NAME logic image name (default \$ISABELLE_LOGIC=$ISABELLE_LOGIC)"
echo " -m MODE add print mode for output"
echo " -p NAME Emacs program name (default xemacs)"
echo " -u BOOL use personal .emacs file (default true)"
echo " -w BOOL use window system (default true)"
echo " -x BOOL enable the X-Symbol package on startup (default false)"
echo
echo "Starts Proof General for Isabelle with theory and proof FILES"
echo "(default Scratch.thy)."
echo
echo " PROOFGENERAL_OPTIONS=$PROOFGENERAL_OPTIONS"
echo
exit 1
}
fail()
{
echo "$1" >&2
exit 2
}
## process command line
# options
ISABELLE_OPTIONS=""
START_PG="true"
GEOMETRY=""
KEYWORDS=""
LOGIC="$ISABELLE_LOGIC"
PROGNAME="xemacs"
INITFILE="true"
WINDOWSYSTEM="true"
XSYMBOL=""
XSYMBOLSETUP=true
getoptions()
{
OPTIND=1
while getopts "I:P:X:g:k:l:m:p:u:w:x:" OPT
do
case "$OPT" in
I)
ISAR="$OPTARG"
;;
P)
START_PG="$OPTARG"
;;
X)
XSYMBOLSETUP="$OPTARG"
;;
g)
GEOMETRY="$OPTARG"
;;
k)
KEYWORDS="$OPTARG"
;;
l)
LOGIC="$OPTARG"
;;
m)
if [ -z "$ISABELLE_OPTIONS" ]; then
ISABELLE_OPTIONS="-m $OPTARG"
else
ISABELLE_OPTIONS="$ISABELLE_OPTIONS -m $OPTARG"
fi
;;
p)
PROGNAME="$OPTARG"
;;
u)
INITFILE="$OPTARG"
;;
w)
WINDOWSYSTEM="$OPTARG"
;;
x)
XSYMBOL="$OPTARG"
;;
\?)
usage
;;
esac
done
}
getoptions $PROOFGENERAL_OPTIONS
getoptions "$@"
shift $(($OPTIND - 1))
if [ "$ISAR" = true ]; then
KIND=isar
DEFAULT_FILES="Scratch.thy"
else
KIND=isa
DEFAULT_FILES="Scratch.thy Scratch.ML"
fi
# args
if [ "$#" -eq 0 ]; then
FILES="$DEFAULT_FILES"
else
FILES=""
while [ "$#" -gt 0 ]; do
FILES="$FILES '$1'"
shift
done
fi
## smart X11 font installation
function checkfonts ()
{
XLSFONTS=$(xlsfonts -fn "-xsymb-xsymb0-*" 2>&1) || return 1
case "$XLSFONTS" in
xlsfonts:*)
return 1
;;
esac
return 0
}
function installfonts ()
{
checkfonts "$XSYMBOL_PATTERN" || eval $XSYMBOL_INSTALLFONTS
}
## main
if [ "$START_PG" = false ]; then
[ "$ISAR" = true ] && ISABELLE_OPTIONS="$ISABELLE_OPTIONS -I"
exec "$ISABELLE" $ISABELLE_OPTIONS "$LOGIC"
else
ARGS=""
[ -n "$GEOMETRY" ] && ARGS="$ARGS -geometry '$GEOMETRY'"
[ "$INITFILE" = false ] && ARGS="$ARGS -q"
if [ "$WINDOWSYSTEM" = true -a -n "$DISPLAY" ]; then
ARGS="$ARGS -T Isabelle"
[ -n "$XSYMBOL_INSTALLFONTS" -a "$XSYMBOLSETUP" = true ] && installfonts
else
ARGS="$ARGS -nw"
XSYMBOL=false
fi
[ ! "$XSYMBOLSETUP" = true ] && XSYMBOL_HOME=""
ARGS="$ARGS -l '$SUPER/isa/interface-setup.el'"
if [ -n "$KEYWORDS" ]; then
if [ -f "$ISABELLE_HOME_USER/etc/isar-keywords-$KEYWORDS.el" ]; then
ARGS="$ARGS -l '$ISABELLE_HOME_USER/etc/isar-keywords-$KEYWORDS.el'"
elif [ -f "$ISABELLE_HOME/etc/isar-keywords-$KEYWORDS.el" ]; then
ARGS="$ARGS -l '$ISABELLE_HOME/etc/isar-keywords-$KEYWORDS.el'"
else
fail "No isar-keywords file for '$KEYWORDS'"
fi
elif [ -f "$ISABELLE_HOME_USER/etc/isar-keywords.el" ]; then
ARGS="$ARGS -l '$ISABELLE_HOME_USER/etc/isar-keywords.el'"
elif [ -f "$ISABELLE_HOME/etc/isar-keywords.el" ]; then
ARGS="$ARGS -l '$ISABELLE_HOME/etc/isar-keywords.el'"
fi
for FILE in "$ISABELLE_HOME/etc/proofgeneral-settings.el" \
"$ISABELLE_HOME_USER/etc/proofgeneral-settings.el"
do
[ -f "$FILE" ] && ARGS="$ARGS -l '$FILE'"
done
case "$LOGIC" in
/*)
;;
*/*)
LOGIC="$PWD/$LOGIC"
;;
esac
PROOFGENERAL_HOME="$SUPER"
PROOFGENERAL_ASSISTANTS="$KIND"
PROOFGENERAL_LOGIC="$LOGIC"
PROOFGENERAL_XSYMBOL="$XSYMBOL"
export PROOFGENERAL_HOME PROOFGENERAL_ASSISTANTS PROOFGENERAL_LOGIC PROOFGENERAL_XSYMBOL
export ISABELLE_OPTIONS
eval exec "$PROGNAME" "$ARGS" "$FILES"
fi
|