forked from SRI-CSL/PVS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pvsio.in
executable file
·167 lines (148 loc) · 3.71 KB
/
pvsio.in
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
#!/bin/sh
#
# pvsio.in
# Release: PVSio-6.0 (12/12/12)
#
# Contact: Cesar Munoz ([email protected])
# NASA Langley Research Center
# http://shemesh.larc.nasa.gov/people/cam/PVSio
#
# Copyright (c) 2011-2012 United States Government as represented by
# the National Aeronautics and Space Administration. No copyright
# is claimed in the United States under Title 17, U.S.Code. All Other
# Rights Reserved.
#
# Script for batch proving several libraries in PVS
#
PVSPATH=@PVSPATH@
#-------------------------------------------------
# Nothing below this line should need modification
export PVSIOTCCS=nil
export PVSIOVERB=nil
export PVSIOTIME=nil
export PVSIOVERSION="PVSio-6.0 (12/12/12)"
export PVSIOPROMPTIN="<PVSio> "
export PVSIOPROMPTOUT="==>~%"
PACK=PVSio
usage() {
echo "pvsio {<option>}* <pvsfile>@[<theory>[:<main>]]
where <option> can be
-h|--help
Print this message
-p|--packages <P1>,..,<Pn>
Load packages (prelude libraries) <P1>,..,<Pn>
-promptin <string>
Change prompt \"$PVSIOPROMPTIN\" to <string>
-promptout <string>
Change prompt \"$PVSIOPROMPTOUT\" to <string>
-t|--tccs
Generate TCCs
-T|--timing
Print timing information for each evaluation
-v|--version
Print PVSio version
-V|--verbose
Print typechecking information
-l|--lisp allegro|cmulisp,sbclisp
Specify a particular PVS binary to execute PVSio. Use this option only
if you know what you are doing.
<pvsfile>@<theory>:<main>
Load <theory> from <pvsfile>, evaluate <main> and exit
One-letter options can be combined. If <theory> is not provided,
it is assumed to have the same name as the name of the file. If <main> is
not provided, PVSio starts a top level read-eval-loop.
"
}
while [ $# -gt 0 ]
do
case $1 in
-h|-help|--help)
usage
exit 0;;
-l|-lisp|--lisp)
case $2 in
allegro) PVSLISP='-lisp allegro';;
cmulisp) PVSLISP='-lisp cmulisp';;
sbclisp) PVSLISP='-lisp sbclisp';;
*) echo "Only allegro, cmulisp, and sbclisp are currently available"
exit 1;;
esac
shift;;
-p|-packages|--packages)
PACK="$PACK,$2"
shift;;
-promptin)
PVSIOPROMPTIN="$2"
shift;;
-promptout)
PVSIOPROMPTOUT="$2"
shift;;
-tccs|--tccs)
PVSIOTCCS=t;;
-timing|--timing)
PVSIOTIME=t;;
-verbose|--verbose)
PVSIOVERB=t;;
-v|-version|--version)
echo $PVSIOVERSION
exit 0;;
-*)
OPTS=`echo "$1" | sed -e s/-//g -e "s/\(.\)/\1 /g"`
for opt in $OPTS
do
case $opt in
t)
PVSIOTCCS=t;;
T)
PVSIOTIME=t;;
V)
PVSIOVERB=t;;
*)
usage
echo "Error: -$opt is not a valid option"
exit 1;;
esac
done;;
*)
ARG="$1"
esac
shift
done
PACK=`echo "(\"$PACK\")" | sed -e "s/,/\" \"/g"`
if [ -z "$ARG" ]
then
echo "pvsio__ : THEORY BEGIN pvsio__ : void = TRUE END pvsio__" > /tmp/pvsio__.pvs
ARG="/tmp/pvsio__"
fi
MAIN=
case $ARG in
*@*) FILE=`echo $ARG | sed -e "s/\([^@]*\)@.*/\1/"`
THMA=`echo $ARG | sed -e "s/[^@]*@//"`;;
*) FILE=$ARG
esac
DIR=`dirname $FILE`
NAME=`basename $FILE .pvs`
FILE="$DIR/$NAME"
if [ ! -f "$FILE.pvs" ]
then
echo Error: "File $FILE.pvs doesn't exist"
exit 0
fi
case $THMA in
*:*) THEORY=`echo $THMA | sed -e "s/\([^:]\):.*$/\1/"`
MAIN=`echo $THMA | sed -e "s/[^:]*://"`;;
*) THEORY=$THMA
esac
if [ -z "$THEORY" ]
then
THEORY=$NAME
fi
if [ -z "$MAIN" ]
then MAIN=nil
else MAIN="\"$MAIN;\""
fi
export PVSIOFILE=$FILE
export PVSIOTHEORY=$THEORY
export PVSIOPACK=$PACK
export PVSIOMAIN=$MAIN
$PVSPATH/pvs -raw $PVSLISP -E "(run-pvsio)"