Files
mercury/samples/diff
Andrew Bromage bc0a109801 Modified files
Estimated hours taken: 30

Modified files
--------------

samples/diff/README:
	Info about this new version.  Put the existing READMEs in
	reverse order, so that they'll be in the most sensible order
	for someone reading top-down.

samples/diff/Mmakefile:
	Supply more detail about which bit of this program GCC 2.7.2
	under Digital Unix 3.2 doesn't compile properly.

samples/diff/diff.m:
	Slight reorganisation.  Accept options, remove some high
	coupling betweem diff__do_diff and lcss.m.

samples/diff/file.m:
	Add support for attaching a filename to a file.

samples/diff/lcss.m:
	Add more documentation, one slight performance improvement.
	lcss__to_diff now works on the reversed LCSS, to avoid going
	to the trouble of reversing it.

New files
---------

samples/diff/TODO:
	Meaning should be obvious.

samples/diff/diff_out.m:
	Replacement for diffs.m (which was never a very good name).
	Now contains code to display a diff in lots more output
	styles than previously supported.

samples/diff/difftype.m:
	Replacement for lcsstype.m.  Contains the type of a diff (but
	not of an lcss, which is now local to lcss.m, hence the
	renaming).

samples/diff/filter.m:
	Contains code to filter a diff before being displayed.  This
	is only required if the user specified that they didn't want
	to see part of the diff (e.g. with --ignore-blank-lines).

samples/diff/globals.m:
samples/diff/options.m:
	Support for option handling.

Removed files
-------------

samples/diff/diffs.m:
	Functionality moved to diff_out.m.

samples/diff/lcsstype.m:
	Functionality moved to difftype.m.
1998-01-13 00:52:08 +00:00
..
1998-01-13 00:52:08 +00:00
1998-01-13 00:52:08 +00:00
1998-01-13 00:52:08 +00:00
1998-01-13 00:52:08 +00:00
1998-01-13 00:52:08 +00:00
1998-01-13 00:52:08 +00:00
1998-01-13 00:52:08 +00:00
1998-01-13 00:52:08 +00:00
1998-01-13 00:52:08 +00:00
1998-01-13 00:52:08 +00:00
1998-01-13 00:52:08 +00:00

This is now looking a LOT more like the standard "diff" utility.  There
are a few features missing (e.g. we can't do directory diffs), but apart
from that, it seems to work.

The major changes in this version are:

	- We now accept command-line options.  In particular, we
	  recognise all options that are accepted by GNU diff,
	  though a lot of them result in error reports and a few
	  which have do nothing to do with the output format or
	  semantics, but are merely for efficiency, are accepted
	  and ignored.

	- We support different output formats, in particular all
	  of the output formats supported by GNU diff. There are
	  a number of modifiers to the output formats (for example,
	  --expand-tabs) which we don't yet support.

	- Just about everything (except the actual diff algorithm)
	  has been modified to support the above changes.

	- Lots of cleanups, lots more documentation.

Examine the file TODO to see what's still missing.

Andrew Bromage  8 Jan 1998

===========================================================================

The version which appears here is a re-hacked version of Marnix Klooster's
hacked version of my original.  Special thanks to him for making my code
a lot more maintainable than it originally was.  :-)

The changes from the previous version:

	- Bug fix for a problem which was causing it to bomb out if
	  the two files were identical.

	- Changed indenting so it more closely matches the Mercury
	  compiler coding standard.

	- Update to use unique arrays (now called array.m).

	- Various minor documentation tweaks.

Oh, and it still runs in nowhere near the speed of GNU diff.

Andrew Bromage  28 Jul 1997

===========================================================================

The Mercury modules in this directory have been derived from the
'diff' sample distributed with Mercury 0.6.  That sample carries the
following copyright information, description and to-do list (in
diff.m):


%-----------------------------------------------------------------------------%
% Copyright (C) 1995 The University of Melbourne.
% This file may only be copied under the terms of the GNU General
% Public License - see the file COPYING in the Mercury distribution.
%-----------------------------------------------------------------------------%

% File: diff.m
% Main author: bromage

% Something very similar to the standard diff utility.  Sort of.  :-)

% On the still-to-do list:
%	- Add command-line options.  Probably:
%		--ignore-all-space
%		--ignore-blank-lines
%		--ignore-case
%		--rcs
%	  What others are easy and don't break up the code?


The major changes I made were

* Moved code for manipulating and displaying diffs to a separate
  module called diffs.m (and changed their calls in diff.m).  The type
  'lcss,' needed both by the rest of lcss.m and by diffs.m, was moved
  to a new module lcsstype.m.

* Made lcss.m independent of files, and allowed it to process any kind
  of list by adding polymorphism.  (The file processing calls have
  been moved to diff.m.)

* Added type synonyms 'pos' and 'segment' in diffs.m to clarify the
  types.  Renamed 'single_diff' to 'edit'.

* Added end-of-file match to the generated lcss, thereby allowing the
  to_diff predicate to be simplified considerably.

* Numbered lists from 0 internally in the lcss-algorithm.  This made
  to_diff simpler still, but also forced changes in the diff-printing
  part.

* Removed the swapping in find_lcss, because it doesn't seem to help.

* The array(string) representing a file in file.m was also renumbered
  to begin with 0.

* Added and corrected comments.

Have fun,

 <><

Marnix
--
Marnix Klooster
marnix@worldonline.nl