7065
|
1 |
#!/bin/bash
|
|
2 |
#
|
|
3 |
# $Id$
|
|
4 |
#
|
|
5 |
# DESCRIPTION: fix occurences of numerals in HOL/ZF terms
|
|
6 |
|
|
7 |
|
|
8 |
## diagnostics
|
|
9 |
|
|
10 |
PRG=$(basename $0)
|
|
11 |
|
|
12 |
function usage()
|
|
13 |
{
|
|
14 |
echo
|
|
15 |
echo "Usage: $PRG [FILES|DIRS...]"
|
|
16 |
echo
|
|
17 |
echo " Options are:"
|
|
18 |
echo " -c add '(_::int)' type constraints (for HOL only)"
|
|
19 |
echo
|
|
20 |
echo " Recursively find .thy/.ML files, fixing occurences of"
|
|
21 |
echo " HOL/ZF numerals: #42 becomes 42, #-42 becomes ~42".
|
|
22 |
echo
|
|
23 |
echo " Renames old versions of FILES by appending \"~~\"."
|
|
24 |
echo
|
|
25 |
exit 1
|
|
26 |
}
|
|
27 |
|
|
28 |
|
|
29 |
## process command line
|
|
30 |
|
|
31 |
# options
|
|
32 |
|
|
33 |
CONSTRAINTS=false
|
|
34 |
|
|
35 |
while getopts "c" OPT
|
|
36 |
do
|
|
37 |
case "$OPT" in
|
|
38 |
c)
|
|
39 |
CONSTRAINTS=true
|
|
40 |
;;
|
|
41 |
\?)
|
|
42 |
usage
|
|
43 |
;;
|
|
44 |
esac
|
|
45 |
done
|
|
46 |
|
|
47 |
shift $(($OPTIND - 1))
|
|
48 |
|
|
49 |
|
|
50 |
# args
|
|
51 |
|
|
52 |
[ $# -eq 0 ] && usage
|
|
53 |
|
|
54 |
SPECS="$@"; shift $#
|
|
55 |
|
|
56 |
|
|
57 |
## main
|
|
58 |
|
|
59 |
#set by configure
|
|
60 |
AUTO_PERL=perl
|
|
61 |
|
|
62 |
find $SPECS \( -name \*.thy -o -name \*.ML \) -print | \
|
|
63 |
xargs $AUTO_PERL -w $ISABELLE_HOME/lib/scripts/fixnumerals.pl $CONSTRAINTS
|