CPCWiki forum

General Category => Applications (CPC and CPC-related) => Topic started by: madram on 13:01, 20 August 16

Title: (Visual) file comparison, aka Diff (Amsdos, CP/M, FutureOs, SymbOS, ...)
Post by: madram on 13:01, 20 August 16
Hi and hello,
I'm looking for any tools to compare 2 ascii files. Either giving a diff (best) and/or displaying them both on the screen.
Ok for displaying 2 files SymbOS should do the trick, but automatic comparison is what I'm longing for.


If I recall well, Promerge allows to open 2 files, but can they be compared ?







Title: Re: (Visual) file comparison, aka Diff (Amsdos, CP/M, FutureOs, SymbOS, ...)
Post by: HAL6128 on 16:54, 20 August 16
Don't if it helps but Utopia can compare data in RAM and a file.
Title: Re: (Visual) file comparison, aka Diff (Amsdos, CP/M, FutureOs, SymbOS, ...)
Post by: Audronic on 23:41, 20 August 16
@madram (http://www.cpcwiki.eu/forum/index.php?action=profile;u=1459)
I bring the files to a MAC and use HexEdit.
I also use HexEdit to Edit Roms.
Ray
Title: Re: (Visual) file comparison, aka Diff (Amsdos, CP/M, FutureOs, SymbOS, ...)
Post by: HAL6128 on 10:22, 21 August 16
...of course NotePad+ on PC side has a good comparing tool.
Title: Re: (Visual) file comparison, aka Diff (Amsdos, CP/M, FutureOs, SymbOS, ...)
Post by: netmercer on 19:28, 21 August 16
Hi,
there is a very useful tool under CP/M, which does this job. It's called "TCOMP.COM" (text compare) and is available from SIG-M disk no. 289 (COMPARE.LBR).

Kind regards
netmercer
Title: Re: (Visual) file comparison, aka Diff (Amsdos, CP/M, FutureOs, SymbOS, ...)
Post by: TFM on 00:19, 22 August 16
Yes, there are few great tools for CP/M to compare files. Also there is the great ASCII tools for CPC under CP/M Plus.  :)




If you need a tool for FutureOS just let me know, then i will make one. You can use/compare as much files at the same time as you want.
Title: Re: (Visual) file comparison, aka Diff (Amsdos, CP/M, FutureOs, SymbOS, ...)
Post by: madram on 08:57, 22 August 16
Thanks all!


