Mega Code Archive

 
Categories / Delphi / Examples
 

Algorithms alfresco what’s the difference

Julian Bucknall wants to find the longest common subsequence: that’s file differencing to you and me. What the article was trying to show, and what I wanted to do, was write a routine that would take two copies of the same text file, one being a later edition of the other, presumably containing several differences, and work out what changes were made in going from the older file to the newer. Unix has a program to do this called DIFF, which is the granddaddy of all file difference programs. I use one from the Windows SDK called WinDiff. This displays the two versions of the file as vertical bars side by side with lines going from the left bar to the right bar recording the changes. The red lines are deletions, the yellow ones insertions. You can also see the text lines as well in the same manner (text lines in red are deleted, text lines in yellow are inserted). This tool is invaluable for me; for example, I use it to determine changes in the VCL source code between one version of Delphi and the next. Visual SourceSafe (the version control system we use) also has a tool like this for showing the differences between one version of a source file and another: this has saved my bacon many a time.