I want these functions:
proc diff {old new} -> # diff data "ddata"
proc patch {old ddata} -> # new
where old and new are strings.
I thought the Tcllib's rcs module could do this but I can't figure it out.
Is this possible using the rcs module or using the struct::list module's
LCS functions?
Mark Summerfield <m.n.summerfield@gmail.com> posted:out.
I want these functions:
proc diff {old new} -> # diff data "ddata"
proc patch {old ddata} -> # new
where old and new are strings.
I thought the Tcllib's rcs module could do this but I can't figure it
module's
Is this possible using the rcs module or using the struct::list
package,LCS functions?
The patch functionality (but not the diff) is provided by the textutil
if I understand it correctly.
Mark Summerfield <m.n.summerfield@gmail.com> posted:
I want these functions:
proc diff {old new} -> # diff data "ddata"
proc patch {old ddata} -> # new
where old and new are strings.
I thought the Tcllib's rcs module could do this but I can't figure it
out.
Is this possible using the rcs module or using the struct::list
module's LCS functions?
The patch functionality (but not the diff) is provided by the textutil package,
if I understand it correctly.
I want these functions:
proc diff {old new} -> # diff data "ddata"
proc patch {old ddata} -> # new
where old and new are strings.
I thought the Tcllib's rcs module could do this but I can't figure it out.
Is this possible using the rcs module or using the struct::list module's
LCS functions?
Mark Summerfield <m.n.summerfield@gmail.com> wrote:
I want these functions:
proc diff {old new} -> # diff data "ddata"
proc patch {old ddata} -> # new
where old and new are strings.
I thought the Tcllib's rcs module could do this but I can't figure it
out.
Is this possible using the rcs module or using the struct::list
module's LCS functions?
The core of the diff algorithm is LCS. You want the LCS functions from struct::list.
But, you don't get a "diff" from the LCS procs, you get the LCS data,
you then have to convert that into a "diff" format of your choice.
You likely want to look at the various "diff in tcl" pages on the wiki.
A starting point: https://wiki.tcl-lang.org/page/diff+in+Tcl
If you don't mind binary extensions, you may want to look at the DiffUtil package - https://github.com/pspjuth/DiffUtilTcl
% package require DiffUtil
0.4.1
% DiffUtil::diffStrings abcdefgh abXdefgY
ab ab c X defg defg h Y {} {}
I don't think it's been ported to Tcl 9 though.
/Ashok
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,064 |
Nodes: | 10 (0 / 10) |
Uptime: | 163:56:42 |
Calls: | 13,691 |
Calls today: | 1 |
Files: | 186,936 |
D/L today: |
9,208 files (2,741M bytes) |
Messages: | 2,411,516 |