author | berghofe |
Wed, 07 Jun 2000 12:16:43 +0200 | |
changeset 9047 | 810966809663 |
parent 8810 | d0eae42f6d12 |
child 9237 | 161fb7f00414 |
permissions | -rwxr-xr-x |
3007 | 1 |
#!/bin/bash |
2808 | 2 |
# |
3 |
# $Id$ |
|
4 |
# |
|
5 |
# DESCRIPTION: build object-logic or run examples |
|
6 |
||
7 |
||
8 |
## diagnostics |
|
9 |
||
10 |
PRG=$(basename $0) |
|
11 |
||
12 |
function usage() |
|
13 |
{ |
|
14 |
echo |
|
15 |
echo "Usage: $PRG LOGIC NAME" |
|
16 |
echo |
|
17 |
echo " Options are:" |
|
8197
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
18 |
echo " -D PATH dump generated document sources into PATH" |
6940 | 19 |
echo " -P PATH set path for remote theory browsing information" |
6212 | 20 |
echo " -b build mode (output heap image, using current dir)" |
8359
124ad46105dd
option -c: tell ML system to compress output image;
wenzelm
parents:
8241
diff
changeset
|
21 |
echo " -c BOOL tell ML system to compress output image (default true)" |
7737 | 22 |
echo " -d FORMAT build document as FORMAT (default false)" |
3747
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
23 |
echo " -i BOOL generate theory browsing information," |
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
24 |
echo " i.e. HTML / graph data (default false)" |
6212 | 25 |
echo " -r reset session path" |
2808 | 26 |
echo " -s NAME override session NAME" |
27 |
echo |
|
28 |
echo " Build object-logic or run examples. Also creates browsing" |
|
29 |
echo " information (HTML etc.) according to settings." |
|
30 |
echo |
|
7461 | 31 |
echo " ISABELLE_USEDIR_OPTIONS=$ISABELLE_USEDIR_OPTIONS" |
32 |
echo |
|
2808 | 33 |
exit 1 |
34 |
} |
|
35 |
||
36 |
||
37 |
## process command line |
|
38 |
||
39 |
# options |
|
40 |
||
8197
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
41 |
DUMP="" |
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
42 |
RPATH="" |
2808 | 43 |
BUILD="" |
8747 | 44 |
COMPRESS=true |
7737 | 45 |
DOCUMENT=false |
3747
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
46 |
INFO=false |
6212 | 47 |
RESET=false |
2808 | 48 |
SESSION="" |
49 |
||
2917 | 50 |
function getoptions() |
51 |
{ |
|
52 |
OPTIND=1 |
|
8197
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
53 |
while getopts "D:P:bc:d:i:rs:" OPT |
2917 | 54 |
do |
55 |
case "$OPT" in |
|
8197
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
56 |
D) |
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
57 |
DUMP="$OPTARG" |
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
58 |
;; |
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
59 |
P) |
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
60 |
RPATH="$OPTARG" |
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
61 |
;; |
2917 | 62 |
b) |
63 |
BUILD=true |
|
64 |
;; |
|
8359
124ad46105dd
option -c: tell ML system to compress output image;
wenzelm
parents:
8241
diff
changeset
|
65 |
c) |
124ad46105dd
option -c: tell ML system to compress output image;
wenzelm
parents:
8241
diff
changeset
|
66 |
COMPRESS="$OPTARG" |
124ad46105dd
option -c: tell ML system to compress output image;
wenzelm
parents:
8241
diff
changeset
|
67 |
;; |
7737 | 68 |
d) |
69 |
DOCUMENT="$OPTARG" |
|
70 |
;; |
|
3747
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
71 |
i) |
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
72 |
INFO="$OPTARG" |
2917 | 73 |
;; |
6212 | 74 |
r) |
75 |
RESET=true |
|
76 |
;; |
|
2917 | 77 |
s) |
78 |
SESSION="$OPTARG" |
|
79 |
;; |
|
80 |
\?) |
|
81 |
usage |
|
82 |
;; |
|
83 |
esac |
|
84 |
done |
|
85 |
} |
|
2808 | 86 |
|
2917 | 87 |
getoptions $ISABELLE_USEDIR_OPTIONS |
88 |
||
89 |
getoptions "$@" |
|
2808 | 90 |
shift $(($OPTIND - 1)) |
91 |
||
92 |
||
93 |
# args |
|
94 |
||
95 |
[ $# -ne 2 ] && usage |
|
96 |
||
97 |
LOGIC="$1"; shift |
|
98 |
NAME="$1"; shift |
|
99 |
||
4419 | 100 |
[ -z "$SESSION" ] && SESSION=$(basename $NAME) |
2808 | 101 |
|
4419 | 102 |
|
103 |
||
104 |
## main |
|
3636
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
105 |
|
4451 | 106 |
# prepare browser info dir |
4419 | 107 |
|
4586 | 108 |
if [ "$INFO" = "true" -a ! -f $ISABELLE_BROWSER_INFO/index.html ]; then |
8241 | 109 |
mkdir -p $ISABELLE_BROWSER_INFO |
8218 | 110 |
cp $ISABELLE_HOME/lib/logo/isabelle.gif $ISABELLE_BROWSER_INFO/isabelle.gif |
8810 | 111 |
cp $ISABELLE_HOME/lib/html/index.html $ISABELLE_BROWSER_INFO/index.html |
3636
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
112 |
fi |
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
113 |
|
2808 | 114 |
|
4451 | 115 |
# prepare log dir |
116 |
||
117 |
LOGDIR="$ISABELLE_OUTPUT/log" |
|
118 |
mkdir -p "$LOGDIR" |
|
119 |
||
120 |
||
121 |
# run isabelle |
|
122 |
||
7737 | 123 |
PARENT=$(basename "$LOGIC") |
124 |
||
125 |
[ -z "$BUILD" ] && cd "$NAME" |
|
4451 | 126 |
|
8568 | 127 |
if [ "$DOCUMENT" != false -a -d document ]; then |
128 |
DOC="$DOCUMENT" |
|
129 |
[ -n "$DUMP" -a -d "$DUMP" ] && $ISATOOL latex -o sty "$DUMP/root.tex" >/dev/null |
|
130 |
else |
|
131 |
DOC="" |
|
132 |
fi |
|
7737 | 133 |
|
134 |
||
135 |
SECONDS=0 |
|
6249 | 136 |
|
2808 | 137 |
if [ -n "$BUILD" ]; then |
4451 | 138 |
ITEM="$SESSION" |
7275 | 139 |
echo "Building $ITEM ..." |
4451 | 140 |
LOG="$LOGDIR/$ITEM" |
141 |
||
8359
124ad46105dd
option -c: tell ML system to compress output image;
wenzelm
parents:
8241
diff
changeset
|
142 |
OPT_C="" |
124ad46105dd
option -c: tell ML system to compress output image;
wenzelm
parents:
8241
diff
changeset
|
143 |
[ "$COMPRESS" = true ] && OPT_C="-c" |
124ad46105dd
option -c: tell ML system to compress output image;
wenzelm
parents:
8241
diff
changeset
|
144 |
|
4451 | 145 |
$ISABELLE \ |
8197
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
146 |
-e "Session.use_dir $RESET $INFO \"$DOC\" \"$PARENT\" \"$SESSION\" \"$DUMP\" \"$RPATH\";" \ |
8359
124ad46105dd
option -c: tell ML system to compress output image;
wenzelm
parents:
8241
diff
changeset
|
147 |
$OPT_C -q -w $LOGIC $NAME > $LOG 2>&1 |
6249 | 148 |
RC=$? |
2808 | 149 |
else |
4451 | 150 |
ITEM=$(basename $LOGIC)-"$SESSION" |
7275 | 151 |
echo "Running $ITEM ..." |
4451 | 152 |
LOG="$LOGDIR/$ITEM" |
153 |
||
154 |
$ISABELLE \ |
|
8197
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
155 |
-e "Session.use_dir $RESET $INFO \"$DOC\" \"$PARENT\" \"$SESSION\" \"$DUMP\" \"$RPATH\"; quit();" \ |
4492 | 156 |
-r -q $LOGIC > $LOG 2>&1 |
6249 | 157 |
RC=$? |
6212 | 158 |
cd .. |
2808 | 159 |
fi |
4451 | 160 |
|
161 |
ELAPSED=$($ISABELLE_HOME/lib/scripts/showtime $SECONDS) |
|
162 |
||
163 |
||
164 |
# exit status |
|
165 |
||
166 |
if [ $RC -eq 0 ]; then |
|
7275 | 167 |
echo "Finished $ITEM ($ELAPSED elapsed time)" |
4451 | 168 |
gzip --force "$LOG" |
169 |
else |
|
7259 | 170 |
echo "$ITEM FAILED" |
4451 | 171 |
echo "(see also $LOG)" |
172 |
echo; tail $LOG; echo |
|
173 |
fi |
|
174 |
||
175 |
exit $RC |