|
Algorithm::Diff3::Diff3 - diff3 plugin |
Algorithm::Diff3::Diff3 - diff3 plugin
use Algorithm::Diff3;
my $f = Algorithm::Diff3::Factory->new;
my $mytext = $f->create_text([ map{chomp;$_} <F0> ]);
my $original = $f->create_text([ map{chomp;$_} <F1> ]);
my $yourtext = $f->create_text([ map{chomp;$_} <F2> ]);
my $p = $f->create_diff3;
my $diff3 = $p->diff3( $mytext, $origial, $yourtext );
This is a plugin to compute differnce sets between three text buffers ported from GNU diff3.c written by Randy Smith.
Please see how to use this plugin through a factory in a Algorithm::Diff3 document.
diff3 processor needs to support of a two way diff plugin module. There are two requirements for a diff plugin module.
First, it must independ upon the policy of line numbers in text buffers.
Not only line numbers may start zero normally Perl's array, but also it
start one diff(1) command output. In this module, any line number scheme
is hidden in the capsul of text buffer class.
Second, it must adapt line number parameters in a delete range and an
append one due to the numbers of lines treatments in diff3 processor.
For instanse, diff plugin modifies the ranges in a same scheme of line
number started from 1 such as diff(1) command as follows.
diff(1) to modified; # original changed text 1c1 to 1,1c1,1; # [ qw( a b ) ] [ qw( A b ) ] 0a1 to 1,0a1,1; # [ qw( a b ) ] [ qw( A a b ) ] 1a2 to 2,1a2,2; # [ qw( a b ) ] [ qw( a B b ) ] 2a3 to 3,2a3,3; # [ qw( a b ) ] [ qw( a b C ) ] 1d0 to 1,1d1,0; # [ qw( A b c ) ] [ qw( b c ) ] 2d1 to 2,2d2,1; # [ qw( a B c ) ] [ qw( a c ) ] 3d2 to 3,3d3,2; # [ qw( a b C ) ] [ qw( a b ) ]
In change case at first one, do not happen modification. In append cases from second to 4th one, increment low line number for the original text side. In delete cases from 5th to 7th one, increment low line number for the modified text side.
Their line numbers are normally droped in the diff(1) command.
So that you do their modifications simply adding success value
from the output one if you make a plugin diff(1) command invoker.
GNU/diffutils/2.7/diff3.c
Three way file comparison program (diff3) for Project GNU. Copyright (C) 1988, 1989, 1992, 1993, 1994 Free Software Foundation, Inc. Written by Randy Smith
Algorithm::Diff3
MIZUTANI Tociyuki <tociyuki@gmail.com>
Copyright (C) 2005 MIZUTANI Tociyuki
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.
|
Algorithm::Diff3::Diff3 - diff3 plugin |