Script Library: 1238 scripts
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
View scriptLicenseDownload documentation as: HTML or editable
Download scriptHistoryOther scripts by: gabriele

Documentation for: reboldiff.r


DIFF and PATCH functions for REBOL


The script defines two functions, DIFF and PATCH. DIFF accepts two files (or blocks of strings, or ports in /lines mode), and returns a dialect block representing the differences between the two files. The result is so that if you apply it with PATCH to the first file, you get the second file.

PATCH accepts a file (or block, or port in /lines mode) and a diff block, and applies the differences to the file.

The dialect block is made of integers and strings. A positive integer means inserting new lines at that (absolute) offset, and it is followed by some strings representing the new lines to insert. A negative integer means removing lines, and it is followed by a positive integer indicating the number of lines to be removed. See the source of PATCH for more details about how to handle a diff block.

MakeDoc2 by REBOL- 29-Jul-2005