NO

Author Topic: Boyer Moore Horsepool  (Read 3557 times)

JohnF

  • Guest
Boyer Moore Horsepool
« on: October 05, 2007, 10:52:58 AM »
Attached is an implementation of the Boyer Moore Horsepool fast string search algorithm.

If you are just searching through normal C strings you would be better off using Pelle's C run time functions strstr()/wcsstr() or _stristr()/_wcsistr(), which are also fast. Unlike the C run time routines the attached routines can handle embedded zeros in the data.

The routines are currently implemented to load and search through files, but you can easily changes them to suit your needs.

Note, before calling any of the search routines you must first call the appropriate initialization routine.

For example, if you want to use the MultiByte routine bmhMatchMb() you need to call the multibyte prep routine bmhPrepMb() first.

bmhPrepMb()  before bmhMatchMb()
bmhPrepiMb() before bmhMatchiMb()
bmhPrepWc()  before bmhMatchWc()
bmhPrepiWc() before bmhMatchiWc()

The prep routines are expensive, especially the WideChar ones so it will only make sense to use these functions for multiple searches or on very large data.

John
« Last Edit: October 05, 2007, 10:54:44 AM by JohnF »

JohnF

  • Guest
Re: Boyer Moore Horsepool
« Reply #1 on: October 05, 2007, 10:52:42 PM »
Tch! corrected an error. toupper() is not required for pattern in the case insensitive routines as the pattern has already been made upper case.

See new attachment.

John