21884
|
1 |
#!/usr/bin/env bash
|
|
2 |
#
|
|
3 |
# Author: Florian Haftmann, TUM
|
|
4 |
#
|
|
5 |
# DESCRIPTION: issue code generation from shell
|
|
6 |
|
|
7 |
|
|
8 |
## diagnostics
|
|
9 |
|
|
10 |
PRG="$(basename "$0")"
|
|
11 |
|
|
12 |
function usage()
|
|
13 |
{
|
|
14 |
echo
|
28650
|
15 |
echo "Usage: isabelle $PRG IMAGE THY CMD"
|
21884
|
16 |
echo
|
|
17 |
echo " Issues code generation using image IMAGE,"
|
|
18 |
echo " theory THY,"
|
25611
|
19 |
echo " with Isar command 'export_code CMD'"
|
21884
|
20 |
echo
|
|
21 |
exit 1
|
|
22 |
}
|
|
23 |
|
|
24 |
|
|
25 |
## process command line
|
|
26 |
|
|
27 |
[ "$#" -lt 2 -o "$1" = "-?" ] && usage
|
|
28 |
|
|
29 |
IMAGE="$1"; shift
|
|
30 |
THY="$1"; shift
|
25611
|
31 |
CMD="$1"
|
21884
|
32 |
|
|
33 |
|
|
34 |
## main
|
|
35 |
|
28660
|
36 |
THY=$(echo $THY | sed -e 's/\\/\\\\"/g; s/"/\\\"/g')
|
|
37 |
ISAR="theory Codegen imports \"$THY\" begin export_code $CMD end"
|
21884
|
38 |
|
28660
|
39 |
echo "$ISAR" | "$ISABELLE_PROCESS" -I "$IMAGE" || exit 1
|
|
40 |
|