A shim is an interface component that helps two components of a system to work smoothly together. In software, a shim is useful where an off-the-shelf component is needed in your system, but needs some effort to adapt the interface to suit your system.

In GGrep, the RE is stored in a series of 32-bit codes as defined by RegExp ( regexp00.h). Many RE components cannot be handled by STBM, so STBMShim analyses the RE to determine if STBM can be used. If the RE does fit into STBM's case-sensitive or case-insensitive searches, the shim creates a simple NUL-terminated C string to hand to STBM as this is how STBM expects to receive the string. Finally, note that STBM can edit the search string (to lowercase each letter) if a case-insensitive search is specified, so using a string built by the shim helps isolate this change.

Public routines:

Init -- Prepare module for operation

Pattern -- Convert RegExp pattern to STBM search spec

Destroy -- Ret rid of STBM search spec supplied by Pattern

Search -- Search for pattern in buffer (case sensitive)

SearchInCase -- Search for pattern in buffer (case INsensitive)

SearchTBM -- Search for pattern in buffer (use tuned BM)