24875
|
1 |
#!/usr/bin/env bash
|
|
2 |
#
|
|
3 |
# $Id$
|
|
4 |
# Author: Makarius
|
|
5 |
#
|
|
6 |
# DESCRIPTION: generate outer syntax keyword files from session logs
|
|
7 |
|
|
8 |
|
|
9 |
## diagnostics
|
|
10 |
|
|
11 |
PRG="$(basename "$0")"
|
|
12 |
|
|
13 |
function usage()
|
|
14 |
{
|
|
15 |
echo
|
|
16 |
echo "Usage: $PRG [OPTIONS] [LOGS ...]"
|
|
17 |
echo
|
|
18 |
echo " Options are:"
|
|
19 |
echo " -k NAME specific name of keywords collection (default: empty)"
|
|
20 |
echo
|
|
21 |
echo " Generate outer syntax keyword files from (compressed) session LOGS."
|
|
22 |
echo " Targets Emacs Proof General."
|
|
23 |
echo
|
|
24 |
exit 1
|
|
25 |
}
|
|
26 |
|
|
27 |
|
|
28 |
## process command line
|
|
29 |
|
|
30 |
# options
|
|
31 |
|
|
32 |
KEYWORDS_NAME=""
|
|
33 |
|
|
34 |
while getopts "k:" OPT
|
|
35 |
do
|
|
36 |
case "$OPT" in
|
|
37 |
k)
|
|
38 |
KEYWORDS_NAME="$OPTARG"
|
|
39 |
;;
|
|
40 |
\?)
|
|
41 |
usage
|
|
42 |
;;
|
|
43 |
esac
|
|
44 |
done
|
|
45 |
|
|
46 |
shift $(($OPTIND - 1))
|
|
47 |
|
|
48 |
|
|
49 |
# args
|
|
50 |
|
|
51 |
LOGS="$@"; shift "$#"
|
|
52 |
|
|
53 |
|
|
54 |
## main
|
|
55 |
|
|
56 |
#set by configure
|
|
57 |
AUTO_PERL=perl
|
|
58 |
|
|
59 |
SESSIONS=""
|
|
60 |
for LOG in $LOGS
|
|
61 |
do
|
|
62 |
NAME="$(basename "$LOG" .gz)"
|
|
63 |
if [ "$NAME" != PG -a "$NAME" != Pure ]; then
|
|
64 |
if [ -z "$SESSIONS" ]; then
|
|
65 |
SESSIONS="$NAME"
|
|
66 |
else
|
|
67 |
SESSIONS="$SESSIONS + $NAME"
|
|
68 |
fi
|
|
69 |
fi
|
|
70 |
done
|
|
71 |
|
|
72 |
for LOG in $LOGS
|
|
73 |
do
|
|
74 |
if [ "${LOG%.gz}" = "$LOG" ]; then
|
|
75 |
cat "$LOG"
|
|
76 |
else
|
|
77 |
gzip -dc "$LOG"
|
|
78 |
fi
|
|
79 |
echo
|
|
80 |
done | "$AUTO_PERL" -w "$ISABELLE_HOME/lib/scripts/keywords.pl" "$KEYWORDS_NAME" "$SESSIONS"
|