The STBM module implements the Self-Tuning Boyer-Moore algorithm, which is an improved version of the Tuned Boyer-Moore algorithm.
A search string must be prepared using Compile before any search. This function creates a handle for the optimised search context, and builds the Boyer-Moore skip table. The caller may specify flags affecting the compilation; currently, the only flag is case insensitivity.
Search implements a case-sensitive search on a specified buffer. SearchCI implements a case-insensitive search. Which routine you choose depends on the flag specified when Compile was called -- you can't mix and match.
SearchTBM implements a Tuned Boyer-Moore algorithm in the same style as Search and SearchCI. This routine is provided so that you can compare algorithms without being distracted by differences in the platform. I've taken the liberty of writing the TBM code in the same style as the STBM code, so there may be differences in the TBM performance here and the TBM in GNU Grep, but I've tried to avoid introducing any distortions.
Init -- Prepare module for operation Compile -- Analyse pattern and prepare for search Search -- Report first occurrence of pattern in buffer SearchCI -- Search for pattern in buffer (case insensitive) SearchTBM -- Search using Tuned BM (not self-tuned BM) GetPattern -- Retrieve originally-supplied pattern pointer Destroy -- Get rid of optimised search spec