[sword-devel] NEED A HAND

Daniel Glassey sword-devel@crosswire.org
Thu, 20 Feb 2003 13:09:46 -0000


couple of queries - how do you want to deal with these?

from rwphtml:
if ((from - &text[maxlen - len]) > 10) {	// not the beginning of the 
entry

and from gbfmorph:
to--

On 20 Feb 2003 at 0:46, Troy A. Griffitts wrote:

> Hey guys.  I just added the new SWBuf class to the API and now need help 
> integrating it throughout.
> 
> CURRENT CVS IS BROKEN AND WON'T WORK TILL THIS IS DONE.
> 
> I was going to do it all myself, but realized that we have nearly 50 
> filters now!
> 
> SO, if you have cvs write access, please post a note claiming a few 
> filter that you are working on so we don't overlap our work.
> 
> 
> Here is the gist...
> 
> SWBuf works pretty much like string, except that it can operate on 
> buffers that aren't null terminated, as well.
> 
> Have a look at tests/swbuftest.cpp and include/swbuf.h
> 
> Up until yesterday there was a FILTER_PAD define that basically told us 
> how much to guess at allocating a buffer to be sure we had enough space 
> for filter to do their job.  The filters used to take a char *.
> 
> Now, FILTER_PAD is gone (hurray!) and we're passing SWBuf & in place of 
> char * to the filters.
> 
> Headers have been changed to reflect the new sigs, but the .cpp files 
> have not.
> 
> swbasicfilter.cpp and gbfhtml.cpp are done.
> 
> Quick help:
> 
> -char Filter::ProcessText(char *text, int maxlen, const SWKey *key,
> -   const SWModule *module)
> +char Filter::processText(SWBuf &text, const SWKey *key,
> +   const SWModule *module)
> 
> 
> - pushString(buf, "whatever");
> + buf += "whatever";
> 
> 
> - *(*buf)++ = 'x';
> + buf += 'x';
> 
> 
> - pushString(buf, "%d %s", 4, "cows");
> + buf.appendFormatted("%d %s", 4, "cows");
> 
> 
> -        char *to, *from;
> -        len = strlen(text) + 1; 
> 
> -        // shift string to right of buffer
> -        if (len < maxlen) {
> -                memmove(&text[maxlen - len], text, len);
> -                from = (unsigned char *)&text[maxlen - len];
> -        }
> -        else    from = (unsigned char *)text;
> -        for (to = (unsigned char *)text; *from; from++) {
> +        const char *from;
> +        SWBuf orig = text;
> +        from = orig.c_str();
> +        for (text = ""; *from; from++) {
> 
> _______________________________________
> 
> Thanks for considering helping on this one!
> 
> 	In His Grace,
> 		-Troy.
> 
> 
> _______________________________________________
> sword-devel mailing list
> sword-devel@crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel