| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | (C_PLUSPLUS) PORTABLE DIF |
DM> create a program with the following spec: DM> DM> 1. Written in pure, portable C or C++ DM> 2. Can produce a "diff", or "difference", I've got something like that.... It's only 160 lines... DM> 3. No line, whether context, addition or deletion, should exceed 75 DM> 4. Can have a maximum number of lines per output file. See CSplit. Why not just use csplit to "wrap" the output. (pun intended) DM> Comparator: This will need some sort of memory to remember a number of DM> lines to produce the context for output. you know, I just made _extensive_ use of fseek() :) that's why I run a disk cache :) setting the buffers to 32K helps too. (see my code) DM> Anyone want to take a crack at it? :-) I'll post some source, you should be able to add the features you want fairly easily. mine does line numbers, but by adding a ring-buffer to hold the file offsets of the previous lines you'd be able to fseek back to a few lines before the first non-matchine line... while I was de-bugging it I used all sorts of different ouput code, all the output code is "centralised" in one location, so it's easy to change it to produce different output styles.... And now the bad news... How much context is sufficient? there may be more than one place where a line or sequence of lines occurrs in a program, managing to get a sufficient amount of context without being wastefull seems tobe a matter of re-scanning the file from the location of the last "edit" to check how much context is needed. The other problem with my code is that it never gives up, if you give it 2 1000 line files with no matches, it'll make sure, by comparing every line in each file... with every line in the other file... that could take a while. I'll post what I have now, and let everyone here "featurise" it for me :) (Code in next messages) Bye. --- EzyQwk V1.20 01fa018d* Origin: CSS Brisbane, Qld, Australia. [61-7-3367-3890] (3:640/350) 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: 640/350 201 270/101 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™.