<!DOCTYPE File PUBLIC "-//Liam Quin//DTD C API Documentation v1.1//EN" "doc.dtd"><File>
<Entry dir="liblqtext">
<Function File="../../src/liblqtext/matchend.c">
<Name>LQT_FindMatchEnds</Name>
<Class>Database/Retrieval, Database/Documents
<Purpose>
<P>Returns pointers to the start and end of the matched text in the
given buffer.  LQT_FindMatchEnds must be called with at least one
block of data (FILEBLOCKSIZE in <h>globals.h</h>, usually 64 bytes)
either side of the block containing the match.
Providing more blocks before the
matched block is more likely to result in a correct return value,
as there are some special cases involving words spanning block
boundaries that are best dealt with by looking a block further
back until a block boundary is found that has a space to one side
of it, and LQT_FindMatchEnds does this.</P>
<P>The Buffer argument is the text from the file, with StartBlock
being a pointer to the first character in the block containing
the match.  The BIF and WIB arguments are the Block In File and
Word In Block fields from the match, and the NumberOfWords argument
determines the number of words in the match, for setting the
match end pointer.
<Returns>
<LIST>
<LI>a t_OffsetPair on success, containing pointers to the
first matched character and the last matched character.
<LI>zero if the match wasn't found
</LIST>
<SeeAlso>
LQT_ReadWordFromStringPointer
</Function>
<Decl>
API t_OffsetPair *
LQT_FindMatchEnds(db, Buffer, Length, StartBlock, BIF, WIB, NumberOfWords)
    t_LQTEXT_Database *db;
    char *Buffer;
    unsigned int Length;
    char *StartBlock;
    unsigned long BIF;
    unsigned long WIB;
    int NumberOfWords;
</Decl>
</Entry>
