xref: /netbsd-src/include/bm.h (revision 33adcbb57fe84b78d03e0183e893782605cbe0b6)
1*33adcbb5Sdholland /*	$NetBSD: bm.h,v 1.7 2016/01/22 22:27:01 dholland Exp $	*/
24d2cbfceScgd 
3d7cd57daScgd /*-
4d7cd57daScgd  * Copyright (c) 1994
5d7cd57daScgd  *	The Regents of the University of California.  All rights reserved.
6d7cd57daScgd  *
7d7cd57daScgd  * This code is derived from software contributed to Berkeley by
8d7cd57daScgd  * Andrew Hume of AT&T Bell Laboratories.
9d7cd57daScgd  *
10d7cd57daScgd  * Redistribution and use in source and binary forms, with or without
11d7cd57daScgd  * modification, are permitted provided that the following conditions
12d7cd57daScgd  * are met:
13d7cd57daScgd  * 1. Redistributions of source code must retain the above copyright
14d7cd57daScgd  *    notice, this list of conditions and the following disclaimer.
15d7cd57daScgd  * 2. Redistributions in binary form must reproduce the above copyright
16d7cd57daScgd  *    notice, this list of conditions and the following disclaimer in the
17d7cd57daScgd  *    documentation and/or other materials provided with the distribution.
18039cc956Sagc  * 3. Neither the name of the University nor the names of its contributors
19d7cd57daScgd  *    may be used to endorse or promote products derived from this software
20d7cd57daScgd  *    without specific prior written permission.
21d7cd57daScgd  *
22d7cd57daScgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23d7cd57daScgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24d7cd57daScgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25d7cd57daScgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26d7cd57daScgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27d7cd57daScgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28d7cd57daScgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29d7cd57daScgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30d7cd57daScgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31d7cd57daScgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32d7cd57daScgd  * SUCH DAMAGE.
33d7cd57daScgd  *
344d2cbfceScgd  *	@(#)bm.h	8.6 (Berkeley) 6/21/94
35d7cd57daScgd  */
36d7cd57daScgd 
37d7cd57daScgd #ifndef _BM_H_
38d7cd57daScgd #define	_BM_H_
39d7cd57daScgd 
40*33adcbb5Sdholland #include <stddef.h>
41*33adcbb5Sdholland 
42d7cd57daScgd typedef struct {
43888c1340Sdholland 	unsigned char *pat;		/* pattern */
44d7cd57daScgd 	size_t	 patlen;		/* pattern length */
45d7cd57daScgd 	size_t	*delta;			/* skip delta */
46d7cd57daScgd 	int	 rarec;			/* rare character */
47d7cd57daScgd 	size_t	 rareoff;		/* rare offset */
48d7cd57daScgd 	size_t	 md2;			/* mini delta */
49d7cd57daScgd } bm_pat;
50d7cd57daScgd 
51d7cd57daScgd #include <sys/cdefs.h>
52d7cd57daScgd 
53d7cd57daScgd __BEGIN_DECLS
54888c1340Sdholland bm_pat	*bm_comp(unsigned char const *, size_t, unsigned char const *);
55888c1340Sdholland unsigned char *bm_exec(bm_pat *, unsigned char *, size_t);
5619b7469aSperry void	 bm_free(bm_pat *);
57d7cd57daScgd __END_DECLS
58d7cd57daScgd 
59d7cd57daScgd #endif /* !_BM_H_ */
60