Skip to content

Commit 0c824dc

Browse files
authored
Prefix hash (#48)
* first try for script * fix some script warnings * fix format
1 parent 69996eb commit 0c824dc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/scripts/ptc.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,13 @@ sed --in-place '/^\/\/NOLINTNEXTLINE(readability-identifier-naming)$/d' ../libra
2929
#adds hash code comments
3030
chmod +x ../library/contest/hash.sh
3131
for header in ../library/**/*.hpp; do
32-
hash=$(sed '/^#include/d' "$header" | cpp -dD -P -fpreprocessed | ./../library/contest/hash.sh)
33-
sed --in-place "1i //hash: $hash" "$header"
32+
echo "$header"
33+
cp "$header" input
34+
lines="$(wc -l <input)"
35+
for i in $(seq 1 "$lines"); do
36+
hash=$(head -n "$i" input | sed '/^#include/d' | cpp -dD -P -fpreprocessed | ./../library/contest/hash.sh)
37+
sed -i "${i}s/^/\/\*${hash}\*\/ /" "$header"
38+
done
3439
done
3540

3641
git submodule init

0 commit comments

Comments
 (0)