| 734 | producing an edit script in forward order. */ |
| 735 | |
| 736 | GnuDiff::change *GnuDiff::build_script(file_data const filevec[]) |
| 737 | { |
| 738 | change *script = nullptr; |
| 739 | bool *changed0 = filevec[0].changed; |
| 740 | bool *changed1 = filevec[1].changed; |
| 741 | GNULineRef i0 = filevec[0].buffered_lines, i1 = filevec[1].buffered_lines; |
| 742 | |
| 743 | /* Note that changedN[-1] does exist, and is 0. */ |
| 744 | |
| 745 | while(i0 >= 0 || i1 >= 0) |
| 746 | { |
| 747 | if(changed0[i0 - 1] | changed1[i1 - 1]) |
| 748 | { |
| 749 | GNULineRef line0 = i0, line1 = i1; |
| 750 | |
| 751 | /* Find # lines changed here in each file. */ |
| 752 | while(changed0[i0 - 1]) --i0; |
| 753 | while(changed1[i1 - 1]) --i1; |
| 754 | |
| 755 | /* Record this change. */ |
| 756 | script = add_change(i0, i1, line0 - i0, line1 - i1, script); |
| 757 | } |
| 758 | |
| 759 | /* We have reached lines in the two files that match each other. */ |
| 760 | i0--, i1--; |
| 761 | } |
| 762 | |
| 763 | return script; |
| 764 | } |
| 765 | |
| 766 | /* Report the differences of two files. */ |
| 767 | GnuDiff::change *GnuDiff::diff_2_files(comparison *cmp) |
nothing calls this directly
no outgoing calls
no test coverage detected