7 unshift @d, "# dummy line to make line 1 index 1 in \@d\n";
10 our $count_i_last_l_ok;
15 if ($i == $i_last_l_ok) {
16 confess $i if $count_i_last_l_ok++ > 50;
18 $count_i_last_l_ok = 0;
22 return unless $i < @d;
24 #print STDERR "L $i\n";
30 confess $i unless l_ok $i;
33 our ($ifilehead, $ihunkhead, $ichunkstart, $ichunkend);
34 our ($before, $after);
36 sub analyse_chunk () {
37 print Dumper($ichunkstart, $ichunkend, $before, $after);
41 for ($ifilehead = 0; l_ok $ifilehead; $ifilehead++) {
43 while (l_ok $ifilehead and m{^diff|^index|^---|^\Q+++\E}) { $ifilehead++ }
44 $ihunkhead = $ifilehead;
45 while (l_ok $ihunkhead) {
46 m{^\@\@} or confess "$ihunkhead $_ ?";
47 my $i = $ihunkhead + 1;
49 if (!l_ok $i or m{^ } or m{^\@\@}) {
50 if (defined $ichunkstart) {
53 $ichunkstart = $ichunkend = $before = $after = undef;
58 my $which = $& eq '-' ? \$before : \$after;