Re: FindReplace


Subject: Re: FindReplace
From: Martin Sevior (msevior@mccubbin.ph.unimelb.edu.au)
Date: Thu Aug 03 2000 - 19:24:45 CDT


On Fri, 4 Aug 2000, Allan Shark Clark wrote:

> Hi
> Fiddling around with the find and replace, I have changed it so that it
> uses what I think is a faster string matching algorithm. Find the patch
> attached.
> There are still a couple of issues, one is the "magic number" where we
> struggle if the document is massive, we have at the moment a foundAt
> variable declared as a UT_sint32 and set to -1 which we later check to see
> if we have found the string, I thought a quick fix for just now would be to
> use an UT_uint32, this would give us twice the document size, we could

This is not neccessary. UT_sint32 allows us document sizes of > 1000
megabytes of characters. Someone working on a document that large should
not be using AbiWord.

> initialize it to the maxium for an int and then test to see if it was still
> that value when we want to know if the string has been found (true this
> would fail a bit if the string was found in that exact position but I don't
> think that's going to happen very often and the current method would fail
> anyway), I can't help thinking there is something wrong with this idea
> though, someone please point out the obvious that I'm missing.
> Secondly I'm going to change the findNext and _findNext functions to accept
> another argument which would be the prefix function of the find string, this
> would mean computing the prefix function could be done in the Replace dialog
> code that way when we do a ReplaceAll we don't have to continually
> re-compute the prefix function.

This seems like a good idea.

> I'll try it anyway see how it goes.
> Lastly once I have done that I was thinking of having a crack at
> implementing searching for regular expressions, just wanted to make sure
> that no-one else was currently working on this as I don't want to duplicate
> effort.

Be careful that regular "Church Secretary" does not need to know about
regular expressions to do a find and replace. I don't think anyone else is
working on this.

Good Luck!

Martin



This archive was generated by hypermail 2b25 : Thu Aug 03 2000 - 19:24:57 CDT