-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathfind_errors.pl
45 lines (40 loc) · 1.74 KB
/
find_errors.pl
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
#! /usr/bin/perl
@hafs_counts = (7, 286, 200, 176, 120, 165, 206, 75, 129, 109, 123, 111,
43, 52, 99, 128, 111, 110, 98, 135, 112, 78, 118, 64, 77,
227, 93, 88, 69, 60, 34, 30, 73, 54, 45, 83, 182, 88, 75,
85, 54, 53, 89, 59, 37, 35, 38, 29, 18, 45, 60, 49, 62, 55,
78, 96, 29, 22, 24, 13, 14, 11, 11, 18, 12, 12, 30, 52, 52,
44, 28, 28, 20, 56, 40, 31, 50, 40, 46, 42, 29, 19, 36, 25,
22, 17, 19, 26, 30, 20, 15, 21, 11, 8, 8, 19, 5, 8, 8, 11,
11, 8, 3, 9, 5, 4, 7, 3, 6, 3, 5, 4, 5, 6);
@warsh_counts = (7, 285, 200, 175, 122, 167, 206, 76, 130, 109, 121, 111,
44, 54, 99, 128, 110, 105, 99, 134, 111, 76, 119, 62, 77,
226, 95, 88, 69, 59, 33, 30, 73, 54, 46, 82, 182, 86, 72,
84, 53, 50, 89, 56, 36, 34, 39, 29, 18, 45, 60, 47, 61, 55,
77, 99, 28, 21, 24, 13, 14, 11, 11, 18, 12, 12, 31, 52, 52,
44, 30, 28, 18, 55, 39, 31, 50, 40, 45, 42, 29, 19, 36, 25,
22, 17, 19, 26, 32, 20, 15, 21, 11, 8, 8, 20, 5, 8, 9, 11,
10, 8, 3, 9, 5, 5, 6, 3, 6, 3, 5, 4, 5, 6);
# important!
@counts = @hafs_counts;
$ayat = 0;
$sura = 1;
$current_target = $counts[0];
while (<>) {
if ($_ =~ /found: (\d+) ayat on page (\d+)/) {
if ($ayat + int($1) >= $current_target) {
$ayat = $ayat + int($1);
while ($ayat > $current_target && $sura < 115) {
$ayat = $ayat - $current_target;
$current_target = $counts[$sura++];
$page = int($2) + ($ayat == 0 ? 1 : 0);
if ($sura < 115) {
print "sura $sura starts on page $page\n";
}
}
} else {
$ayat = $ayat + int($1);
print "page $2 ends with $ayat\n";
}
}
}