@netmercer (http://www.cpcwiki.eu/forum/index.php?action=profile;u=1266) Which tool do you suggest to unpack LBR files?
@TFM (http://www.cpcwiki.eu/forum/index.php?action=profile;u=179) That's quite vague! Mind to name a few?
@Audronic (http://www.cpcwiki.eu/forum/index.php?action=profile;u=1169). There was a MACINTOSH emulator on the Atari ST, but nothing like that for CPC I guess.


Transfering files on another machine is not a serious solution!
Title: Re: (Visual) file comparison, aka Diff (Amsdos, CP/M, FutureOs, SymbOS, ...)
Post by: Audronic on 09:03, 22 August 16
@madram (http://www.cpcwiki.eu/forum/index.php?action=profile;u=1459)
Were there some older ROMS that had a range of tools in them.? ?
Ray

Title: Re: (Visual) file comparison, aka Diff (Amsdos, CP/M, FutureOs, SymbOS, ...)
Post by: SRS on 11:30, 22 August 16
Ascii-Tools:

ASCII Tools - CPCWiki (http://www.cpcwiki.eu/index.php/ASCII_Tools)
Title: Re: (Visual) file comparison, aka Diff (Amsdos, CP/M, FutureOs, SymbOS, ...)
Post by: TFM on 16:45, 22 August 16
Quote from: madram on 08:57, 22 August 16
@TFM (http://www.cpcwiki.eu/forum/index.php?action=profile;u=179) That's quite vague! Mind to name a few?


Wished I could, currently only my work pc runs, so I can't access my own stuff sadly. But you can check the public domain of CP/M in the internet, f.e. SIGM and ZCPR stuff included. It should be still out there.
Title: Re: (Visual) file comparison, aka Diff (Amsdos, CP/M, FutureOs, SymbOS, ...)
Post by: netmercer on 22:53, 23 August 16
Hi,

there are several tools for managing libary files, for example the improved "NULU.COM".
I have attached the TCOMP.COM file as RAR for you.
Visit the great "www.gaby.de" homepage for a lot of CP/M stuff and links.

Quote from: madram on 08:57, 22 August 16

Transfering files on another machine is not a serious solution!

You are absolutely right.   :D

Kind regards
netmercer
Title: Re: (Visual) file comparison, aka Diff (Amsdos, CP/M, FutureOs, SymbOS, ...)
Post by: madram on 17:36, 24 August 16
@TFM (http://www.cpcwiki.eu/forum/index.php?action=profile;u=179)  In FutureOs, a visual diff (à la vim -d / meld / kdiff3 / beyond compare ...) would be terrific.
Title: Re: (Visual) file comparison, aka Diff (Amsdos, CP/M, FutureOs, SymbOS, ...)
Post by: TFM on 18:40, 24 August 16
Quote from: madram on 17:36, 24 August 16
@TFM (http://www.cpcwiki.eu/forum/index.php?action=profile;u=179)  In FutureOs, a visual diff (à la vim -d / meld / kdiff3 / beyond compare ...) would be terrific.


Sorry, got no idea about non-Z80 OS/computer. So what does a "vim -d / meld / kdiff3 / beyond compare" do? Or more easy what do you want it to do?
:)
Title: Re: (Visual) file comparison, aka Diff (Amsdos, CP/M, FutureOs, SymbOS, ...)
Post by: madram on 19:13, 24 August 16
Visual "diff" allows to easily locate and monitor modifications/insertions/deletions between 2 files, with full context.

One image better than 52 words :

(http://meld.sourceforge.net/meld_file1.png)

The visualization part is the most needed. In a second time, editing/merge facilities are very welcome.
A smart diff is complex thus/and fun to code, but it doesn't need to be very sophisticated as long as it is offered to manually align some parts (hints for "synchronization points").
 



Title: Re: (Visual) file comparison, aka Diff (Amsdos, CP/M, FutureOs, SymbOS, ...)
Post by: Prodatron on 19:40, 24 August 16
I never had a deeper look at these algorythms for file comparisons. It's quite a very interestic topic, and I really wonder what is the best methode for that.
The problem for 8bit machines might be the size of the "window" which can be used for the comparison.
E.g. if the part of the source code, which has been added to the new version, is too large, an limited 8bit machine could have some problems?
It was the same issue for decompression algorithms, and I was really glad, that the famouse deflate algorithm (ZIP, GZIP, PNG etc) only requires a 32K "window". But that might be not enough for some file comparisons?
Title: Re: (Visual) file comparison, aka Diff (Amsdos, CP/M, FutureOs, SymbOS, ...)
Post by: Munchausen on 12:21, 25 August 16
Quote from: Prodatron on 19:40, 24 August 16
I never had a deeper look at these algorythms for file comparisons. It's quite a very interestic topic, and I really wonder what is the best methode for that.
The problem for 8bit machines might be the size of the "window" which can be used for the comparison.
E.g. if the part of the source code, which has been added to the new version, is too large, an limited 8bit machine could have some problems?
It was the same issue for decompression algorithms, and I was really glad, that the famouse deflate algorithm (ZIP, GZIP, PNG etc) only requires a 32K "window". But that might be not enough for some file comparisons?

There are lots of papers on the topic (was researching them a while back for another task), you're looking at the line oriented longest common subsequence (LCS) problem, the classic (1985/86) algorithm is described in "An O(ND) difference algorithm and its variations" [1] but there will be lots of newer stuff as well.

[1] http://www.xmailserver.org/diff2.pdf (http://www.xmailserver.org/diff2.pdf)
Title: Re: (Visual) file comparison, aka Diff (Amsdos, CP/M, FutureOs, SymbOS, ...)
Post by: TFM on 15:19, 25 August 16
Quote from: madram on 19:13, 24 August 16
One image better than 52 words :
Indeed. That looks great! The idea with the arrows is nice, so you can transfer blocks from one to another file.
Now it would be fun to have that for more that two files, right? Looks like a fun project on CPC.  :)


Quote from: Munchausen on 12:21, 25 August 16
There are lots of papers on the topic ...
The fun about it so do it without studying other ideas, but to invent a cool and quick algorithm by oneself - IMHO.  ;)
Title: Re: (Visual) file comparison, aka Diff (Amsdos, CP/M, FutureOs, SymbOS, ...)
Post by: Prodatron on 16:22, 25 August 16
Quote from: Munchausen on 12:21, 25 August 16
There are lots of papers on the topic (was researching them a while back for another task), you're looking at the line oriented longest common subsequence (LCS) problem, the classic (1985/86) algorithm is described in "An O(ND) difference algorithm and its variations" [1] but there will be lots of newer stuff as well.

[1] http://www.xmailserver.org/diff2.pdf (http://www.xmailserver.org/diff2.pdf)
I already suspected, that this isn't a trivial one.
Here is an interesting Wikipedia article about it:
Longest common subsequence problem - Wikipedia, the free encyclopedia (https://en.wikipedia.org/wiki/Longest_common_subsequence_problem)
which is mentioned in the diff article:
diff utility - Wikipedia, the free encyclopedia (https://en.wikipedia.org/wiki/Diff_utility#Algorithm)
Title: Re: (Visual) file comparison, aka Diff (Amsdos, CP/M, FutureOs, SymbOS, ...)
Post by: madram on 02:35, 29 August 16

Quote
For displaying 2 files SymbOS should do the trick.


Not quite!
Quote
I have attached the TCOMP.COM file as RAR for you.


Thank you very much. TCOMP seems to do a pretty good diff job (mismatch vs insertion/deletion), but :

Quote
The fun about it so do it without studying other ideas.

I tend to agree! The constraints on CPC are not quite the same. Prodatron is right, fixed window/look-ahead will limit the size of inserted blocs which can be detected as so. But once again, allowing manual synchronization points (which amounts to internally split files and compare each portion independently) can save the day (I sometimes wish I had them even with modern & sophisticated algorithms).

Quote
Now it would be fun to have that for more that two files, right?

A typical use case is to have one "base" file and two distinct evolutions of this file. Then, a forth window can be needed for the output file (merging the two evolutions)!
But a simple two-way visual diff would be a really good and useful start.   
Title: Re: (Visual) file comparison, aka Diff (Amsdos, CP/M, FutureOs, SymbOS, ...)
Post by: TFM on 15:57, 29 August 16
Ah, that's actually a good idea (to make a new file out of some source files). Well, we may end up with an file comparing text editior. But why not?  :)
Powered by SMFPacks Menu Editor Mod