author | huffman |
Sat, 02 Apr 2005 00:33:51 +0200 | |
changeset 15651 | 4b393520846e |
parent 14981 | e73f8140af78 |
permissions | -rw-r--r-- |
5213
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
1 |
# |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
2 |
# $Id$ |
9789 | 3 |
# Author: Markus Wenzel, TU Muenchen |
5213
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
4 |
# |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
5 |
# fixdatatype.pl - adapt theories and proof scripts to new datatype package |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
6 |
# |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
7 |
|
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
8 |
sub fixdatatype { |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
9 |
my ($file) = @_; |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
10 |
|
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
11 |
open (FILE, $file) || die $!; |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
12 |
undef $/; $text = <FILE>; $/ = "\n"; # slurp whole file |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
13 |
close FILE || die $!; |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
14 |
|
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
15 |
$_ = $text; |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
16 |
|
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
17 |
## convert split_type_case[_asm] to type.split[_asm] |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
18 |
s/([^"])\bsplit_([\w]+)_case\b/$1$2.split/sg; |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
19 |
s/([^"])\bsplit_([\w]+)_case_asm\b/$1$2.split_asm/sg; |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
20 |
|
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
21 |
## delete function name and type after "primrec" |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
22 |
s/\bprimrec\b\s+([\w]+|"[^"]+")\s+([\w\.]+)/primrec/sg; |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
23 |
|
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
24 |
## replace specific induct_tac by generic induct_tac |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
25 |
s/[\w\.]+\.induct_tac/induct_tac/sg; |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
26 |
|
8444 | 27 |
## replace res_inst_tac ... natE by case_tac |
28 |
s/\bres_inst_tac\b\s*\[\s*\(\s*"[^"]+"\s*,\s*("[^"]+")\s*\)\s*\]\s*natE\b/case_tac $1/sg; |
|
5213
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
29 |
|
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
30 |
$result = $_; |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
31 |
|
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
32 |
if ($text ne $result) { |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
33 |
print STDERR "fixing $file\n"; |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
34 |
if (! -f "$file~~") { |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
35 |
rename $file, "$file~~" || die $!; |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
36 |
} |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
37 |
open (FILE, "> $file") || die $!; |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
38 |
print FILE $result; |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
39 |
close FILE || die $!; |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
40 |
} |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
41 |
} |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
42 |
|
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
43 |
|
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
44 |
## main |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
45 |
|
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
46 |
foreach $file (@ARGV) { |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
47 |
eval { &fixdatatype($file); }; |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
48 |
if ($@) { print STDERR "*** fixdatatype $file: ", $@, "\n"; } |
0aa62210e67c
Script that adapts theories and proof scripts to new datatype package.
berghofe
parents:
diff
changeset
|
49 |
} |