Debian Codegraph @

dev/tools/deprecate_file.sh

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 usagescip-shell shell shell-project 0.0.0 usage().()
3 {
4 catscip-shell system . . cat. 1>&2 <<EOF
5 Usage: $0 FILE VERSION NOTE
6
7 Write deprecation attributes in a Rocq source file for all commands that
8 support it.
9 Example: $0 Heap.v 8.3 "Use mergesort.v"
10 EOF
11 }
12
13 case $# in
14 3) ;;
15 *) usagescip-shell shell shell-project 0.0.0 usage().; exit 1
16 esac
17
18 file=$1
19 vers=$2
20 note=$3
21
22 if ! [scip-shell system . . `[`. -f "$file" ]; then
23 printfscip-shell system . . printf. '%s: %s: No such file\n' "$0" "$file" 1>&2
24 exit 1
25 fi
26
27 attr="((Local|Global|Program|Canonical)[[:space:]]+)"
28
29 deprable="Theorem|Lemma|Fact|Corollary|Proposition|Property|\
30 Definition|Example|Fixpoint|\
31 Instance|Axiom|Parameter|Notation|Coercion"
32
33 annot="#[deprecated(since=\"$vers\", note=\"$note\")]"
34
35 tmp="$file".depr
36
37 sedscip-shell system . . sed. -E "s/(^[[:space:]]*)(($attr)*($deprable).*\$)/\\1$annot\\n\\1\\2/" \
38 "$file" >"$tmp"
39 mvscip-shell system . . mv. "$tmp" "$file"