lq-text: LQT_FindMatchEnds

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;

Purpose

Returns pointers to the start and end of the matched text in the given buffer. LQT_Find­Match­Ends must be called with at least one block of data (FILEBLOCKSIZE in <globals.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_Find­Match­Ends does this.

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

See Also: