Lazarus

Installation => General => Topic started by: DaltonCalford on October 22, 2009, 10:17:47 pm

Title: Native Pascal code for Diff utility?
Post by: DaltonCalford on October 22, 2009, 10:17:47 pm
Hi all,
I am writing a series of components for Firebird (UDF'S) that will get compiled into a general use library.   The code is compiled by Freepascal and I will be calling the firebird code from lazarus.

I was wondering if anyone knew where i could find some reference code in pascal that would perform the same task as diff does?   I want to perform the task on text blobs in the database.

Thanks in advance.

Dalton
Title: Re: Native Pascal code for Diff utility?
Post by: Leledumbo on October 24, 2009, 09:50:08 am
Lazarus source includes support for diff, you just need to look for it.
Title: Re: Native Pascal code for Diff utility?
Post by: Ñuño_Martínez on October 27, 2009, 12:14:46 pm
I think he's looking for Pascal source code to generate diff-data.

If you're using *NIX may be you can call the "diff" command and get it's output via a pipe. I can't remember how to create a pipe on Pascal but I'm sure it's possible.

If you actually need Pascal code to do the work, I did wrote a small program that does it. It was pretty simple and detects fairly differences but it's slower and less perfect than other tools, and I'm not sure it will work with binary data (I'd test it only with text data). It uses a sort of "incremental search". I found the algorithm incrementally: I did a simple diff-search program, then optimize it a bit, then a bit more, until I can't do it better. Most diff tools uses table-guided searches or matrix based algorithms much more complex than the mine. The sad thing is it was written in Spanish (naming and documentation).

I never released the code, but if you need it I'll give it to you with a MIT or ZLib license (open & free).
Title: Re: Native Pascal code for Diff utility?
Post by: Leledumbo on October 28, 2009, 07:47:45 am
Quote
I think he's looking for Pascal source code to generate diff-data.
I know. Lazarus has that support and the source code is given, so it must be somewhere in the .pas / .pp in Lazarus directory.
TinyPortal © 2005-2018