Home | History | Annotate | Line # | Download | only in include
regex.h revision 1.5
      1  1.5  explorer /*	$NetBSD: regex.h,v 1.5 1996/06/10 18:55:04 explorer Exp $	*/
      2  1.4       cgd 
      3  1.3       cgd /*-
      4  1.3       cgd  * Copyright (c) 1992 Henry Spencer.
      5  1.3       cgd  * Copyright (c) 1992, 1993
      6  1.3       cgd  *	The Regents of the University of California.  All rights reserved.
      7  1.3       cgd  *
      8  1.3       cgd  * This code is derived from software contributed to Berkeley by
      9  1.3       cgd  * Henry Spencer of the University of Toronto.
     10  1.3       cgd  *
     11  1.3       cgd  * Redistribution and use in source and binary forms, with or without
     12  1.3       cgd  * modification, are permitted provided that the following conditions
     13  1.3       cgd  * are met:
     14  1.3       cgd  * 1. Redistributions of source code must retain the above copyright
     15  1.3       cgd  *    notice, this list of conditions and the following disclaimer.
     16  1.3       cgd  * 2. Redistributions in binary form must reproduce the above copyright
     17  1.3       cgd  *    notice, this list of conditions and the following disclaimer in the
     18  1.3       cgd  *    documentation and/or other materials provided with the distribution.
     19  1.3       cgd  * 3. All advertising materials mentioning features or use of this software
     20  1.3       cgd  *    must display the following acknowledgement:
     21  1.3       cgd  *	This product includes software developed by the University of
     22  1.3       cgd  *	California, Berkeley and its contributors.
     23  1.3       cgd  * 4. Neither the name of the University nor the names of its contributors
     24  1.3       cgd  *    may be used to endorse or promote products derived from this software
     25  1.3       cgd  *    without specific prior written permission.
     26  1.3       cgd  *
     27  1.3       cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     28  1.3       cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     29  1.3       cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     30  1.3       cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     31  1.3       cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     32  1.3       cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     33  1.3       cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     34  1.3       cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     35  1.3       cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     36  1.3       cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     37  1.3       cgd  * SUCH DAMAGE.
     38  1.3       cgd  *
     39  1.3       cgd  *	@(#)regex.h	8.1 (Berkeley) 6/2/93
     40  1.3       cgd  */
     41  1.3       cgd 
     42  1.1       jtc #ifndef _REGEX_H_
     43  1.3       cgd #define	_REGEX_H_
     44  1.3       cgd 
     45  1.3       cgd #include <sys/cdefs.h>
     46  1.5  explorer #include <sys/types.h>
     47  1.1       jtc 
     48  1.3       cgd /* types */
     49  1.1       jtc typedef off_t regoff_t;
     50  1.3       cgd 
     51  1.1       jtc typedef struct {
     52  1.1       jtc 	int re_magic;
     53  1.1       jtc 	size_t re_nsub;		/* number of parenthesized subexpressions */
     54  1.3       cgd 	const char *re_endp;	/* end pointer for REG_PEND */
     55  1.1       jtc 	struct re_guts *re_g;	/* none of your business :-) */
     56  1.1       jtc } regex_t;
     57  1.3       cgd 
     58  1.1       jtc typedef struct {
     59  1.1       jtc 	regoff_t rm_so;		/* start of match */
     60  1.1       jtc 	regoff_t rm_eo;		/* end of match */
     61  1.1       jtc } regmatch_t;
     62  1.1       jtc 
     63  1.3       cgd /* regcomp() flags */
     64  1.1       jtc #define	REG_BASIC	0000
     65  1.1       jtc #define	REG_EXTENDED	0001
     66  1.1       jtc #define	REG_ICASE	0002
     67  1.1       jtc #define	REG_NOSUB	0004
     68  1.1       jtc #define	REG_NEWLINE	0010
     69  1.1       jtc #define	REG_NOSPEC	0020
     70  1.1       jtc #define	REG_PEND	0040
     71  1.1       jtc #define	REG_DUMP	0200
     72  1.1       jtc 
     73  1.3       cgd /* regerror() flags */
     74  1.1       jtc #define	REG_NOMATCH	 1
     75  1.1       jtc #define	REG_BADPAT	 2
     76  1.1       jtc #define	REG_ECOLLATE	 3
     77  1.1       jtc #define	REG_ECTYPE	 4
     78  1.1       jtc #define	REG_EESCAPE	 5
     79  1.1       jtc #define	REG_ESUBREG	 6
     80  1.1       jtc #define	REG_EBRACK	 7
     81  1.1       jtc #define	REG_EPAREN	 8
     82  1.1       jtc #define	REG_EBRACE	 9
     83  1.1       jtc #define	REG_BADBR	10
     84  1.1       jtc #define	REG_ERANGE	11
     85  1.1       jtc #define	REG_ESPACE	12
     86  1.1       jtc #define	REG_BADRPT	13
     87  1.1       jtc #define	REG_EMPTY	14
     88  1.1       jtc #define	REG_ASSERT	15
     89  1.1       jtc #define	REG_INVARG	16
     90  1.1       jtc #define	REG_ATOI	255	/* convert name to number (!) */
     91  1.1       jtc #define	REG_ITOA	0400	/* convert number to name (!) */
     92  1.1       jtc 
     93  1.3       cgd /* regexec() flags */
     94  1.1       jtc #define	REG_NOTBOL	00001
     95  1.1       jtc #define	REG_NOTEOL	00002
     96  1.1       jtc #define	REG_STARTEND	00004
     97  1.1       jtc #define	REG_TRACE	00400	/* tracing of execution */
     98  1.1       jtc #define	REG_LARGE	01000	/* force large representation */
     99  1.1       jtc #define	REG_BACKR	02000	/* force use of backref code */
    100  1.1       jtc 
    101  1.3       cgd __BEGIN_DECLS
    102  1.3       cgd int	regcomp __P((regex_t *, const char *, int));
    103  1.3       cgd size_t	regerror __P((int, const regex_t *, char *, size_t));
    104  1.3       cgd int	regexec __P((const regex_t *,
    105  1.3       cgd 	    const char *, size_t, regmatch_t [], int));
    106  1.3       cgd void	regfree __P((regex_t *));
    107  1.3       cgd __END_DECLS
    108  1.1       jtc 
    109  1.3       cgd #endif /* !_REGEX_H_ */
    110