author | wenzelm |
Sat, 17 Dec 2016 12:24:13 +0100 | |
changeset 64577 | 0288a566c966 |
parent 53774 | 729a43c36ccb |
child 72316 | 3cc6aa405858 |
permissions | -rwxr-xr-x |
10555 | 1 |
#!/usr/bin/env bash |
5557 | 2 |
# |
9788 | 3 |
# Author: Markus Wenzel, TU Muenchen |
5557 | 4 |
# |
5 |
# DESCRIPTION: create an instance of the Isabelle logo |
|
6 |
||
7 |
||
10511 | 8 |
PRG="$(basename "$0")" |
5557 | 9 |
|
10 |
function usage() |
|
11 |
{ |
|
12 |
echo |
|
49072
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
13 |
echo "Usage: isabelle $PRG [OPTIONS] [XYZ]" |
5570 | 14 |
echo |
49072
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
15 |
echo " Create instance XYZ of the Isabelle logo (as EPS and PDF)." |
5557 | 16 |
echo |
5570 | 17 |
echo " Options are:" |
49072
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
18 |
echo " -n NAME alternative output base name (default \"isabelle_xyx\")" |
5570 | 19 |
echo " -q quiet mode" |
5557 | 20 |
echo |
21 |
exit 1 |
|
22 |
} |
|
23 |
||
24 |
function fail() |
|
25 |
{ |
|
26 |
echo "$1" >&2 |
|
27 |
exit 2 |
|
28 |
} |
|
29 |
||
30 |
||
5570 | 31 |
## process command line |
32 |
||
33 |
# options |
|
34 |
||
49072
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
35 |
OUTPUT_NAME="" |
5570 | 36 |
QUIET="" |
37 |
||
49072
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
38 |
while getopts "n:q" OPT |
5570 | 39 |
do |
40 |
case "$OPT" in |
|
49072
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
41 |
n) |
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
42 |
OUTPUT_NAME="$OPTARG" |
5570 | 43 |
;; |
44 |
q) |
|
45 |
QUIET=true |
|
46 |
;; |
|
47 |
\?) |
|
48 |
usage |
|
49 |
;; |
|
50 |
esac |
|
51 |
done |
|
52 |
||
53 |
shift $(($OPTIND - 1)) |
|
54 |
||
55 |
||
56 |
# args |
|
5557 | 57 |
|
49072
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
58 |
TEXT="" |
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
59 |
[ "$#" -ge 1 ] && { TEXT="$1"; shift; } |
5557 | 60 |
|
49072
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
61 |
[ "$#" -ne 0 ] && usage |
5557 | 62 |
|
63 |
||
64 |
## main |
|
65 |
||
49072
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
66 |
case "$OUTPUT_NAME" in |
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
67 |
"") |
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
68 |
OUTPUT_NAME=$(echo "$TEXT" | tr A-Z a-z) |
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
69 |
if [ -z "$OUTPUT_NAME" ]; then |
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
70 |
OUTPUT_NAME="isabelle" |
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
71 |
else |
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
72 |
OUTPUT_NAME="isabelle_${OUTPUT_NAME}" |
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
73 |
fi |
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
74 |
;; |
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
75 |
*/* | *.eps | *.pdf) |
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
76 |
fail "Bad output base name: \"$OUTPUT_NAME\"" |
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
77 |
;; |
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
78 |
*) |
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
79 |
;; |
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
80 |
esac |
5570 | 81 |
|
49072
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
82 |
[ -z "$QUIET" ] && echo "${OUTPUT_NAME}.eps" >&2 |
53774 | 83 |
perl -p -e "s,<any>,$TEXT," "$ISABELLE_HOME/lib/logo/isabelle_any.eps" > "${OUTPUT_NAME}.eps" |
48936 | 84 |
|
49072
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
85 |
[ -z "$QUIET" ] && echo "${OUTPUT_NAME}.pdf" >&2 |
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
86 |
"$ISABELLE_EPSTOPDF" "${OUTPUT_NAME}.eps" |
747835eb2782
"isabelle logo" produces EPS and PDF format simultaneously;
wenzelm
parents:
48936
diff
changeset
|
87 |