TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: All
from: Darin McBride
date: 1998-12-13 13:14:52
subject: (C_PLUSPLUS) portable diff for echomail?

* Original Area: C_PLUSPLUS
* Original To  : All (1:250/102)
* Original Subj: portable diff for echomail?

I was kinda looking at this latest version of CSplit, and in trying to get
it to work on my compiler, I found some problems.  Which I then kinda
posted.  I'm wondering if it would be worth hosting a contest to create a
program with the following spec:

1. Written in pure, portable C or C++, where "portable" means
that it works on multiple compilers on multiple OS's, even if that means
using dirport.h or other such time-saving devices from the Snippets.

2. Can produce a "diff", or "difference", between
original and changed files.  This should not be line-number dependant, but
should be able to use "context".  Should be able to handle
removals as well as additions.  (Replacements can be handled separately,
but probably are best handled as a removal followed by an addition.)

3. No line, whether context, addition or deletion, should exceed 75
characters, whether or not the context, addition, or deletion exceeds 75
characters.  See CSplit's handling.

4. Can have a maximum number of lines per output file.  See CSplit.

5. Can handle multiple files simultaneously, and put all the output into
one set of files.

From what I can see, this would involve a number of "engines" to
make this all straight forward.  These engines could either be modules (C)
or objects (C++).

Read/Write line: Read a line from a file.  Should not depend on a maximum
possible length, but be dynamic.  Something like C++'s string object. 
Lowest level access to files.

Read/Write diff file: When writing, will use the given maximum lines, and
start new files appropriately.  Low level access to the diff files.

Read/Write diff line: When writing, will split the line.  When reading,
will rejoin the line(s).  Abstracts the access to the diff files.

Comparator: This will need some sort of memory to remember a number of
lines to produce the context for output.  During the application of a diff
file, the memory isn't actually needed.  Should be a straight,
case-sensitive comparison of line to line, although the line numbers may
not match up.  May have enough intelligence to know that when a single line
has had the line before and after it added, but it hasn't changed, that
removing the line then adding three lines may produce a tighter diff file
(bonus points :->).

Anyone want to take a crack at it?  :-)


---
* Origin: Tanktalus' Tower BBS (1:250/102)
SEEN-BY: 396/1 632/0 371 633/260 262 267 270 371 634/397 635/506 728 639/252
SEEN-BY: 670/218
@PATH: 250/102 201 99 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.