Home
Search all pages
Subjects
By activity
Professions, Sciences, Humanities, Business, ...
User Interface
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...
Text Strings
Conversions, tests, processing, manipulation,...
Math
Integer, Floating point, Matrix, Statistics, Boolean, ...
Processing
Algorithms, Memory, Process control, Debugging, ...
Stored Data
Data storage, Integrity, Encryption, Compression, ...
Communications
Networks, protocols, Interprocess, Remote, Client Server, ...
Hard World Timing, Calendar and Clock, Audio, Video, Printer, Controls...
File System
Management, Filtering, File & Directory access, Viewers, ...
|
|
|
RocketLink!--> Man page versions:
OpenBSD
BM(3) OpenBSD Programmer's Manual BM(3)
NAME
bm_comp, bm_exec, bm_free - Boyer-Moore string search
SYNOPSIS
#include <sys/types.h>
#include <bm.h>
bm_pat *
bm_comp(u_char *pattern, size_t patlen, u_char freq[256]);
u_char *
bm_exec(bm_pat *pdesc, u_char *text, size_t len);
void
bm_free(bm_pat *pdesc);
DESCRIPTION
These routines implement an efficient mechanism to find an occurrence of
a byte string within another byte string.
bm_comp() evaluates patlen bytes starting at pattern, and returns a
pointer to a structure describing them. The bytes referenced by pattern
may be of any value.
The search takes advantage of the frequency distribution of the bytes in
the text to be searched. If specified, freq should be an array of 256
values, with higher values indicating that the corresponding character
occurs more frequently. (A less than optimal frequency distribution can
only result in less than optimal performance, not incorrect results.) If
freq is NULL, a system default table is used.
bm_exec() returns a pointer to the leftmost occurrence of the string giv-
en to bm_comp() within text, or NULL if none occurs. The number of bytes
in text must be specified by len.
Space allocated for the returned description is discarded by calling
bm_free() with the returned description as an argument.
The asymptotic speed of bm_exec() is O(len / patlen).
SEE ALSO
regexp(3), strstr(3)
Hume and Sunday, Software Practice and Experience, Fast String Searching,
Volume 21, 11 (November 1991), 1221-48.
OpenBSD 2.6 June 29, 1999 1
Source: OpenBSD 2.6 man pages. Copyright: Portions are copyrighted by BERKELEY SOFTWARE DESIGN, INC., The Regents of the University of California, Massachusetts Institute of Technology, Free Software Foundation, FreeBSD Inc., and others. |
(Corrections, notes, and links courtesy of RocketAware.com)
OpenBSD sources for bm(3)
Up to: NUL terminated String Comparison and Search - covers functions for comparing strings, finding characters within strings, et al.
RocketLink!--> Man page versions:
OpenBSD
Rapid-Links:
Search | About | Comments | Submit Path: RocketAware > man pages >
bm.3/
RocketAware.com is a service of Mib Software Copyright 1999, Forrest J. Cavalier III. All Rights Reserved. We welcome submissions and comments
|